@arcgis/core 4.32.0-next.20250121 → 4.32.0-next.20250122
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/WebLinkChart.js +1 -1
- package/arcade/treeAnalysis.js +1 -1
- package/assets/esri/core/t9n/Units_ar.json +1 -1
- package/assets/esri/core/t9n/Units_bg.json +1 -1
- package/assets/esri/core/t9n/Units_bs.json +1 -1
- package/assets/esri/core/t9n/Units_ca.json +1 -1
- package/assets/esri/core/t9n/Units_cs.json +1 -1
- package/assets/esri/core/t9n/Units_da.json +1 -1
- package/assets/esri/core/t9n/Units_de.json +1 -1
- package/assets/esri/core/t9n/Units_el.json +1 -1
- package/assets/esri/core/t9n/Units_es.json +1 -1
- package/assets/esri/core/t9n/Units_et.json +1 -1
- package/assets/esri/core/t9n/Units_fi.json +1 -1
- package/assets/esri/core/t9n/Units_fr.json +1 -1
- package/assets/esri/core/t9n/Units_he.json +1 -1
- package/assets/esri/core/t9n/Units_hr.json +1 -1
- package/assets/esri/core/t9n/Units_hu.json +1 -1
- package/assets/esri/core/t9n/Units_id.json +1 -1
- package/assets/esri/core/t9n/Units_it.json +1 -1
- package/assets/esri/core/t9n/Units_ja.json +1 -1
- package/assets/esri/core/t9n/Units_ko.json +1 -1
- package/assets/esri/core/t9n/Units_lt.json +1 -1
- package/assets/esri/core/t9n/Units_lv.json +1 -1
- package/assets/esri/core/t9n/Units_nl.json +1 -1
- package/assets/esri/core/t9n/Units_no.json +1 -1
- package/assets/esri/core/t9n/Units_pl.json +1 -1
- package/assets/esri/core/t9n/Units_pt-BR.json +1 -1
- package/assets/esri/core/t9n/Units_pt-PT.json +1 -1
- package/assets/esri/core/t9n/Units_ro.json +1 -1
- package/assets/esri/core/t9n/Units_ru.json +1 -1
- package/assets/esri/core/t9n/Units_sk.json +1 -1
- package/assets/esri/core/t9n/Units_sl.json +1 -1
- package/assets/esri/core/t9n/Units_sr.json +1 -1
- package/assets/esri/core/t9n/Units_sv.json +1 -1
- package/assets/esri/core/t9n/Units_th.json +1 -1
- package/assets/esri/core/t9n/Units_tr.json +1 -1
- package/assets/esri/core/t9n/Units_uk.json +1 -1
- package/assets/esri/core/t9n/Units_vi.json +1 -1
- package/assets/esri/core/t9n/Units_zh-CN.json +1 -1
- package/assets/esri/core/t9n/Units_zh-HK.json +1 -1
- package/assets/esri/core/t9n/Units_zh-TW.json +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/03b94362ed2a45ee5ea3.js +1 -0
- package/assets/esri/core/workers/chunks/0446f2ffad255cd40272.js +1 -0
- package/assets/esri/core/workers/chunks/059119f1731c2103c91c.js +1 -0
- package/assets/esri/core/workers/chunks/05e58286f8015dba6768.js +1 -0
- package/assets/esri/core/workers/chunks/060414956bf316529c48.js +1 -0
- package/assets/esri/core/workers/chunks/{f8e188af5608293d5b2b.js → 07bff9e742f3e5877f3f.js} +1 -1
- package/assets/esri/core/workers/chunks/{6400f39a965900f66ce7.js → 083c73428945fb3d4558.js} +1 -1
- package/assets/esri/core/workers/chunks/0d3154b90bc3fd7e6b4c.js +1 -0
- package/assets/esri/core/workers/chunks/0ec2ae595fa22998ffea.js +1 -0
- package/assets/esri/core/workers/chunks/{105dcc7b7284b1e965b7.js → 15c5b1dd8f398f641f6e.js} +1 -1
- package/assets/esri/core/workers/chunks/163451124c66a7a0bcdc.js +1 -0
- package/assets/esri/core/workers/chunks/17cc6638a510da164f58.js +1 -0
- package/assets/esri/core/workers/chunks/1e3ab66d0e8a7f160f33.js +1 -0
- package/assets/esri/core/workers/chunks/1e9349411af082ec03d0.js +1 -0
- package/assets/esri/core/workers/chunks/1eb47cfca815ac432cf5.js +1 -0
- package/assets/esri/core/workers/chunks/{82266ca8002554198208.js → 20e7fae0c173807ba9a2.js} +1 -1
- package/assets/esri/core/workers/chunks/{af0b0a7eedebcf99d05d.js → 2118e9ffb24178ed7f59.js} +1 -1
- package/assets/esri/core/workers/chunks/21c12edc0632eb911e73.js +1 -0
- package/assets/esri/core/workers/chunks/21c3882a282a4755e032.js +1 -0
- package/assets/esri/core/workers/chunks/{435c037ccba71f1e22d3.js → 2488a0da3be64b0a26f4.js} +1 -1
- package/assets/esri/core/workers/chunks/254fbd8055ae7a0bb393.js +1 -0
- package/assets/esri/core/workers/chunks/2d55eb8059a532ffcc56.js +1 -0
- package/assets/esri/core/workers/chunks/3034df78da56fe1c0535.js +1 -0
- package/assets/esri/core/workers/chunks/32a96ef30f4608f377d6.js +1 -0
- package/assets/esri/core/workers/chunks/{97d66b0d0ff1132966de.js → 33b2f59c2ec10b2a1034.js} +1 -1
- package/assets/esri/core/workers/chunks/402de76b5de05615e111.js +1 -0
- package/assets/esri/core/workers/chunks/{17726b0ab1bf66185d66.js → 40efcdf03c5224e6c4f7.js} +1 -1
- package/assets/esri/core/workers/chunks/424c7788a708abbf9299.js +1 -0
- package/assets/esri/core/workers/chunks/484d99910d110830df76.js +1 -0
- package/assets/esri/core/workers/chunks/{9970e0e74cf2877a7ffc.js → 486969dba1dc99402172.js} +2 -2
- package/assets/esri/core/workers/chunks/{02b2175132c9720bc756.js → 48f4ba1a5bb692903d06.js} +1 -1
- package/assets/esri/core/workers/chunks/4d7bd2bbe9045a2fee7a.js +1 -0
- package/assets/esri/core/workers/chunks/{decd316936df1ad3fa65.js → 50b538c93696de5eda97.js} +1 -1
- package/assets/esri/core/workers/chunks/{de00150030003de05146.js → 52aea8a4f292a66f5cfa.js} +1 -1
- package/assets/esri/core/workers/chunks/56f0eb9802f5cf9ad0d9.js +1 -0
- package/assets/esri/core/workers/chunks/57ddd64f0c22274d87e0.js +1 -0
- package/assets/esri/core/workers/chunks/5b5be7eb139b153934f5.js +1 -0
- package/assets/esri/core/workers/chunks/{4af0674fabfc965f1660.js → 5b876743865ef91b5648.js} +1 -1
- package/assets/esri/core/workers/chunks/62b88350892198de5055.js +1 -0
- package/assets/esri/core/workers/chunks/{206194cf069ad4bcc3ad.js → 6adf4f3d807f1af1c7c1.js} +1 -1
- package/assets/esri/core/workers/chunks/6b1285db2d6695a87553.js +1 -0
- package/assets/esri/core/workers/chunks/6c425e1041bdeef32832.js +1 -0
- package/assets/esri/core/workers/chunks/6eb829a7959df2269b0e.js +1 -0
- package/assets/esri/core/workers/chunks/765b4aefce7c11bbcb1f.js +1 -0
- package/assets/esri/core/workers/chunks/{6d17488396583d83d9be.js → 79a265dc21e29d3fd888.js} +1 -1
- package/assets/esri/core/workers/chunks/7a9e1696dc6120df15b0.js +1 -0
- package/assets/esri/core/workers/chunks/7ae1f26ded268099f429.js +1 -0
- package/assets/esri/core/workers/chunks/7bf08823f861628144a1.js +1 -0
- package/assets/esri/core/workers/chunks/7e4d72279cc599b7029c.js +1 -0
- package/assets/esri/core/workers/chunks/{ee5f43fbe4c2cc199e64.js → 8434cd16effc5efbf1bd.js} +1 -1
- package/assets/esri/core/workers/chunks/86149b4a5a148744c7d1.js +1 -0
- package/assets/esri/core/workers/chunks/{2779cf112299b612a73a.js → 875cb81f143ff8fe03b5.js} +1 -1
- package/assets/esri/core/workers/chunks/885814ef0e34c01a589f.js +1 -0
- package/assets/esri/core/workers/chunks/{e610dd938d30f75778bc.js → 8be2d16663a238de9438.js} +1 -1
- package/assets/esri/core/workers/chunks/91d5cb094a7051abb6c5.js +1 -0
- package/assets/esri/core/workers/chunks/93ba76749746871357e7.js +314 -0
- package/assets/esri/core/workers/chunks/991c597f27daa67158c5.js +1 -0
- package/assets/esri/core/workers/chunks/9bd22cdf6eb158555906.js +1 -0
- package/assets/esri/core/workers/chunks/{33eebe5cb22a03ae90c8.js → 9c88ce9b0020b6f9a37a.js} +1 -1
- package/assets/esri/core/workers/chunks/9df7bffadbe0b4aad442.js +1 -0
- package/assets/esri/core/workers/chunks/a0a056698f8227210f49.js +1 -0
- package/assets/esri/core/workers/chunks/a1cdd09968e11d95c701.js +1 -0
- package/assets/esri/core/workers/chunks/a28cb975974b99540432.js +1 -0
- package/assets/esri/core/workers/chunks/a29958273958c3e3e932.js +1 -0
- package/assets/esri/core/workers/chunks/{98da074899c82f0ded0b.js → af224962edae72b002fa.js} +1 -1
- package/assets/esri/core/workers/chunks/af2ed4c8ac238b932d89.js +1 -0
- package/assets/esri/core/workers/chunks/af75107f207b2ba01bb4.js +1 -0
- package/assets/esri/core/workers/chunks/b1661e6c76ef0800ffd6.js +1 -0
- package/assets/esri/core/workers/chunks/b42ecc7c3eb2fd8d1308.js +1 -0
- package/assets/esri/core/workers/chunks/b44cf0e4c2f93408cabc.js +1 -0
- package/assets/esri/core/workers/chunks/b846052b6f80ad6ada89.js +1 -0
- package/assets/esri/core/workers/chunks/{399e67ccb69a5b206354.js → c1fd87af3129873369fd.js} +1 -1
- package/assets/esri/core/workers/chunks/c473756f8785ab868ba5.js +1 -0
- package/assets/esri/core/workers/chunks/c5368ca97b7f7261967a.js +1 -0
- package/assets/esri/core/workers/chunks/c685991c9a30f7435933.js +1 -0
- package/assets/esri/core/workers/chunks/ca5bd71bc2c1b1b3f9d9.js +1 -0
- package/assets/esri/core/workers/chunks/ce1c89b5a10fb5a7bb49.js +1 -0
- package/assets/esri/core/workers/chunks/d45ff061bf71b73e9f26.js +1 -0
- package/assets/esri/core/workers/chunks/d4760e583dfac95dc8a1.js +1 -0
- package/assets/esri/core/workers/chunks/de2ca2dc1b5d62c0d82e.js +1 -0
- package/assets/esri/core/workers/chunks/dfa4be2e07cc4c0938b0.js +1 -0
- package/assets/esri/core/workers/chunks/e067cef3b3ac3af49b88.js +1 -0
- package/assets/esri/core/workers/chunks/e2775bcceb62fd0df41b.js +1 -0
- package/assets/esri/core/workers/chunks/{c81204ae663e58c7b689.js → e63ff8d57fd771413488.js} +1 -1
- package/assets/esri/core/workers/chunks/e9993d4f2bfdc434fbcc.js +1 -0
- package/assets/esri/core/workers/chunks/{54c149f90bf94b797b36.js → ed30f46236da29c15430.js} +1 -1
- package/assets/esri/core/workers/chunks/f016205a8f1fb665d6dd.js +1 -0
- package/assets/esri/core/workers/chunks/f02119812ec852edda57.js +1 -0
- package/assets/esri/core/workers/chunks/f272070f0878cd3e39a4.js +1 -0
- package/assets/esri/core/workers/chunks/f2cf05fbbb51d657d300.js +1 -0
- package/assets/esri/core/workers/chunks/{e4f4ad67d778dea5b956.js → f4f6f4933ca58438d7bc.js} +1 -1
- package/assets/esri/core/workers/chunks/fdc3d97510c6d43a8882.js +1 -0
- package/assets/esri/core/workers/chunks/fef135e55706d84d1947.js +1 -0
- package/assets/esri/core/workers/chunks/ff4107b4fd3d3ce24e84.js +1 -0
- package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
- package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
- package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
- package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
- package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +24 -0
- package/assets/esri/themes/base/widgets/_UtilityNetworkTrace.scss +49 -24
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_en.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_en.json +1 -1
- package/chunks/arcgis-knowledge-client-core-simd.js +1 -1
- package/chunks/arcgis-knowledge-client-core.js +1 -1
- package/chunks/lyr3DMain.js +1 -1
- package/chunks/lyr3DWorker.js +1 -1
- package/editing/sharedTemplates/SharedTemplate.js +1 -1
- package/editing/sharedTemplates/SharedTemplateMetadata.d.ts +4 -0
- package/editing/sharedTemplates/SharedTemplateMetadata.js +1 -1
- package/editing/templateUtils.js +5 -0
- package/geometry/operators/projectOperator.d.ts +4 -0
- package/geometry/operators/shapePreservingProjectOperator.d.ts +4 -0
- package/geometry/operators/support/GeographicTransformation.d.ts +4 -0
- package/geometry/operators/support/GeographicTransformation.js +1 -1
- package/geometry/operators/support/GeographicTransformationStep.d.ts +4 -0
- package/geometry/operators/support/geographicTransformationUtils.d.ts +4 -0
- package/geometry/support/GeographicTransformation.d.ts +2 -2
- package/geometry/support/GeographicTransformationStep.d.ts +2 -2
- package/interfaces.d.ts +522 -53
- package/layers/ILyr3DWasmPerSceneView.js +1 -1
- package/layers/LinkChartLayer.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/networks/support/utils.js +1 -1
- package/package.json +1 -1
- package/rest/featureService/FeatureService.js +1 -1
- package/rest/knowledgeGraph/toolService/findPaths/CIMFilteredFindPathsConfiguration.d.ts +4 -0
- package/rest/knowledgeGraph/toolService/findPaths/CIMFilteredFindPathsConfiguration.js +5 -0
- package/rest/knowledgeGraph/toolService/findPaths/CIMFilteredFindPathsEntity.d.ts +4 -0
- package/rest/knowledgeGraph/toolService/findPaths/CIMFilteredFindPathsEntity.js +5 -0
- package/rest/knowledgeGraph/toolService/findPaths/CIMFilteredFindPathsPathFilter.d.ts +4 -0
- package/rest/knowledgeGraph/toolService/findPaths/CIMFilteredFindPathsPathFilter.js +5 -0
- package/rest/knowledgeGraph/toolService/findPaths/CIMKGTraversalDirection.d.ts +4 -0
- package/rest/knowledgeGraph/toolService/findPaths/CIMKGTraversalDirection.js +5 -0
- package/rest/knowledgeGraph/toolService/findPaths/FindPathsToolSettings.d.ts +4 -0
- package/rest/knowledgeGraph/toolService/findPaths/FindPathsToolSettings.js +5 -0
- package/rest/knowledgeGraphService.js +1 -1
- package/support/revision.js +1 -1
- package/undoredo/support/Services.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/Lyr3DWasm.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
- package/widgets/FeatureForm/UtilityNetworkAssociationInput.js +1 -1
- package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
- package/widgets/FeatureTemplates/TemplateItem.js +1 -1
- package/widgets/FeatureTemplates/featureTemplatesUtils.js +1 -1
- package/widgets/FeatureTemplates.js +1 -1
- package/widgets/LayerList/LayerListItem.js +1 -1
- package/widgets/Locate.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerVisibleElements.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageAreaMeasurement.js +5 -0
- package/widgets/OrientedImageryViewer/components/ImageDistanceMeasurement.js +5 -0
- package/widgets/OrientedImageryViewer/components/ImageMeasurement.js +5 -0
- package/widgets/OrientedImageryViewer/css.js +1 -1
- package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +5 -0
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeaturesDrillIn.js +5 -0
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/widgets/support/UtilityNetworkAssociations/UtilityNetworkAssociationList.js +1 -1
- package/widgets/support/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/0651586dc7bd2e8b34db.js +0 -1
- package/assets/esri/core/workers/chunks/077070295499b9bfabb6.js +0 -1
- package/assets/esri/core/workers/chunks/090cfc7f088a729afd47.js +0 -1
- package/assets/esri/core/workers/chunks/0d387baa64a89f88b1de.js +0 -1
- package/assets/esri/core/workers/chunks/134de9fa142129a43b1e.js +0 -1
- package/assets/esri/core/workers/chunks/16fa0a5f73ab67a8d3e4.js +0 -1
- package/assets/esri/core/workers/chunks/1797f62e9bf8f1ac8d13.js +0 -1
- package/assets/esri/core/workers/chunks/182722e2fe0a35c4d8db.js +0 -1
- package/assets/esri/core/workers/chunks/1b3215f3290fb2f07ab8.js +0 -1
- package/assets/esri/core/workers/chunks/1f4dd96aacf8c40a1120.js +0 -1
- package/assets/esri/core/workers/chunks/22748779ca94eda44de5.js +0 -1
- package/assets/esri/core/workers/chunks/2427a01678f3d9fbf30b.js +0 -1
- package/assets/esri/core/workers/chunks/33a13544b9e5f4f20bce.js +0 -1
- package/assets/esri/core/workers/chunks/423329432fbf007c620b.js +0 -1
- package/assets/esri/core/workers/chunks/467bd3c0da9518a0058b.js +0 -1
- package/assets/esri/core/workers/chunks/4c1d11a91291b28a73be.js +0 -1
- package/assets/esri/core/workers/chunks/51fbbd082ca78e4417d9.js +0 -1
- package/assets/esri/core/workers/chunks/5c05c899f7e6f764fedd.js +0 -1
- package/assets/esri/core/workers/chunks/6c1470dc0bd4389d1a2d.js +0 -1
- package/assets/esri/core/workers/chunks/6e804ee2d96d4de85a5f.js +0 -1
- package/assets/esri/core/workers/chunks/712f0dd46932c544df68.js +0 -1
- package/assets/esri/core/workers/chunks/71e88c90e9f9a9bddcd8.js +0 -1
- package/assets/esri/core/workers/chunks/74ba752dfab8ea5b6d2a.js +0 -314
- package/assets/esri/core/workers/chunks/79903647d4ed16d9a402.js +0 -1
- package/assets/esri/core/workers/chunks/7b4880b2dc6b01d70ccc.js +0 -1
- package/assets/esri/core/workers/chunks/7c98e4fcba1dc24eb788.js +0 -1
- package/assets/esri/core/workers/chunks/7d0fc25ce1f74adcfeb6.js +0 -1
- package/assets/esri/core/workers/chunks/8249351daa45ca82ca0c.js +0 -1
- package/assets/esri/core/workers/chunks/87ddc3d5d751d565cd97.js +0 -1
- package/assets/esri/core/workers/chunks/88bb55bca76f978c0aa3.js +0 -1
- package/assets/esri/core/workers/chunks/89198ca24466d939e4e8.js +0 -1
- package/assets/esri/core/workers/chunks/8cda8dbd95f0a78063a8.js +0 -1
- package/assets/esri/core/workers/chunks/8e0e5183c88a45fbfd8e.js +0 -1
- package/assets/esri/core/workers/chunks/90eea0c2435bb5d10460.js +0 -1
- package/assets/esri/core/workers/chunks/93c1541241f92fc07eaa.js +0 -1
- package/assets/esri/core/workers/chunks/964f2897794d8d71dcb7.js +0 -1
- package/assets/esri/core/workers/chunks/976daa00d35ee7f27a26.js +0 -1
- package/assets/esri/core/workers/chunks/99b4f146d0f1661a217c.js +0 -1
- package/assets/esri/core/workers/chunks/aa96a05b94ae642c1c9f.js +0 -1
- package/assets/esri/core/workers/chunks/b0055e7b2e840d478de8.js +0 -1
- package/assets/esri/core/workers/chunks/b1bf8ad629a6b8f4489a.js +0 -1
- package/assets/esri/core/workers/chunks/b1e3448ba51557ff6c13.js +0 -1
- package/assets/esri/core/workers/chunks/b30046a40bcfbec8abe4.js +0 -1
- package/assets/esri/core/workers/chunks/b538d02706a25bbbe2d0.js +0 -1
- package/assets/esri/core/workers/chunks/c436a112a3119ceabebf.js +0 -1
- package/assets/esri/core/workers/chunks/c690268f48bc84778b23.js +0 -1
- package/assets/esri/core/workers/chunks/c8a09db652389f0d254d.js +0 -1
- package/assets/esri/core/workers/chunks/c8a645601d041f411060.js +0 -1
- package/assets/esri/core/workers/chunks/cb3b7f83b3efb315bd14.js +0 -1
- package/assets/esri/core/workers/chunks/cdc5e4cd1214362e752a.js +0 -1
- package/assets/esri/core/workers/chunks/da5fc368eb5b3592d05e.js +0 -1
- package/assets/esri/core/workers/chunks/dae7e8357936466482fe.js +0 -1
- package/assets/esri/core/workers/chunks/dd935b6335c674b6f596.js +0 -1
- package/assets/esri/core/workers/chunks/ddd20894b5107b76b815.js +0 -1
- package/assets/esri/core/workers/chunks/df4d7f100222ea671730.js +0 -1
- package/assets/esri/core/workers/chunks/eb256e8488e341c4a6f2.js +0 -1
- package/assets/esri/core/workers/chunks/ebc0094355504ec09fb8.js +0 -1
- package/assets/esri/core/workers/chunks/f1b63f092e239f84b849.js +0 -1
- package/assets/esri/core/workers/chunks/f2126b79f41dc62cc576.js +0 -1
- package/assets/esri/core/workers/chunks/f3e0b0f07a622fcdd6ae.js +0 -1
- package/assets/esri/core/workers/chunks/f581aec77accce7411e0.js +0 -1
- package/assets/esri/core/workers/chunks/f877bcbd277a28154d82.js +0 -1
- package/assets/esri/core/workers/chunks/fa1c68f2ffcdff7986b6.js +0 -1
- package/assets/esri/core/workers/chunks/feeb36ffdffb227c4353.js +0 -1
- package/widgets/support/templateUtils.js +0 -5
- /package/assets/esri/core/workers/chunks/{9970e0e74cf2877a7ffc.js.LICENSE.txt → 486969dba1dc99402172.js.LICENSE.txt} +0 -0
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import has from"../../../core/has.js";import r from"../../../core/Logger.js";import{destroyMaybe as i}from"../../../core/maybe.js";import{watch as s,initial as o}from"../../../core/reactiveUtils.js";import{schedule as n}from"../../../core/scheduling.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as c,invert as m}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{IDENTITY as d,create as h}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as u,getTranslation as p}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as f}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{g as b,q as y}from"../../../chunks/vec32.js";import{fromArray as w,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as v}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{SphericalECEFSpatialReferenceLike as x}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as j}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as C}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as T}from"../../../geometry/projection/projectVectorToVector.js";import{BufferViewVec4f as M,BufferViewVec4u8 as P,BufferViewVec4u16 as O,BufferViewVec3f as U,BufferViewVec3u8 as E,BufferViewVec3u16 as V,BufferViewVec2f as I,BufferViewInt16 as A,BufferViewUint32 as H,BufferViewUint16 as S}from"../../../geometry/support/buffer/BufferView.js";import{invalidLayerView as R,wasmFailedToInit as F,Lyr3DLightingModel as L,Lyr3DUvWrapMode as D,Lyr3DImageFormat as k,Lyr3DPixelFormat as B,Lyr3DVtxAtrbSemantic as N,Lyr3DType as G}from"../../../layers/ILyr3DWasmPerSceneView.js";import{getElevationOffsetInMeters as z}from"../../../support/elevationInfoUtils.js";import{ViewingMode as W}from"../../ViewingMode.js";import{IntegratedMesh3DTilesViewPerformanceInfo as $}from"./IntegratedMesh3DTilesViewPerformanceInfo.js";import{DrapeTargetType as q}from"./interfaces.js";import{LayerView3D as J}from"./LayerView3D.js";import{addLayerViewToWasm as K,removeLayerViewFromWasm as Q,getLyr3DWasm as X}from"./Lyr3DWasm.js";import{LayerElevationProvider as Y}from"./i3s/LayerElevationProvider.js";import{primTypeConversion as Z,alphaModeConversion as ee,faceCullingConversion as te,wrapModeConversion as re,lyr3DTypeToByteSize as ie}from"./support/lyr3dTypeConversions.js";import{Tiles3DIntersectionHandler as se}from"./support/Tiles3DIntersectionHandler.js";import{ElevationRange as oe}from"../support/ElevationRange.js";import{Obb as ne,compute as ae}from"../support/orientedBoundingBox.js";import{ObjectParameters as le}from"../webgl-engine/collections/Component/ObjectParameters.js";import{GeometryParameters as ce,createVertexBufferLayout as me}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as de}from"../webgl-engine/collections/Component/Transform.js";import{ComponentParameterSummary as he}from"../webgl-engine/collections/Component/Material/ComponentMaterial.js";import{RenderTexture as ue}from"../webgl-engine/core/material/RenderTexture.js";import{TextureCoordinateType as pe}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{alphaCutoff as ge}from"../webgl-engine/core/shaderLibrary/util/AlphaCutoff.js";import{getEllipsoidMode as fe}from"../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{Attribute as be}from"../webgl-engine/lib/Attribute.js";import{CullFaceOptions as ye,AlphaDiscardMode as we,TextureEncodingMimeType as _e}from"../webgl-engine/lib/basicInterfaces.js";import{compressAndTransformNormals as ve}from"../webgl-engine/lib/Normals.js";import{Texture as xe}from"../webgl-engine/lib/Texture.js";import{VertexAttribute as je}from"../webgl-engine/lib/VertexAttribute.js";import{writeDefaultAttribute as Ce}from"../webgl-engine/materials/internal/bufferWriterUtils.js";import Te from"../../layers/LayerView.js";import{isInEffectiveScaleRange as Me}from"../../support/layerViewUtils.js";var Pe;!function(e){e[e.API=1]="API",e[e.VerboseAPI=2]="VerboseAPI",e[e.Error=3]="Error"}(Pe||(Pe={}));class Oe{constructor(){this.handle=0,this.isVisible=!1,this.components=[],this.texMemoryUsage=0,this.vboMemoryUsage=0,this.cpuMemoryUsage=0,this.textures=[]}get usedMemory(){return this.texMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get cachedMemory(){return this.usedMemory}}function Ue(e){return Math.round(e/1048.576)/1e3}let Ee=class extends(J(Te)){constructor(){super(...arguments),this.type="integrated-mesh-3dtiles",this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this.drapeTargetType=q.WithoutRasterImage,this._applySSAO=!has("disable-feature:im-ssao"),this._shadeNormals=!!has("enable-feature:im-shading"),this._lyrHandleToObjects=new Map,this._initialCullFace=new Map,this._suspendedHandle=null,this._dbgFlags=new Set}initialize(){if(this._dbgFlags.add(Pe.Error),this._dbg(Pe.VerboseAPI,"Tiles3DLayerView3D initialize() called"),!this._canProjectWithoutEngine())throw new t("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{});const e=K(this).then((e=>{this._intersectionHandler=new se(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(e))),this._elevationProvider=new Y({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this.view.elevationProvider.register("im",this._elevationProvider),this.view.basemapTerrain.overlayManager.registerDrapeTarget(this),this._wasmLayerId=e;const t=this.view.resourceController.memoryController.newCache(`t3d-${this.uid}`,(e=>this._onRemoveFromCache(e)));this._memCache=t,this.addHandles([s((()=>this.layer.elevationInfo),(e=>this._elevationInfoChanged(e)))]),this._suspendedHandle=s((()=>this.suspended),(e=>this._wasm?.setEnabled(this,!e)),o)})).catch((e=>{if(Q(this),this._wasmLayerId=-1,e===R)throw new t("tiles3d:addLayer-failure","The 3d tiles layer description was invalid.",{});if(e===F)throw new t("tiles3d:addLayer-failure","The 3d tiles layer web assembly module failed to download.",{})}));this.addResolvingPromise(e)}destroy(){this._dbg(Pe.VerboseAPI,"Tiles3DLayerView3D destroy() called"),Q(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.objectsChanged(this._obbs),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.basemapTerrain.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach((e=>this.freeObject(e))),this._lyrHandleToObjects.clear(),this._initialCullFace.clear(),this._memCache=i(this._memCache),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=n((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),this.objects.forEach((t=>{const r=this._collection.getMaterial(t);r.commonMaterialParameters.hasSlicePlane=e,r.commonMaterialParameters.cullFace=e?ye.None:this._initialCullFace.get(t)}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,z(e))}get _obbs(){return this.objects.map((e=>this._collection.getComponentObb(e)))}get _wasm(){return X(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){let e=0;return this._lyrHandleToObjects.forEach((t=>{t.isVisible&&(e+=t.usedMemory)})),e}get unloadedMemory(){return 0}get cachedMemory(){let e=0;return this._lyrHandleToObjects.forEach((t=>{t.isVisible||(e+=t.usedMemory)})),e}get visibleAtCurrentScale(){return Me(this.layer.effectiveScaleRange,this.view.scale)}get performanceInfo(){let e=0,t=0,r=0,i=0,s=0,o=0;return this._lyrHandleToObjects.forEach((n=>{n.isVisible?(e+=n.texMemoryUsage,t+=n.vboMemoryUsage,s++):(r+=n.texMemoryUsage,i+=n.vboMemoryUsage,o++)})),new $(this.usedMemory,s,o,Ue(t),Ue(e),Ue(i),Ue(r))}_canProjectWithoutEngine(){if(this.view.state.viewingMode===W.Local){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view._stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationOffset(){return z(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new oe(e.zmin,e.zmax):null}getElevationRange(e){return null}get fullExtent(){return this.layer.fullExtent}get objects(){return Array.from(this._lyrHandleToObjects.values()).reduce(((e,t)=>e.concat(t.components)),new Array)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&e.isUpdating(this._wasmLayerId)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const r=w(t.desc.origin),i=new Array,s=new Map,o=new Oe;o.handle=e.handle,this._lyrHandleToObjects.set(e.handle,o);const n=this.view.basemapTerrain.spatialReference;let a,l;if("global"===this.view.viewingMode){const e=g();j(x,r,e,n),a=c(h(),e),l=m(h(),a)}else a=d,l=d;const M=g();u(M,M,r);const P=p(_(),M);let O=null;const U=_();if(t.desc.obb){const e=t.desc.obb.quaternion;O=new ne(t.desc.obb.center,t.desc.obb.halfSize,f(e[0],e[1],e[2],e[3]))}for(let c=0;c<t.desc.prims.length;c++){const e=t.desc.prims[c];this._dbg(Pe.VerboseAPI,JSON.stringify(e));if(null==Z[e.ptype]||null==t.data){this._dbg(Pe.VerboseAPI,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive.");continue}const m=t.desc?.materials&&null!=e.materialId?t.desc.materials[e.materialId]:null,h=null!=m?m.lightingModel:L.Unlit,{positionView:u,positionAttr:p,normalsView:g,normalsAttr:f,colorAttr:w,texCoord0Attr:x,indicesView:j}=this.getBufferViews(e,t.data.buffer,a);if(null==p||null==u||null==j)continue;const M=new ce(null!=w,null!=x?pe.Default:pe.None,null!=g,this._shadeNormals,this._applySSAO),E=p.data.length/p.size,V=(e,t)=>!e||e.data.length/e.size===E||(this._dbg(Pe.Error,`${t} !== numPos. Skipping primitive.`),!1);if(!V(x,"numTexcoord")||!V(w,"numColors")||!V(f,"normals"))continue;const I=me(M);if(null!=O?O=O.clone():(O=ae(p),b(U,O.center,r),O.center=U),a!==d)for(let t=0;t<u.count;t++)u.getVec(t,U),y(U,U,a),u.setVec(t,U);const A=I.createBuffer(p.data.length),H=new Map([[je.POSITION,p]]);null!=x&&H.set(je.UV0,x),null!=w&&H.set(je.COLOR,w),null!=f&&H.set(je.NORMALCOMPRESSED,f),H.forEach(((e,t)=>{null!=e&&Ce(t,e,null,null,A,0)}));const S=new Uint32Array([0,j.typedBuffer.length]),R={vertices:{data:A.buffer,count:A.byteLength/I.stride,layoutParameters:M},positionData:{positions:u.typedBuffer,indices:j.typedBuffer},indices:j.typedBuffer,componentOffsets:S};o.cpuMemoryUsage+=u.count,o.cpuMemoryUsage+=j.count;const F=this.view.renderSpatialReference,D=_(),k=[1,1,1];C(P,F,k,n)||this._dbg(Pe.Error,"Unsupported coordinate system for IM overlay"),T(P,F,D,n);const B=this._collection.createObject(new le(v(D[0],D[1],k[0],k[1]),new de(P,l),O,R));m&&this._collection.updateMaterial(B,(e=>{e.baseColor=m.baseColorFactor,e.usePBR=h===L.Pbr,e.hasParametersFromSource=!1,e.baseColorTexture=this._getTexture(m.baseColorTex,t,s),e.usePBR&&(e.mrrFactors=[m.metallicFactor,m.roughnessFactor,0],e.emissiveFactor=m.emissiveFactor??[0,0,0],e.metallicRoughnessTexture=this._getTexture(m.metalTex,t,s),e.emissionTexture=this._getTexture(m.emissiveTex,t,s),e.occlusionTexture=this._getTexture(m.occlusionTex,t,s),e.normalTexture=this._getTexture(m.normalTex,t,s)),e.objectOpacity=0,e.alphaDiscardMode=we.Mask;const r=[];e.baseColorTexture&&r.push(e.baseColorTexture.loadPromise),e.usePBR&&e.metallicRoughnessTexture&&r.push(e.metallicRoughnessTexture.loadPromise),e.usePBR&&e.emissionTexture&&r.push(e.emissionTexture.loadPromise),e.usePBR&&e.occlusionTexture&&r.push(e.occlusionTexture.loadPromise),e.usePBR&&e.normalTexture&&r.push(e.normalTexture.loadPromise);const n=Promise.all(r);i.push(n),n.then((()=>{e.alphaDiscardMode=ee[m.alphaMode],e.objectOpacity=1,o.texMemoryUsage+=e.baseColorTexture?.glTexture?.usedMemory||0,e.usePBR&&(o.texMemoryUsage+=e.metallicRoughnessTexture?.glTexture?.usedMemory||0,o.texMemoryUsage+=e.emissionTexture?.glTexture?.usedMemory||0,o.texMemoryUsage+=e.occlusionTexture?.glTexture?.usedMemory||0,o.texMemoryUsage+=e.normalTexture?.glTexture?.usedMemory||0)})),e.commonMaterialParameters.doubleSided=m.isDoubleSided,e.commonMaterialParameters.cullFace=m.faceCulling?te[m.faceCulling]:ye.Back,this._initialCullFace.set(B,e.commonMaterialParameters.cullFace),e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.componentParameters.castShadows=he.All,e.textureAlphaCutoff=m.alphaCutoff??ge,e.alphaDiscardMode=ee[m.alphaMode],e.isIntegratedMesh=!0,e.polygonOffsetEnabled=!1,e.hasOccludees=!1,e.ellipsoidMode=fe(this.view.spatialReference)})),o.components.push(B),o.vboMemoryUsage+=this._collection.getObjectGPUMemoryUsage(B)}if(await Promise.all(i),s.forEach((e=>{o.textures.push(e)})),!this._memCache)throw new Error("no memCache");return this._memCache.put(`${o.handle}`,o),{memUsageBytes:o.usedMemory}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t&&(this.freeObject(t),this._lyrHandleToObjects.delete(e))}freeObject(e){this._memCache&&this._memCache.pop(`${e.handle}`),e.components.forEach((t=>{e.textures.forEach((e=>{this._stage.remove(e)})),this._collection.destroyObject(t),this._initialCullFace.delete(t)}))}setRenderableVisibility(e,t,r){if(this._memCache){for(let i=0;i<r;++i){const r=e[i],s=t[i];if(!s)continue;const o=this._lyrHandleToObjects.get(r);o&&(this._visibleGeometryChanged(),o.isVisible=s,o.components.forEach((e=>{this._collection.setObjectVisibility(e,s),this._elevationProvider.objectChanged(this._collection.getComponentObb(e))})),this._memCache.pop(`${r}`))}for(let i=0;i<r;++i){const r=e[i],s=t[i];if(s)continue;const o=this._lyrHandleToObjects.get(r);o&&(this._visibleGeometryChanged(),o.isVisible=s,o.components.forEach((e=>{this._collection.setObjectVisibility(e,s),this._elevationProvider.objectChanged(this._collection.getComponentObb(e))})),this._memCache.put(`${r}`,o))}}}_getTexture(e,t,r){let i=null;if(e&&t.desc?.images&&t.data?.buffer){const s=t.desc.images[e?.imageId];if(i=r.get(s),!i&&s){const o=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,n=!!s.mipCount||o>1,a=re[e.wrapMode??D.None];let l=s.alpha?4:3;const c=new Uint8Array(t.data.buffer,s.data.byteOffset,s.data.byteCount);let m=null,d=null,h=null;switch(s.format){case k.Raw:s.pixelFormat===B.R8?(m=c,l=1,d=""):s.pixelFormat===B.Rgb8?(m=c,l=3,d=""):s.pixelFormat===B.Rgba8&&(m=c,l=4,d="");break;case k.Dxt1:m=c,l=3,d=_e.DDS_ENCODING;break;case k.Dxt5:m=c,l=4,d=_e.DDS_ENCODING;break;case k.Png:d="image/png",h=document.createElement("img");break;case k.Jpeg:d="image/jpeg",h=document.createElement("img");break;case k.Etc2:d="image/ktx",h=document.createElement("img");break;case k.Astc:this._dbg(Pe.Error,"Astc texture not supported");break;case k.Pvrtc:this._dbg(Pe.Error,"Pvrtc texture not supported")}if(h&&d){const e=new Blob([c],{type:d});h.src=URL.createObjectURL(e),m=h}m&&null!=d&&(i=new xe(m,{mipmap:n,maxAnisotropy:o,encoding:d,wrap:a,components:l,noUnpackFlip:!0,width:s.mip0Width,height:s.mip0Height}),this._stage.add(i),r.set(s,i))}}return i?new ue(this.view._stage.renderView.textures,i.id):null}getBufferViews(e,t,r){let i,s,o,n,a,l,c,m=null;for(let h=0;h<e.atrbs.length;h++){const c=e.atrbs[h],u=c.view,p=void 0,g=u.byteOffset+u.byteCount,f=u.byteCount/ie[u.type],b=[...Array(f).keys()].map((e=>e));try{switch(c.sem){case N.Position:3!==u.ncomp||u.type!==G.F32?this._dbg(Pe.Error,"[Unsupported Feature] Unsupported view for Position ("+u+")"):(i=new U(t,u.byteOffset,p,g),s=new be(i.typedBuffer,b,3));break;case N.Normal:if(3!==u.ncomp||u.type!==G.F32)this._dbg(Pe.Error,"[Unsupported Feature] Unsupported view for Normal ("+u+")");else{const e=new U(t,u.byteOffset,p,g),i=ve(e.typedBuffer,r);a=new A(i),l=new be(a.typedBuffer,b,2)}break;case N.TexCoord:2!==u.ncomp||u.type!==G.F32?this._dbg(Pe.Error,"[Unsupported Feature] Unsupported view for Texcoord ("+u+")"):void 0===n&&(n=new be(new I(t,u.byteOffset,p,g).typedBuffer,b,2));break;case N.Color:4===u.ncomp?(u.type===G.F32&&(m=new M(t,u.byteOffset,p,g)),u.type===G.U8&&(m=new P(t,u.byteOffset,p,g)),u.type===G.U16&&(m=new O(t,u.byteOffset,p,g))):3===u.ncomp&&(u.type===G.F32&&(m=new U(t,u.byteOffset,p,g)),u.type===G.U8&&(m=new E(t,u.byteOffset,p,g)),u.type===G.U16&&(m=new V(t,u.byteOffset,p,g))),null==m?this._dbg(Pe.VerboseAPI,"[Unsupported Feature] Unsupported view for Color ("+u+")"):o=new be(m.typedBuffer,b,u.ncomp);break;case N.FeatureIndex:break;default:this._dbg(Pe.VerboseAPI,"[Unsupported Feature] Unsupported semantic ("+c.sem+"). Skipping vertex attribute.")}}catch(d){this._dbg(Pe.VerboseAPI,"Error Creating buffer ("+d+"). Skipping vertex attribute.")}}if(e.index){const r=e.index.view,i=void 0,s=r.byteOffset+r.byteCount;switch(e.index.view.type){case G.U16:c=new S(t,r.byteOffset,i,s);break;case G.U32:c=new H(t,r.byteOffset,i,s);break;case G.U8:default:this._dbg(Pe.Error,"[Unsupported Feature] index type not supported ("+r.type+").")}}if(null==c&&null!=i){const e=i.count;if(e<65535){const t=new Uint16Array(e);c=new S(t)}else{const t=new Uint32Array(e);c=new H(t)}for(let t=0;t<e;t++)c.set(t,t)}return{positionView:i,positionAttr:s,colorAttr:o,texCoord0Attr:n,indicesView:c,normalsView:a,normalsAttr:l}}_onRemoveFromCache(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,t){this._dbgFlags.has(e)&&(e===Pe.Error?r.getLogger(this).error(t):r.getLogger(this).warn(t))}};e([a()],Ee.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([a()],Ee.prototype,"layer",void 0),e([a({readOnly:!0})],Ee.prototype,"visibleAtCurrentScale",null),e([a()],Ee.prototype,"elevationOffset",null),Ee=e([l("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Ee);const Ve=Ee;export{Ve as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import has from"../../../core/has.js";import r from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as i,initial as o}from"../../../core/reactiveUtils.js";import{schedule as a}from"../../../core/scheduling.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as c,invert as m}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{IDENTITY as d,create as h}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as u,getTranslation as p}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as f}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{g as b,q as y}from"../../../chunks/vec32.js";import{fromArray as w,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as v}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{SphericalECEFSpatialReferenceLike as x}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as j}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as C}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as T}from"../../../geometry/projection/projectVectorToVector.js";import{BufferViewVec4f as M,BufferViewVec4u8 as P,BufferViewVec4u16 as O,BufferViewVec3f as U,BufferViewVec3u8 as E,BufferViewVec3u16 as I,BufferViewVec2f as V,BufferViewInt16 as A,BufferViewUint32 as H,BufferViewUint16 as S}from"../../../geometry/support/buffer/BufferView.js";import{invalidLayerView as R,wasmFailedToInit as F,Lyr3DLightingModel as D,Lyr3DUvWrapMode as L,Lyr3DImageFormat as k,Lyr3DPixelFormat as B,Lyr3DVtxAtrbSemantic as N,Lyr3DType as G}from"../../../layers/ILyr3DWasmPerSceneView.js";import{getElevationOffsetInMeters as z}from"../../../support/elevationInfoUtils.js";import{ViewingMode as W}from"../../ViewingMode.js";import{IntegratedMesh3DTilesViewPerformanceInfo as $}from"./IntegratedMesh3DTilesViewPerformanceInfo.js";import{DrapeTargetType as q}from"./interfaces.js";import{LayerView3D as J}from"./LayerView3D.js";import{addLayerViewToWasm as K,removeLayerViewFromWasm as X,getLyr3DWasm as Q}from"./Lyr3DWasm.js";import{LayerElevationProvider as Y}from"./i3s/LayerElevationProvider.js";import{primTypeConversion as Z,alphaModeConversion as ee,faceCullingConversion as te,wrapModeConversion as re,lyr3DTypeToByteSize as se}from"./support/lyr3dTypeConversions.js";import{Tiles3DIntersectionHandler as ie}from"./support/Tiles3DIntersectionHandler.js";import{ElevationRange as oe}from"../support/ElevationRange.js";import{Obb as ae,compute as ne}from"../support/orientedBoundingBox.js";import{ObjectParameters as le}from"../webgl-engine/collections/Component/ObjectParameters.js";import{GeometryParameters as ce,createVertexBufferLayout as me}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as de}from"../webgl-engine/collections/Component/Transform.js";import{ComponentParameterSummary as he}from"../webgl-engine/collections/Component/Material/ComponentMaterial.js";import{RenderTexture as ue}from"../webgl-engine/core/material/RenderTexture.js";import{TextureCoordinateType as pe}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{alphaCutoff as ge}from"../webgl-engine/core/shaderLibrary/util/AlphaCutoff.js";import{getEllipsoidMode as fe}from"../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{Attribute as be}from"../webgl-engine/lib/Attribute.js";import{CullFaceOptions as ye,AlphaDiscardMode as we,TextureEncodingMimeType as _e}from"../webgl-engine/lib/basicInterfaces.js";import{compressAndTransformNormals as ve}from"../webgl-engine/lib/Normals.js";import{Texture as xe}from"../webgl-engine/lib/Texture.js";import{VertexAttribute as je}from"../webgl-engine/lib/VertexAttribute.js";import{writeDefaultAttribute as Ce}from"../webgl-engine/materials/internal/bufferWriterUtils.js";import Te from"../../layers/LayerView.js";import{isInEffectiveScaleRange as Me}from"../../support/layerViewUtils.js";var Pe;!function(e){e[e.API=1]="API",e[e.VerboseAPI=2]="VerboseAPI",e[e.Error=3]="Error"}(Pe||(Pe={}));class Oe{constructor(){this.handle=0,this.isVisible=!1,this.components=[],this.texMemoryUsage=0,this.vboMemoryUsage=0,this.cpuMemoryUsage=0,this.textures=[]}get usedMemory(){return this.texMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get cachedMemory(){return this.usedMemory}}function Ue(e){return Math.round(e/1048.576)/1e3}let Ee=class extends(J(Te)){constructor(){super(...arguments),this.type="integrated-mesh-3dtiles",this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this.drapeTargetType=q.WithoutRasterImage,this._applySSAO=!has("disable-feature:im-ssao"),this._shadeNormals=!!has("enable-feature:im-shading"),this._lyrHandleToObjects=new Map,this._initialCullFace=new Map,this._suspendedHandle=null,this._dbgFlags=new Set}initialize(){if(this._dbgFlags.add(Pe.Error),this._dbg(Pe.VerboseAPI,"Tiles3DLayerView3D initialize() called"),!this._canProjectWithoutEngine())throw new t("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{});const e=K(this).then((e=>{this._intersectionHandler=new ie(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(e))),this._elevationProvider=new Y({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this.view.elevationProvider.register("im",this._elevationProvider),this.view.basemapTerrain.overlayManager.registerDrapeTarget(this),this._wasmLayerId=e;const t=this.view.resourceController.memoryController.newCache(`t3d-${this.uid}`,(e=>this._onRemoveFromCache(e)));this._memCache=t,this.addHandles([i((()=>this.layer.elevationInfo),(e=>this._elevationInfoChanged(e)))]),this._suspendedHandle=i((()=>this.suspended),(e=>this._wasm?.setEnabled(this,!e)),o)})).catch((e=>{if(X(this),this._wasmLayerId=-1,e===R)throw new t("tiles3d:addLayer-failure","The 3d tiles layer description was invalid.",{});if(e===F)throw new t("tiles3d:addLayer-failure","The 3d tiles layer web assembly module failed to download.",{})}));this.addResolvingPromise(e)}destroy(){this._dbg(Pe.VerboseAPI,"Tiles3DLayerView3D destroy() called"),X(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.objectsChanged(this._obbs),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.basemapTerrain.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach((e=>this.freeObject(e))),this._lyrHandleToObjects.clear(),this._initialCullFace.clear(),this._memCache=s(this._memCache),this._updatingHandles=s(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=a((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),this.objects.forEach((t=>{const r=this._collection.getMaterial(t);r.commonMaterialParameters.hasSlicePlane=e,r.commonMaterialParameters.cullFace=e?ye.None:this._initialCullFace.get(t)}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,z(e))}get _obbs(){return this.objects.map((e=>this._collection.getComponentObb(e)))}get _wasm(){return Q(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){let e=0;return this._lyrHandleToObjects.forEach((t=>{t.isVisible&&(e+=t.usedMemory)})),e}get unloadedMemory(){return 0}get cachedMemory(){let e=0;return this._lyrHandleToObjects.forEach((t=>{t.isVisible||(e+=t.usedMemory)})),e}get visibleAtCurrentScale(){return Me(this.layer.effectiveScaleRange,this.view.scale)}get performanceInfo(){let e=0,t=0,r=0,s=0,i=0,o=0;return this._lyrHandleToObjects.forEach((a=>{a.isVisible?(e+=a.texMemoryUsage,t+=a.vboMemoryUsage,i++):(r+=a.texMemoryUsage,s+=a.vboMemoryUsage,o++)})),new $(this.usedMemory,i,o,Ue(t),Ue(e),Ue(s),Ue(r))}_canProjectWithoutEngine(){if(this.view.state.viewingMode===W.Local){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view._stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationOffset(){return z(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new oe(e.zmin,e.zmax):null}getElevationRange(e){return null}get fullExtent(){return this.layer.fullExtent}get objects(){return Array.from(this._lyrHandleToObjects.values()).reduce(((e,t)=>e.concat(t.components)),new Array)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&e.isUpdating(this._wasmLayerId)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const r=w(t.desc.origin),s=new Array,i=new Map,o=new Oe;o.handle=e.handle,this._lyrHandleToObjects.set(e.handle,o);const a=this.view.basemapTerrain.spatialReference;let n,l;if("global"===this.view.viewingMode){const e=g();j(x,r,e,a),n=c(h(),e),l=m(h(),n)}else n=d,l=d;const M=g();u(M,M,r);const P=p(_(),M);let O=null;const U=_();if(t.desc.obb){const e=t.desc.obb.quaternion;O=new ae(t.desc.obb.center,t.desc.obb.halfSize,f(e[0],e[1],e[2],e[3]))}for(let c=0;c<t.desc.prims.length;c++){const e=t.desc.prims[c];this._dbg(Pe.VerboseAPI,JSON.stringify(e));if(null==Z[e.ptype]||null==t.data){this._dbg(Pe.VerboseAPI,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive.");continue}const m=t.desc?.materials&&null!=e.materialId?t.desc.materials[e.materialId]:null,h=null!=m?m.lightingModel:D.Unlit,{positionView:u,positionAttr:p,normalsView:g,normalsAttr:f,colorAttr:w,texCoord0Attr:x,indicesView:j}=this.getBufferViews(e,t.data.buffer,n);if(null==p||null==u||null==j)continue;const M=new ce(null!=w,null!=x?pe.Default:pe.None,null!=g,this._shadeNormals,this._applySSAO),E=p.data.length/p.size,I=(e,t)=>!e||e.data.length/e.size===E||(this._dbg(Pe.Error,`${t} !== numPos. Skipping primitive.`),!1);if(!I(x,"numTexcoord")||!I(w,"numColors")||!I(f,"normals"))continue;const V=me(M);if(null!=O?O=O.clone():(O=ne(p),b(U,O.center,r),O.center=U),n!==d)for(let t=0;t<u.count;t++)u.getVec(t,U),y(U,U,n),u.setVec(t,U);const A=V.createBuffer(p.data.length),H=new Map([[je.POSITION,p]]);null!=x&&H.set(je.UV0,x),null!=w&&H.set(je.COLOR,w),null!=f&&H.set(je.NORMALCOMPRESSED,f),H.forEach(((e,t)=>{null!=e&&Ce(t,e,null,null,A,0)}));const S=new Uint32Array([0,j.typedBuffer.length]),R={vertices:{data:A.buffer,count:A.byteLength/V.stride,layoutParameters:M},positionData:{positions:u.typedBuffer,indices:j.typedBuffer},indices:j.typedBuffer,componentOffsets:S};o.cpuMemoryUsage+=u.count,o.cpuMemoryUsage+=j.count;const F=this.view.renderSpatialReference,L=_(),k=[1,1,1];C(P,F,k,a)||this._dbg(Pe.Error,"Unsupported coordinate system for IM overlay"),T(P,F,L,a);const B=this._collection.createObject(new le(v(L[0],L[1],k[0],k[1]),new de(P,l),O,R));m&&this._collection.updateMaterial(B,(e=>{e.baseColor=m.baseColorFactor,e.usePBR=h===D.Pbr,e.hasParametersFromSource=!1,e.baseColorTexture=this._getTexture(m.baseColorTex,t,i),e.usePBR&&(e.mrrFactors=[m.metallicFactor,m.roughnessFactor,0],e.emissiveFactor=m.emissiveFactor??[0,0,0],e.metallicRoughnessTexture=this._getTexture(m.metalTex,t,i),e.emissionTexture=this._getTexture(m.emissiveTex,t,i),e.occlusionTexture=this._getTexture(m.occlusionTex,t,i),e.normalTexture=this._getTexture(m.normalTex,t,i)),e.objectOpacity=0,e.alphaDiscardMode=we.Mask;const r=[];e.baseColorTexture&&r.push(e.baseColorTexture.loadPromise),e.usePBR&&e.metallicRoughnessTexture&&r.push(e.metallicRoughnessTexture.loadPromise),e.usePBR&&e.emissionTexture&&r.push(e.emissionTexture.loadPromise),e.usePBR&&e.occlusionTexture&&r.push(e.occlusionTexture.loadPromise),e.usePBR&&e.normalTexture&&r.push(e.normalTexture.loadPromise);const a=Promise.all(r);s.push(a),a.then((()=>{e.alphaDiscardMode=ee[m.alphaMode],e.objectOpacity=1,o.texMemoryUsage+=e.baseColorTexture?.glTexture?.usedMemory||0,e.usePBR&&(o.texMemoryUsage+=e.metallicRoughnessTexture?.glTexture?.usedMemory||0,o.texMemoryUsage+=e.emissionTexture?.glTexture?.usedMemory||0,o.texMemoryUsage+=e.occlusionTexture?.glTexture?.usedMemory||0,o.texMemoryUsage+=e.normalTexture?.glTexture?.usedMemory||0)})),e.commonMaterialParameters.doubleSided=m.isDoubleSided,e.commonMaterialParameters.cullFace=m.faceCulling?te[m.faceCulling]:ye.Back,this._initialCullFace.set(B,e.commonMaterialParameters.cullFace),e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.componentParameters.castShadows=he.All,e.textureAlphaCutoff=m.alphaCutoff??ge,e.alphaDiscardMode=ee[m.alphaMode],e.isIntegratedMesh=!0,e.polygonOffsetEnabled=!1,e.hasOccludees=!1,e.ellipsoidMode=fe(this.view.spatialReference)})),o.components.push(B),o.vboMemoryUsage+=this._collection.getObjectGPUMemoryUsage(B)}if(await Promise.all(s),i.forEach((e=>{o.textures.push(e)})),!this._memCache)throw new Error("no memCache");return this._memCache.put(`${o.handle}`,o),{memUsageBytes:o.usedMemory}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t&&(this.freeObject(t),this._lyrHandleToObjects.delete(e))}freeObject(e){this._memCache&&this._memCache.pop(`${e.handle}`),e.components.forEach((t=>{e.textures.forEach((e=>{this._stage.remove(e)})),this._collection.destroyObject(t),this._initialCullFace.delete(t)}))}setRenderableVisibility(e,t,r){if(this._memCache){for(let s=0;s<r;++s){const r=e[s],i=t[s];if(!i)continue;const o=this._lyrHandleToObjects.get(r);o&&(this._visibleGeometryChanged(),o.isVisible=i,o.components.forEach((e=>{this._collection.setObjectVisibility(e,i),this._elevationProvider.objectChanged(this._collection.getComponentObb(e))})),this._memCache.pop(`${r}`))}for(let s=0;s<r;++s){const r=e[s],i=t[s];if(i)continue;const o=this._lyrHandleToObjects.get(r);o&&(this._visibleGeometryChanged(),o.isVisible=i,o.components.forEach((e=>{this._collection.setObjectVisibility(e,i),this._elevationProvider.objectChanged(this._collection.getComponentObb(e))})),this._memCache.put(`${r}`,o))}}}_getTexture(e,t,r){let s=null;if(e&&t.desc?.images&&t.data?.buffer){const i=t.desc.images[e?.imageId];if(s=r.get(i),!s&&i){const o=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,a=!!i.mipCount||o>1,n=re[e.wrapMode??L.None];let l=i.alpha?4:3;const c=new Uint8Array(t.data.buffer,i.data.byteOffset,i.data.byteCount);let m=null,d=null,h=null;switch(i.format){case k.Raw:i.pixelFormat===B.R8?(m=c,l=1,d=""):i.pixelFormat===B.Rgb8?(m=c,l=3,d=""):i.pixelFormat===B.Rgba8&&(m=c,l=4,d="");break;case k.Dxt1:m=c,l=3,d=_e.DDS_ENCODING;break;case k.Dxt5:m=c,l=4,d=_e.DDS_ENCODING;break;case k.Basis:m=c,l=3,d=_e.KTX2_ENCODING;break;case k.Png:d="image/png",h=document.createElement("img");break;case k.Jpeg:d="image/jpeg",h=document.createElement("img");break;case k.Etc2:d="image/ktx",h=document.createElement("img");break;case k.Astc:this._dbg(Pe.Error,"Astc texture not supported");break;case k.Pvrtc:this._dbg(Pe.Error,"Pvrtc texture not supported")}if(h&&d){const e=new Blob([c],{type:d});h.src=URL.createObjectURL(e),m=h}m&&null!=d&&(s=new xe(m,{mipmap:a,maxAnisotropy:o,encoding:d,wrap:n,components:l,noUnpackFlip:!0,width:i.mip0Width,height:i.mip0Height}),this._stage.add(s),r.set(i,s))}}return s?new ue(this.view._stage.renderView.textures,s.id):null}getBufferViews(e,t,r){let s,i,o,a,n,l,c,m=null;for(let h=0;h<e.atrbs.length;h++){const c=e.atrbs[h],u=c.view,p=void 0,g=u.byteOffset+u.byteCount,f=u.byteCount/se[u.type],b=[...Array(f).keys()].map((e=>e));try{switch(c.sem){case N.Position:3!==u.ncomp||u.type!==G.F32?this._dbg(Pe.Error,"[Unsupported Feature] Unsupported view for Position ("+u+")"):(s=new U(t,u.byteOffset,p,g),i=new be(s.typedBuffer,b,3));break;case N.Normal:if(3!==u.ncomp||u.type!==G.F32)this._dbg(Pe.Error,"[Unsupported Feature] Unsupported view for Normal ("+u+")");else{const e=new U(t,u.byteOffset,p,g),s=ve(e.typedBuffer,r);n=new A(s),l=new be(n.typedBuffer,b,2)}break;case N.TexCoord:2!==u.ncomp||u.type!==G.F32?this._dbg(Pe.Error,"[Unsupported Feature] Unsupported view for Texcoord ("+u+")"):void 0===a&&(a=new be(new V(t,u.byteOffset,p,g).typedBuffer,b,2));break;case N.Color:4===u.ncomp?(u.type===G.F32&&(m=new M(t,u.byteOffset,p,g)),u.type===G.U8&&(m=new P(t,u.byteOffset,p,g)),u.type===G.U16&&(m=new O(t,u.byteOffset,p,g))):3===u.ncomp&&(u.type===G.F32&&(m=new U(t,u.byteOffset,p,g)),u.type===G.U8&&(m=new E(t,u.byteOffset,p,g)),u.type===G.U16&&(m=new I(t,u.byteOffset,p,g))),null==m?this._dbg(Pe.VerboseAPI,"[Unsupported Feature] Unsupported view for Color ("+u+")"):o=new be(m.typedBuffer,b,u.ncomp);break;case N.FeatureIndex:break;default:this._dbg(Pe.VerboseAPI,"[Unsupported Feature] Unsupported semantic ("+c.sem+"). Skipping vertex attribute.")}}catch(d){this._dbg(Pe.VerboseAPI,"Error Creating buffer ("+d+"). Skipping vertex attribute.")}}if(e.index){const r=e.index.view,s=void 0,i=r.byteOffset+r.byteCount;switch(e.index.view.type){case G.U16:c=new S(t,r.byteOffset,s,i);break;case G.U32:c=new H(t,r.byteOffset,s,i);break;case G.U8:default:this._dbg(Pe.Error,"[Unsupported Feature] index type not supported ("+r.type+").")}}if(null==c&&null!=s){const e=s.count;if(e<65535){const t=new Uint16Array(e);c=new S(t)}else{const t=new Uint32Array(e);c=new H(t)}for(let t=0;t<e;t++)c.set(t,t)}return{positionView:s,positionAttr:i,colorAttr:o,texCoord0Attr:a,indicesView:c,normalsView:n,normalsAttr:l}}_onRemoveFromCache(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,t){this._dbgFlags.has(e)&&(e===Pe.Error?r.getLogger(this).error(t):r.getLogger(this).warn(t))}};e([n()],Ee.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([n()],Ee.prototype,"layer",void 0),e([n({readOnly:!0})],Ee.prototype,"visibleAtCurrentScale",null),e([n()],Ee.prototype,"elevationOffset",null),Ee=e([l("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Ee);const Ie=Ee;export{Ie as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
let e,t=null;const
|
|
5
|
+
let e,t=null;const i=new Map;async function n(n){null==t&&(null==e&&(e=import("../../../layers/Lyr3DWasmPerSceneView.js")),t=await e);const r=n.view;let s=i.get(r);s||(s=new t.default({view:r}),i.set(r,s));const a=!!r._stage.renderView.renderingContext.capabilities.compressedTextureS3TC,l=!!r._stage.renderView.renderingContext.capabilities.compressedTextureETC;return await s.initializeWasm(a,l),s.add3DTilesLayerView(n)}function r(e){return i.get(e)}function s(n){const r=n.view,s=i.get(r);if(s){s.remove3DTilesLayerView(n)<1&&(i.delete(r),0===i.size&&(e=null,t=null))}}export{n as addLayerViewToWasm,r as getLyr3DWasm,s as removeLayerViewFromWasm};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{remove as a}from"../../core/arrayUtils.js";import i from"../../core/Error.js";import{makeHandle as r,handlesGroup as s,abortHandle as n}from"../../core/handleUtils.js";import"../../core/has.js";import{removeMaybe as o,destroyMaybe as l}from"../../core/maybe.js";import{debounce as c}from"../../core/promiseUtils.js";import{watch as d,initial as h,whenOnce as u,syncAndInitial as p}from"../../core/reactiveUtils.js";import{generateBracedUUID as f}from"../../core/uuid.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import"../../core/Logger.js";import{subclass as g}from"../../core/accessorSupport/decorators/subclass.js";import w from"../../layers/GraphicsLayer.js";import{isTable as y}from"../../layers/support/layerUtils.js";import{getDrawHelpMessage as v}from"../../views/draw/support/helpMessageUtils.js";import{ViewEventPriorities as _}from"../../views/input/InputManager.js";import F from"../../views/interactive/sketch/SketchOptions.js";import M from"../../views/interactive/snapping/FeatureSnappingLayerSource.js";import b from"./CreateFeaturesWorkflowData.js";import{isModelUpload as I,handleModelUpload as A}from"./modelUploadUtils.js";import k from"./Workflow.js";import{startCreatingNewFeature as V,findLayerInfo as C,updateGraphicSymbolWhenRequired as S,isTerminalUpdateEventType as H,getVisualVariableAttributes as j,startUpdatingFeature as U,createWorkflowSteps as O,avoidFeatureTemplateSelectionWithOnlyOneItem as E,prepareAttachmentsForCreateFeaturesWorkflow as D,showProgressCursor as T,visualVariableInteractiveUpdate as P}from"./workflowUtils.js";import G from"../FeatureForm/FeatureFormViewModel.js";import L from"../Sketch/SketchViewModel.js";var W;const x=Symbol(),N=Symbol(),z=Symbol(),R=Symbol();let Z=W=class extends k{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._featureFormViewModel=new G,this._sketchViewModel=null,this._attachmentFileInfos=new Map,this._highlightHandles=new Map,this._preventDefaultActionOnCancel=!1,this._lastActiveGraphics=[],this._isActive=!0,this._updateGraphicDebounced=c(((e,t,a)=>S(e,t,a)))}initialize(){this.isNested&&(this._isActive=!1),this._initializeSketchViewModel()}destroy(){this._sketchViewModel.destroy()}get featureFormViewModel(){return this._featureFormViewModel}get hasPendingEdits(){if(this.pendingFeatures.some((e=>!!this.data.getEditsForPendingFeature(e)?.modified)))return!0;const{creationInfo:e,upload:t}=this.data,a=this._sketchViewModel,{activeComponent:i}=a,r=a.createGraphic?.geometry?.type;return!("polyline"!==r&&"polygon"!==r&&"multipoint"!==r||"draw-2d"!==i?.type&&"draw-3d"!==i?.type)&&i.drawOperation.committedVertices.length>0||(!(!t||"pending"!==t.state&&"success"!==t.state)||!!e?.geometryToPlace)}get helpMessage(){const{creationInfo:e,viewModel:t}=this.data;if("creating-features"!==this.stepId||!e)return;const a=e.layer.geometryType,i=this._sketchViewModel.createGraphic;if("mesh"===a){this._getDrawMeshHelpMessage||import("../../views/draw/support/helpMessageUtils3d.js").then((e=>{this._getDrawMeshHelpMessage=e.getDrawMeshHelpMessage}));const{view:e}=t;return"3d"===e?.type?this._getDrawMeshHelpMessage?.(i,e):void 0}return v(a,i?.geometry)}get layer(){return this.data.creationInfo?.layer}get numPendingFeatures(){return this.pendingFeatures.length}get parent(){return this.data.parent}get parentLayer(){return this.parent?.data.editorItem.layer}get pendingFeatures(){return this.data.pendingFeatures}get keyboardCancellationEnabled(){return 0===this.numPendingFeatures}get reliesOnOwnerAdminPrivileges(){return this.data.editorItem?.capabilities.create.reliesOnOwnerAdminPrivileges??!1}get shouldShowAttachments(){return this.data.editorItem?.capabilities.create.attachments.enabled??!1}get shouldAllowAttachmentEditing(){return this.shouldShowAttachments}get sketchViewModel(){return this._sketchViewModel}get test(){}async enter(){this._isActive=!0,"awaiting-feature-creation-info"!==this.stepId&&this._setUpCreatingFeaturesStep()}exit(){this._isActive=!1,this.removeHandles([z])}async updatePendingFeature(e,t){return this._preventDefaultActionOnCancel=!0,this._sketchViewModel.cancel(),a(this._lastActiveGraphics,e),this._startUpdating({feature:e,webStyleCache:t})}async start(){return await super.start(),y(this.data.creationInfo?.layer)?null:{enter:async()=>{},exit:async()=>{},viewModel:this._sketchViewModel}}static create(e){const{addAttachmentsCallback:t,applyEditsCallback:a,isNested:i,creationInfo:r,parent:s,snappingManager:n,startAt:o,viewModel:l}=e,c=e.sketchOptions??new F,d=r?.layer,h=d?l.findEditorItemForLayer(d):void 0,u=new W({data:new b({creationInfo:r,editorItem:h,parent:s,sketchOptions:c,snappingManager:n,viewModel:l}),isNested:i,onCommit:async e=>{const{creationInfo:i}=e;if(!i)return;const r=e.pendingFeatures.toArray(),{layer:s}=i,n=s.capabilities?.editing.supportsGlobalId&&"globalIdField"in s,o=u._attachmentFileInfos;if(n){const e=B(r,s,o);return void await a(s,e,{globalIdUsed:!0})}const l=await a(s,{addFeatures:r});if(o.size>0){const e=l?.addFeatureResults??[];await t(s,K(r,e,s,o))}}});return u._set("steps",this._createWorkflowSteps(u,o)),u}_fadeExistingFeatures(e){if("effect"in e){const t=e.effect;return e.effect="saturate(0.6) opacity(0.8)",r((()=>e.effect=t))}const t=e.opacity;return e.opacity=.7,r((()=>e.opacity=t))}_highlight(e){const t=this.data.viewModel.view;"3d"===t?.type&&this._highlightHandles.set(e,t.highlight(e))}_removeHighlight(e){o(this._highlightHandles.get(e)),this._highlightHandles.delete(e)}async _startCreating(e){this.removeHandles(N);const{creationInfo:t}=this.data;if(!t)return;this.createFeatureState="create-new";const a=await V(this._sketchViewModel,t,e);this.addHandles(a,N)}async _startUpdating({feature:e,webStyleCache:t,initialFeature:a=e}){const{data:i,pendingFeatures:r}=this;r.includes(e)||i.addPendingFeature(e,a);const{_featureFormViewModel:n,_sketchViewModel:l}=this,{creationInfo:c,viewModel:h}=i,{attachmentsViewModel:u,layerInfos:p,view:f}=h;if(!f||!c)return;const m=c.layer,g=C(p,m),w=g?.formTemplate,v=f.spatialReference;n.set({arcadeEditType:"INSERT",feature:e,formTemplate:w,spatialReference:v,map:f.map}),"add"!==u.mode&&"edit"!==u.mode||h.activeWorkflow?.previous(),u.graphic=e,u.fileInfos.removeAll(),u.mode="view";if((this._attachmentFileInfos.get(e)||[]).forEach((({file:e,form:t})=>u.addFile(e,t))),this._removeHighlight(e),await S(e,t,"2d"===f.type?f.scale:null),this.removeHandles(N),o(this._featureFormHandle),"2d"===f.type){const a=d((()=>f.scale),(a=>this._updateGraphicDebounced(e,t,a)));this.addHandles(a,N)}const _=i.getEditsForPendingFeature(e);return this._featureFormHandle=s([n.on("value-change",(async()=>{_?.updateAttributes(n.getValues()),await S(e,t,"2d"===f.type?f.scale:null)})),l.on(["update","undo","redo"],(e=>{("undo"===e.type||"redo"===e.type||"update"===e.type&&null!=e.toolEventInfo&&H(e.toolEventInfo.type))&&n.notifyFeatureGeometryChanged()})),d((()=>n.feature?.sourceLayer),(t=>e.sourceLayer=t))]),this.createFeatureState="update-pending",this._visualVariableAttributes=j(e),y(m)?void 0:U({graphic:e,sketchViewModel:l,sourceLayer:m,visualVariables:this._visualVariableAttributes,webStyleCache:t})}static _createWorkflowSteps(e,t="awaiting-feature-creation-info"){const{data:a}=e,i=O(["awaiting-feature-creation-info","creating-features","adding-attachment","editing-attachment"],t,{"awaiting-feature-creation-info":()=>({id:"awaiting-feature-creation-info",async setUp(){const{creationInfo:t,viewModel:i}=a,{view:r}=i;r&&(I(t)?e.addHandles(await A({view:r,data:a,next:()=>e.next(),cancel:()=>i.cancelWorkflow({warnIfNoWorkflow:!1})}),this.id):(a.parent&&t&&(e.addHandles(i.lockFeatureTemplatesViewModel(),this.id),i.featureTemplatesViewModel.layers=[t.layer]),e.addHandles(i.featureTemplatesViewModel.on("select",(({item:t})=>{t&&(a.creationInfo={...a.creationInfo,layer:t.layer,template:t.template},e.next())})),this.id)))},async tearDown(){e.removeHandles([this.id,N])}}),"creating-features":()=>({id:"creating-features",async setUp(){e._isActive&&await e._setUpCreatingFeaturesStep()},async tearDown(t){const{viewModel:i}=a;t.canceled&&(e.removeHandles([z,x,N,R]),i.attachmentsViewModel.fileInfos.removeAll(),e._attachmentFileInfos.clear())}}),"adding-attachment":()=>({id:"adding-attachment",parent:"creating-features",async setUp(){},async tearDown(){const{attachmentsViewModel:t}=a.viewModel,{graphic:i,fileInfos:r}=t;e._attachmentFileInfos.set(i,r.toArray()),t.mode="view"}}),"editing-attachment":()=>({id:"editing-attachment",parent:"creating-features",async setUp(){},async tearDown(){const{attachmentsViewModel:t}=a.viewModel,{graphic:i,fileInfos:r}=t;e._attachmentFileInfos.set(i,r.toArray()),t.mode="view"}})});return E(a,i)}static _configureSketchViewModel(e,t){const{data:i}=e,{creationInfo:n,viewModel:o}=i,{view:l}=o,c=e._sketchViewModel;let d=null;const h=[];if(!l)return r();"2d"===l.type&&n&&h.push(e._fadeExistingFeatures(n.layer));const p=async a=>{if("cancel"===a.state){if(e._preventDefaultActionOnCancel)return void(e._preventDefaultActionOnCancel=!1);if(null==l.activeTool){if(e._lastActiveGraphics.length<1)return e._startCreating(t);const a=e._lastActiveGraphics.pop();return e._startUpdating({feature:a,webStyleCache:t})}return e._waitForActiveToolCleared().then((()=>e._startCreating(t)))}if("complete"===a.state&&a.graphic){const i=a.graphic.clone();return i.geometry=null,e._startUpdating({feature:a.graphic,webStyleCache:t,initialFeature:i})}},f=async a=>{const{attachmentsViewModel:i}=o,{_featureFormViewModel:r}=e,s=a.graphics[0];if("complete"===a.state){s!==d&&(e._lastActiveGraphics.push(s),e._highlight(s)),d=null;const{hasPendingSubtypeChoice:c,submittable:h}=r;if(e.numPendingFeatures===n?.maxFeatures||c||!h){!h&&r.submit();const a=e._lastActiveGraphics.pop();return null===o.view?.activeTool?e._startUpdating({feature:a,webStyleCache:t}):e._waitForActiveToolCleared().then((()=>e._startUpdating({feature:a,webStyleCache:t})))}if("add"!==i.mode&&"edit"!==i.mode||o.activeWorkflow?.previous(),a.aborted&&e._preventDefaultActionOnCancel)return void(e._preventDefaultActionOnCancel=!1);if(e.addHandles([T(l),l.on("click",(e=>e.preventDefault()))],x),await u((()=>!r.updating)),e.removeHandles(x),null!=o.view?.activeTool)return e._waitForActiveToolCleared().then((()=>{const a=e._lastActiveGraphics.pop();if(a)return e._startUpdating({feature:a,webStyleCache:t})}));e._startCreating(t)}"start"===a.state&&e._removeHighlight(s);const c=e._visualVariableAttributes;await P(l,s,a,c,t);const h=s.attributes,{rotation:p,size:f}=c;if(null!=p){const{field:e}=p;r.setValue(e,h[e])}if(null!=f){const{field:e}=f;r.setValue(e,h[e])}},m=t=>{const r=t.graphics[0];i.removePendingFeature(r),a(e._lastActiveGraphics,r),d=r},g=async a=>{if(I(n))return;const{results:i}=await l.hitTest(a,{include:c.layer}),r=i.find((e=>"graphic"===e.type&&e.graphic.sourceLayer===n?.layer));if(!r)return;const s=r.graphic;if("transform"===c.activeTool||"reshape"===c.activeTool){if(c.updateGraphics.at(0)===s)return;const{submittable:a,hasPendingSubtypeChoice:i}=e._featureFormViewModel;if(!a||i)return;await e.updatePendingFeature(s,t)}};h.push(c.on("create",(t=>e._updatingHandles.addPromise(p(t)))),c.on("update",(t=>e._updatingHandles.addPromise(f(t)))),c.on("delete",(e=>m(e))),l.on("immediate-click",(t=>e._updatingHandles.addPromise(g(t))),_.TOOL),r((()=>{e._preventDefaultActionOnCancel=!0,c.cancel()})),q(c,i));const w=s(h);return c.addHandles(w),w}_initializeSketchViewModel(){const{data:e}=this,{view:t}=e.viewModel,a=new w({elevationInfo:e.creationInfo?.layer.elevationInfo,internal:!0,listMode:"hide"}),i=new L({layer:a,sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,updateOnGraphicClick:!1,view:t});this._sketchViewModel=i,t?.map.add(a),this.addHandles(r((()=>{t?.destroyed||t?.map.remove(a),a.destroy()})))}async _setUpCreatingFeaturesStep(){if(this.hasHandles(z))return;const{data:e}=this,{creationInfo:a,viewModel:n}=e,{attachmentsViewModel:l,view:c}=n;if(!c||!a?.layer)throw new i("missing-parameters","CreateFeaturesWorkflow requires a view and creationInfo.");this._preventDefaultActionOnCancel=!1;const{initialFeature:u,layer:p}=a,f=this._sketchViewModel,m=new Map,g=[];this._lastActiveGraphics=[],this._featureFormHandle=o(this._featureFormHandle),this._visualVariableAttributes={rotation:null,size:null},this.data.editorItem=n.findEditorItemForLayer(a.layer),D(l),g.push(d((()=>l.mode),(e=>{switch(e){case"add":this.go("adding-attachment");break;case"edit":this.go("editing-attachment")}})));const w=T(c);g.push(w);const v=y(a.layer);try{if(v){const e=u??new t({attributes:{...a.template?.prototype.attributes,...a.attributeOverrides},sourceLayer:p});await this._startUpdating({feature:e,webStyleCache:m})}else g.push(W._configureSketchViewModel(this,m)),u?(f.layer.add(u),await this._startUpdating({feature:u,webStyleCache:m})):await this._startCreating(m)}finally{w.remove()}const _=r((()=>{for(const t of e.pendingFeatures)f.layer.remove(t),e.removePendingFeature(t)})),F=d((()=>c?.timeZone),(e=>this._featureFormViewModel.timeZone=e),h),M=r((()=>{I(a)&&n.cancelWorkflow({warnIfNoWorkflow:!1})}));this._featureFormHandle&&g.push(this._featureFormHandle),this.addHandles(g,this._handleKeys.beforeCommit),this.addHandles([r((()=>l.fileInfos.removeAll())),s(g),M,_,F],z)}async _waitForActiveToolCleared(){const e=this.data.viewModel.view;if(null==e?.activeTool)return;const t=new AbortController;this.addHandles(n(t),R),await u((()=>null==e?.activeTool),t.signal),t.abort()}};function q(e,t){let a=null;const i=()=>e.snappingOptions.featureSources,n=()=>(a=new M({layer:e.layer}),i().add(a),a),o=()=>{null!=a&&(i().remove(a),a=l(a))};return s([d((()=>{const e=t.creationInfo?.layer,a=i().find((t=>t.layer===e));return{hasFeatureLayerSource:!!a,enabled:a?.enabled??!1}}),(({hasFeatureLayerSource:e,enabled:t})=>{if(!e)return o();a??=n(),a.enabled=t}),p),r(o)])}function K(e,t,a,i){const r=[];return t.forEach(((t,s)=>{if(!t.error){const n=e[s],o=i.get(n)||[];n.attributes[a.objectIdField]=t.objectId,o.forEach((({form:e})=>r.push({feature:n,attachment:e})))}})),r}function B(e,t,a){const i=[],r=t.globalIdField;return e.forEach(((t,s)=>{e[s].attributes[r]??=f(),(a?.get(t)||[]).forEach((({file:e})=>i.push({feature:t,attachment:{globalId:f(),data:e}})))})),i.length?{addFeatures:e,addAttachments:i}:{addFeatures:e}}e([m()],Z.prototype,"createFeatureState",void 0),e([m()],Z.prototype,"data",void 0),e([m({constructOnly:!0})],Z.prototype,"isNested",void 0),e([m()],Z.prototype,"featureFormViewModel",null),e([m()],Z.prototype,"hasPendingEdits",null),e([m()],Z.prototype,"_getDrawMeshHelpMessage",void 0),e([m()],Z.prototype,"helpMessage",null),e([m()],Z.prototype,"layer",null),e([m()],Z.prototype,"parent",null),e([m()],Z.prototype,"parentLayer",null),e([m()],Z.prototype,"keyboardCancellationEnabled",null),e([m()],Z.prototype,"reliesOnOwnerAdminPrivileges",null),e([m()],Z.prototype,"shouldShowAttachments",null),e([m()],Z.prototype,"shouldAllowAttachmentEditing",null),e([m()],Z.prototype,"sketchViewModel",null),Z=W=e([g("esri.widgets.Editor.CreateFeaturesWorkflow")],Z);const J=Z;export{J as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{remove as a}from"../../core/arrayUtils.js";import i from"../../core/Error.js";import{makeHandle as r,handlesGroup as s,abortHandle as n}from"../../core/handleUtils.js";import"../../core/has.js";import{removeMaybe as o,destroyMaybe as l}from"../../core/maybe.js";import{debounce as c}from"../../core/promiseUtils.js";import{watch as d,initial as h,whenOnce as u,syncAndInitial as p}from"../../core/reactiveUtils.js";import{generateBracedUUID as f}from"../../core/uuid.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import"../../core/Logger.js";import{subclass as g}from"../../core/accessorSupport/decorators/subclass.js";import{isSharedTemplateOrMetadata as w}from"../../editing/templateUtils.js";import y from"../../layers/GraphicsLayer.js";import{isTable as v}from"../../layers/support/layerUtils.js";import{getDrawHelpMessage as _}from"../../views/draw/support/helpMessageUtils.js";import{ViewEventPriorities as F}from"../../views/input/InputManager.js";import M from"../../views/interactive/sketch/SketchOptions.js";import b from"../../views/interactive/snapping/FeatureSnappingLayerSource.js";import I from"./CreateFeaturesWorkflowData.js";import{isModelUpload as A,handleModelUpload as k}from"./modelUploadUtils.js";import V from"./Workflow.js";import{startCreatingNewFeature as C,findLayerInfo as S,updateGraphicSymbolWhenRequired as H,isTerminalUpdateEventType as j,getVisualVariableAttributes as U,startUpdatingFeature as O,createWorkflowSteps as E,avoidFeatureTemplateSelectionWithOnlyOneItem as D,prepareAttachmentsForCreateFeaturesWorkflow as T,showProgressCursor as P,visualVariableInteractiveUpdate as G}from"./workflowUtils.js";import L from"../FeatureForm/FeatureFormViewModel.js";import W from"../Sketch/SketchViewModel.js";var x;const N=Symbol(),z=Symbol(),R=Symbol(),Z=Symbol();let q=x=class extends V{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._featureFormViewModel=new L,this._sketchViewModel=null,this._attachmentFileInfos=new Map,this._highlightHandles=new Map,this._preventDefaultActionOnCancel=!1,this._lastActiveGraphics=[],this._isActive=!0,this._updateGraphicDebounced=c(((e,t,a)=>H(e,t,a)))}initialize(){this.isNested&&(this._isActive=!1),this._initializeSketchViewModel()}destroy(){this._sketchViewModel.destroy()}get featureFormViewModel(){return this._featureFormViewModel}get hasPendingEdits(){if(this.pendingFeatures.some((e=>!!this.data.getEditsForPendingFeature(e)?.modified)))return!0;const{creationInfo:e,upload:t}=this.data,a=this._sketchViewModel,{activeComponent:i}=a,r=a.createGraphic?.geometry?.type;return!("polyline"!==r&&"polygon"!==r&&"multipoint"!==r||"draw-2d"!==i?.type&&"draw-3d"!==i?.type)&&i.drawOperation.committedVertices.length>0||(!(!t||"pending"!==t.state&&"success"!==t.state)||!!e?.geometryToPlace)}get helpMessage(){const{creationInfo:e,viewModel:t}=this.data;if("creating-features"!==this.stepId||!e)return;const a=e.layer.geometryType,i=this._sketchViewModel.createGraphic;if("mesh"===a){this._getDrawMeshHelpMessage||import("../../views/draw/support/helpMessageUtils3d.js").then((e=>{this._getDrawMeshHelpMessage=e.getDrawMeshHelpMessage}));const{view:e}=t;return"3d"===e?.type?this._getDrawMeshHelpMessage?.(i,e):void 0}return _(a,i?.geometry)}get layer(){return this.data.creationInfo?.layer}get numPendingFeatures(){return this.pendingFeatures.length}get parent(){return this.data.parent}get parentLayer(){return this.parent?.data.editorItem.layer}get pendingFeatures(){return this.data.pendingFeatures}get keyboardCancellationEnabled(){return 0===this.numPendingFeatures}get reliesOnOwnerAdminPrivileges(){return this.data.editorItem?.capabilities.create.reliesOnOwnerAdminPrivileges??!1}get shouldShowAttachments(){return this.data.editorItem?.capabilities.create.attachments.enabled??!1}get shouldAllowAttachmentEditing(){return this.shouldShowAttachments}get sketchViewModel(){return this._sketchViewModel}get test(){}async enter(){this._isActive=!0,"awaiting-feature-creation-info"!==this.stepId&&this._setUpCreatingFeaturesStep()}exit(){this._isActive=!1,this.removeHandles([R])}async updatePendingFeature(e,t){return this._preventDefaultActionOnCancel=!0,this._sketchViewModel.cancel(),a(this._lastActiveGraphics,e),this._startUpdating({feature:e,webStyleCache:t})}async start(){return await super.start(),v(this.data.creationInfo?.layer)?null:{enter:async()=>{},exit:async()=>{},viewModel:this._sketchViewModel}}static create(e){const{addAttachmentsCallback:t,applyEditsCallback:a,isNested:i,creationInfo:r,parent:s,snappingManager:n,startAt:o,viewModel:l}=e,c=e.sketchOptions??new M,d=r?.layer,h=d?l.findEditorItemForLayer(d):void 0,u=new x({data:new I({creationInfo:r,editorItem:h,parent:s,sketchOptions:c,snappingManager:n,viewModel:l}),isNested:i,onCommit:async e=>{const{creationInfo:i}=e;if(!i)return;const r=e.pendingFeatures.toArray(),{layer:s}=i,n=s.capabilities?.editing.supportsGlobalId&&"globalIdField"in s,o=u._attachmentFileInfos;if(n){const e=J(r,s,o);return void await a(s,e,{globalIdUsed:!0})}const l=await a(s,{addFeatures:r});if(o.size>0){const e=l?.addFeatureResults??[];await t(s,B(r,e,s,o))}}});return u._set("steps",this._createWorkflowSteps(u,o)),u}_fadeExistingFeatures(e){if("effect"in e){const t=e.effect;return e.effect="saturate(0.6) opacity(0.8)",r((()=>e.effect=t))}const t=e.opacity;return e.opacity=.7,r((()=>e.opacity=t))}_highlight(e){const t=this.data.viewModel.view;"3d"===t?.type&&this._highlightHandles.set(e,t.highlight(e))}_removeHighlight(e){o(this._highlightHandles.get(e)),this._highlightHandles.delete(e)}async _startCreating(e){this.removeHandles(z);const{creationInfo:t}=this.data;if(!t)return;this.createFeatureState="create-new";const a=await C(this._sketchViewModel,t,e);this.addHandles(a,z)}async _startUpdating({feature:e,webStyleCache:t,initialFeature:a=e}){const{data:i,pendingFeatures:r}=this;r.includes(e)||i.addPendingFeature(e,a);const{_featureFormViewModel:n,_sketchViewModel:l}=this,{creationInfo:c,viewModel:h}=i,{attachmentsViewModel:u,layerInfos:p,view:f}=h;if(!f||!c)return;const m=c.layer,g=S(p,m),w=g?.formTemplate,y=f.spatialReference;n.set({arcadeEditType:"INSERT",feature:e,formTemplate:w,spatialReference:y,map:f.map}),"add"!==u.mode&&"edit"!==u.mode||h.activeWorkflow?.previous(),u.graphic=e,u.fileInfos.removeAll(),u.mode="view";if((this._attachmentFileInfos.get(e)||[]).forEach((({file:e,form:t})=>u.addFile(e,t))),this._removeHighlight(e),await H(e,t,"2d"===f.type?f.scale:null),this.removeHandles(z),o(this._featureFormHandle),"2d"===f.type){const a=d((()=>f.scale),(a=>this._updateGraphicDebounced(e,t,a)));this.addHandles(a,z)}const _=i.getEditsForPendingFeature(e);return this._featureFormHandle=s([n.on("value-change",(async()=>{_?.updateAttributes(n.getValues()),await H(e,t,"2d"===f.type?f.scale:null)})),l.on(["update","undo","redo"],(e=>{("undo"===e.type||"redo"===e.type||"update"===e.type&&null!=e.toolEventInfo&&j(e.toolEventInfo.type))&&n.notifyFeatureGeometryChanged()})),d((()=>n.feature?.sourceLayer),(t=>e.sourceLayer=t))]),this.createFeatureState="update-pending",this._visualVariableAttributes=U(e),v(m)?void 0:O({graphic:e,sketchViewModel:l,sourceLayer:m,visualVariables:this._visualVariableAttributes,webStyleCache:t})}static _createWorkflowSteps(e,t="awaiting-feature-creation-info"){const{data:a}=e,i=E(["awaiting-feature-creation-info","creating-features","adding-attachment","editing-attachment"],t,{"awaiting-feature-creation-info":()=>({id:"awaiting-feature-creation-info",async setUp(){const{creationInfo:t,viewModel:i}=a,{view:r}=i;r&&(A(t)?e.addHandles(await k({view:r,data:a,next:()=>e.next(),cancel:()=>i.cancelWorkflow({warnIfNoWorkflow:!1})}),this.id):(a.parent&&t&&(e.addHandles(i.lockFeatureTemplatesViewModel(),this.id),i.featureTemplatesViewModel.layers=[t.layer]),e.addHandles(i.featureTemplatesViewModel.on("select",(({item:t})=>{t&&(a.creationInfo={...a.creationInfo,layer:t.layer,template:t.template},e.next())})),this.id)))},async tearDown(){e.removeHandles([this.id,z])}}),"creating-features":()=>({id:"creating-features",async setUp(){e._isActive&&await e._setUpCreatingFeaturesStep()},async tearDown(t){const{viewModel:i}=a;t.canceled&&(e.removeHandles([R,N,z,Z]),i.attachmentsViewModel.fileInfos.removeAll(),e._attachmentFileInfos.clear())}}),"adding-attachment":()=>({id:"adding-attachment",parent:"creating-features",async setUp(){},async tearDown(){const{attachmentsViewModel:t}=a.viewModel,{graphic:i,fileInfos:r}=t;e._attachmentFileInfos.set(i,r.toArray()),t.mode="view"}}),"editing-attachment":()=>({id:"editing-attachment",parent:"creating-features",async setUp(){},async tearDown(){const{attachmentsViewModel:t}=a.viewModel,{graphic:i,fileInfos:r}=t;e._attachmentFileInfos.set(i,r.toArray()),t.mode="view"}})});return D(a,i)}static _configureSketchViewModel(e,t){const{data:i}=e,{creationInfo:n,viewModel:o}=i,{view:l}=o,c=e._sketchViewModel;let d=null;const h=[];if(!l)return r();"2d"===l.type&&n&&h.push(e._fadeExistingFeatures(n.layer));const p=async a=>{if("cancel"===a.state){if(e._preventDefaultActionOnCancel)return void(e._preventDefaultActionOnCancel=!1);if(null==l.activeTool){if(e._lastActiveGraphics.length<1)return e._startCreating(t);const a=e._lastActiveGraphics.pop();return e._startUpdating({feature:a,webStyleCache:t})}return e._waitForActiveToolCleared().then((()=>e._startCreating(t)))}if("complete"===a.state&&a.graphic){const i=a.graphic.clone();return i.geometry=null,e._startUpdating({feature:a.graphic,webStyleCache:t,initialFeature:i})}},f=async a=>{const{attachmentsViewModel:i}=o,{_featureFormViewModel:r}=e,s=a.graphics[0];if("complete"===a.state){s!==d&&(e._lastActiveGraphics.push(s),e._highlight(s)),d=null;const{hasPendingSubtypeChoice:c,submittable:h}=r;if(e.numPendingFeatures===n?.maxFeatures||c||!h){!h&&r.submit();const a=e._lastActiveGraphics.pop();return null===o.view?.activeTool?e._startUpdating({feature:a,webStyleCache:t}):e._waitForActiveToolCleared().then((()=>e._startUpdating({feature:a,webStyleCache:t})))}if("add"!==i.mode&&"edit"!==i.mode||o.activeWorkflow?.previous(),a.aborted&&e._preventDefaultActionOnCancel)return void(e._preventDefaultActionOnCancel=!1);if(e.addHandles([P(l),l.on("click",(e=>e.preventDefault()))],N),await u((()=>!r.updating)),e.removeHandles(N),null!=o.view?.activeTool)return e._waitForActiveToolCleared().then((()=>{const a=e._lastActiveGraphics.pop();if(a)return e._startUpdating({feature:a,webStyleCache:t})}));e._startCreating(t)}"start"===a.state&&e._removeHighlight(s);const c=e._visualVariableAttributes;await G(l,s,a,c,t);const h=s.attributes,{rotation:p,size:f}=c;if(null!=p){const{field:e}=p;r.setValue(e,h[e])}if(null!=f){const{field:e}=f;r.setValue(e,h[e])}},m=t=>{const r=t.graphics[0];i.removePendingFeature(r),a(e._lastActiveGraphics,r),d=r},g=async a=>{if(A(n))return;const{results:i}=await l.hitTest(a,{include:c.layer}),r=i.find((e=>"graphic"===e.type&&e.graphic.sourceLayer===n?.layer));if(!r)return;const s=r.graphic;if("transform"===c.activeTool||"reshape"===c.activeTool){if(c.updateGraphics.at(0)===s)return;const{submittable:a,hasPendingSubtypeChoice:i}=e._featureFormViewModel;if(!a||i)return;await e.updatePendingFeature(s,t)}};h.push(c.on("create",(t=>e._updatingHandles.addPromise(p(t)))),c.on("update",(t=>e._updatingHandles.addPromise(f(t)))),c.on("delete",(e=>m(e))),l.on("immediate-click",(t=>e._updatingHandles.addPromise(g(t))),F.TOOL),r((()=>{e._preventDefaultActionOnCancel=!0,c.cancel()})),K(c,i));const w=s(h);return c.addHandles(w),w}_initializeSketchViewModel(){const{data:e}=this,{view:t}=e.viewModel,a=new y({elevationInfo:e.creationInfo?.layer.elevationInfo,internal:!0,listMode:"hide"}),i=new W({layer:a,sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,updateOnGraphicClick:!1,view:t});this._sketchViewModel=i,t?.map.add(a),this.addHandles(r((()=>{t?.destroyed||t?.map.remove(a),a.destroy()})))}async _setUpCreatingFeaturesStep(){if(this.hasHandles(R))return;const{data:e}=this,{creationInfo:a,viewModel:n}=e,{attachmentsViewModel:l,view:c}=n;if(!c||!a?.layer)throw new i("missing-parameters","CreateFeaturesWorkflow requires a view and creationInfo.");this._preventDefaultActionOnCancel=!1;const{initialFeature:u,layer:p}=a,f=this._sketchViewModel,m=new Map,g=[];this._lastActiveGraphics=[],this._featureFormHandle=o(this._featureFormHandle),this._visualVariableAttributes={rotation:null,size:null},this.data.editorItem=n.findEditorItemForLayer(a.layer),T(l),g.push(d((()=>l.mode),(e=>{switch(e){case"add":this.go("adding-attachment");break;case"edit":this.go("editing-attachment")}})));const y=P(c);g.push(y);const _=v(a.layer);try{if(_){const{template:e}=a;if(e&&w(e))throw new i("Shared templates are not yet supported");const r=u??new t({attributes:{...e?.prototype.attributes,...a.attributeOverrides},sourceLayer:p});await this._startUpdating({feature:r,webStyleCache:m})}else g.push(x._configureSketchViewModel(this,m)),u?(f.layer.add(u),await this._startUpdating({feature:u,webStyleCache:m})):await this._startCreating(m)}finally{y.remove()}const F=r((()=>{for(const t of e.pendingFeatures)f.layer.remove(t),e.removePendingFeature(t)})),M=d((()=>c?.timeZone),(e=>this._featureFormViewModel.timeZone=e),h),b=r((()=>{A(a)&&n.cancelWorkflow({warnIfNoWorkflow:!1})}));this._featureFormHandle&&g.push(this._featureFormHandle),this.addHandles(g,this._handleKeys.beforeCommit),this.addHandles([r((()=>l.fileInfos.removeAll())),s(g),b,F,M],R)}async _waitForActiveToolCleared(){const e=this.data.viewModel.view;if(null==e?.activeTool)return;const t=new AbortController;this.addHandles(n(t),Z),await u((()=>null==e?.activeTool),t.signal),t.abort()}};function K(e,t){let a=null;const i=()=>e.snappingOptions.featureSources,n=()=>(a=new b({layer:e.layer}),i().add(a),a),o=()=>{null!=a&&(i().remove(a),a=l(a))};return s([d((()=>{const e=t.creationInfo?.layer,a=i().find((t=>t.layer===e));return{hasFeatureLayerSource:!!a,enabled:a?.enabled??!1}}),(({hasFeatureLayerSource:e,enabled:t})=>{if(!e)return o();a??=n(),a.enabled=t}),p),r(o)])}function B(e,t,a,i){const r=[];return t.forEach(((t,s)=>{if(!t.error){const n=e[s],o=i.get(n)||[];n.attributes[a.objectIdField]=t.objectId,o.forEach((({form:e})=>r.push({feature:n,attachment:e})))}})),r}function J(e,t,a){const i=[],r=t.globalIdField;return e.forEach(((t,s)=>{e[s].attributes[r]??=f(),(a?.get(t)||[]).forEach((({file:e})=>i.push({feature:t,attachment:{globalId:f(),data:e}})))})),i.length?{addFeatures:e,addAttachments:i}:{addFeatures:e}}e([m()],q.prototype,"createFeatureState",void 0),e([m()],q.prototype,"data",void 0),e([m({constructOnly:!0})],q.prototype,"isNested",void 0),e([m()],q.prototype,"featureFormViewModel",null),e([m()],q.prototype,"hasPendingEdits",null),e([m()],q.prototype,"_getDrawMeshHelpMessage",void 0),e([m()],q.prototype,"helpMessage",null),e([m()],q.prototype,"layer",null),e([m()],q.prototype,"parent",null),e([m()],q.prototype,"parentLayer",null),e([m()],q.prototype,"keyboardCancellationEnabled",null),e([m()],q.prototype,"reliesOnOwnerAdminPrivileges",null),e([m()],q.prototype,"shouldShowAttachments",null),e([m()],q.prototype,"shouldAllowAttachmentEditing",null),e([m()],q.prototype,"sketchViewModel",null),q=x=e([g("esri.widgets.Editor.CreateFeaturesWorkflow")],q);const Q=q;export{Q as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import a from"../../core/Error.js";import{makeHandle as o}from"../../core/handleUtils.js";import i from"../../core/Logger.js";import{abortMaybe as r}from"../../core/maybe.js";import{createResolver as s,onAbort as n,createAbortError as l,throwIfAborted as d,debounce as c}from"../../core/promiseUtils.js";import p from"../../core/Queue.js";import{whenOnce as u,when as h,watch as w,sync as f}from"../../core/reactiveUtils.js";import{last as m}from"../../core/SetUtils.js";import{property as g}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as k}from"../../core/accessorSupport/decorators/subclass.js";import{isEditableLayer as v}from"../../layers/support/editableLayers.js";import{isSubtypeGroupLayer as y,isTable as W}from"../../layers/support/layerUtils.js";import b from"../../views/draw/support/HighlightHelper.js";import{ViewEventPriorities as _}from"../../views/input/InputManager.js";import C from"../../views/interactive/sketch/SketchOptions.js";import{temporaryHighlightName as M}from"../../views/support/HighlightDefaults.js";import S from"./CreateFeaturesWorkflow.js";import{UpdateFeatureWorkflow as F}from"./UpdateFeatureWorkflow.js";import{UpdateRecordWorkflow as A}from"./UpdateRecordWorkflow.js";import j from"./UpdateWorkflowData.js";import I from"./Workflow.js";import{createWorkflowSteps as U,fetchCandidates as E}from"./workflowUtils.js";import{isGraphicForRelatableFeatureSupportedLayer as P}from"../Feature/support/featureUtils.js";import{getAllTemplatesForLayer as x}from"../support/templateUtils.js";var O;const R="esri.widgets.Editor.UpdateWorkflow",L=()=>i.getLogger(R);let V=O=class extends I{constructor(e){super(e),this._workflowStack=new p(m),this._sketchStack=new p(m),this.data=void 0,this.type="update"}get activeEditorItem(){return this.activeWorkflow?.data.editorItem??void 0}get activeFeatureFormViewModel(){return this.activeWorkflow?.featureFormViewModel}get activeSketchViewModel(){return this._sketchStack.peek()?.viewModel}get activeWorkflow(){return this._workflowStack.last()}get updating(){return this._updatingHandles.updating||!!this.activeWorkflow?.updating}get hasPreviousStep(){const e=this.activeWorkflow?.featureFormViewModel;return this._stepIndex>0||this.nestedWorkflowCount>1||null!=e?.relationshipId||"view"!==this.data.viewModel.attachmentsViewModel.mode||null!=e?.associationId||null!=e?.associatedLayer}get hasUpdatableCandidates(){const{candidates:e,viewModel:t}=this.data;return e.some((({layer:e})=>t.findEditorItemForLayer(e)?.supportsUpdateWorkflow))}get nestedWorkflowCount(){return this._workflowStack.length}get shouldShowAttachments(){return!!this.activeEditorItem?.capabilities.attachments.enabled}get shouldAllowAttachmentEditing(){return!!this.activeEditorItem?.capabilities.update.attachments.enabled}get hasPendingEdits(){return Array.from(this._workflowStack).some((e=>e.hasPendingEdits))}get helpMessage(){return this.activeWorkflow?.helpMessage?this.activeWorkflow.helpMessage:"awaiting-feature-to-update"===this.stepId?"select":void 0}get reliesOnOwnerAdminPrivileges(){return this.activeWorkflow?.reliesOnOwnerAdminPrivileges??!1}get hasInvalidFormTemplate(){return!!this.activeEditorItem?.hasInvalidFormTemplate}async back(e=()=>Promise.resolve(!0)){const{activeWorkflow:t}=this,a=t?.featureFormViewModel;if(null==a?.relationshipId)if(null==a?.associatedLayer)if(null==a?.associationId)if(t){if(t.hasPendingEdits){if(!await e())return}t.hasPreviousStep?await t.previous({cancelCurrentStep:!0}):await this.cancelActiveWorkflow({force:!0})}else this.hasPreviousStep?await this.previous({cancelCurrentStep:!0}):await this.cancel({force:!0});else a.associationId=null;else a.associatedLayer=null;else a.relationshipId=null}async cancelActiveWorkflow(e){await(this.activeWorkflow?.cancel(e)),await this._popWorkflow()}async commit(){await this._drainWorkflowStack((e=>e.commit())),await super.commit()}static create(e){const{viewModel:t,snappingManager:a,startAt:o,addAttachmentsCallback:i,applyEditsCallback:r}=e,s=e.sketchOptions??new C,n=new O({data:new j({addAttachmentsCallback:i,applyEditsCallback:r,sketchOptions:s,snappingManager:a,viewModel:t}),onCommit:async()=>{}});return n._set("steps",this._createWorkflowSteps(n,o)),n}async save(){this.nestedWorkflowCount>1?(await(this.activeWorkflow?.commit()),await this._popWorkflow()):await this.commit()}async startCreatingRelatedRecord(e){try{const t=await this._createNestedCreateFeaturesWorkflow(e);await this._pushWorkflow(t)}catch(t){throw new a("editor:unable-to-start-creating","Could not begin updating the provided feature or table record.",{error:t})}}async startUpdating(e){try{const t=await this._createNestedUpdateWorkflow(e);await this._pushWorkflow(t)}catch(t){throw new a("editor:unable-to-start-updating","Could not begin updating the provided feature or table record.",{error:t})}}async deleteActiveFeature(){const{activeWorkflow:e}=this;if(!e)throw new a("editor:nothing-to-delete","There is no feature to delete");D(e)?await e.deleteAndCommit():await e.cancel(),1===this.nestedWorkflowCount?await this.reset():await this._popWorkflow()}async cancelAll(){await this._drainWorkflowStack((e=>e.cancel({force:!0})))}async _createNestedCreateFeaturesWorkflow(e){const{relatedLayer:t}=e,{addAttachmentsCallback:o,applyEditsCallback:i,sketchOptions:r,snappingManager:s,viewModel:n}=this.data;if(!v(t))throw new a("editor:unsupported-layer","Editing is not supported on the provided layer");const l=this._getCreationInfoForNestedCreateFeaturesWorkflow(e),d=l.template||l.initialFeature?"creating-features":"awaiting-feature-creation-info",c="create-features"!==this.activeWorkflow?.type?this.activeWorkflow:void 0;return S.create({addAttachmentsCallback:o,applyEditsCallback:i,creationInfo:l,isNested:!0,parent:c,sketchOptions:r,snappingManager:s,startAt:d,viewModel:n})}_getCreationInfoForNestedCreateFeaturesWorkflow(e){const{relatedLayer:o}=e;if(!v(o)||y(o))throw new a("editor:unsupported-layer","Editing is not supported on the provided layer");const i={layer:o,maxFeatures:1},r=this._makeRelatedRecordAttributes(e),s=x(o);return s?.length>0?(i.attributeOverrides=r,1===s.length&&(i.template=s[0])):i.initialFeature=new t({sourceLayer:o,attributes:r}),i}async _createNestedUpdateWorkflow(e){const t=W(e.sourceLayer)?A:F,{applyEditsCallback:a,sketchOptions:o,snappingManager:i,viewModel:r}=this.data,s="create-features"!==this.activeWorkflow?.type?this.activeWorkflow:void 0,n=await t.create({feature:e,parent:s,sketchOptions:o,snappingManager:i,viewModel:r,applyEdits:a,featureFormCallbacks:{addRelatedRecord:async e=>await this.startCreatingRelatedRecord(e),editRelatedRecord:async({relatedFeature:e})=>await this.startUpdating(e),selectAssociatedFeature:async e=>await this.startUpdating(e.feature)}});return await u((()=>!n.updating)),n}async _drainWorkflowStack(e){const t=this._workflowStack,a=[];for(;t.length>0;){const o=t.pop();this._sketchStack.pop();const i=e(o).then((()=>o.destroy()));this._updatingHandles.addPromise(i),a.push(i)}await Promise.all(a)}_makeRelatedRecordAttributes(e){const{parentFeature:t,relatedLayer:a,relationshipId:o}=e;if(!P(t))return;const i=a.relationships?.find((e=>e.id===o));if(!i)return void T("relationship-not-found","Could not begin creating a related record because the relationship specified could not be found on the destination layer.");if("origin"===i.role)return void T("unsupported-role","Creating new related records in the 'origin' table of a relationship is not yet supported");const r=t.sourceLayer;i.relatedTableId!==r.layerId&&T("invalid-argument-combination","The given parent feature does not belong to the relationship designated by the given relationship ID.");const s=r.relationships?.find((e=>e.id===o));if(!s)return void T("relationship-not-found","Could not begin creating a related record because the relationship specified could not be found on the origin layer.");const n=H(r,s),l=t.getAttribute(n);l||T("no-key-on-origin-feature","The given parent feature does not have a value for the relationship's origin primary key field.");const d=H(a,i);return{[d]:l}}async _popWorkflow(){this._workflowStack.pop()?.destroy(),this._sketchStack.pop();const e=await this._reconcileWorkflowStack();if(e.failureCount>0)throw new a("editor:next-workflow-failed","Popped the top workflow, but the next workflow in the stack failed to activate",e)}async _pushWorkflow(e){const t=this._workflowRequiresSketchViewModel(e);this.activeWorkflow?.exit({removeSketchHandles:t});const o=this._sketchStack,i=await(e?.start()),r=o.peek();i?(r?.exit(),o.push(i)):o.push(this._cloneSketchController(r)),this._workflowStack.push(e);const s=await this._reconcileWorkflowStack();if(s.failureCount>0)throw new a("editor:failed-to-start-updating-feature","Failed to enter the provided workflow.",s)}async _reconcileWorkflowStack(){const e=this._workflowStack,t=this._sketchStack;try{const a=e.peek();return await(a?.enter()),await(t.peek()?.enter()),{activeWorkflow:a,failureCount:0}}catch(a){e.pop().destroy(),t.pop();const{activeWorkflow:o,failureCount:i}=await this._reconcileWorkflowStack();return{activeWorkflow:o,failureCount:i+1}}}_cloneSketchController(e){return{enter:e?.enter??(async()=>{}),exit:e?.exit??(async()=>{}),viewModel:e?.viewModel}}_workflowRequiresSketchViewModel(e){const{type:t}=e;return"update-feature"===t||"create-features"===t&&!W(e.data.creationInfo?.layer)}static _createWorkflowSteps(e,t="awaiting-feature-to-update"){const{data:i}=e;return U(["awaiting-feature-to-update","awaiting-update-feature-candidate","editing-existing-feature","adding-attachment","editing-attachment"],t,{"awaiting-feature-to-update":()=>({id:"awaiting-feature-to-update",async setUp(){const{spinnerViewModel:t}=i.viewModel,a=i.viewModel.view;a.activeTool=null;let c=null;e.addHandles(o((()=>{c=r(c)})),this.id),i.rootFeature=null,i.candidates=[];const p=a.on("immediate-click",(async o=>{const r=s();e._updatingHandles.addPromise(r.promise);try{t.location=o.mapPoint,t.visible=!0,c?.abort();const{editorItems:r}=i.viewModel;c=new AbortController;const s=await o.async((()=>new Promise(((e,t)=>{n(c?.signal,(()=>t(l()))),e(E(r,a,o,c?.signal))}))));if(d(c),i.candidates=s.filter((e=>"fulfilled"===e.status)).flatMap((e=>e.value)).filter((e=>!e.isAggregate)),t.visible=1===i.candidates.length,0===i.candidates.length)return;o.stopPropagation(),1===i.candidates.length?(i.rootFeature=i.candidates[0],e.go("editing-existing-feature").catch((()=>{})).then((()=>t.visible=!1))):e.next()}finally{r.resolve()}}),_.TOOL),u=h((()=>null!=a.activeTool),(()=>e.cancel({force:!0})),{once:!0});a.focus(),e.addHandles([p,u],this.id)},async tearDown(){0===i.candidates.length&&(i.viewModel.spinnerViewModel.visible=!1),e.removeHandles(this.id)}}),"awaiting-update-feature-candidate":()=>({id:"awaiting-update-feature-candidate",async setUp(){i.rootFeature=null;const{view:t}=i.viewModel;if(!t)return;const a=new b({view:t,highlightName:M});e.addHandles([w((()=>i.rootFeature),((e,t)=>{a.remove(t),a.add(e)}),f),o((()=>a.removeAll()))],this.id)},async tearDown(){e.removeHandles(this.id)}}),"editing-existing-feature":()=>({id:"editing-existing-feature",async setUp(){const{rootFeature:t,viewModel:o}=e.data;if(!t)throw new a("editor:no-feature-specified","Cannot setup the 'updating-existing-feature' step until the root feature is defined");await e.startUpdating(t),o.spinnerViewModel.visible=!1;const i=c((async()=>{await u((()=>!e.updating)),e.previous()}));e.addHandles([w((()=>e.nestedWorkflowCount),((e,t)=>{0===e&&0!==t&&i()}),f)],this.id)},async tearDown(){await e.cancelAll(),e.removeHandles(this.id)}}),"adding-attachment":()=>({id:"adding-attachment",parent:"editing-existing-feature",async setUp(){},async tearDown(){i.viewModel.attachmentsViewModel.mode="view"}}),"editing-attachment":()=>({id:"editing-attachment",parent:"editing-existing-feature",async setUp(){},async tearDown(){i.viewModel.attachmentsViewModel.mode="view"}})})}};function H(e,{keyField:t}){return e.getField(t)?.name??t}e([g()],V.prototype,"activeEditorItem",null),e([g()],V.prototype,"activeFeatureFormViewModel",null),e([g()],V.prototype,"activeSketchViewModel",null),e([g()],V.prototype,"activeWorkflow",null),e([g()],V.prototype,"updating",null),e([g()],V.prototype,"data",void 0),e([g()],V.prototype,"hasPreviousStep",null),e([g()],V.prototype,"hasUpdatableCandidates",null),e([g()],V.prototype,"nestedWorkflowCount",null),e([g()],V.prototype,"shouldShowAttachments",null),e([g()],V.prototype,"shouldAllowAttachmentEditing",null),e([g()],V.prototype,"hasPendingEdits",null),e([g()],V.prototype,"helpMessage",null),e([g()],V.prototype,"reliesOnOwnerAdminPrivileges",null),e([g()],V.prototype,"hasInvalidFormTemplate",null),V=O=e([k(R)],V);const T=(e,t)=>L().warn(`editor:${e}`,t,"The create operation will be allowed to proceed, but the resulting feature may not be related to the given parent feature."),D=e=>!!e&&/update-/.test(e.type),N=V;export{N as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import a from"../../core/Error.js";import{makeHandle as o}from"../../core/handleUtils.js";import i from"../../core/Logger.js";import{abortMaybe as r}from"../../core/maybe.js";import{createResolver as s,onAbort as n,createAbortError as l,throwIfAborted as d,debounce as c}from"../../core/promiseUtils.js";import p from"../../core/Queue.js";import{whenOnce as u,when as h,watch as w,sync as f}from"../../core/reactiveUtils.js";import{last as m}from"../../core/SetUtils.js";import{property as g}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as k}from"../../core/accessorSupport/decorators/subclass.js";import{getAllStandardFeatureTemplatesForLayer as v}from"../../editing/templateUtils.js";import{isEditableLayer as y}from"../../layers/support/editableLayers.js";import{isSubtypeGroupLayer as W,isTable as b}from"../../layers/support/layerUtils.js";import _ from"../../views/draw/support/HighlightHelper.js";import{ViewEventPriorities as C}from"../../views/input/InputManager.js";import M from"../../views/interactive/sketch/SketchOptions.js";import{temporaryHighlightName as S}from"../../views/support/HighlightDefaults.js";import F from"./CreateFeaturesWorkflow.js";import{UpdateFeatureWorkflow as A}from"./UpdateFeatureWorkflow.js";import{UpdateRecordWorkflow as j}from"./UpdateRecordWorkflow.js";import I from"./UpdateWorkflowData.js";import U from"./Workflow.js";import{createWorkflowSteps as E,fetchCandidates as P}from"./workflowUtils.js";import{isGraphicForRelatableFeatureSupportedLayer as x}from"../Feature/support/featureUtils.js";var O;const R="esri.widgets.Editor.UpdateWorkflow",L=()=>i.getLogger(R);let V=O=class extends U{constructor(e){super(e),this._workflowStack=new p(m),this._sketchStack=new p(m),this.data=void 0,this.type="update"}get activeEditorItem(){return this.activeWorkflow?.data.editorItem??void 0}get activeFeatureFormViewModel(){return this.activeWorkflow?.featureFormViewModel}get activeSketchViewModel(){return this._sketchStack.peek()?.viewModel}get activeWorkflow(){return this._workflowStack.last()}get updating(){return this._updatingHandles.updating||!!this.activeWorkflow?.updating}get hasPreviousStep(){const e=this.activeWorkflow?.featureFormViewModel;return this._stepIndex>0||this.nestedWorkflowCount>1||null!=e?.relationshipId||"view"!==this.data.viewModel.attachmentsViewModel.mode||null!=e?.associationId||null!=e?.associatedLayer}get hasUpdatableCandidates(){const{candidates:e,viewModel:t}=this.data;return e.some((({layer:e})=>t.findEditorItemForLayer(e)?.supportsUpdateWorkflow))}get nestedWorkflowCount(){return this._workflowStack.length}get shouldShowAttachments(){return!!this.activeEditorItem?.capabilities.attachments.enabled}get shouldAllowAttachmentEditing(){return!!this.activeEditorItem?.capabilities.update.attachments.enabled}get hasPendingEdits(){return Array.from(this._workflowStack).some((e=>e.hasPendingEdits))}get helpMessage(){return this.activeWorkflow?.helpMessage?this.activeWorkflow.helpMessage:"awaiting-feature-to-update"===this.stepId?"select":void 0}get reliesOnOwnerAdminPrivileges(){return this.activeWorkflow?.reliesOnOwnerAdminPrivileges??!1}get hasInvalidFormTemplate(){return!!this.activeEditorItem?.hasInvalidFormTemplate}async back(e=()=>Promise.resolve(!0)){const{activeWorkflow:t}=this,a=t?.featureFormViewModel;if(null==a?.relationshipId)if(null==a?.associatedLayer)if(null==a?.associationId)if(t){if(t.hasPendingEdits){if(!await e())return}t.hasPreviousStep?await t.previous({cancelCurrentStep:!0}):await this.cancelActiveWorkflow({force:!0})}else this.hasPreviousStep?await this.previous({cancelCurrentStep:!0}):await this.cancel({force:!0});else a.associationId=null;else a.associatedLayer=null;else a.relationshipId=null}async cancelActiveWorkflow(e){await(this.activeWorkflow?.cancel(e)),await this._popWorkflow()}async commit(){await this._drainWorkflowStack((e=>e.commit())),await super.commit()}static create(e){const{viewModel:t,snappingManager:a,startAt:o,addAttachmentsCallback:i,applyEditsCallback:r}=e,s=e.sketchOptions??new M,n=new O({data:new I({addAttachmentsCallback:i,applyEditsCallback:r,sketchOptions:s,snappingManager:a,viewModel:t}),onCommit:async()=>{}});return n._set("steps",this._createWorkflowSteps(n,o)),n}async save(){this.nestedWorkflowCount>1?(await(this.activeWorkflow?.commit()),await this._popWorkflow()):await this.commit()}async startCreatingRelatedRecord(e){try{const t=await this._createNestedCreateFeaturesWorkflow(e);await this._pushWorkflow(t)}catch(t){throw new a("editor:unable-to-start-creating","Could not begin updating the provided feature or table record.",{error:t})}}async startUpdating(e){try{const t=await this._createNestedUpdateWorkflow(e);await this._pushWorkflow(t)}catch(t){throw new a("editor:unable-to-start-updating","Could not begin updating the provided feature or table record.",{error:t})}}async deleteActiveFeature(){const{activeWorkflow:e}=this;if(!e)throw new a("editor:nothing-to-delete","There is no feature to delete");D(e)?await e.deleteAndCommit():await e.cancel(),1===this.nestedWorkflowCount?await this.reset():await this._popWorkflow()}async cancelAll(){await this._drainWorkflowStack((e=>e.cancel({force:!0})))}async _createNestedCreateFeaturesWorkflow(e){const{relatedLayer:t}=e,{addAttachmentsCallback:o,applyEditsCallback:i,sketchOptions:r,snappingManager:s,viewModel:n}=this.data;if(!y(t))throw new a("editor:unsupported-layer","Editing is not supported on the provided layer");const l=this._getCreationInfoForNestedCreateFeaturesWorkflow(e),d=l.template||l.initialFeature?"creating-features":"awaiting-feature-creation-info",c="create-features"!==this.activeWorkflow?.type?this.activeWorkflow:void 0;return F.create({addAttachmentsCallback:o,applyEditsCallback:i,creationInfo:l,isNested:!0,parent:c,sketchOptions:r,snappingManager:s,startAt:d,viewModel:n})}_getCreationInfoForNestedCreateFeaturesWorkflow(e){const{relatedLayer:o}=e;if(!y(o)||W(o))throw new a("editor:unsupported-layer","Editing is not supported on the provided layer");const i={layer:o,maxFeatures:1},r=this._makeRelatedRecordAttributes(e),s=v(o);return s?.length>0?(i.attributeOverrides=r,1===s.length&&(i.template=s[0])):i.initialFeature=new t({sourceLayer:o,attributes:r}),i}async _createNestedUpdateWorkflow(e){const t=b(e.sourceLayer)?j:A,{applyEditsCallback:a,sketchOptions:o,snappingManager:i,viewModel:r}=this.data,s="create-features"!==this.activeWorkflow?.type?this.activeWorkflow:void 0,n=await t.create({feature:e,parent:s,sketchOptions:o,snappingManager:i,viewModel:r,applyEdits:a,featureFormCallbacks:{addRelatedRecord:async e=>await this.startCreatingRelatedRecord(e),editRelatedRecord:async({relatedFeature:e})=>await this.startUpdating(e),selectAssociatedFeature:async e=>await this.startUpdating(e.feature)}});return await u((()=>!n.updating)),n}async _drainWorkflowStack(e){const t=this._workflowStack,a=[];for(;t.length>0;){const o=t.pop();this._sketchStack.pop();const i=e(o).then((()=>o.destroy()));this._updatingHandles.addPromise(i),a.push(i)}await Promise.all(a)}_makeRelatedRecordAttributes(e){const{parentFeature:t,relatedLayer:a,relationshipId:o}=e;if(!x(t))return;const i=a.relationships?.find((e=>e.id===o));if(!i)return void T("relationship-not-found","Could not begin creating a related record because the relationship specified could not be found on the destination layer.");if("origin"===i.role)return void T("unsupported-role","Creating new related records in the 'origin' table of a relationship is not yet supported");const r=t.sourceLayer;i.relatedTableId!==r.layerId&&T("invalid-argument-combination","The given parent feature does not belong to the relationship designated by the given relationship ID.");const s=r.relationships?.find((e=>e.id===o));if(!s)return void T("relationship-not-found","Could not begin creating a related record because the relationship specified could not be found on the origin layer.");const n=H(r,s),l=t.getAttribute(n);l||T("no-key-on-origin-feature","The given parent feature does not have a value for the relationship's origin primary key field.");const d=H(a,i);return{[d]:l}}async _popWorkflow(){this._workflowStack.pop()?.destroy(),this._sketchStack.pop();const e=await this._reconcileWorkflowStack();if(e.failureCount>0)throw new a("editor:next-workflow-failed","Popped the top workflow, but the next workflow in the stack failed to activate",e)}async _pushWorkflow(e){const t=this._workflowRequiresSketchViewModel(e);this.activeWorkflow?.exit({removeSketchHandles:t});const o=this._sketchStack,i=await(e?.start()),r=o.peek();i?(r?.exit(),o.push(i)):o.push(this._cloneSketchController(r)),this._workflowStack.push(e);const s=await this._reconcileWorkflowStack();if(s.failureCount>0)throw new a("editor:failed-to-start-updating-feature","Failed to enter the provided workflow.",s)}async _reconcileWorkflowStack(){const e=this._workflowStack,t=this._sketchStack;try{const a=e.peek();return await(a?.enter()),await(t.peek()?.enter()),{activeWorkflow:a,failureCount:0}}catch(a){e.pop().destroy(),t.pop();const{activeWorkflow:o,failureCount:i}=await this._reconcileWorkflowStack();return{activeWorkflow:o,failureCount:i+1}}}_cloneSketchController(e){return{enter:e?.enter??(async()=>{}),exit:e?.exit??(async()=>{}),viewModel:e?.viewModel}}_workflowRequiresSketchViewModel(e){const{type:t}=e;return"update-feature"===t||"create-features"===t&&!b(e.data.creationInfo?.layer)}static _createWorkflowSteps(e,t="awaiting-feature-to-update"){const{data:i}=e;return E(["awaiting-feature-to-update","awaiting-update-feature-candidate","editing-existing-feature","adding-attachment","editing-attachment"],t,{"awaiting-feature-to-update":()=>({id:"awaiting-feature-to-update",async setUp(){const{spinnerViewModel:t}=i.viewModel,a=i.viewModel.view;a.activeTool=null;let c=null;e.addHandles(o((()=>{c=r(c)})),this.id),i.rootFeature=null,i.candidates=[];const p=a.on("immediate-click",(async o=>{const r=s();e._updatingHandles.addPromise(r.promise);try{t.location=o.mapPoint,t.visible=!0,c?.abort();const{editorItems:r}=i.viewModel;c=new AbortController;const s=await o.async((()=>new Promise(((e,t)=>{n(c?.signal,(()=>t(l()))),e(P(r,a,o,c?.signal))}))));if(d(c),i.candidates=s.filter((e=>"fulfilled"===e.status)).flatMap((e=>e.value)).filter((e=>!e.isAggregate)),t.visible=1===i.candidates.length,0===i.candidates.length)return;o.stopPropagation(),1===i.candidates.length?(i.rootFeature=i.candidates[0],e.go("editing-existing-feature").catch((()=>{})).then((()=>t.visible=!1))):e.next()}finally{r.resolve()}}),C.TOOL),u=h((()=>null!=a.activeTool),(()=>e.cancel({force:!0})),{once:!0});a.focus(),e.addHandles([p,u],this.id)},async tearDown(){0===i.candidates.length&&(i.viewModel.spinnerViewModel.visible=!1),e.removeHandles(this.id)}}),"awaiting-update-feature-candidate":()=>({id:"awaiting-update-feature-candidate",async setUp(){i.rootFeature=null;const{view:t}=i.viewModel;if(!t)return;const a=new _({view:t,highlightName:S});e.addHandles([w((()=>i.rootFeature),((e,t)=>{a.remove(t),a.add(e)}),f),o((()=>a.removeAll()))],this.id)},async tearDown(){e.removeHandles(this.id)}}),"editing-existing-feature":()=>({id:"editing-existing-feature",async setUp(){const{rootFeature:t,viewModel:o}=e.data;if(!t)throw new a("editor:no-feature-specified","Cannot setup the 'updating-existing-feature' step until the root feature is defined");await e.startUpdating(t),o.spinnerViewModel.visible=!1;const i=c((async()=>{await u((()=>!e.updating)),e.previous()}));e.addHandles([w((()=>e.nestedWorkflowCount),((e,t)=>{0===e&&0!==t&&i()}),f)],this.id)},async tearDown(){await e.cancelAll(),e.removeHandles(this.id)}}),"adding-attachment":()=>({id:"adding-attachment",parent:"editing-existing-feature",async setUp(){},async tearDown(){i.viewModel.attachmentsViewModel.mode="view"}}),"editing-attachment":()=>({id:"editing-attachment",parent:"editing-existing-feature",async setUp(){},async tearDown(){i.viewModel.attachmentsViewModel.mode="view"}})})}};function H(e,{keyField:t}){return e.getField(t)?.name??t}e([g()],V.prototype,"activeEditorItem",null),e([g()],V.prototype,"activeFeatureFormViewModel",null),e([g()],V.prototype,"activeSketchViewModel",null),e([g()],V.prototype,"activeWorkflow",null),e([g()],V.prototype,"updating",null),e([g()],V.prototype,"data",void 0),e([g()],V.prototype,"hasPreviousStep",null),e([g()],V.prototype,"hasUpdatableCandidates",null),e([g()],V.prototype,"nestedWorkflowCount",null),e([g()],V.prototype,"shouldShowAttachments",null),e([g()],V.prototype,"shouldAllowAttachmentEditing",null),e([g()],V.prototype,"hasPendingEdits",null),e([g()],V.prototype,"helpMessage",null),e([g()],V.prototype,"reliesOnOwnerAdminPrivileges",null),e([g()],V.prototype,"hasInvalidFormTemplate",null),V=O=e([k(R)],V);const T=(e,t)=>L().warn(`editor:${e}`,t,"The create operation will be allowed to proceed, but the resulting feature may not be related to the given parent feature."),D=e=>!!e&&/update-/.test(e.type),N=V;export{N as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../Graphic.js";import{addMany as t}from"../../core/arrayUtils.js";import{createTask as r}from"../../core/asyncUtils.js";import"../../core/has.js";import{makeHandle as i,handlesGroup as a,abortHandle as n}from"../../core/handleUtils.js";import{clone as s}from"../../core/lang.js";import{whenOrAbort as l,throwIfAborted as o,debounce as c}from"../../core/promiseUtils.js";import{watch as u,whenOnce as p}from"../../core/reactiveUtils.js";import{px2pt as y}from"../../core/screenUtils.js";import{diff as f}from"../../core/accessorSupport/diffUtils.js";import{featureHasFields as d,fixFields as m,getDisplayFieldName as g}from"../../layers/support/fieldUtils.js";import{calculateTolerance as b}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as h}from"../../renderers/support/lengthUtils.js";import{getTransformationType as w,TransformationType as v}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import{getRotationAngle as S,getSize as I}from"../../renderers/visualVariables/support/visualVariableUtils.js";import{to3D as j}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as U}from"../../symbols/support/symbolUtils.js";import{GraphicState as V}from"../../views/3d/layers/graphics/GraphicState.js";import{createQueryGeometry as T}from"../../views/support/drapedUtils.js";import{hitTestSelectSimilarDistance as z,filterGraphicHits as F}from"../../views/support/hitTestSelectUtils.js";import{getAllTemplatesForLayer as L}from"../support/templateUtils.js";function x(e){return"update"===e.type}function k(e){const t=e.sourceLayer;if(!t||"feature"!==t.type||!R(t.renderer))return{rotation:null,size:null};let r=null,i=null;const a=t.renderer.getVisualVariablesForType("rotation").filter((t=>(!t.axis||"heading"===t.axis)&&t.field&&!t.valueExpression&&null!=S(t,e)));1===a.length&&(r=A(a[0],t));const n=t.renderer.getVisualVariablesForType("size").filter((t=>t.field&&!t.useSymbolValue&&!t.valueExpression&&w(t)===v.RealWorldSize&&null!=I(t,e)));return 1===n.length&&(i=C(n[0],t)),{rotation:r,size:i}}function A(e,t){const r="heading"===(e.axis||"heading")&&"arithmetic"===e.rotationType?-1:1,i=e.field,a=t.fields&&t.fields.filter((e=>e.name===i)),n=a&&1===a.length?a[0].type:"double",s={initial:0,current:0};return{field:i,fieldType:n,getDefault:()=>Promise.resolve(0),getValue:e=>(s.current=s.initial-r*e,M((s.current+360)%360,n)),setInitialValue:e=>{s.initial=e,s.current=0},isUpdatingInteractively:!1,rotationType:e.rotationType??"geographic"}}function E(e,t){switch(t){case"width":return e[0];case"depth":return e[1];case"height":return e[2];default:return e[2]||e[1]||e[0]}}async function P(e,t,r){if(null==t)return 0;const{symbol:i}=j(t);if(null==i||"web-style"===i.type||"cim"===i.type)return 0;const a=i.symbolLayers.at(0);if(!a)return 0;switch(a.type){case"icon":{const{computeIconLayerResourceSize:e}=await import("../../symbols/support/symbolLayerUtils.js");return a.size||Math.min(ae.icon,(await e(a,ae.icon))[0])||ae.icon}case"text":return a.size||ae.text;case"line":return a.size||ae.line;case"object":{const{computeObjectLayerResourceSize:t}=await import("../../symbols/support/symbolLayerUtils.js");return E(await t(a,e.scale/ae.viewScaleSizeFactor),r)}case"path":return(null!=a.width?a.width:a.height)||e.scale/ae.viewScaleSizeFactor;case"extrude":return a.size||e.scale/ae.viewScaleSizeFactor;default:return 0}}function C(e,t){const r=e.field,i=e.axis,a=t.fields&&t.fields.filter((e=>e.name===r)),n=a&&1===a.length?a[0].type:"double",s={initial:0,current:0},l=h[e.valueUnit]??1;let o;return o="area"===e.valueRepresentation?e=>(e*l/2)**2*Math.PI:"radius"===e.valueRepresentation||"distance"===e.valueRepresentation?e=>e*l/2:e=>e*l,{field:r,fieldType:n,getDefault:async(e,t)=>M(o(await P(t,e,i)),n),getValue:(e,t)=>(s.initial||(s.initial=t.pixelSizeAt(t.center)),s.current=s.initial*e,M(s.current,n)),setInitialValue:e=>{s.initial=e,s.current=0},isUpdatingInteractively:!1,displayUnit:le(e.valueUnit),axis:e.axis}}function M(e,t){switch(t){case"small-integer":case"integer":case"long":return Math.round(e);case"double":case"single":return e;default:return 0}}function R(e){switch(e?.type){case"class-breaks":case"simple":case"unique-value":case"dot-density":case"dictionary":case"pie-chart":return!0;default:return!1}}async function O(e,t,r){const i=await U(e,{useSourceLayer:!0,ignoreGraphicSymbol:!0,webStyleCache:t,scale:r});null!=f(e.symbol,i)&&(e.symbol=i)}function G(e){if(!e)throw new Error("no geometry type");return"multipatch"===e?"mesh":e}async function D(e,t,r){const a=t.layer,n=Z(t);let s=null;const{view:l}=e,o="2d"===l?.type;if(await q(e,a,n,r,o?l.scale:null),o){const t=c((t=>q(e,a,n,r,t)));s=u((()=>l.scale),(e=>t(e)))}const{data:p,editing:y}=a.capabilities;return e.layer.elevationInfo=a.elevationInfo,null==t.geometryToPlace?await e.create(G(a.geometryType),{graphicProperties:{attributes:n,sourceLayer:a},hasZ:p.supportsZ,defaultZ:(o?y.zDefault:null)??e.defaultCreateOptions.defaultZ}):await e.place(t.geometryToPlace,{graphicProperties:{attributes:n,sourceLayer:a}}),s??i()}function Z(e){return{...e.template?.prototype.attributes,...e.attributeOverrides}}async function q(t,r,i,a,n){const s=new e({sourceLayer:r,attributes:i}),{rotation:l,size:o}=k(s);let c=await U(s,{useSourceLayer:!0,webStyleCache:a,scale:n}),u=!1;for(const e of[o,l]){if(null==e)continue;null==i[e.field]&&(i[e.field]=await e.getDefault(c,t.view),u=!0)}switch(u&&(c=await U(s,{useSourceLayer:!0,webStyleCache:a,scale:n})),c?.type){case"simple-fill":case"polygon-3d":t.polygonSymbol=c;break;case"simple-line":case"line-3d":t.polylineSymbol=c;break;case"simple-marker":case"picture-marker":case"point-3d":case"cim":t.pointSymbol=c;break;case"mesh-3d":t.meshSymbol=c}Q(t.tooltipOptions,o,l)}function Q(e,t,r){e.visualVariables=null!=t||null!=r?{size:null!=t?{unit:t.displayUnit,axis:t.axis,valueType:t.fieldType}:null,rotation:null!=r?{valueType:r.fieldType,rotationType:r.rotationType??"geographic"}:null}:null}function B(e,t){return e?.find((e=>e.layer===t))}async function W(e,t,r,i){switch(t.type){case"3d":return H(e,t,r,i);case"2d":return J(e,t,r,i)}}async function H(e,r,i,a){if(0===e.length)return[];const{updatable:n,graphicsByLayer:s}=await i.async((async()=>{const{results:t}=await l(z(r,i),a),n=new Map,s=e=>{const t=e.layer,r=n.get(t);if(!r){const e=new Array;return n.set(t,e),e}return r};F(t).forEach((({graphic:e})=>s(e).push(e)));const o=e.filter((({capabilities:e,layer:t})=>e.update.enabled&&n.has(t)));return 0!==o.length&&i.stopPropagation(),{updatable:o,graphicsByLayer:n}}));return l(Promise.allSettled(n.map((async({layer:e})=>{const r=s.get(e),i=K(e);if(r.every((e=>d(i,e))))return r;const n=[];for(const a of r){n.push(a.getObjectId());const e=Object.keys(a.attributes);t(i,e)}const l=e.createQuery();return l.returnGeometry=!1,l.objectIds=n,l.outFields=m(e.fieldsIndex,i),e.queryFeatures(l,{signal:a}).then((({features:e})=>e))}))),a)}async function J(e,t,r,i){if(0===e.length)return[];const{mapPoint:a}=r;if(null==a)return[];let n=null;const s=await r.async((async()=>{const{results:a}=await l(t.hitTest(r),i);if(0===a.length)return[];const s=new Set;n=F(a),n.forEach((({graphic:e})=>e&&s.add(e.layer)));const o=e.filter((e=>s.has(e.layer)&&e.supportsUpdateWorkflow));return o.length>0&&r.stopPropagation(),o}));return l(Promise.allSettled(s.map((async({layer:e})=>{const s=e.createQuery();s.returnGeometry=!1,s.outFields=K(e);const l="renderer"in e?b({renderer:e.renderer,pointerType:r.pointerType}):0;s.geometry=T(a,l,t),s.outSpatialReference=t.spatialReference;const{features:o}=await e.queryFeatures(s,{signal:i});return n?.forEach((({graphic:t})=>{t.layer!==e||o.some((e=>e.getObjectId()===t.getObjectId()))||o.push(t)})),o}))),i)}function K(e){return m(e.fieldsIndex,[e.objectIdField,g({displayField:"displayField"in e?e.displayField:null,fields:e.fields})])}async function N(e,t,r){const{sourceLayer:i}=e,a=i.createQuery();a.objectIds=[e.getAttribute(i.objectIdField)],a.outFields=["*"],a.returnM=i.capabilities.data.supportsM,a.returnZ=i.capabilities.data.supportsZ,"scene"===i.type&&null!=i.infoFor3D||(a.outSpatialReference=t);const n=await i.queryFeatures(a,{signal:r});o(r);return n.features[0]}async function X(e){const{graphic:t,sketchViewModel:r,sourceLayer:i,visualVariables:a,webStyleCache:n}=e;let s=!1;const{rotation:l,size:o}=a;if([l,o].forEach((async e=>{if(null==e)return;const i=t.getAttribute(e.field);if(null!=i)e.setInitialValue(i);else{const i=await e.getDefault(t.symbol,r.view);e.setInitialValue(i),t.setAttribute(e.field,i),s=!0}})),s){const e="2d"===r.view?.type?r.view.scale:null;await O(t,n,e)}const c={multipleSelectionEnabled:!1};return"point"===i.geometryType&&(c.enableRotation=null!=l,c.enableScaling=null!=o),Q(r.tooltipOptions,o,l),r.layer.elevationInfo=i.elevationInfo,r.update(t,c)}function Y(e){return null==e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function $(e){return null==e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}async function _(e,t,r,i,a){if(null==t.geometry||"point"!==t.geometry?.type)return;const n=i.rotation,s=Y(r.toolEventInfo);if(null!=n&&null!=s){const{field:r,getValue:i}=n;"rotate-stop"===s.type?(n.isUpdatingInteractively=!1,n.setInitialValue(t.getAttribute(r))):(n.isUpdatingInteractively=!0,t.setAttribute(r,i(s.angle,e)))}const l=i.size,o=$(r.toolEventInfo);if(null!=l&&null!=o){const{field:r,getValue:i}=l;"scale-stop"===o.type?(l.isUpdatingInteractively=!1,l.setInitialValue(t.getAttribute(r))):(l.isUpdatingInteractively=!0,t.setAttribute(r,i(o.xScale,e)))}await O(t,a,"2d"===e.type?e.scale:null)}async function ee({feature:e,featureClone:t,visualVariableAttributes:r,sketchViewModel:s,view:l,onUpdate:o,webStyleCache:y,addUpdatingPromise:f,addHandle:d}){await O(t,y,"2d"===l.type?l.scale:null);let m=null;if("2d"===s?.view?.type){const e=c((e=>O(t,y,e)));m=u((()=>s?.view?.scale),(t=>e(t)))}const g=t.sourceLayer,b=ue(l,g);await X({graphic:t,sketchViewModel:s,sourceLayer:g,visualVariables:r,webStyleCache:y});let h=null;b.then((e=>h=e)).catch((()=>{}));const w=r.size,v=r.rotation,S=u((()=>e.attributes),(async e=>{let r=!1;for(const i in e){const a=e[i];a!==t.getAttribute(i)&&(t.setAttribute(i,a),null==w||w.isUpdatingInteractively||w.field!==i||w.setInitialValue(a),null==v||v.isUpdatingInteractively||v.field!==i||v.setInitialValue(a),(null==h||h.requiredFields.includes(i))&&(r=!0))}r&&await O(t,y,"2d"===l.type?l.scale:null)})),I=s.on("update",(async e=>{const t=e.graphics[0],i={graphic:t,sketchViewModel:s,sourceLayer:g,visualVariables:r,webStyleCache:y};if("complete"===e.state){if(null===l.activeTool)return X(i);const e=new AbortController,t=n(e);return d(t),f(p((()=>null===l.activeTool),e.signal).then((()=>(e.abort(),X(i)))))}await _(l,t,e,r,y),o(ye(t),e)})),j=s.on(["undo","redo"],(async e=>{o(ye(e.graphics[0]),e)}));return a([j,I,i((()=>s.cancel())),S,m])}async function te(e,t,n){const s=e.view;e.layer.add(n);const l=t.sourceLayer,c=t.layer,u=t.getAttribute(c.objectIdField);let y=null;function f(e){y?.abort(),y=r((async t=>{const r=await ue(s,l);o(t),r.setVisibility?.(u,e)}))}return await ie(s,n),f(!1),a([re(s,n,(e=>f(!e))),i((async()=>{f(!0);try{const e=await ue(s,l);await p((()=>!e.updating))}finally{e.layer.remove(n)}}))])}function re(e,t,r){if("3d"===e.type){const i=new V({graphic:t});return a([e.trackGraphicState(i),u((()=>i.displaying),r)])}return u((()=>t.visible),r)}async function ie(e,t){if("3d"===e.type){const r=new V({graphic:t}),i=e.trackGraphicState(r);await p((()=>r.displaying||r.error)),i.remove()}else await p((()=>t.visible))}const ae={icon:y(24),text:y(12),line:y(1),viewScaleSizeFactor:100};function ne(e,t,r){let i=!1;return e.filter((e=>!!i||(i=e===t,i))).map((e=>r[e]()))}function se(e,t){e.viewModel.syncFeatureTemplates();const r=e.creationInfo;if("awaiting-feature-creation-info"===t[0].id&&r){const e=r.layer,i=L(e);1===i.length&&"scene"!==e.type&&(r.template=i[0],t.shift())}return t}function le(e){return"unknown"===e?null:e}function oe(e){e.filesEnabled=!0,e.mode="view",e.capabilities={editing:!0,operations:{add:!0,update:!0,delete:!0}}}const ce=e=>/-stop/.test(e)||/vertex-/.test(e),ue=(e,t)=>{const r="subtype-sublayer"===t.type?t.parent:t;return e.whenLayerView(r)};function pe(e){return"createInteractiveEditSession"in e}function ye(e){const t=e.geometry;if("mesh"===t?.type){const r=e.cloneShallow();return r.attributes=s(e.attributes),r.geometry=t.cloneShallow(),r.geometry.transform=t.transform?.clone()??null,r}return e.clone()}function fe(e){const t=e.cursor;return e.cursor="progress",i((()=>e.cursor=t))}export{se as avoidFeatureTemplateSelectionWithOnlyOneItem,pe as canCreateInteractiveEditSession,ye as cloneGraphicExceptMesh,ne as createWorkflowSteps,W as fetchCandidates,N as fetchFullFeature,B as findLayerInfo,Z as getCreationAttributes,k as getVisualVariableAttributes,ce as isTerminalUpdateEventType,x as isUpdateWorkflow,oe as prepareAttachmentsForCreateFeaturesWorkflow,ee as setUpGeometryUpdate,fe as showProgressCursor,ae as sizeDefaults,le as sizeVariableUnitToLengthUnit,D as startCreatingNewFeature,X as startUpdatingFeature,te as swapForEditingSession,O as updateGraphicSymbolWhenRequired,_ as visualVariableInteractiveUpdate,ue as whenEditorLayerView,ie as whenGraphicDisplayed};
|
|
5
|
+
import e from"../../Graphic.js";import{addMany as t}from"../../core/arrayUtils.js";import{createTask as r}from"../../core/asyncUtils.js";import"../../core/has.js";import i from"../../core/Error.js";import{makeHandle as a,handlesGroup as n,abortHandle as s}from"../../core/handleUtils.js";import{clone as l}from"../../core/lang.js";import{whenOrAbort as o,throwIfAborted as c,debounce as u}from"../../core/promiseUtils.js";import{watch as p,whenOnce as y}from"../../core/reactiveUtils.js";import{px2pt as f}from"../../core/screenUtils.js";import{diff as d}from"../../core/accessorSupport/diffUtils.js";import{isSharedTemplateOrMetadata as m,getAllStandardFeatureTemplatesForLayer as g}from"../../editing/templateUtils.js";import{featureHasFields as h,fixFields as b,getDisplayFieldName as w}from"../../layers/support/fieldUtils.js";import{calculateTolerance as v}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as S}from"../../renderers/support/lengthUtils.js";import{getTransformationType as I,TransformationType as j}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import{getRotationAngle as U,getSize as V}from"../../renderers/visualVariables/support/visualVariableUtils.js";import{to3D as T}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as z}from"../../symbols/support/symbolUtils.js";import{GraphicState as F}from"../../views/3d/layers/graphics/GraphicState.js";import{createQueryGeometry as L}from"../../views/support/drapedUtils.js";import{hitTestSelectSimilarDistance as x,filterGraphicHits as k}from"../../views/support/hitTestSelectUtils.js";function A(e){return"update"===e.type}function E(e){const t=e.sourceLayer;if(!t||"feature"!==t.type||!G(t.renderer))return{rotation:null,size:null};let r=null,i=null;const a=t.renderer.getVisualVariablesForType("rotation").filter((t=>(!t.axis||"heading"===t.axis)&&t.field&&!t.valueExpression&&null!=U(t,e)));1===a.length&&(r=P(a[0],t));const n=t.renderer.getVisualVariablesForType("size").filter((t=>t.field&&!t.useSymbolValue&&!t.valueExpression&&I(t)===j.RealWorldSize&&null!=V(t,e)));return 1===n.length&&(i=R(n[0],t)),{rotation:r,size:i}}function P(e,t){const r="heading"===(e.axis||"heading")&&"arithmetic"===e.rotationType?-1:1,i=e.field,a=t.fields&&t.fields.filter((e=>e.name===i)),n=a&&1===a.length?a[0].type:"double",s={initial:0,current:0};return{field:i,fieldType:n,getDefault:()=>Promise.resolve(0),getValue:e=>(s.current=s.initial-r*e,O((s.current+360)%360,n)),setInitialValue:e=>{s.initial=e,s.current=0},isUpdatingInteractively:!1,rotationType:e.rotationType??"geographic"}}function C(e,t){switch(t){case"width":return e[0];case"depth":return e[1];case"height":return e[2];default:return e[2]||e[1]||e[0]}}async function M(e,t,r){if(null==t)return 0;const{symbol:i}=T(t);if(null==i||"web-style"===i.type||"cim"===i.type)return 0;const a=i.symbolLayers.at(0);if(!a)return 0;switch(a.type){case"icon":{const{computeIconLayerResourceSize:e}=await import("../../symbols/support/symbolLayerUtils.js");return a.size||Math.min(se.icon,(await e(a,se.icon))[0])||se.icon}case"text":return a.size||se.text;case"line":return a.size||se.line;case"object":{const{computeObjectLayerResourceSize:t}=await import("../../symbols/support/symbolLayerUtils.js");return C(await t(a,e.scale/se.viewScaleSizeFactor),r)}case"path":return(null!=a.width?a.width:a.height)||e.scale/se.viewScaleSizeFactor;case"extrude":return a.size||e.scale/se.viewScaleSizeFactor;default:return 0}}function R(e,t){const r=e.field,i=e.axis,a=t.fields&&t.fields.filter((e=>e.name===r)),n=a&&1===a.length?a[0].type:"double",s={initial:0,current:0},l=S[e.valueUnit]??1;let o;return o="area"===e.valueRepresentation?e=>(e*l/2)**2*Math.PI:"radius"===e.valueRepresentation||"distance"===e.valueRepresentation?e=>e*l/2:e=>e*l,{field:r,fieldType:n,getDefault:async(e,t)=>O(o(await M(t,e,i)),n),getValue:(e,t)=>(s.initial||(s.initial=t.pixelSizeAt(t.center)),s.current=s.initial*e,O(s.current,n)),setInitialValue:e=>{s.initial=e,s.current=0},isUpdatingInteractively:!1,displayUnit:ce(e.valueUnit),axis:e.axis}}function O(e,t){switch(t){case"small-integer":case"integer":case"long":return Math.round(e);case"double":case"single":return e;default:return 0}}function G(e){switch(e?.type){case"class-breaks":case"simple":case"unique-value":case"dot-density":case"dictionary":case"pie-chart":return!0;default:return!1}}async function D(e,t,r){const i=await z(e,{useSourceLayer:!0,ignoreGraphicSymbol:!0,webStyleCache:t,scale:r});null!=d(e.symbol,i)&&(e.symbol=i)}function Z(e){if(!e)throw new Error("no geometry type");return"multipatch"===e?"mesh":e}async function q(e,t,r){const i=t.layer,n=Q(t);let s=null;const{view:l}=e,o="2d"===l?.type;if(await B(e,i,n,r,o?l.scale:null),o){const t=u((t=>B(e,i,n,r,t)));s=p((()=>l.scale),(e=>t(e)))}const{data:c,editing:y}=i.capabilities;return e.layer.elevationInfo=i.elevationInfo,null==t.geometryToPlace?await e.create(Z(i.geometryType),{graphicProperties:{attributes:n,sourceLayer:i},hasZ:c.supportsZ,defaultZ:(o?y.zDefault:null)??e.defaultCreateOptions.defaultZ}):await e.place(t.geometryToPlace,{graphicProperties:{attributes:n,sourceLayer:i}}),s??a()}function Q(e){const{template:t}=e;if(t&&m(t))throw new i("Shared templates are not yet supported");return{...t?.prototype.attributes,...e.attributeOverrides}}async function B(t,r,i,a,n){const s=new e({sourceLayer:r,attributes:i}),{rotation:l,size:o}=E(s);let c=await z(s,{useSourceLayer:!0,webStyleCache:a,scale:n}),u=!1;for(const e of[o,l]){if(null==e)continue;null==i[e.field]&&(i[e.field]=await e.getDefault(c,t.view),u=!0)}switch(u&&(c=await z(s,{useSourceLayer:!0,webStyleCache:a,scale:n})),c?.type){case"simple-fill":case"polygon-3d":t.polygonSymbol=c;break;case"simple-line":case"line-3d":t.polylineSymbol=c;break;case"simple-marker":case"picture-marker":case"point-3d":case"cim":t.pointSymbol=c;break;case"mesh-3d":t.meshSymbol=c}W(t.tooltipOptions,o,l)}function W(e,t,r){e.visualVariables=null!=t||null!=r?{size:null!=t?{unit:t.displayUnit,axis:t.axis,valueType:t.fieldType}:null,rotation:null!=r?{valueType:r.fieldType,rotationType:r.rotationType??"geographic"}:null}:null}function H(e,t){return e?.find((e=>e.layer===t))}async function J(e,t,r,i){switch(t.type){case"3d":return K(e,t,r,i);case"2d":return N(e,t,r,i)}}async function K(e,r,i,a){if(0===e.length)return[];const{updatable:n,graphicsByLayer:s}=await i.async((async()=>{const{results:t}=await o(x(r,i),a),n=new Map,s=e=>{const t=e.layer,r=n.get(t);if(!r){const e=new Array;return n.set(t,e),e}return r};k(t).forEach((({graphic:e})=>s(e).push(e)));const l=e.filter((({capabilities:e,layer:t})=>e.update.enabled&&n.has(t)));return 0!==l.length&&i.stopPropagation(),{updatable:l,graphicsByLayer:n}}));return o(Promise.allSettled(n.map((async({layer:e})=>{const r=s.get(e),i=X(e);if(r.every((e=>h(i,e))))return r;const n=[];for(const a of r){n.push(a.getObjectId());const e=Object.keys(a.attributes);t(i,e)}const l=e.createQuery();return l.returnGeometry=!1,l.objectIds=n,l.outFields=b(e.fieldsIndex,i),e.queryFeatures(l,{signal:a}).then((({features:e})=>e))}))),a)}async function N(e,t,r,i){if(0===e.length)return[];const{mapPoint:a}=r;if(null==a)return[];let n=null;const s=await r.async((async()=>{const{results:a}=await o(t.hitTest(r),i);if(0===a.length)return[];const s=new Set;n=k(a),n.forEach((({graphic:e})=>e&&s.add(e.layer)));const l=e.filter((e=>s.has(e.layer)&&e.supportsUpdateWorkflow));return l.length>0&&r.stopPropagation(),l}));return o(Promise.allSettled(s.map((async({layer:e})=>{const s=e.createQuery();s.returnGeometry=!1,s.outFields=X(e);const l="renderer"in e?v({renderer:e.renderer,pointerType:r.pointerType}):0;s.geometry=L(a,l,t),s.outSpatialReference=t.spatialReference;const{features:o}=await e.queryFeatures(s,{signal:i});return n?.forEach((({graphic:t})=>{t.layer!==e||o.some((e=>e.getObjectId()===t.getObjectId()))||o.push(t)})),o}))),i)}function X(e){return b(e.fieldsIndex,[e.objectIdField,w({displayField:"displayField"in e?e.displayField:null,fields:e.fields})])}async function Y(e,t,r){const{sourceLayer:i}=e,a=i.createQuery();a.objectIds=[e.getAttribute(i.objectIdField)],a.outFields=["*"],a.returnM=i.capabilities.data.supportsM,a.returnZ=i.capabilities.data.supportsZ,"scene"===i.type&&null!=i.infoFor3D||(a.outSpatialReference=t);const n=await i.queryFeatures(a,{signal:r});c(r);return n.features[0]}async function $(e){const{graphic:t,sketchViewModel:r,sourceLayer:i,visualVariables:a,webStyleCache:n}=e;let s=!1;const{rotation:l,size:o}=a;if([l,o].forEach((async e=>{if(null==e)return;const i=t.getAttribute(e.field);if(null!=i)e.setInitialValue(i);else{const i=await e.getDefault(t.symbol,r.view);e.setInitialValue(i),t.setAttribute(e.field,i),s=!0}})),s){const e="2d"===r.view?.type?r.view.scale:null;await D(t,n,e)}const c={multipleSelectionEnabled:!1};return"point"===i.geometryType&&(c.enableRotation=null!=l,c.enableScaling=null!=o),W(r.tooltipOptions,o,l),r.layer.elevationInfo=i.elevationInfo,r.update(t,c)}function _(e){return null==e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function ee(e){return null==e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}async function te(e,t,r,i,a){if(null==t.geometry||"point"!==t.geometry?.type)return;const n=i.rotation,s=_(r.toolEventInfo);if(null!=n&&null!=s){const{field:r,getValue:i}=n;"rotate-stop"===s.type?(n.isUpdatingInteractively=!1,n.setInitialValue(t.getAttribute(r))):(n.isUpdatingInteractively=!0,t.setAttribute(r,i(s.angle,e)))}const l=i.size,o=ee(r.toolEventInfo);if(null!=l&&null!=o){const{field:r,getValue:i}=l;"scale-stop"===o.type?(l.isUpdatingInteractively=!1,l.setInitialValue(t.getAttribute(r))):(l.isUpdatingInteractively=!0,t.setAttribute(r,i(o.xScale,e)))}await D(t,a,"2d"===e.type?e.scale:null)}async function re({feature:e,featureClone:t,visualVariableAttributes:r,sketchViewModel:i,view:l,onUpdate:o,webStyleCache:c,addUpdatingPromise:f,addHandle:d}){await D(t,c,"2d"===l.type?l.scale:null);let m=null;if("2d"===i?.view?.type){const e=u((e=>D(t,c,e)));m=p((()=>i?.view?.scale),(t=>e(t)))}const g=t.sourceLayer,h=ye(l,g);await $({graphic:t,sketchViewModel:i,sourceLayer:g,visualVariables:r,webStyleCache:c});let b=null;h.then((e=>b=e)).catch((()=>{}));const w=r.size,v=r.rotation,S=p((()=>e.attributes),(async e=>{let r=!1;for(const i in e){const a=e[i];a!==t.getAttribute(i)&&(t.setAttribute(i,a),null==w||w.isUpdatingInteractively||w.field!==i||w.setInitialValue(a),null==v||v.isUpdatingInteractively||v.field!==i||v.setInitialValue(a),(null==b||b.requiredFields.includes(i))&&(r=!0))}r&&await D(t,c,"2d"===l.type?l.scale:null)})),I=i.on("update",(async e=>{const t=e.graphics[0],a={graphic:t,sketchViewModel:i,sourceLayer:g,visualVariables:r,webStyleCache:c};if("complete"===e.state){if(null===l.activeTool)return $(a);const e=new AbortController,t=s(e);return d(t),f(y((()=>null===l.activeTool),e.signal).then((()=>(e.abort(),$(a)))))}await te(l,t,e,r,c),o(de(t),e)})),j=i.on(["undo","redo"],(async e=>{o(de(e.graphics[0]),e)}));return n([j,I,a((()=>i.cancel())),S,m])}async function ie(e,t,i){const s=e.view;e.layer.add(i);const l=t.sourceLayer,o=t.layer,u=t.getAttribute(o.objectIdField);let p=null;function f(e){p?.abort(),p=r((async t=>{const r=await ye(s,l);c(t),r.setVisibility?.(u,e)}))}return await ne(s,i),f(!1),n([ae(s,i,(e=>f(!e))),a((async()=>{f(!0);try{const e=await ye(s,l);await y((()=>!e.updating))}finally{e.layer.remove(i)}}))])}function ae(e,t,r){if("3d"===e.type){const i=new F({graphic:t});return n([e.trackGraphicState(i),p((()=>i.displaying),r)])}return p((()=>t.visible),r)}async function ne(e,t){if("3d"===e.type){const r=new F({graphic:t}),i=e.trackGraphicState(r);await y((()=>r.displaying||r.error)),i.remove()}else await y((()=>t.visible))}const se={icon:f(24),text:f(12),line:f(1),viewScaleSizeFactor:100};function le(e,t,r){let i=!1;return e.filter((e=>!!i||(i=e===t,i))).map((e=>r[e]()))}function oe(e,t){e.viewModel.syncFeatureTemplates();const r=e.creationInfo;if("awaiting-feature-creation-info"===t[0].id&&r){const e=r.layer,i=g(e);1===i.length&&"scene"!==e.type&&(r.template=i[0],t.shift())}return t}function ce(e){return"unknown"===e?null:e}function ue(e){e.filesEnabled=!0,e.mode="view",e.capabilities={editing:!0,operations:{add:!0,update:!0,delete:!0}}}const pe=e=>/-stop/.test(e)||/vertex-/.test(e),ye=(e,t)=>{const r="subtype-sublayer"===t.type?t.parent:t;return e.whenLayerView(r)};function fe(e){return"createInteractiveEditSession"in e}function de(e){const t=e.geometry;if("mesh"===t?.type){const r=e.cloneShallow();return r.attributes=l(e.attributes),r.geometry=t.cloneShallow(),r.geometry.transform=t.transform?.clone()??null,r}return e.clone()}function me(e){const t=e.cursor;return e.cursor="progress",a((()=>e.cursor=t))}export{oe as avoidFeatureTemplateSelectionWithOnlyOneItem,fe as canCreateInteractiveEditSession,de as cloneGraphicExceptMesh,le as createWorkflowSteps,J as fetchCandidates,Y as fetchFullFeature,H as findLayerInfo,Q as getCreationAttributes,E as getVisualVariableAttributes,pe as isTerminalUpdateEventType,A as isUpdateWorkflow,ue as prepareAttachmentsForCreateFeaturesWorkflow,re as setUpGeometryUpdate,me as showProgressCursor,se as sizeDefaults,ce as sizeVariableUnitToLengthUnit,q as startCreatingNewFeature,$ as startUpdatingFeature,ie as swapForEditingSession,D as updateGraphicSymbolWhenRequired,te as visualVariableInteractiveUpdate,ye as whenEditorLayerView,ne as whenGraphicDisplayed};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{getFeatureFormTitle as i}from"../featureFormUtils.js";import o from"../UtilityNetworkAssociationInput.js";import{loadCalciteComponents as r}from"../../support/componentsUtils.js";import{globalCss as n}from"../../support/globalCss.js";import{Heading as a}from"../../support/Heading.js";import"../../support/widgetUtils.js";import{messageBundle as c}from"../../support/decorators/messageBundle.js";import{tsx as l,tsxFragment as p}from"../../support/jsxFactory.js";import d from"../../support/UtilityNetworkAssociations/UtilityNetworkAssociationList.js";import u from"../../support/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js";import{isConnectivity as m,isConnectivityMidspan as h,formatPercentAlong as y}from"../../support/UtilityNetworkAssociations/utilityNetworkUtils.js";import{substitute as g}from"../../../intl/substitute.js";const F="esri-feature-form-utility-network-association-list",f={base:F,header:`${F}__header`,headingContent:`${F}__heading-content`,listContainer:`${F}__list-container`};let _=class extends d{constructor(t,e){super(t,e),this.associationInput=null,this.headingLevel=5,this.listType=null,this.messagesFeatureForm=null,this.onSelectLayer=()=>{},this.onSelectFeature=()=>{},this.viewModel=new u}initialize(){this.setUpObserver()}loadDependencies(){return r({chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}get associatedFeatureCount(){const{associationInput:t}=this;if(!t)return 0;const{associatedFeatureInfos:e,associatedLayer:s}=t,i=s?e.get(s):null;return i?i.length:0}render(){const{associationInput:t}=this;if(!t)return l("div",{class:this.classes(f.base,n.widget)});const{associatedLayer:e}=t,{state:s}=this.viewModel;return l("div",{class:this.classes(f.base,n.widget)},"loading"===s||"querying"===s?this.renderLoading():e?this._renderFeatureList(t,e):this._renderLayerList(t))}_renderLayerList(t){const{associatedFeatureInfos:e}=t;return l("div",{class:f.listContainer},l("calcite-list",{label:this.messagesFeatureForm?.associatedLayers},Array.from(e.keys(),(e=>this._renderLayerItem(t,e)))))}_renderFeatureList(t,e){return l(p,null,this._renderHeader(t,e),l("div",{class:f.listContainer},l("calcite-list",{label:this.messagesFeatureForm?.associatedFeatures},this.
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{getFeatureFormTitle as i}from"../featureFormUtils.js";import o from"../UtilityNetworkAssociationInput.js";import{loadCalciteComponents as r}from"../../support/componentsUtils.js";import{globalCss as n}from"../../support/globalCss.js";import{Heading as a}from"../../support/Heading.js";import"../../support/widgetUtils.js";import{messageBundle as c}from"../../support/decorators/messageBundle.js";import{tsx as l,tsxFragment as p}from"../../support/jsxFactory.js";import d from"../../support/UtilityNetworkAssociations/UtilityNetworkAssociationList.js";import u from"../../support/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js";import{isConnectivity as m,isConnectivityMidspan as h,formatPercentAlong as y}from"../../support/UtilityNetworkAssociations/utilityNetworkUtils.js";import{substitute as g}from"../../../intl/substitute.js";const F="esri-feature-form-utility-network-association-list",f={base:F,header:`${F}__header`,headingContent:`${F}__heading-content`,listContainer:`${F}__list-container`};let _=class extends d{constructor(t,e){super(t,e),this.associationInput=null,this.headingLevel=5,this.listType=null,this.messagesFeatureForm=null,this.onSelectLayer=()=>{},this.onSelectFeature=()=>{},this.viewModel=new u}initialize(){this.setUpObserver()}loadDependencies(){return r({chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}get associatedFeatureCount(){const{associationInput:t}=this;if(!t)return 0;const{associatedFeatureInfos:e,associatedLayer:s}=t,i=s?e.get(s):null;return i?i.length:0}render(){const{associationInput:t}=this;if(!t)return l("div",{class:this.classes(f.base,n.widget)});const{associatedLayer:e}=t,{state:s}=this.viewModel;return l("div",{class:this.classes(f.base,n.widget)},"loading"===s||"querying"===s?this.renderLoading():e?this._renderFeatureList(t,e):this._renderLayerList(t))}_renderLayerList(t){const{associatedFeatureInfos:e}=t;return l("div",{class:f.listContainer},l("calcite-list",{label:this.messagesFeatureForm?.associatedLayers},Array.from(e.keys(),(e=>this._renderLayerItem(t,e)))))}_renderFeatureList(t,e){return l(p,null,this._renderHeader(t,e),l("div",{class:f.listContainer},this.renderFeatureCountWarning(),l("calcite-list",{label:this.messagesFeatureForm?.associatedFeatures},this._renderAssociatedFeatureListPage(t,e),this.renderFeatureObserver())))}_renderLayerTitle(t){return t.title?l(a,{key:"title",level:this.headingLevel},l("div",{class:f.headingContent},l("calcite-icon",{icon:"layer"}),t.title)):null}_renderTotal(t,e){const{messagesFeature:s}=this,{associatedFeatureInfos:i}=t,o=i.get(e),r=g(s?.numberRecords,{number:o?.length??"0"});return l("div",{key:e.id},r)}_renderHeader(t,e){return l("div",{class:f.header,key:"filter"},this._renderLayerTitle(e),this.renderFilter(),this._renderTotal(t,e))}_renderAssociatedFeatureListPage(t,e){const{filterText:s,endIndex:o}=this,r=t.associatedFeatureInfos.get(e)?.filter((t=>i(t).toLowerCase().includes(s))).slice(0,o).toArray()??[];return[...this._renderTooltips(r),...this._renderAssociatedFeatureList(r)]}_renderItemTooltip(t){const{tooltipReferenceMap:e}=this,s=t.feature.uid.toString();return m(t.association)?l("calcite-tooltip",{key:`tooltip-${s}`,overlayPositioning:"fixed",referenceElement:e.get(s)},this.getConnectivityTooltip(t.association.associationType)):null}_renderAssociatedFeature(t){const e=i(t),s=t.feature.uid.toString();return l("calcite-list-item",{description:t.terminalName??"",key:`associated-feature-type-${s}`,label:e,onCalciteListItemSelect:()=>this._selectAssociation(t)},m(t.association)?this.renderConnectivityIcon(t.association.associationType,s):null,h(t.association)?l("calcite-chip",{label:y(t.association),scale:"s",slot:"content-end"},y(t.association)):null,l("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderTooltips(t){return t.map((t=>this._renderItemTooltip(t)))}_renderAssociatedFeatureList(t){return t.map((t=>this._renderAssociatedFeature(t)))}_renderLayerItem(t,e){const{associatedFeatureInfos:s}=t,i=s.get(e)?.length??0;return l("calcite-list-item",{key:`${e.id}-show-all`,label:e.title??this.messagesCommon.untitled,open:!0,value:e.id,onCalciteListItemSelect:()=>this._showAllAssociations(e)},l("calcite-chip",{label:i.toString(),scale:"s",slot:"content-end"},i),l("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}_selectAssociation(t){this.onSelectFeature({feature:t.feature,association:t.association})}_showAllAssociations(t){this.onSelectLayer({layer:t,associationInput:this.associationInput})}};t([e()],_.prototype,"associatedFeatureCount",null),t([e({type:o})],_.prototype,"associationInput",void 0),t([e()],_.prototype,"headingLevel",void 0),t([e()],_.prototype,"listType",void 0),t([e(),c("esri/widgets/FeatureForm/t9n/FeatureForm")],_.prototype,"messagesFeatureForm",void 0),t([e({constructOnly:!0})],_.prototype,"onSelectLayer",void 0),t([e({constructOnly:!0})],_.prototype,"onSelectFeature",void 0),t([e({type:u})],_.prototype,"viewModel",void 0),_=t([s("esri.widgets.FeatureForm.FeatureFormUtilityNetworkAssociations.FeatureFormUtilityNetworkAssociationList")],_);const L=_;export{L as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Identifiable.js";import{watch as s,initial as o}from"../../core/reactiveUtils.js";import{property as
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Identifiable.js";import{watch as s,on as i,initial as o}from"../../core/reactiveUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{isAssociatedFeatureSupportedLayer as n}from"../Feature/support/featureUtils.js";import l from"./EditableInput.js";import{parseFormTemplateString as p}from"./featureFormUtils.js";import c from"../support/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js";let u=class extends(e.IdentifiableMixin(l)){constructor(t){super(t),this.group=null,this.type="utilityNetworkAssociations",this.addHandles([s((()=>({feature:this.feature,element:this.element,layer:this.layer})),(t=>this._createAssociationVM(t)),o),s((()=>this.associatedLayer),((t,e)=>this._updateLayerEditHandle(t,e)),o)])}destroy(){this._associationsVM?.destroy()}get activeAssociationType(){return this._associationsVM?.associationTypes.find((t=>t.open))}get associatedFeatureInfos(){const{_associationsVM:t,timeZone:e}=this;if(!t?.associationFeatures?.size||!t?.utilityNetwork)return new Map;const{associationFeatures:s}=t,i=new Map;return s.forEach(((t,s)=>{const o=t.map((t=>{const i=s&&"formTemplate"in s&&s.formTemplate?s.formTemplate.title:void 0,o=i?p({label:i,attributes:t.feature.attributes,fieldsIndex:s.fieldsIndex,timeZone:e}):void 0;return{...t,title:o}}));i.set(s,o)})),i}get associatedLayer(){return this._get("associatedLayer")}set associatedLayer(t){this._associationsVM.showAllEnabled=null!=t,this._set("associatedLayer",t)}get associationsViewModel(){return this._associationsVM}get canAddAssociation(){const{editable:t,utilityNetwork:e}=this;return!(!e||!this.loaded)&&t}get editable(){return this.evaluatedEditableExpression??!0}get featureCount(){return this._associationsVM?.featureCount??0}get viewModel(){return this._associationsVM}get loaded(){return"loading"!==this._associationsVM?.state}get map(){return this._get("map")}set map(t){t&&this._associationsVM?.set("map",t),this._set("map",t)}get utilityNetwork(){return this._associationsVM?.utilityNetwork}get associationTypes(){return this._associationsVM?.associationTypes??this.element.associationTypes}get visible(){const{utilityNetwork:t}=this;return!!t&&(null!=this.evaluatedVisibilityExpression?this.evaluatedVisibilityExpression:null!=this.element)}get updating(){return"loading"===this._associationsVM?.state||"querying"===this._associationsVM?.state}_updateLayerEditHandle(t,e){e&&"layerId"in e&&this.removeHandles(e?.layerId),n(t)&&this.addHandles(i((()=>t),"edits",(()=>this._associationsVM?.refresh())),t.layerId)}_createAssociationVM(t){const{feature:e,element:s,layer:i}=t;if(this._associationsVM?.destroy(),!e||!s||!i)return;const{map:o,associationTypes:a}=this;n(i)&&(this._associationsVM=new c({graphic:e,layer:i,map:o,associationTypes:a,source:"featureForm",title:this.label,description:this.description}))}};t([a()],u.prototype,"_associationsVM",void 0),t([a()],u.prototype,"activeAssociationType",null),t([a()],u.prototype,"associatedFeatureInfos",null),t([a()],u.prototype,"associatedLayer",null),t([a()],u.prototype,"associationsViewModel",null),t([a()],u.prototype,"canAddAssociation",null),t([a()],u.prototype,"editable",null),t([a()],u.prototype,"featureCount",null),t([a()],u.prototype,"viewModel",null),t([a()],u.prototype,"group",void 0),t([a()],u.prototype,"loaded",null),t([a()],u.prototype,"map",null),t([a()],u.prototype,"utilityNetwork",null),t([a()],u.prototype,"associationTypes",null),t([a({readOnly:!0})],u.prototype,"type",void 0),t([a()],u.prototype,"visible",null),t([a()],u.prototype,"updating",null),u=t([r("esri.widgets.FeatureForm.UtilityNetworkAssociationInput")],u);const d=u;export{d as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import{createTask as e}from"../../core/asyncUtils.js";import s from"../../core/Evented.js";import{abortMaybe as
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import{createTask as e}from"../../core/asyncUtils.js";import s from"../../core/Evented.js";import{abortMaybe as l}from"../../core/maybe.js";import{throwIfAborted as o}from"../../core/promiseUtils.js";import{watch as r,when as i,syncAndInitial as a,sync as n}from"../../core/reactiveUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as m}from"../../core/support/UpdatingHandles.js";import{getTemplatesForLayers as d}from"../../editing/templateUtils.js";import{getEffectiveLayerCapabilities as c,isSubtypeGroupLayer as y}from"../../layers/support/layerUtils.js";import{isTemplateItemGroup as h,mapItemsByTemplate as f,isTemplateGroupInfo as g,loadLayerWithTemplates as _,makeTemplateItemInfos as I,makeGroupItemInfos as F,nullGroupBy as b}from"./featureTemplatesUtils.js";import v from"./TemplateItem.js";import T from"./TemplateItemGroup.js";const j=({layer:t})=>({key:t,label:t.title??""}),B=({layer:t})=>({key:t.geometryType,label:t.geometryType??""});let w=class extends s.EventedAccessor{constructor(t){super(t),this._allItems=[],this._updatingHandles=new m,this._updateTask=null,this.disabled=!1,this.disabledItemFunction=null,this.filterFunction=null,this.selectedItem=null,this.templateInfos=null,this.view=null}initialize(){this._get("groupBy")||(this.groupBy="layer"),this.addHandles([r((()=>[this.templateInfos,this.layers]),(([t],e)=>{t&&t===e?.at(0)||(this._updateTask=l(this._updateTask),t?this._updateAllItems(t):this._getTemplatesAndUpdateAllItems())}),a),r((()=>this._groupByFunction),(()=>{null==this.templateInfos&&(this._updateTask=l(this._updateTask),this._getTemplatesAndUpdateAllItems())}),n),r((()=>this.filterFunction),(t=>{for(const e of this._allItems)h(e)&&(e.filterFunction=t)}),n)])}set groupBy(t){if(this._set("groupBy",t),"function"!=typeof t)switch(t){case"layer":this._groupByFunction=j;break;case"geometry":this._groupByFunction=B;break;default:this._groupByFunction=null}else this._groupByFunction=e=>this._ensureGroupByObject(t(e))}get layers(){return this._get("layers")}set layers(t){const e="layers";if(this.removeHandles(e),t){const s=()=>this.notifyChange("state");this.addHandles(t.map((t=>i((()=>t.loadStatus),s))),e)}this._set("layers",t)}get state(){return this.updating?"loading":0===this.layers.length?"disabled":"ready"}get numberOfFeatureTemplates(){return this._allItems.reduce(((t,e)=>h(e)?t+e.items.length:t+1),0)}get items(){const{filterFunction:t}=this;return null==t?this._allItems:this._allItems.filter((e=>h(e)?e.items.length>0:t(e)))}get updating(){return this._updatingHandles.updating}refresh(){this.notifyChange("filterFunction");for(const t of this._allItems)h(t)&&t.reapplyFilter()}select(t,{emit:e=!0}={}){const s=this.selectedItem,l=t?.clone()||null;this._set("selectedItem",l),e&&this.emit("select",{item:l,oldItem:s,template:l?.template??null})}_createItem(t,e){return new v({disabledFunction:this.disabledItemFunction,layer:e,template:t})}_ensureGroupByObject(t){return"string"==typeof t?{key:t,label:t}:t}_updateAllItems(t){const e=this._allItems;if(0===t.length)return k(e),void(this._allItems=[]);const[s,l]=f(e),o=t=>{const e=s.get(t.template);return e?(s.delete(t.template),e):this._createItem(t.template,t.layer)},{filterFunction:r}=this,i=t.map((t=>g(t)?new T({filterFunction:r,label:t.label,allItems:t.templateInfos.map((t=>o(t)))}):o(t)));for(const a of[...s.values(),...l])a.destroy();this._allItems=i}async _getTemplatesFromLayers(t){const e=[],s={signal:t};await Promise.all(this.layers.map((async l=>{await _(l,s),o(t);const r=c(l)?.operations;r?.supportsEditing&&r?.supportsAdd&&(y(l)?e.push(...l.sublayers):e.push(l))})));const l=await d(e,this.view,t);o(t);const r=I(l),i=this._groupByFunction;if(null==i)return r;const a=F(r,i);return 1===a.length&&a[0].label===b.label?a[0].templateInfos:a}async _getTemplatesAndUpdateAllItems(){if(0===this.layers.length)return;const t=e((async t=>{const e=await this._getTemplatesFromLayers(t);o(t),this._updateAllItems(e)}));this._updateTask=t,this._updatingHandles.addPromise(t.promise)}};function k(t){for(const e of t){if(h(e))for(const t of e.items)t.destroy();e.destroy()}}t([p()],w.prototype,"_allItems",void 0),t([p()],w.prototype,"_groupByFunction",void 0),t([p()],w.prototype,"_updatingHandles",void 0),t([p()],w.prototype,"disabled",void 0),t([p()],w.prototype,"disabledItemFunction",void 0),t([p({value:null})],w.prototype,"filterFunction",void 0),t([p()],w.prototype,"groupBy",null),t([p({value:[]})],w.prototype,"layers",null),t([p()],w.prototype,"state",null),t([p({readOnly:!0})],w.prototype,"numberOfFeatureTemplates",null),t([p({readOnly:!0})],w.prototype,"items",null),t([p({readOnly:!0})],w.prototype,"selectedItem",void 0),t([p()],w.prototype,"templateInfos",void 0),t([p()],w.prototype,"updating",null),t([p()],w.prototype,"view",void 0),w=t([u("esri.widgets.FeatureTemplates.FeatureTemplatesViewModel")],w);const A=w;export{A as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../Graphic.js";import r from"../../core/Accessor.js";import{watch as
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../Graphic.js";import r from"../../core/Accessor.js";import i from"../../core/Logger.js";import{watch as s,initial as l}from"../../core/reactiveUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{isStandardFeatureTemplate as a,isSharedTemplateMetadata as p}from"../../editing/templateUtils.js";import{renderPreviewHTML as m}from"../../symbols/support/symbolUtils.js";var u;let c=u=class extends r{constructor(t){super(t),this._activeFetchInfo={id:null,request:null},this.disabledFunction=null,this.layer=null,this.template=null,this.thumbnail=null}initialize(){this.addHandles(s((()=>{const{layer:t}=this;return[t&&"renderer"in t?t.renderer:null,this.template]}),(()=>{this._activeFetchInfo.id=null,this._activeFetchInfo.request=null,this._set("thumbnail",null)}),l))}get description(){return this.template?.description}set description(t){this.template&&(this.template.description=t)}get disabled(){return this.disabledFunction?.(this)??!1}get label(){return this.template?.name}set label(t){this.template&&(this.template.name=t)}get id(){return`${this.label??""}–${this.layer?.id}`}get supportsUpload(){return"scene"===this.layer?.type}clone(){const t=null!=this.thumbnail?this.thumbnail.cloneNode(!0):null,e=new u({layer:this.layer,template:this.template});return e._set("thumbnail",t),e}static async fetchThumbnail(t,e){const r=await h(t,e);if(null==r)return null;const i={maxSize:36};a(e)&&"dictionary"===t.renderer?.type&&(i.fieldMap=t.renderer.fieldMap??void 0,i.feature={attributes:e.prototype.attributes??{}});return await m(r,i)}};t([o()],c.prototype,"description",null),t([o()],c.prototype,"disabled",null),t([o()],c.prototype,"disabledFunction",void 0),t([o()],c.prototype,"label",null),t([o()],c.prototype,"layer",void 0),t([o()],c.prototype,"template",void 0),t([o()],c.prototype,"thumbnail",void 0),t([o()],c.prototype,"id",null),t([o()],c.prototype,"supportsUpload",null),c=u=t([n("esri.widgets.FeatureTemplates.TemplateItem")],c);const d=c;async function h(t,r){const{renderer:s}=t;if(p(r))return i.getLogger("esri.widgets.FeatureTemplates.TemplateItem").warn("Shared templates are not yet supported"),y(t);if(s){const t=new e({attributes:r.prototype.attributes}),i=await s.getSymbolAsync(t);if(i)return i}return y(t)}async function y(t){const{geometryType:e}=t,r="point"===e||"multipoint"===e?await import("../../symbols/SimpleMarkerSymbol.js"):"polyline"===e?await import("../../symbols/SimpleLineSymbol.js"):"polygon"===e||"mesh"===e||"multipatch"===e?await import("../../symbols/SimpleFillSymbol.js"):null;return r?new r.default:null}export{d as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
import{getOrCreateMapValue as t}from"../../core/MapUtils.js";const e={key:Symbol(),label:"Other"};function o(t){return"templateInfos"in t}function n(t){const e=[];for(const{layer:o,templates:n}of t)for(const t of n)e.push({layer:o,template:t});return e}function s(o,n){const s=new Map;for(const r of o){const o=n(r),{key:a,label:l}=null!=o.key?o:e;t(s,a,(()=>({label:l,templateInfos:[]}))).templateInfos.push(r)}return Array.from(s.values())}async function r(t,e){return"subtype-sublayer"===t.type?await(t.parent?.load(e)):await t.load(e),t}function a(t){const e=new Map,o=[];for(const n of t)if(l(n)){o.push(n);for(const t of n.items)e.set(t.template,t)}else e.set(n.template,n);return[e,o]}const l=t=>"items"in t;export{o as isTemplateGroupInfo,l as isTemplateItemGroup,r as loadLayerWithTemplates,s as makeGroupItemInfos,n as makeTemplateItemInfos,a as mapItemsByTemplate,e as nullGroupBy};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import{watch as t,initial as o}from"../core/reactiveUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as i}from"../core/accessorSupport/decorators/subclass.js";import{isTable as s}from"../layers/support/layerUtils.js";import n from"./Widget.js";import{isTemplateItemGroup as
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import{watch as t,initial as o}from"../core/reactiveUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as i}from"../core/accessorSupport/decorators/subclass.js";import{isTable as s}from"../layers/support/layerUtils.js";import n from"./Widget.js";import{nullGroupBy as l,isTemplateItemGroup as a}from"./FeatureTemplates/featureTemplatesUtils.js";import d from"./FeatureTemplates/FeatureTemplatesViewModel.js";import{ItemList as c}from"./FeatureTemplates/ItemList.js";import m from"./FeatureTemplates/TemplateItem.js";import p from"./FeatureTemplates/VisibleElements.js";import{loadCalciteComponents as u}from"./support/componentsUtils.js";import{globalCss as h}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as f}from"./support/decorators/messageBundle.js";import{vmEvent as v}from"./support/decorators/vmEvent.js";import{tsx as b}from"./support/jsxFactory.js";const I={base:"esri-feature-templates"};function y(e){return e.length>0&&a(e[0])}function g(e){return e.id}let C=class extends n{constructor(e,t){super(e,t),this.enableListScroll=!0,this.filterText="",this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.selectionMode="none",this.viewModel=new d,this.visibleElements=new p,this.renderCustomItem=e=>null,this.renderCustomGroupContent=e=>null,this.renderItemLabel=()=>null,this.renderItemDescription=()=>null,this.renderItemContent=e=>null,this.renderItemContentEnd=e=>null,this._iconIntersectionObserver=new IntersectionObserver(((e,t)=>{e.forEach((async e=>{if(e.isIntersecting){const o=e.target;if(M(o))return void t.unobserve(o);const r=w(o),{layer:i,template:s}=r;j(o,!0);const n=await m.fetchThumbnail(i,s).catch((()=>(j(o,!1),null)));if(null==n)return;o.appendChild(n)}}))})),this._renderItemIcon=e=>s(e.layer)?b("span",{"data-has-icon":!0,"data-item":e,key:"icon"},b("calcite-icon",{icon:"table"})):b("span",{afterCreate:this._afterItemCreateOrUpdate,afterRemoved:this._afterItemRemoved,afterUpdate:this._afterItemCreateOrUpdate,"data-has-icon":!1,"data-item":e,key:"icon"}),this._afterItemCreateOrUpdate=e=>{this._iconIntersectionObserver?.observe(e)},this._afterItemRemoved=e=>{this._iconIntersectionObserver?.unobserve(e)}}initialize(){const e=({label:e})=>!this.filterText||!!e?.toLowerCase().includes(this.filterText.toLowerCase());this.addHandles(t((()=>this.viewModel),((t,o)=>{t&&!t.filterFunction&&(this.filterFunction=e),o&&o!==t&&o.filterFunction===e&&(o.filterFunction=null)}),o))}destroy(){this._iconIntersectionObserver?.disconnect(),this._iconIntersectionObserver=null}loadDependencies(){return u({icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice")})}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get filterFunction(){return this.viewModel.filterFunction}set filterFunction(e){this.viewModel.filterFunction=e}get groupBy(){return this.viewModel.groupBy}set groupBy(e){this.viewModel.groupBy=e}get icon(){return"list-rectangle"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layers(){return this.viewModel.layers}set layers(e){this.viewModel.layers=e}get selectedItem(){return this.viewModel.selectedItem}select(e,t){return this.viewModel.select(e,t)}render(){const{disabled:e,enableListScroll:t,filterText:o,headingLevel:r,messages:i,viewModel:{items:s,numberOfFeatureTemplates:n,selectedItem:d,state:m}}=this,p=this.visibleElements.filter&&n>1;if(y(s)){const e=s.find((e=>e.label===l.label));e&&(e.label=i.other)}return b("div",{"aria-label":i.widgetLabel,class:this.classes(I.base,h.widget)},"loading"===m?b("calcite-loader",{key:"loader",label:this.messagesCommon.loading,type:"indeterminate"}):"ready"===m?b(c,{disabled:e,enableListScroll:t,filterEnabled:p,filterText:o,headingLevel:r,id:this.id,identify:g,items:s,messages:{filterPlaceholder:i.filterPlaceholder,noItems:i.noItems,noMatches:i.noMatches},renderCustomGroupContent:this.renderCustomGroupContent,renderCustomItem:this.renderCustomItem,renderIcon:this._renderItemIcon,renderItemContent:this.renderItemContent,renderItemContentEnd:this.renderItemContentEnd,renderItemDescription:this.renderItemDescription,renderItemLabel:this.renderItemLabel,selectedItem:d??void 0,selectionMode:this.selectionMode??void 0,onFilterChange:e=>{this.filterText=e},onItemSelect:e=>!a(e)&&this.viewModel.select(e)}):null)}};function w(e){return e?.["data-item"]}function M(e){return!!e?.["data-has-icon"]}function j(e,t){e&&(e["data-has-icon"]=t)}e([r()],C.prototype,"disabled",null),e([r()],C.prototype,"enableListScroll",void 0),e([r()],C.prototype,"filterFunction",null),e([r()],C.prototype,"filterText",void 0),e([r()],C.prototype,"groupBy",null),e([r()],C.prototype,"headingLevel",void 0),e([r()],C.prototype,"icon",null),e([r()],C.prototype,"label",null),e([r()],C.prototype,"layers",null),e([r(),f("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],C.prototype,"messages",void 0),e([r(),f("esri/t9n/common")],C.prototype,"messagesCommon",void 0),e([r({readOnly:!0})],C.prototype,"selectedItem",null),e([r()],C.prototype,"selectionMode",void 0),e([r(),v("select")],C.prototype,"viewModel",void 0),e([r({type:p,nonNullable:!0})],C.prototype,"visibleElements",void 0),e([r()],C.prototype,"renderCustomItem",void 0),e([r()],C.prototype,"renderCustomGroupContent",void 0),e([r()],C.prototype,"renderItemLabel",void 0),e([r()],C.prototype,"renderItemDescription",void 0),e([r()],C.prototype,"renderItemContent",void 0),e([r()],C.prototype,"renderItemContentEnd",void 0),C=e([i("esri.widgets.FeatureTemplates")],C);const F=C;export{F as default};
|