@arcgis/core 4.33.0-next.20250228 → 4.33.0-next.20250301
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/066844a51cd22cbef0e6.js +1 -0
- package/assets/esri/core/workers/chunks/0ce1bfcdcccb679569f8.js +1 -0
- package/assets/esri/core/workers/chunks/0e164b19e4ea3aa73843.js +1 -0
- package/assets/esri/core/workers/chunks/12d798775a96a45aada2.js +1 -0
- package/assets/esri/core/workers/chunks/{f298cda10a9ffe35ea49.js → 1377ddd582518e5fa051.js} +1 -1
- package/assets/esri/core/workers/chunks/{95a5ed95f0060b43f38f.js → 15fe629cd4da1bb2169f.js} +1 -1
- package/assets/esri/core/workers/chunks/1a5f96b1b892ecceb36a.js +1 -0
- package/assets/esri/core/workers/chunks/{b4002b4fd99748fdf5da.js → 1e631e34ee495eb0e76e.js} +1 -1
- package/assets/esri/core/workers/chunks/22618753349eb9d8b3df.js +1 -0
- package/assets/esri/core/workers/chunks/25a686f00479ac12a1ca.js +1 -0
- package/assets/esri/core/workers/chunks/25ef080163f3f795911a.js +1 -0
- package/assets/esri/core/workers/chunks/{afdbdc1569b56489c14d.js → 29fe3e9a0ecab74bb729.js} +1 -1
- package/assets/esri/core/workers/chunks/2c091edee3601f345f5f.js +1 -0
- package/assets/esri/core/workers/chunks/2f23fc27d005ffa18f47.js +1 -0
- package/assets/esri/core/workers/chunks/2f818b9a6b1f2b61410d.js +978 -0
- package/assets/esri/core/workers/chunks/3010a22d00f45fce5939.js +1 -0
- package/assets/esri/core/workers/chunks/{05869484d7de75f86916.js → 33005043f7084048296d.js} +1 -1
- package/assets/esri/core/workers/chunks/{835fa4484c58d9b31c78.js → 3315de71eb8791189c05.js} +1 -1
- package/assets/esri/core/workers/chunks/{f7a055be225f3498baaf.js → 354117429b3a0a0794c9.js} +1 -1
- package/assets/esri/core/workers/chunks/361a3253877acd3b4f07.js +1 -0
- package/assets/esri/core/workers/chunks/{53bc621e2cbc519b2535.js → 36b406131cd864567033.js} +1 -1
- package/assets/esri/core/workers/chunks/385dd6466fd967ce3ae9.js +1 -0
- package/assets/esri/core/workers/chunks/394b9723d108cff7136e.js +1 -0
- package/assets/esri/core/workers/chunks/4395b7263a299a8020d4.js +1 -0
- package/assets/esri/core/workers/chunks/47c04980098dc0c228d7.js +1 -0
- package/assets/esri/core/workers/chunks/{d6ee6ebdaf582f39c14b.js → 4c8164955f8d844c09ee.js} +1 -1
- package/assets/esri/core/workers/chunks/{e4d7f1e685f69b3bf54d.js → 4c9160e3d596fe75392d.js} +1 -1
- package/assets/esri/core/workers/chunks/534f3d7e4300b662191a.js +1 -0
- package/assets/esri/core/workers/chunks/55c7c51e56d72f507c22.js +1 -0
- package/assets/esri/core/workers/chunks/5802406d0a239a27a9a3.js +1 -0
- package/assets/esri/core/workers/chunks/6ce738960ee47904968f.js +314 -0
- package/assets/esri/core/workers/chunks/{b12f2eaa15f6753fa1a8.js → 6ff981ec0c725efe5525.js} +1 -1
- package/assets/esri/core/workers/chunks/7ca33e03a2fd217b9443.js +1 -0
- package/assets/esri/core/workers/chunks/7d93ff4f18fd21c7b9f2.js +1 -0
- package/assets/esri/core/workers/chunks/{983d787730bf8b74fe13.js → 7ec2f531217718e76469.js} +1 -1
- package/assets/esri/core/workers/chunks/8196ff250c0de00104f7.js +1 -0
- package/assets/esri/core/workers/chunks/{ae25c6108918d37e61bf.js → 8278d9263e9b7e3bf2d1.js} +1 -1
- package/assets/esri/core/workers/chunks/852c32b5e717c54e3ae0.js +1 -0
- package/assets/esri/core/workers/chunks/856b03020b2dd047291d.js +1 -0
- package/assets/esri/core/workers/chunks/85a9025c2990a8bbd61b.js +1 -0
- package/assets/esri/core/workers/chunks/8b057b5a606ac3669a78.js +1 -0
- package/assets/esri/core/workers/chunks/8bf623f560b1ed440004.js +1 -0
- package/assets/esri/core/workers/chunks/8d421e0a01e2c3f6980c.js +1 -0
- package/assets/esri/core/workers/chunks/{f27828ba83846d686072.js → 97078a7871e243c19b6b.js} +1 -1
- package/assets/esri/core/workers/chunks/a68b48fd1a529f69705e.js +1 -0
- package/assets/esri/core/workers/chunks/{272662e4e28341419b4f.js → a73a262ddc959a59819f.js} +1 -1
- package/assets/esri/core/workers/chunks/{4253438dd3045566892d.js → aba4353892c47de98eb3.js} +1 -1
- package/assets/esri/core/workers/chunks/{14cb593dfb50c724b9eb.js → ac6b582ca180210e596c.js} +1 -1
- package/assets/esri/core/workers/chunks/af27a3f646a4404d3b8d.js +1 -0
- package/assets/esri/core/workers/chunks/{fc07d47d44c04f123650.js → b1e275607d9754079f60.js} +1 -1
- package/assets/esri/core/workers/chunks/b3c126e8a0a722c03efc.js +1 -0
- package/assets/esri/core/workers/chunks/b464b7800a2ddd92b9a7.js +1 -0
- package/assets/esri/core/workers/chunks/b52a3a48d2d3ff22542d.js +1 -0
- package/assets/esri/core/workers/chunks/be883ebdbaf11647b718.js +1 -0
- package/assets/esri/core/workers/chunks/bf9b45604249520b596a.js +1 -0
- package/assets/esri/core/workers/chunks/c0400c25c53fd90fc90e.js +1 -0
- package/assets/esri/core/workers/chunks/c2939e0c45a6d074cac0.js +1 -0
- package/assets/esri/core/workers/chunks/{fccf505dbd98e59e721a.js → c3dc8d1958ddc71e1129.js} +1 -1
- package/assets/esri/core/workers/chunks/c68c68e918c72932b247.js +1 -0
- package/assets/esri/core/workers/chunks/c8cd9a3175f516624842.js +1 -0
- package/assets/esri/core/workers/chunks/cc1aedb2b3aa3854b0de.js +1 -0
- package/assets/esri/core/workers/chunks/d374d2a1487faee3672d.js +1 -0
- package/assets/esri/core/workers/chunks/d630e64463687090db92.js +1 -0
- package/assets/esri/core/workers/chunks/dbdca19978fbee8dc106.js +1 -0
- package/assets/esri/core/workers/chunks/ddfb5a2055a36576ba0d.js +1 -0
- package/assets/esri/core/workers/chunks/e1a90f63d2e6c761953b.js +1 -0
- package/assets/esri/core/workers/chunks/{5b5d89b94e020b4bfcc1.js → e3b0bb6850d5252d5f24.js} +1 -1
- package/assets/esri/core/workers/chunks/{4235bb1334c95f3c828d.js → e45404a982e173459990.js} +1 -1
- package/assets/esri/core/workers/chunks/{b7a3d9c5d18e59da378f.js → eab1e3c101158675abba.js} +1 -1
- package/assets/esri/core/workers/chunks/{8a3290ee6e6587fa39a6.js → ed4afafbcb31491c2049.js} +1 -1
- package/assets/esri/core/workers/chunks/ef46613c3aa363dc1cfc.js +1 -0
- package/assets/esri/core/workers/chunks/{6c5877e4ad108a6d074e.js → f0351930cbb3d8643119.js} +1 -1
- package/assets/esri/core/workers/chunks/f31986ea5cadfade8344.js +1 -0
- package/assets/esri/core/workers/chunks/f350aefc5e348ebad1da.js +1 -0
- package/assets/esri/core/workers/chunks/{a2e52b40eeeda4282c07.js → f70dd16f14279bb7e60d.js} +1 -1
- package/assets/esri/core/workers/chunks/f995a74bd9b58c069c07.js +1 -0
- package/assets/esri/core/workers/chunks/{7437b7423c8b7fb4f0dd.js → fe3ed029b07bb1e4aef3.js} +1 -1
- package/assets/esri/core/workers/chunks/{e6e6247ea5ce0c2b125f.js → fe8ee1938d196a70d809.js} +1 -1
- package/assets/esri/themes/base/widgets/_LabeledSwitch.scss +0 -2
- 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/BatchAttributeForm/t9n/BatchAttributeForm_ar.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bg.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bs.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ca.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_cs.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_da.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_de.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_el.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_es.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_et.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fi.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_he.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hu.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_id.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_it.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ja.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ko.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lt.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lv.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_nl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_no.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-BR.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-PT.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ro.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ru.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sk.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sv.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_th.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_tr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_uk.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_vi.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-CN.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-HK.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-TW.json +1 -1
- package/chunks/Envelope.js +1 -1
- package/chunks/{GeodeticDistanceCalculator-D4iQ-_NX.js → GeodeticDistanceCalculator-CcF1gMZX.js} +1 -1
- package/chunks/LineSeries.js +1 -1
- package/chunks/OperatorGeodeticArea.js +1 -1
- package/chunks/OperatorGeodeticDistance.js +1 -1
- package/chunks/OperatorProximityGeodesic.js +1 -1
- package/chunks/Point2D.js +1 -1
- package/chunks/ProjectionTransformation.js +1 -1
- package/chunks/QuadraticBezier.js +1 -1
- package/chunks/Theme.js +1 -1
- package/chunks/chartUtilsAm5.js +1 -1
- package/chunks/distanceOperator.js +1 -1
- package/core/timeUtils.js +1 -1
- package/editing/sharedTemplates/SharedTemplateProvider.js +1 -1
- package/editing/sharedTemplates/executor/createTemplateExecutor.js +1 -1
- package/editing/sharedTemplates/support/sharedTemplateErrors.js +1 -1
- package/editing/sharedTemplates/templateDefinitions/GroupTemplateDefinition.js +1 -1
- package/editing/templateUtils.js +1 -1
- package/geometry/operators/extendOperator.js +1 -1
- package/geometry/operators/gx/operatorAlphaShape.js +1 -1
- package/geometry/operators/gx/operatorBuffer.js +1 -1
- package/geometry/operators/gx/operatorConvexHull.js +1 -1
- package/geometry/operators/gx/operatorGraphicBuffer.js +1 -1
- package/geometry/operators/gx/operatorMinimumBoundingCircle.js +1 -1
- package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
- package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
- package/geometry/operators/isNearOperator.js +1 -1
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/geometry/support/PolylineBuilder.js +5 -0
- package/geometry/support/TileClipper.js +1 -1
- package/interfaces.d.ts +9 -9
- package/intl/date.js +1 -1
- package/layers/graphics/sources/WFSSource.js +1 -1
- package/layers/graphics/sources/WFSSourceWorker.js +1 -1
- package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
- package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
- package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
- package/layers/mixins/ImageryTileMixin.js +1 -1
- package/layers/ogc/ogcFeatureUtils.js +1 -1
- package/layers/support/FieldsIndex.js +1 -1
- package/layers/support/rasterFunctions/RemapFunction.js +1 -1
- package/layers/support/rasterFunctions/pixelUtils.js +1 -1
- package/networks/support/UtilityNetworkLookupHelper.js +5 -0
- package/package.json +2 -2
- package/smartMapping/support/utils.js +1 -1
- package/support/guards.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMOperators.js +1 -1
- package/symbols/cim/CIMSymbolRasterizer.js +1 -1
- package/symbols/cim/defaultCIMValues.js +1 -1
- package/symbols/cim/effects/EffectEnclosingPolygon.js +5 -0
- package/symbols/cim/effects/EffectRadial.js +5 -0
- package/symbols/cim/effects/EffectTaperedPolygon.js +5 -0
- package/symbols/cim/utils.js +1 -1
- package/time/TimeExtent.js +1 -1
- package/time/constants.js +5 -0
- package/time/timeZoneUtils.js +1 -1
- package/views/2d/engine/webgl/TextureManager.js +1 -1
- package/views/2d/engine/webgl/Utils.js +1 -1
- package/views/2d/engine/webgl/mesh/factories/ResourceProxy.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ComplexOutlineFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/constants.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/RemapShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/math.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/typed/TypedShaderProgram.js +1 -1
- package/views/2d/engine/webgl/textureUtils.js +5 -0
- package/views/2d/engine/webgl/urlUtils.js +5 -0
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextureCompressionWorkerHandle.js +1 -1
- package/views/VideoView.js +1 -1
- package/views/View.js +1 -1
- package/views/support/TextureCompressionHelper.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/webmap/InitialViewProperties.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
- package/widgets/Bookmarks.js +1 -1
- package/widgets/Directions/DirectionsViewModel.js +1 -1
- package/widgets/Editor/AddAssociationWorkflow.js +1 -1
- package/widgets/Feature/FeatureUtilityNetworkAssociationList.js +1 -1
- package/widgets/Feature/FeatureViewModel.js +1 -1
- package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/AssociationDetails.js +1 -1
- package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
- package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
- package/widgets/FeatureForm/UtilityNetworkAssociationInput.js +1 -1
- package/widgets/FeatureForm/featureFormUtils.js +1 -1
- package/widgets/FeatureTable/FieldColumn.js +1 -1
- package/widgets/Features/FeaturesViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/DataCaptureAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/dataCaptureUtils.js +1 -1
- package/widgets/OrientedImageryViewer/symbols.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/TimeSlider.js +1 -1
- package/widgets/TimeZoneLabel.js +1 -1
- package/widgets/support/LabeledSwitch.js +1 -1
- package/widgets/support/UtilityNetworkAssociations/utils/createAssociation.js +5 -0
- package/widgets/support/UtilityNetworkAssociations/utils/formatPercentAlong.js +5 -0
- package/widgets/support/UtilityNetworkAssociations/utils/getAssociationTitle.js +5 -0
- package/widgets/support/UtilityNetworkAssociations/utils/getFeatureTitle.js +5 -0
- package/widgets/support/UtilityNetworkAssociations/utils/isConnectivity.js +5 -0
- package/widgets/support/UtilityNetworkAssociations/utils/isConnectivityMidspan.js +5 -0
- package/widgets/support/UtilityNetworkAssociations/utils/isFromElement.js +5 -0
- package/widgets/support/dateUtils.js +1 -1
- package/assets/esri/core/workers/chunks/0509af0f6c732a847531.js +0 -1
- package/assets/esri/core/workers/chunks/1461ca910c3dba1d808b.js +0 -1
- package/assets/esri/core/workers/chunks/19f45bb389daf866dbc5.js +0 -1
- package/assets/esri/core/workers/chunks/1c4cafb879f21a42f7db.js +0 -978
- package/assets/esri/core/workers/chunks/2626f4201deb7bdd4866.js +0 -1
- package/assets/esri/core/workers/chunks/2e1126a35976b2d48197.js +0 -1
- package/assets/esri/core/workers/chunks/2eadc555038a38afdc9c.js +0 -1
- package/assets/esri/core/workers/chunks/36f0446d9d47685b7ce0.js +0 -1
- package/assets/esri/core/workers/chunks/3cf3aa74541f0cfff94f.js +0 -1
- package/assets/esri/core/workers/chunks/3d46327469ed5170e83e.js +0 -1
- package/assets/esri/core/workers/chunks/440afa7d26e721af578a.js +0 -1
- package/assets/esri/core/workers/chunks/460e5f78574cc0d157af.js +0 -1
- package/assets/esri/core/workers/chunks/4de09a997691305415b1.js +0 -1
- package/assets/esri/core/workers/chunks/5066fc5257296d95fe60.js +0 -1
- package/assets/esri/core/workers/chunks/53315ca098d76d34cf00.js +0 -1
- package/assets/esri/core/workers/chunks/539190038ac552e5374c.js +0 -1
- package/assets/esri/core/workers/chunks/55162949a2b2c8e1c95c.js +0 -1
- package/assets/esri/core/workers/chunks/58853056c16f2b525a9e.js +0 -1
- package/assets/esri/core/workers/chunks/5af9737d0530ca17b771.js +0 -1
- package/assets/esri/core/workers/chunks/5c0dfc75a9b654e6fa25.js +0 -1
- package/assets/esri/core/workers/chunks/6245c51d1525767ce2fe.js +0 -1
- package/assets/esri/core/workers/chunks/6728185fdf53b4921bf8.js +0 -1
- package/assets/esri/core/workers/chunks/68cb0c3462c90f2d1538.js +0 -1
- package/assets/esri/core/workers/chunks/6affa0f3d5bb74c7a1db.js +0 -1
- package/assets/esri/core/workers/chunks/6e108fb9884139dd3b52.js +0 -314
- package/assets/esri/core/workers/chunks/6f9bfa6ed34ef6efcc6f.js +0 -1
- package/assets/esri/core/workers/chunks/70943dc884d9ba8045a2.js +0 -1
- package/assets/esri/core/workers/chunks/7fe799c1e60e23a976e9.js +0 -1
- package/assets/esri/core/workers/chunks/80395a1d8ae91ff3961b.js +0 -1
- package/assets/esri/core/workers/chunks/87b78e491c800c96b503.js +0 -1
- package/assets/esri/core/workers/chunks/8abd2235aa702d8b239f.js +0 -1
- package/assets/esri/core/workers/chunks/8bf29e5e4c93d85a6abf.js +0 -1
- package/assets/esri/core/workers/chunks/99838ad20c10aa5aa471.js +0 -1
- package/assets/esri/core/workers/chunks/9fb568d25ed4f4660963.js +0 -1
- package/assets/esri/core/workers/chunks/9ff9cf156d024ade068b.js +0 -1
- package/assets/esri/core/workers/chunks/a288c2474ef193f9fbd3.js +0 -1
- package/assets/esri/core/workers/chunks/a2d0f7d82630dd8efb9b.js +0 -1
- package/assets/esri/core/workers/chunks/a66c3866888bd7e415e8.js +0 -1
- package/assets/esri/core/workers/chunks/b3bbe6f569ab6a3777b5.js +0 -1
- package/assets/esri/core/workers/chunks/ba33405a524c6bb88656.js +0 -1
- package/assets/esri/core/workers/chunks/bb1fb9990f8bf5f7a05f.js +0 -1
- package/assets/esri/core/workers/chunks/c22664f9f2b4ba7fe3d4.js +0 -1
- package/assets/esri/core/workers/chunks/c83245257deb230f79c0.js +0 -1
- package/assets/esri/core/workers/chunks/d2f8eed0b5b7cbdcd182.js +0 -1
- package/assets/esri/core/workers/chunks/d56426def776aae6fac6.js +0 -1
- package/assets/esri/core/workers/chunks/e12882be1b6820b8e9e8.js +0 -1
- package/assets/esri/core/workers/chunks/e648f1c96edf44c781eb.js +0 -1
- package/assets/esri/core/workers/chunks/ef6e9dbfc9a5bd38a7b6.js +0 -1
- package/assets/esri/core/workers/chunks/f2723d0c9c8d8ff4ec70.js +0 -1
- package/assets/esri/core/workers/chunks/f45ef721d21388846101.js +0 -1
- package/assets/esri/core/workers/chunks/fdab6921d007929ab288.js +0 -1
- package/widgets/support/UtilityNetworkAssociations/utilityNetworkUtils.js +0 -5
- /package/chunks/{Bufferer-B-V7yYm-.js → Bufferer-CicaNej1.js} +0 -0
- /package/chunks/{Distance2DCalculator-Coa0qAFt.js → Distance2DCalculator-C1KHhZwD.js} +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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import{stripHTML as e}from"../../../core/string.js";import{property as s}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{getFeatureFormTitle as o}from"../featureFormUtils.js";import r from"../UtilityNetworkAssociationInput.js";import{AssociationDetails as a}from"./AssociationDetails.js";import n from"./VisibleElements.js";import{loadCalciteComponents as c}from"../../support/componentsUtils.js";import{globalCss as l}from"../../support/globalCss.js";import{Heading as d}from"../../support/Heading.js";import"../../support/widgetUtils.js";import{messageBundle as p}from"../../support/decorators/messageBundle.js";import{tsx as u,tsxFragment as m}from"../../support/jsxFactory.js";import h from"../../support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js";import y from"../../support/UtilityNetworkAssociations/UtilityNetworkAssociationList.js";import{formatPercentAlong as g}from"../../support/UtilityNetworkAssociations/utils/formatPercentAlong.js";import{isConnectivity as f}from"../../support/UtilityNetworkAssociations/utils/isConnectivity.js";import{isConnectivityMidspan as F}from"../../support/UtilityNetworkAssociations/utils/isConnectivityMidspan.js";import{substitute as v}from"../../../intl/substitute.js";const _="esri-feature-form-utility-network-association-list",L={base:_,header:`${_}__header`,headingContent:`${_}__heading-content`,listContainer:`${_}__list-container`};let A=class extends y{constructor(t,e){super(t,e),this._isLoadingSelectFeature=!1,this.associationInput=null,this.headingLevel=5,this.messagesFeatureForm=null,this.onSelectLayer=()=>{},this.onSelectFeature=async()=>{},this.onAddAssociation=()=>{},this.viewModel=new h,this.visibleElements=new n}initialize(){this.setUpObserver()}loadDependencies(){return c({chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),fab:()=>import("@esri/calcite-components/dist/components/calcite-fab"),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 u("div",{class:this.classes(L.base,l.widget)});const{associatedLayer:e}=t,{state:s}=this.viewModel;return u("div",{class:this.classes(L.base,l.widget)},"loading"===s||"querying"===s?this.renderLoading():e?this._renderFeatureList(t,e):this._renderLayerList(t))}_renderLayerList(t){const{associatedFeatureInfos:e,editable:s}=t;return u("div",{class:L.listContainer},u("calcite-list",{label:this.messagesFeatureForm?.associations.associatedLayers},Array.from(e.keys(),(e=>this._renderLayerItem(t,e)))),s?u("calcite-fab",{appearance:"outline-fill",icon:"plus",key:`${t.uid}-add-button`,kind:"neutral",onclick:()=>this.onAddAssociation({feature:t.feature,associationType:t.activeAssociationType,utilityNetwork:t.utilityNetwork}),text:this.messagesCommon.add,textEnabled:!0}):null)}_renderFeatureList(t,e){return u(m,null,this._renderHeader(t,e),u("div",{class:L.listContainer},this.renderFeatureCountWarning(),u("calcite-list",{label:this.messagesFeatureForm?.associations.associatedFeatures},this._renderAssociatedFeatureListPage(t,e),this.renderFeatureObserver())))}_renderLayerTitle(t){return t.title?u(d,{key:"title",level:this.headingLevel},u("div",{class:L.headingContent},u("calcite-icon",{icon:"layer"}),t.title)):null}_renderTotal(t,e){const{messagesFeature:s}=this,{associatedFeatureInfos:i}=t,o=i.get(e),r=v(s?.numberRecords,{number:o?.length??"0"});return u("div",{key:e.id},r)}_renderHeader(t,e){const{messagesFeatureForm:s}=this,{activeAssociationType:i,featureItem:o,feature:r}=t;return u("div",{class:L.header,key:"filter"},this.visibleElements.associationDetails?u(a,{associationType:i?.type,feature:r,heading:o?.label,messages:s.associations}):void 0,this._renderLayerTitle(e),this.renderFilter(),this._renderTotal(t,e))}_renderAssociatedFeatureListPage(t,e){const{filterText:s,endIndex:i}=this,r=this.messagesCommon.untitled,a=t.associatedFeatureInfos.get(e)?.filter((t=>o(t,r).toLowerCase().includes(s)??!1)).slice(0,i).toArray()??[];return[...this._renderTooltips(a),...this._renderAssociatedFeatureList(a)]}_renderItemTooltip(t){const{tooltipReferenceMap:e}=this,s=t.feature.uid.toString();return f(t.association)?u("calcite-tooltip",{key:`tooltip-${s}`,overlayPositioning:"fixed",referenceElement:e.get(s)},this.getConnectivityTooltip(t.association.associationType)):null}_renderAssociatedFeature(t){const s=this.messagesCommon.untitled,i=o(t,s),r=t.feature.uid.toString();return u("calcite-list-item",{description:e(t.terminalName??""),key:`associated-feature-type-${r}`,label:e(i),onCalciteListItemSelect:()=>this._selectAssociation(t)},f(t.association)?this.renderConnectivityIcon(t.association.associationType,r):null,F(t.association)?u("calcite-chip",{label:g(t.association),scale:"s",slot:"content-end"},g(t.association)):null,u("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 u("calcite-list-item",{key:`${e.id}-show-all`,label:e.title??this.messagesCommon.untitled,open:!0,value:e.id,onCalciteListItemSelect:()=>this._showAllAssociations(e)},u("calcite-chip",{label:i.toString(),scale:"s",slot:"content-end"},i),u("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}async _selectAssociation(t){this._isLoadingSelectFeature||(this._isLoadingSelectFeature=!0,await this.onSelectFeature({feature:t.feature,association:t.association}),this._isLoadingSelectFeature=!1)}_showAllAssociations(t){this.onSelectLayer({layer:t,associationInput:this.associationInput})}};t([s()],A.prototype,"associatedFeatureCount",null),t([s({type:r})],A.prototype,"associationInput",void 0),t([s()],A.prototype,"headingLevel",void 0),t([s(),p("esri/widgets/FeatureForm/t9n/FeatureForm")],A.prototype,"messagesFeatureForm",void 0),t([s({constructOnly:!0})],A.prototype,"onSelectLayer",void 0),t([s({constructOnly:!0})],A.prototype,"onSelectFeature",void 0),t([s({constructOnly:!0})],A.prototype,"onAddAssociation",void 0),t([s({type:h})],A.prototype,"viewModel",void 0),t([s({type:n,nonNullable:!0})],A.prototype,"visibleElements",void 0),A=t([i("esri.widgets.FeatureForm.FeatureFormUtilityNetworkAssociations.FeatureFormUtilityNetworkAssociationList")],A);const b=A;export{b 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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import i from"../../Widget.js";import{loadCalciteComponents as n}from"../../support/componentsUtils.js";import{globalCss as s}from"../../support/globalCss.js";import"../../support/widgetUtils.js";import{messageBundle as r}from"../../support/decorators/messageBundle.js";import{tsx as c}from"../../support/jsxFactory.js";import{
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import i from"../../Widget.js";import{loadCalciteComponents as n}from"../../support/componentsUtils.js";import{globalCss as s}from"../../support/globalCss.js";import"../../support/widgetUtils.js";import{messageBundle as r}from"../../support/decorators/messageBundle.js";import{tsx as c}from"../../support/jsxFactory.js";import{getAssociationTitle as a}from"../../support/UtilityNetworkAssociations/utils/getAssociationTitle.js";import{isFromElement as l}from"../../support/UtilityNetworkAssociations/utils/isFromElement.js";const m="esri-feature-form-utility-network-association-settings",d={base:m,infoContainer:`${m}__info-container`};let u=class extends i{constructor(e,t){super(e,t),this.percentAlong=50,this.headingLevel=5,this.messagesFeature=null,this.messagesCommon=null,this.messagesFeatureForm=null,this.readOnly=!1,this.sourceFeature=null,this.targetFeature=null,this.utilityNetwork=null}loadDependencies(){return n({block:()=>import("@esri/calcite-components/dist/components/calcite-block"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch")})}get association(){return this._get("association")}set association(e){this.percentAlong=e.percentAlong?100*e.percentAlong:50,this._set("association",e)}get associationType(){return this.association.associationType}set associationType(e){this.association.associationType=e,"junction-edge-to-connectivity"!==e&&"junction-edge-from-connectivity"!==e||(this.association.percentAlong=void 0)}render(){return c("div",{class:this.classes(d.base,s.widget)},this._renderFromAssociationEndpoint(),this._renderToAssociationEndpoint(),this._renderAdditionalContent())}_renderFromAssociationEndpoint(){const{associationType:e,association:t,sourceFeature:o,targetFeature:i,messagesFeatureForm:n}=this,s=l(o.feature,t)?o:i,r=s.label,c=a(t,"from",n.associations);switch(e){case"connectivity":case"junction-junction-connectivity":case"junction-edge-midspan-connectivity":case"junction-edge-from-connectivity":case"junction-edge-to-connectivity":return this._renderAssociationEndpoint(r,c,this._renderConnectivityContent(s.feature,t.fromNetworkElement))}return this._renderAssociationEndpoint(r,c)}_renderToAssociationEndpoint(){const{associationType:e,association:t,sourceFeature:o,targetFeature:i,messagesFeatureForm:n}=this,s=l(o.feature,t)?i:o,r=s.label,c=a(t,"to",n.associations);switch(e){case"connectivity":case"junction-junction-connectivity":return this._renderAssociationEndpoint(r,c,this._renderConnectivityContent(s.feature,t.toNetworkElement));case"containment":return this._renderAssociationEndpoint(r,c,this._renderContainmentContent())}return this._renderAssociationEndpoint(r,c)}_renderAssociationEndpoint(e,t,o){return c("calcite-block",{description:t,heading:e,open:!0},o)}_renderContainmentContent(){const{messagesFeatureForm:e,association:t}=this,o=t.isContentVisible??!1;return c("calcite-label",{layout:"inline"},e.associations.visible,c("calcite-switch",{checked:o,onCalciteSwitchChange:({currentTarget:e})=>{t.isContentVisible=e.checked}}))}_renderConnectivityContent(e,t){const{messagesFeatureForm:o,utilityNetwork:i}=this,n=i.getTerminalConfiguration(e),s=n?.terminals.map((e=>this._renderComboboxListItemNumber(e.id,t.terminalId,e.name)))||[];return c("calcite-label",null,o.associations.terminal,c("calcite-combobox",{allowCustomValues:!1,clearDisabled:!0,label:o.associations.terminalComboboxLabel,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({currentTarget:e})=>{t.terminalId=parseInt(e.value,10)}},...s))}_renderAdditionalContent(){const{associationType:e}=this;switch(e){case"connectivity":case"junction-junction-connectivity":case"attachment":case"containment":return}const t="junction-edge-midspan-connectivity"===e?e:"junction-edge-from-connectivity",{messagesFeatureForm:o}=this,i=[this._renderComboboxListItemString("junction-edge-midspan-connectivity",t,o.associations.midspanEdge),this._renderComboboxListItemString("junction-edge-from-connectivity",t,o.associations.endpointEdge)];return c("div",{class:d.infoContainer},c("calcite-label",{key:"additional-content"},o.associations.connectTo,c("calcite-combobox",{allowCustomValues:!1,clearDisabled:!0,label:o.associations.edgeConnectionComboboxLabel,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({currentTarget:e})=>{this.associationType=e.value}},...i)),"junction-edge-midspan-connectivity"===t?this._renderMidspanEdgeContent():this._renderEndpointEdgeContent())}_renderMidspanEdgeContent(){const{messagesFeatureForm:e,percentAlong:t,association:o}=this;return o.percentAlong=t/100,c("calcite-label",{key:"midspan-edge"},e.associations.midspanLocation,c("calcite-input-number",{max:100,min:0,numberButtonType:"vertical",suffixText:"%",value:`${t}`,onCalciteInputNumberInput:({currentTarget:e})=>{this.percentAlong=parseFloat(e.value)}}))}_renderEndpointEdgeContent(){const{associationType:e,messagesFeatureForm:t}=this,o="junction-edge-to-connectivity"===e;return c("calcite-label",{key:"endpoint-edge"},t.associations.edgeSide,c("calcite-label",{layout:"inline"},t.associations.fromSide,c("calcite-switch",{checked:o,onCalciteSwitchChange:({currentTarget:e})=>{const t=e.checked?"junction-edge-to-connectivity":"junction-edge-from-connectivity";this.associationType=t}}),t.associations.toSide))}_renderComboboxListItemNumber(e,t,o){return c("calcite-combobox-item",{heading:o,key:`#${e}`,selected:t===e,value:`${e}`})}_renderComboboxListItemString(e,t,o){return c("calcite-combobox-item",{heading:o,key:`#${e}`,selected:t===e,value:`${e}`})}};e([t()],u.prototype,"association",null),e([t()],u.prototype,"percentAlong",void 0),e([t()],u.prototype,"associationType",null),e([t()],u.prototype,"headingLevel",void 0),e([t(),r("esri/widgets/Feature/t9n/Feature")],u.prototype,"messagesFeature",void 0),e([t(),r("esri/t9n/common")],u.prototype,"messagesCommon",void 0),e([t(),r("esri/widgets/FeatureForm/t9n/FeatureForm")],u.prototype,"messagesFeatureForm",void 0),e([t()],u.prototype,"readOnly",void 0),e([t()],u.prototype,"sourceFeature",void 0),e([t()],u.prototype,"targetFeature",void 0),e([t()],u.prototype,"utilityNetwork",void 0),u=e([o("esri.widgets.FeatureForm.FeatureFormUtilityNetworkAssociations.UtilityNetworkAssociationSettings")],u);const p=u;export{p as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{neverReached as n}from"../../core/compilerUtils.js";import s from"../../core/Evented.js";import i from"../../core/Logger.js";import{destroyMaybe as o}from"../../core/maybe.js";import r from"../../core/Promise.js";import{debounce as a}from"../../core/promiseUtils.js";import{watch as l,whenOnce as u,on as p,syncAndInitial as c}from"../../core/reactiveUtils.js";import{templateHasKey as d}from"../../core/string.js";import{property as h}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as m}from"../../core/support/UpdatingHandles.js";import g from"../../form/FormTemplate.js";import{isUtilityNetworkAssociationsElement as y,isGroupElement as _,isFieldElement as v,isRelationshipElement as I,isTextElement as x}from"../../form/support/formUtils.js";import E from"../../layers/support/ContingentValue.js";import{isEditableLayer as C}from"../../layers/support/editableLayers.js";import F from"../../layers/support/LayerContingentValuesCache.js";import{utc as b,unknown as V,system as w}from"../../time/timeZoneUtils.js";import{flattenAssociationInputs as A,flattenFieldInputs as j,isGroupInput as T,flattenRelationshipInputs as M,parseFormTemplateString as N,isRelationshipInput as k,isFieldInput as L,isTextElementInput as R,getNormalizedFeatureTypeInfo as S,valueIsValidContingentValue as U}from"./featureFormUtils.js";import H from"./FieldInput.js";import{FormExpressionsManager as Z}from"./FormExpressionsManager.js";import P from"./GroupInput.js";import O from"./RelationshipInput.js";import W from"./TextElementInput.js";import G from"./UtilityNetworkAssociationInput.js";import{createFormExpressionArcadeExecutor as $}from"../support/forms/expressions/FormExpressionArcadeExecutor.js";const D=new t({attributes:{}}),z={field:["editableExpression","requiredExpression","valueExpression","visibilityExpression"],group:["visibilityExpression"],relationship:["editableExpression","visibilityExpression"],text:["visibilityExpression"],utilityNetworkAssociations:["editableExpression","visibilityExpression"]},J="#JSAPI_CONTINGENT_VALUE_EMPTY_HASH",B="#JSAPI_CONTINGENT_VALUE_ANY_HASH",K="#JSAPI_CONTINGENT_VALUE_NULL_HASH",Y="esri.widgets.FeatureForm.FeatureFormViewModel",q=()=>i.getLogger(Y);let Q=class extends(r.EsriPromiseMixin(s.EventedAccessor)){constructor(e){super(e),this._expressionExecutorsInUse=new Set,this._expressionExecutorLookup=new Map,this._expressionsManager=null,this._contingentValuesCache=null,this._featureClone=D.clone(),this._initialFeature=D.clone(),this._timeZone=null,this._updatingHandles=new m,this.activeAssociation=null,this.arcadeEditType="NA",this.contingencyConstraintViolations=new Map,this.disabled=!1,this.highlightHelper=null,this.inputs=[],this.map=null,this.callbacks=null,this.strict=!1,this.pendingSubtypeChoice=null,this._updateInputs=a((async()=>{this._stopExpressions();const{_featureClone:e,_initialFeature:t,arcadeEditType:n,formTemplate:s,inputs:i,layer:o,timeZone:r}=this;if(!o)return;const a={arcadeEditType:n,feature:e,initialFeature:t,layer:o,timeZone:r},l=i.slice(),u=s?.elements&&s.elements.length>0?await this._updateInputsUsingFormElements(l,s.elements,a):this._updateInputsUsingLayerFields(l,o?.fields,a);this.inputs=u,await this._startExpressions()}))}initialize(){const e=l((()=>[this.layer,!!this.layer?.loaded,this.formTemplate,this.feature,this.timeZone,this.arcadeEditType]),(([e,t])=>{null!=e&&(t?this._updatingHandles.addPromise(this._updateInputs()):e.load().catch((()=>{})))}),c),t=l((()=>this._arcadeContextInfo),(e=>{null!=this._expressionsManager&&(this._expressionsManager.arcadeContextInfo=e,this._updatingHandles.addPromise(this._expressionsManager.evaluateAll().finally((()=>this._afterExpressionsEvaluated()))))})),n=l((()=>this.layer),(e=>{const t="subtype-sublayer"===e?.type?e.parent:"feature"===e?.type?e:null;t&&this.addResolvingPromise(F.createLoadedLayerContingentValuesCache(t).then((e=>{this._contingentValuesCache=e,this.notifyChange("fieldsWithContingentValues")})))}),{initial:!0});this.addHandles([e,t,n])}destroy(){this.feature=null,this.layer=null,this._contingentValuesCache=o(this._contingentValuesCache),this.highlightHelper?.removeAll(),this._updatingHandles.destroy()}get _expressionInfosLookup(){return new Map(this.formTemplate?.expressionInfos?.map((e=>[e.name,e])))}get activeAssociationInput(){return this.allAssociationInputs.find((e=>e.uid===this.associationId))}get activeRelationshipInput(){return this.allRelationshipInputs.find((e=>e.relationshipId===this.relationshipId))}get _arcadeContextInfo(){const{_initialFeature:e,arcadeEditType:t,layer:n,map:s,spatialReference:i,timeZone:o}=this;return{layer:C(n)?n:null,originalFeature:e,editType:t,map:s,spatialReference:i,timeZone:o}}get associationId(){return this._get("associationId")}set associationId(e){null==e&&this.activeAssociationInput?.viewModel&&(this.activeAssociationInput.associatedLayer=null,this.activeAssociationInput.viewModel.activeAssociationType=null),this._set("associationId",e)}get associatedLayer(){return this.activeAssociationInput?.associatedLayer}set associatedLayer(e){this.activeAssociationInput&&(this.activeAssociationInput.associatedLayer=e)}get allAssociationInputs(){return A(this.inputs)}get allFieldInputs(){return j(this.inputs)}get allGroupInputs(){return this.inputs.filter(T)}get allRelationshipInputs(){return M(this.inputs)}get _layerFieldsByName(){return new Map(this.layer?.fields.map((e=>[e.name,e])))}get feature(){return this._get("feature")}set feature(e){const t=this._get("feature");this._featureClone=e?e.clone():D.clone(),this._initialFeature=this._featureClone.clone(),this._expressionsManager&&(this._expressionsManager.feature=this._featureClone),e?(this._resetFieldInputValues(this._featureClone),this.allRelationshipInputs.forEach((t=>t.feature=e))):(this.inputs.forEach((e=>e.destroy())),this.inputs.length=0),t!==e&&(this.pendingSubtypeChoice=null),this.contingencyConstraintViolations.clear(),this._set("feature",e)}get fieldsWithContingentValues(){if(null==this._contingentValuesCache)return new Set;const e=this._contingentValuesCache.fieldGroups.flatMap((e=>e.fields));return new Set(e)}get formTemplate(){return this.layer&&"formTemplate"in this.layer?this.layer.formTemplate:null}set formTemplate(e){void 0===e?this._clearOverride("formTemplate"):this._override("formTemplate",e)}get formDescription(){const{formTemplate:e,layer:t}=this;return e?.description&&t?N({label:e.description,attributes:this.getValues(),fieldsIndex:t.fieldsIndex,timeZone:this.timeZone}):null}get formTitle(){const{formTemplate:e,layer:t}=this;return e?.title&&t?N({label:e.title,attributes:this.getValues(),fieldsIndex:t.fieldsIndex,timeZone:this.timeZone}):null}get formHeaderVisible(){const{activeRelationshipInput:e,activeAssociationInput:t,formDescription:n,formTitle:s}=this;return!(e||t||!n&&!s)}get joinedContingentValues(){return this._joinContingentValues()}get layer(){return this.feature?.sourceLayer&&"applyEdits"in this.feature.sourceLayer?this.feature.sourceLayer:null}set layer(e){this._override("layer",e)}get relationshipId(){return this._get("relationshipId")}set relationshipId(e){const t=this.allRelationshipInputs;if(null!=e&&e===this.relationshipId||t.forEach((e=>e.showAllEnabled=!1)),null!=e){const n=t.find((t=>t.relationshipId===e));n&&(n.showAllEnabled=!0)}this._set("relationshipId",e)}get spatialReference(){return this.layer?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){return this.layer?.loaded?"ready":"disabled"}get submittable(){return!!this.valid||this.allFieldInputs.filter((e=>!e.valid)).every((({submittable:e})=>e))}get timeZone(){const{layer:e}=this;if(e&&"datesInUnknownTimezone"in e&&e.datesInUnknownTimezone)return b;const t=e&&"preferredTimeZone"in e&&e.preferredTimeZone;return this._timeZone===V?t||b:this._timeZone||w}set timeZone(e){this._timeZone=e}get updating(){return this._updatingHandles.updating}get valid(){const e=this.allFieldInputs;return e.length>0&&e.every((({valid:e})=>e))}findField(e){return this.allFieldInputs.find((t=>t.name===e))}getFieldValueOptionsForField(e,t){const n=this.findField(e);if(!n)return[[],[],[]];const s="coded-value"===n.domain?.type?n.domain.codedValues.map((({name:e,code:t})=>({name:e,value:t}))):[],i=null==n.value||s.some((e=>e.value===n.value))?[]:[{name:`${n.value}`,value:n.value}],o=this.fieldsWithContingentValues.has(e)?this._getContingentValueOptionsForField(e,t):[];if(o.length>0){const e=new Set(o.map((e=>e.value)));return[o,s.filter((t=>!e.has(t.value))),i]}return[s,[],i]}getValue(e){const t=this.layer?.getField(e);if(null!=t)return this._featureClone.getAttribute(t.name)??null}setValue(e,t){const{_featureClone:n,strict:s}=this,i=this.findField(e);t=""===t?null:t,i&&n.getAttribute(e)!==t&&(i.value=t,s&&!i.valid||(this._afterValueChange(i),null!=this._expressionsManager&&this._updatingHandles.addPromise(this._expressionsManager.evaluateInvalidated([i.name]).finally((()=>this._afterExpressionsEvaluated())))))}getValues(){return{...this._featureClone.attributes}}overrideInitialFeature(e){this._initialFeature=e}submit(){const e=this.allFieldInputs,t=new Set(e.filter((e=>e.valid)).map((({name:e})=>e))),n=e.filter((e=>!e.valid)).map((({name:e})=>e)),s=this.getValues();if(this.validateContingencyConstraints(s,{includeIncompleteViolations:!0}).length>0)for(const[i,o]of this.contingencyConstraintViolations.entries())"error"===o.type&&(t.delete(i),n.push(i));this.notifyChange("submittable"),this.notifyChange("valid"),this.emit("submit",{valid:[...t],invalid:n,values:s})}validateContingencyConstraints(e,t){const{_contingentValuesCache:n}=this,s=new Map;if(this.contingencyConstraintViolations=s,null==n)return[];const{invalid:i,incomplete:o}=n.validateContingencyConstraints(e),r=[...i,...t?.includeIncompleteViolations?o:[]];for(const a of r)for(const e of a.fieldGroup.fields)s.set(e,a);return r}notifyFeatureGeometryChanged(){const{_expressionsManager:e,feature:t,_featureClone:n}=this;t&&(n.geometry=t.geometry,null!=e&&this._updatingHandles.addPromise(e.evaluateInvalidatedByGeometry().finally((()=>this._afterExpressionsEvaluated()))))}applySubtypeDefaults(e){const{defaultValues:t}=e,{allFieldInputs:n}=this;for(const{name:s}of n){const e=t[s];null!=e&&this.setValue(s,e)}}_emitChangeEvent({name:e,valid:t,value:n}){this.emit("value-change",{layer:this.layer,feature:this.feature,fieldName:e,value:n,valid:t})}async _updateInputsUsingFormElements(e,t,n){const s=new Map;for(const r of e)if(T(r)){s.set(r.element,r);for(const e of r.inputs)e.element&&s.set(e.element,e)}else r.element&&s.set(r.element,r);const i=new Map,o=await this._updateInputsUsingFormElementsRecursive({existingInputsByElement:s,updatedElements:t.filter(X),sharedInitializationProperties:n,group:null,newExpressionExecutorPromises:i});for(const[r,a]of s.entries())s.delete(r),a.destroy();return await Promise.all(Array.from(i.values())),o}async _updateInputsUsingFormElementsRecursive(e){const{existingInputsByElement:t,updatedElements:n,sharedInitializationProperties:s,group:i,newExpressionExecutorPromises:o}=e,r=[];for(const a of n){const e=t.has(a),n=e?t.get(a):this._makeInputFromElement(a,s,i);if(n){if(r.push(n),await u((()=>!n.updating)),this._assignExpressionExecutors(n,a,o),e)if(t.delete(a),T(n)){const{feature:e,timeZone:t}=s;n.set({feature:e,timeZone:t})}else if(k(n)){const e=this.relationshipId===a.relationshipId;n.set(s),n.set({map:this.map,showAllEnabled:e})}else y(n)?(n.set(s),n.set({map:this.map})):n.set(s);if(_(a)){const e=a.elements.filter((e=>X(e)));n.inputs=await this._updateInputsUsingFormElementsRecursive({existingInputsByElement:t,updatedElements:e,sharedInitializationProperties:s,group:n,newExpressionExecutorPromises:o})}}}return r}_updateInputsUsingLayerFields(e,t,n){if(!Array.isArray(t))return q().warn(this.declaredClass,"No attribute fields found."),[];const s=new Map;for(const o of e)if(T(o)){for(const e of o.inputs)e.destroy();o.inputs.length=0,o.destroy()}else k(o)?o.destroy():L(o)&&(null!==o.element?o.destroy():s.set(o.field,o));const i=[];for(const o of t){const e=n.feature?.getAttribute(o.name)??null,t=s.get(o)??new H({field:o,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden});i.push(t.set({...n,value:e})),s.delete(o)}for(const[o,r]of s.entries())s.delete(o),r.destroy();return i}_resetFieldInputValues(e){for(const t of this.allFieldInputs)t.value=e.getAttribute(t.name)}_makeInputFromElement(e,t,s){return _(e)?ee(e,t):v(e)?this._makeFieldInputFromElement(e,t,s):I(e)?this._makeRelationshipInputFromElement(e,t,s):y(e)?this._makeUtilityNetworkAssociationInputFromElement(e,t,s):x(e)?te(e,t):y(e)?this._makeUtilityNetworkAssociationInputFromElement(e,t,s):n()}_makeFieldInputFromElement(e,t,n){const{arcadeEditType:s,feature:i,initialFeature:o,layer:r,timeZone:a}=t,{fieldName:l}=e,u=l&&this._layerFieldsByName.get(l);return u?new H({arcadeEditType:s,element:e,field:u,value:i?.getAttribute(e.fieldName)??null,feature:i,initialFeature:o,layer:r,group:n,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden,timeZone:a}):null}_makeRelationshipInputFromElement(e,t,n=null){const{map:s}=this,{feature:i,layer:o,timeZone:r}=t,a=new O({element:e,feature:i,group:n,layer:o,map:s,timeZone:r});return a.addHandles(p((()=>a.relatedLayer),"edits",(()=>this._expressionsManager?.evaluateAsyncExpressions()))),a}_makeUtilityNetworkAssociationInputFromElement(e,t,n=null){const{map:s}=this,{feature:i,layer:o,timeZone:r}=t;return new G({element:e,feature:i,group:n,layer:o,map:s,timeZone:r})}_assignExpressionExecutors(e,t,n){const s=z[t.type],i=[];for(const o of s){const s=`${o}Executor`;if(e[s]){this._useExecutor(e[s]);continue}const r=t[o];if(null!=r&&""!==r){const t=this._expressionInfosLookup.get(r)?.expression??r;i.push(this._getOrCreateExecutorForExpression(t,n).then((t=>{e[s]=this._useExecutor(t)})))}}return R(e)&&i.push(...this._assignTextElementExpressionExecutors(e,n)),i}_assignTextElementExpressionExecutors(e,t){const{_expressionInfosLookup:n}=this,s=[];for(const o of e.expressionsUsed){const r=n.get(o);null!=r?s.push(this._getOrCreateExecutorForExpression(r.expression,t).then((t=>e.setExpressionExecutor(o,this._useExecutor(t))))):i.getLogger(this).error("feature-form:expression-not-found",`Could not find expressionInfo object with name '${o}'`)}for(const i of e.fieldsUsed){const n=`return $feature['${i}'];`;s.push(this._getOrCreateExecutorForExpression(n,t).then((t=>e.setFieldExecutor(i,this._useExecutor(t)))))}return s}async _getOrCreateExecutorForExpression(e,t){const{_expressionExecutorLookup:n}=this;if(n.has(e))return n.get(e);if(t.has(e))return t.get(e);const s=$(e,this.layer);t.set(e,s);const i=await s;return n.set(e,i),i}_createExpressionsManager(e){const{_arcadeContextInfo:t,_featureClone:n,allFieldInputs:s,formTemplate:i}=this;this._expressionsManager=new Z({executors:e,feature:n,arcadeContextInfo:t,fieldInputs:s,preserveFieldValuesWhenHidden:!0===i?.preserveFieldValuesWhenHidden})}async _startExpressions(){if(0===this._expressionExecutorsInUse.size)return;const e=Array.from(this._expressionExecutorsInUse);this._createExpressionsManager(e),await this._expressionsManager.evaluateAll().finally((()=>this._afterExpressionsEvaluated()))}_stopExpressions(){this._expressionsManager=o(this._expressionsManager),this._expressionExecutorsInUse.clear()}_useExecutor(e){return this._expressionExecutorsInUse.add(e),e}_afterValueChange(e){const{name:t,value:n}=e,{_featureClone:s,formTemplate:i,layer:o}=this;if(!o)return;const r=s.getAttribute(t);s.setAttribute(t,n);const{typeFieldName:a,types:l}=S(o);if((e.isSubtypeField||t===a)&&n!==r){if("subtype-sublayer"===o.type){const e=o.parent?.findSublayerForFeature(s);this.feature&&(this.feature.sourceLayer=e),s.sourceLayer=e}const e=new Set;for(const t of l)if(t.domains&&"object"==typeof t.domains)for(const n of Object.keys(t.domains))e.add(n);for(const t of e){const e=this.findField(t);e&&e.notifyChange("domain")}this.notifyChange("joinedContingentValues")}if(null!=i){const{description:e,title:n}=i;n&&d(n,t)&&this.notifyChange("formTitle"),e&&d(e,t)&&this.notifyChange("formDescription")}this._emitChangeEvent(e)}_afterExpressionsEvaluated(){const{_featureClone:e}=this;for(const t of this.allFieldInputs)t.value!==e.getAttribute(t.name)&&this._afterValueChange(t)}_joinContingentValues(){const e=this._contingentValuesCache;if(null==e)return[];const{typeFieldName:t}=S(this.layer),n=t?this.getValue(t):null,s=[];for(const r of e.fieldGroups){const{contingencies:e,fields:t,name:i}=r,o=[];for(const s of e)s.isRetired||null!=s.subtype&&s.subtype.code!==n||o.push({values:s.values});o.length>0&&s.push({name:i,fields:t,contingencies:o})}const[i,o]=this._generateJoinPlan(s);return[...i.flatMap((e=>this._joinFieldGroupContingencies(e))),...o.flatMap((e=>e.contingencies))]}_generateJoinPlan(e){const t=new Map,n=[],s=new Set;for(const l of e)for(const e of l.fields)if(t.has(e)){const i=t.get(e),o=l,r=[i.name,o.name].sort().join("|");if(s.has(r))continue;n.push([i,o]),s.add(r),t.set(e,o)}else t.set(e,l);const i=new Set(n.flat()),o=new Set(e);for(const l of i)o.delete(l);const r=new Map,a=new Map;for(const l of new Set(n.flat())){const e=Symbol(l.name);r.set(e,new Set([l])),a.set(l,e)}for(const[l,u]of n){const e=a.get(l),t=a.get(u);if(e===t)continue;const n=r.get(e),s=r.get(t);for(const i of s)n.add(i),a.set(i,e);r.delete(t)}return[[...r.values()].map((e=>[...e])),[...o]]}_joinFieldGroupContingencies(e){const t=e.slice(),n=t.shift();let s=t.shift(),i=this._generateJoinKey(n.fields,s.fields),o=new Set([...n.fields,...s.fields]),r=new Map;for(const l of n.contingencies){const[e]=this._hashContingency(l,i.codedValueFields,!0);r.has(e)?r.get(e)?.push(l):r.set(e,[l])}for(;t.length>0;){const e=new Map,n=t.shift(),a=this._generateJoinKey(o,n.fields);for(const t of s.contingencies){const[n,s]=this._hashContingency(t,i.codedValueFields),o=s?this._findMatchingContingenciesWithAnyHashMask(r,n):r.get(n);if(r.has(B)&&o?.push(...this._findMatchingContingenciesContainingAny(t,r.get(B),i.codedValueFields)),null!=o)for(const r of o){const n=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(r,t,i.rangeFields):this._joinContingencies(r,t);if(null==n)break;const[s]=this._hashContingency(n,a.codedValueFields,!0);e.has(s)?e.get(s)?.push(n):e.set(s,[n])}}r=e,s=n,i=a,o=new Set([...o,...s.fields])}const a=[];for(const l of s.contingencies){const[e,t]=this._hashContingency(l,i.codedValueFields),n=t?this._findMatchingContingenciesWithAnyHashMask(r,e):r.get(e);if(r.has(B)&&n.push(...this._findMatchingContingenciesContainingAny(l,r.get(B),i.codedValueFields)),null!=n)for(const s of n){const e=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(s,l,i.rangeFields):this._joinContingencies(s,l);null!=e&&a.push(e)}}return a}_joinContingencies(e,t){const n={values:{...e.values,...t.values}};for(const[s,i]of Object.entries(n.values))"any"===i.objectType&&null!=e.values[s]&&(n.values[s]=e.values[s]);return n}_joinContingenciesWithRangeDomains(e,t,n){const s=this._joinContingencies(e,t);for(const i of n){const n=e.values[i],o=t.values[i],{leftIsNull:r,rightIsNull:a,bothAreNull:l,leftIsAny:u,rightIsAny:p,bothAreAny:c,leftIsRange:d,rightIsRange:h}=this._compareObjectTypes(n.objectType,o.objectType);if(l||c)continue;if(r&&p||a&&u){s.values[i]=new E({objectType:"null"});continue}if(r&&h||a&&d)return null;u?(n.minValue=-1/0,n.maxValue=1/0):p&&(o.minValue=-1/0,o.maxValue=1/0);const f=Math.max(n.minValue,o.minValue),m=Math.min(n.maxValue,o.maxValue);if(f>m)return null;s.values[i]=new E({objectType:"range",minValue:f,maxValue:m})}return s}_findMatchingContingenciesContainingAny(e,t,n){return t.filter((t=>n.every((n=>{const s=t.values[n],i=e.values[n];return"any"===s.objectType||"any"===i.objectType||s.codedValue?.code===i.codedValue?.code}))))}_findMatchingContingenciesWithAnyHashMask(e,t){const n=RegExp(`${t}$`),s=[];for(const[i,o]of e){if(i===B)break;n.test(i)&&s.push(...o)}return s}_generateJoinKey(e,t){const n=Array.isArray(e)?new Set(e):e,s=Array.isArray(t)?new Set(t):t,i=n.size<s.size?n:s,o=i===n?s:n,{feature:r}=this,a=new Set,l=new Set;for(const u of i)if(o.has(u)){const e=this.layer?.getFieldDomain(u,{feature:r??void 0,excludeImpliedDomains:!0});if(null==e)continue;switch(e.type){case"coded-value":a.add(u);break;case"range":l.add(u)}}return{codedValueFields:[...a],rangeFields:[...l]}}_contingencyIsValid(e,t){const n={};for(const{name:s,value:i}of this.allFieldInputs)this.fieldsWithContingentValues.has(s)&&null!=i&&s!==e&&(n[s]=i);return Object.entries(n).every((([e,n])=>!t.values.hasOwnProperty(e)||U(n,t.values[e])))}_getContingentValueOptionsForField(e,t){const n=this.joinedContingentValues.slice(),s=new Map,i={code:"",name:t??"No value"};for(const o of n){const t=o.values[e];if("code"===t?.objectType||"null"===t?.objectType){const{code:n,name:r}=t.codedValue&&"null"!==t.objectType?t.codedValue:i;!s.has(n)&&this._contingencyIsValid(e,o)&&s.set(n,{name:r,value:n})}}return[...s.values()]}_hashContingency(e,t,n=!1){if(t.length<1)return[J,!1];const s=[];let i=!1;for(const o of t){const t=e.values[o];if("any"===t.objectType){if(n)return[B,!0];i=!0,s.push(`${o}:.*`)}else"null"===t.objectType?s.push(`${o}:${K}`):s.push(`${o}:${t.codedValue?.code}`)}return[s.sort().join("&"),i]}_compareObjectTypes(e,t){return{leftIsNull:"null"===e,rightIsNull:"null"===t,bothAreNull:"null"===e&&"null"===t,leftIsAny:"any"===e,rightIsAny:"any"===t,bothAreAny:"any"===e&&"any"===t,leftIsRange:"range"===e,rightIsRange:"range"===t}}get test(){return{featureClone:this._featureClone}}};function X(e){return"field"===e.type||"group"===e.type||"relationship"===e.type||"text"===e.type||"utilityNetworkAssociations"===e.type||(q().warn("form-info::unsupported-element-type","Only element types 'field', 'group' and 'relationship' are supported",`Element ${e.label} has unsupported type '${e.type}'`),!1)}function ee(e,t){const{feature:n,layer:s}=t;return new P({element:e,inputs:[],feature:n,layer:s})}function te(e,t,n=null){const{feature:s,layer:i,timeZone:o}=t;return new W({element:e,feature:s,group:n,layer:i,timeZone:o})}e([h()],Q.prototype,"_expressionInfosLookup",null),e([h()],Q.prototype,"_featureClone",void 0),e([h()],Q.prototype,"_timeZone",void 0),e([h()],Q.prototype,"activeAssociation",void 0),e([h()],Q.prototype,"activeAssociationInput",null),e([h()],Q.prototype,"activeRelationshipInput",null),e([h()],Q.prototype,"_arcadeContextInfo",null),e([h()],Q.prototype,"associationId",null),e([h()],Q.prototype,"associatedLayer",null),e([h()],Q.prototype,"allAssociationInputs",null),e([h()],Q.prototype,"allFieldInputs",null),e([h()],Q.prototype,"allGroupInputs",null),e([h()],Q.prototype,"allRelationshipInputs",null),e([h()],Q.prototype,"_layerFieldsByName",null),e([h()],Q.prototype,"arcadeEditType",void 0),e([h()],Q.prototype,"contingencyConstraintViolations",void 0),e([h()],Q.prototype,"disabled",void 0),e([h()],Q.prototype,"feature",null),e([h()],Q.prototype,"fieldsWithContingentValues",null),e([h({type:g})],Q.prototype,"formTemplate",null),e([h()],Q.prototype,"formDescription",null),e([h()],Q.prototype,"formTitle",null),e([h()],Q.prototype,"formHeaderVisible",null),e([h()],Q.prototype,"highlightHelper",void 0),e([h()],Q.prototype,"inputs",void 0),e([h()],Q.prototype,"joinedContingentValues",null),e([h()],Q.prototype,"layer",null),e([h()],Q.prototype,"map",void 0),e([h()],Q.prototype,"callbacks",void 0),e([h()],Q.prototype,"relationshipId",null),e([h()],Q.prototype,"spatialReference",null),e([h()],Q.prototype,"state",null),e([h()],Q.prototype,"strict",void 0),e([h()],Q.prototype,"submittable",null),e([h()],Q.prototype,"timeZone",null),e([h()],Q.prototype,"updating",null),e([h()],Q.prototype,"valid",null),e([h()],Q.prototype,"pendingSubtypeChoice",void 0),e([h()],Q.prototype,"getValues",null),e([h()],Q.prototype,"submit",null),e([h()],Q.prototype,"test",null),Q=e([f(Y)],Q);const ne=Q;export{ne as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{neverReached as n}from"../../core/compilerUtils.js";import s from"../../core/Evented.js";import i from"../../core/Logger.js";import{destroyMaybe as o}from"../../core/maybe.js";import r from"../../core/Promise.js";import{debounce as a}from"../../core/promiseUtils.js";import{watch as l,whenOnce as u,on as p,syncAndInitial as c}from"../../core/reactiveUtils.js";import{templateHasKey as d}from"../../core/string.js";import{property as h}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as m}from"../../core/support/UpdatingHandles.js";import g from"../../form/FormTemplate.js";import{isUtilityNetworkAssociationsElement as y,isGroupElement as _,isFieldElement as v,isRelationshipElement as I,isTextElement as x}from"../../form/support/formUtils.js";import E from"../../layers/support/ContingentValue.js";import{isEditableLayer as C}from"../../layers/support/editableLayers.js";import F from"../../layers/support/LayerContingentValuesCache.js";import{utc as b,unknown as V,system as w}from"../../time/constants.js";import{flattenAssociationInputs as A,flattenFieldInputs as j,isGroupInput as T,flattenRelationshipInputs as M,parseFormTemplateString as N,isRelationshipInput as k,isFieldInput as L,isTextElementInput as R,getNormalizedFeatureTypeInfo as S,valueIsValidContingentValue as H}from"./featureFormUtils.js";import U from"./FieldInput.js";import{FormExpressionsManager as Z}from"./FormExpressionsManager.js";import P from"./GroupInput.js";import O from"./RelationshipInput.js";import W from"./TextElementInput.js";import G from"./UtilityNetworkAssociationInput.js";import{createFormExpressionArcadeExecutor as $}from"../support/forms/expressions/FormExpressionArcadeExecutor.js";const D=new t({attributes:{}}),z={field:["editableExpression","requiredExpression","valueExpression","visibilityExpression"],group:["visibilityExpression"],relationship:["editableExpression","visibilityExpression"],text:["visibilityExpression"],utilityNetworkAssociations:["editableExpression","visibilityExpression"]},J="#JSAPI_CONTINGENT_VALUE_EMPTY_HASH",B="#JSAPI_CONTINGENT_VALUE_ANY_HASH",K="#JSAPI_CONTINGENT_VALUE_NULL_HASH",Y="esri.widgets.FeatureForm.FeatureFormViewModel",q=()=>i.getLogger(Y);let Q=class extends(r.EsriPromiseMixin(s.EventedAccessor)){constructor(e){super(e),this._expressionExecutorsInUse=new Set,this._expressionExecutorLookup=new Map,this._expressionsManager=null,this._contingentValuesCache=null,this._featureClone=D.clone(),this._initialFeature=D.clone(),this._timeZone=null,this._updatingHandles=new m,this.activeAssociation=null,this.arcadeEditType="NA",this.contingencyConstraintViolations=new Map,this.disabled=!1,this.highlightHelper=null,this.inputs=[],this.map=null,this.callbacks=null,this.strict=!1,this.pendingSubtypeChoice=null,this._updateInputs=a((async()=>{this._stopExpressions();const{_featureClone:e,_initialFeature:t,arcadeEditType:n,formTemplate:s,inputs:i,layer:o,timeZone:r}=this;if(!o)return;const a={arcadeEditType:n,feature:e,initialFeature:t,layer:o,timeZone:r},l=i.slice(),u=s?.elements&&s.elements.length>0?await this._updateInputsUsingFormElements(l,s.elements,a):this._updateInputsUsingLayerFields(l,o?.fields,a);this.inputs=u,await this._startExpressions()}))}initialize(){const e=l((()=>[this.layer,!!this.layer?.loaded,this.formTemplate,this.feature,this.timeZone,this.arcadeEditType]),(([e,t])=>{null!=e&&(t?this._updatingHandles.addPromise(this._updateInputs()):e.load().catch((()=>{})))}),c),t=l((()=>this._arcadeContextInfo),(e=>{null!=this._expressionsManager&&(this._expressionsManager.arcadeContextInfo=e,this._updatingHandles.addPromise(this._expressionsManager.evaluateAll().finally((()=>this._afterExpressionsEvaluated()))))})),n=l((()=>this.layer),(e=>{const t="subtype-sublayer"===e?.type?e.parent:"feature"===e?.type?e:null;t&&this.addResolvingPromise(F.createLoadedLayerContingentValuesCache(t).then((e=>{this._contingentValuesCache=e,this.notifyChange("fieldsWithContingentValues")})))}),{initial:!0});this.addHandles([e,t,n])}destroy(){this.feature=null,this.layer=null,this._contingentValuesCache=o(this._contingentValuesCache),this.highlightHelper?.removeAll(),this._updatingHandles.destroy()}get _expressionInfosLookup(){return new Map(this.formTemplate?.expressionInfos?.map((e=>[e.name,e])))}get activeAssociationInput(){return this.allAssociationInputs.find((e=>e.uid===this.associationId))}get activeRelationshipInput(){return this.allRelationshipInputs.find((e=>e.relationshipId===this.relationshipId))}get _arcadeContextInfo(){const{_initialFeature:e,arcadeEditType:t,layer:n,map:s,spatialReference:i,timeZone:o}=this;return{layer:C(n)?n:null,originalFeature:e,editType:t,map:s,spatialReference:i,timeZone:o}}get associationId(){return this._get("associationId")}set associationId(e){null==e&&this.activeAssociationInput?.viewModel&&(this.activeAssociationInput.associatedLayer=null,this.activeAssociationInput.viewModel.activeAssociationType=null),this._set("associationId",e)}get associatedLayer(){return this.activeAssociationInput?.associatedLayer}set associatedLayer(e){this.activeAssociationInput&&(this.activeAssociationInput.associatedLayer=e)}get allAssociationInputs(){return A(this.inputs)}get allFieldInputs(){return j(this.inputs)}get allGroupInputs(){return this.inputs.filter(T)}get allRelationshipInputs(){return M(this.inputs)}get _layerFieldsByName(){return new Map(this.layer?.fields.map((e=>[e.name,e])))}get feature(){return this._get("feature")}set feature(e){const t=this._get("feature");this._featureClone=e?e.clone():D.clone(),this._initialFeature=this._featureClone.clone(),this._expressionsManager&&(this._expressionsManager.feature=this._featureClone),e?(this._resetFieldInputValues(this._featureClone),this.allRelationshipInputs.forEach((t=>t.feature=e))):(this.inputs.forEach((e=>e.destroy())),this.inputs.length=0),t!==e&&(this.pendingSubtypeChoice=null),this.contingencyConstraintViolations.clear(),this._set("feature",e)}get fieldsWithContingentValues(){if(null==this._contingentValuesCache)return new Set;const e=this._contingentValuesCache.fieldGroups.flatMap((e=>e.fields));return new Set(e)}get formTemplate(){return this.layer&&"formTemplate"in this.layer?this.layer.formTemplate:null}set formTemplate(e){void 0===e?this._clearOverride("formTemplate"):this._override("formTemplate",e)}get formDescription(){const{formTemplate:e,layer:t}=this;return e?.description&&t?N({label:e.description,attributes:this.getValues(),fieldsIndex:t.fieldsIndex,timeZone:this.timeZone}):null}get formTitle(){const{formTemplate:e,layer:t}=this;return e?.title&&t?N({label:e.title,attributes:this.getValues(),fieldsIndex:t.fieldsIndex,timeZone:this.timeZone}):null}get formHeaderVisible(){const{activeRelationshipInput:e,activeAssociationInput:t,formDescription:n,formTitle:s}=this;return!(e||t||!n&&!s)}get joinedContingentValues(){return this._joinContingentValues()}get layer(){return this.feature?.sourceLayer&&"applyEdits"in this.feature.sourceLayer?this.feature.sourceLayer:null}set layer(e){this._override("layer",e)}get relationshipId(){return this._get("relationshipId")}set relationshipId(e){const t=this.allRelationshipInputs;if(null!=e&&e===this.relationshipId||t.forEach((e=>e.showAllEnabled=!1)),null!=e){const n=t.find((t=>t.relationshipId===e));n&&(n.showAllEnabled=!0)}this._set("relationshipId",e)}get spatialReference(){return this.layer?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){return this.layer?.loaded?"ready":"disabled"}get submittable(){return!!this.valid||this.allFieldInputs.filter((e=>!e.valid)).every((({submittable:e})=>e))}get timeZone(){const{layer:e}=this;if(e&&"datesInUnknownTimezone"in e&&e.datesInUnknownTimezone)return b;const t=e&&"preferredTimeZone"in e&&e.preferredTimeZone;return this._timeZone===V?t||b:this._timeZone||w}set timeZone(e){this._timeZone=e}get updating(){return this._updatingHandles.updating}get valid(){const e=this.allFieldInputs;return e.length>0&&e.every((({valid:e})=>e))}findField(e){return this.allFieldInputs.find((t=>t.name===e))}getFieldValueOptionsForField(e,t){const n=this.findField(e);if(!n)return[[],[],[]];const s="coded-value"===n.domain?.type?n.domain.codedValues.map((({name:e,code:t})=>({name:e,value:t}))):[],i=null==n.value||s.some((e=>e.value===n.value))?[]:[{name:`${n.value}`,value:n.value}],o=this.fieldsWithContingentValues.has(e)?this._getContingentValueOptionsForField(e,t):[];if(o.length>0){const e=new Set(o.map((e=>e.value)));return[o,s.filter((t=>!e.has(t.value))),i]}return[s,[],i]}getValue(e){const t=this.layer?.getField(e);if(null!=t)return this._featureClone.getAttribute(t.name)??null}setValue(e,t){const{_featureClone:n,strict:s}=this,i=this.findField(e);t=""===t?null:t,i&&n.getAttribute(e)!==t&&(i.value=t,s&&!i.valid||(this._afterValueChange(i),null!=this._expressionsManager&&this._updatingHandles.addPromise(this._expressionsManager.evaluateInvalidated([i.name]).finally((()=>this._afterExpressionsEvaluated())))))}getValues(){return{...this._featureClone.attributes}}overrideInitialFeature(e){this._initialFeature=e}submit(){const e=this.allFieldInputs,t=new Set(e.filter((e=>e.valid)).map((({name:e})=>e))),n=e.filter((e=>!e.valid)).map((({name:e})=>e)),s=this.getValues();if(this.validateContingencyConstraints(s,{includeIncompleteViolations:!0}).length>0)for(const[i,o]of this.contingencyConstraintViolations.entries())"error"===o.type&&(t.delete(i),n.push(i));this.notifyChange("submittable"),this.notifyChange("valid"),this.emit("submit",{valid:[...t],invalid:n,values:s})}validateContingencyConstraints(e,t){const{_contingentValuesCache:n}=this,s=new Map;if(this.contingencyConstraintViolations=s,null==n)return[];const{invalid:i,incomplete:o}=n.validateContingencyConstraints(e),r=[...i,...t?.includeIncompleteViolations?o:[]];for(const a of r)for(const e of a.fieldGroup.fields)s.set(e,a);return r}notifyFeatureGeometryChanged(){const{_expressionsManager:e,feature:t,_featureClone:n}=this;t&&(n.geometry=t.geometry,null!=e&&this._updatingHandles.addPromise(e.evaluateInvalidatedByGeometry().finally((()=>this._afterExpressionsEvaluated()))))}applySubtypeDefaults(e){const{defaultValues:t}=e,{allFieldInputs:n}=this;for(const{name:s}of n){const e=t[s];null!=e&&this.setValue(s,e)}}_emitChangeEvent({name:e,valid:t,value:n}){this.emit("value-change",{layer:this.layer,feature:this.feature,fieldName:e,value:n,valid:t})}async _updateInputsUsingFormElements(e,t,n){const s=new Map;for(const r of e)if(T(r)){s.set(r.element,r);for(const e of r.inputs)e.element&&s.set(e.element,e)}else r.element&&s.set(r.element,r);const i=new Map,o=await this._updateInputsUsingFormElementsRecursive({existingInputsByElement:s,updatedElements:t.filter(X),sharedInitializationProperties:n,group:null,newExpressionExecutorPromises:i});for(const[r,a]of s.entries())s.delete(r),a.destroy();return await Promise.all(Array.from(i.values())),o}async _updateInputsUsingFormElementsRecursive(e){const{existingInputsByElement:t,updatedElements:n,sharedInitializationProperties:s,group:i,newExpressionExecutorPromises:o}=e,r=[];for(const a of n){const e=t.has(a),n=e?t.get(a):this._makeInputFromElement(a,s,i);if(n){if(r.push(n),await u((()=>!n.updating)),this._assignExpressionExecutors(n,a,o),e)if(t.delete(a),T(n)){const{feature:e,timeZone:t}=s;n.set({feature:e,timeZone:t})}else if(k(n)){const e=this.relationshipId===a.relationshipId;n.set(s),n.set({map:this.map,showAllEnabled:e})}else y(n)?(n.set(s),n.set({map:this.map})):n.set(s);if(_(a)){const e=a.elements.filter((e=>X(e)));n.inputs=await this._updateInputsUsingFormElementsRecursive({existingInputsByElement:t,updatedElements:e,sharedInitializationProperties:s,group:n,newExpressionExecutorPromises:o})}}}return r}_updateInputsUsingLayerFields(e,t,n){if(!Array.isArray(t))return q().warn(this.declaredClass,"No attribute fields found."),[];const s=new Map;for(const o of e)if(T(o)){for(const e of o.inputs)e.destroy();o.inputs.length=0,o.destroy()}else k(o)?o.destroy():L(o)&&(null!==o.element?o.destroy():s.set(o.field,o));const i=[];for(const o of t){const e=n.feature?.getAttribute(o.name)??null,t=s.get(o)??new U({field:o,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden});i.push(t.set({...n,value:e})),s.delete(o)}for(const[o,r]of s.entries())s.delete(o),r.destroy();return i}_resetFieldInputValues(e){for(const t of this.allFieldInputs)t.value=e.getAttribute(t.name)}_makeInputFromElement(e,t,s){return _(e)?ee(e,t):v(e)?this._makeFieldInputFromElement(e,t,s):I(e)?this._makeRelationshipInputFromElement(e,t,s):y(e)?this._makeUtilityNetworkAssociationInputFromElement(e,t,s):x(e)?te(e,t):y(e)?this._makeUtilityNetworkAssociationInputFromElement(e,t,s):n()}_makeFieldInputFromElement(e,t,n){const{arcadeEditType:s,feature:i,initialFeature:o,layer:r,timeZone:a}=t,{fieldName:l}=e,u=l&&this._layerFieldsByName.get(l);return u?new U({arcadeEditType:s,element:e,field:u,value:i?.getAttribute(e.fieldName)??null,feature:i,initialFeature:o,layer:r,group:n,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden,timeZone:a}):null}_makeRelationshipInputFromElement(e,t,n=null){const{map:s}=this,{feature:i,layer:o,timeZone:r}=t,a=new O({element:e,feature:i,group:n,layer:o,map:s,timeZone:r});return a.addHandles(p((()=>a.relatedLayer),"edits",(()=>this._expressionsManager?.evaluateAsyncExpressions()))),a}_makeUtilityNetworkAssociationInputFromElement(e,t,n=null){const{map:s}=this,{feature:i,layer:o,timeZone:r}=t;return new G({element:e,feature:i,group:n,layer:o,map:s,timeZone:r})}_assignExpressionExecutors(e,t,n){const s=z[t.type],i=[];for(const o of s){const s=`${o}Executor`;if(e[s]){this._useExecutor(e[s]);continue}const r=t[o];if(null!=r&&""!==r){const t=this._expressionInfosLookup.get(r)?.expression??r;i.push(this._getOrCreateExecutorForExpression(t,n).then((t=>{e[s]=this._useExecutor(t)})))}}return R(e)&&i.push(...this._assignTextElementExpressionExecutors(e,n)),i}_assignTextElementExpressionExecutors(e,t){const{_expressionInfosLookup:n}=this,s=[];for(const o of e.expressionsUsed){const r=n.get(o);null!=r?s.push(this._getOrCreateExecutorForExpression(r.expression,t).then((t=>e.setExpressionExecutor(o,this._useExecutor(t))))):i.getLogger(this).error("feature-form:expression-not-found",`Could not find expressionInfo object with name '${o}'`)}for(const i of e.fieldsUsed){const n=`return $feature['${i}'];`;s.push(this._getOrCreateExecutorForExpression(n,t).then((t=>e.setFieldExecutor(i,this._useExecutor(t)))))}return s}async _getOrCreateExecutorForExpression(e,t){const{_expressionExecutorLookup:n}=this;if(n.has(e))return n.get(e);if(t.has(e))return t.get(e);const s=$(e,this.layer);t.set(e,s);const i=await s;return n.set(e,i),i}_createExpressionsManager(e){const{_arcadeContextInfo:t,_featureClone:n,allFieldInputs:s,formTemplate:i}=this;this._expressionsManager=new Z({executors:e,feature:n,arcadeContextInfo:t,fieldInputs:s,preserveFieldValuesWhenHidden:!0===i?.preserveFieldValuesWhenHidden})}async _startExpressions(){if(0===this._expressionExecutorsInUse.size)return;const e=Array.from(this._expressionExecutorsInUse);this._createExpressionsManager(e),await this._expressionsManager.evaluateAll().finally((()=>this._afterExpressionsEvaluated()))}_stopExpressions(){this._expressionsManager=o(this._expressionsManager),this._expressionExecutorsInUse.clear()}_useExecutor(e){return this._expressionExecutorsInUse.add(e),e}_afterValueChange(e){const{name:t,value:n}=e,{_featureClone:s,formTemplate:i,layer:o}=this;if(!o)return;const r=s.getAttribute(t);s.setAttribute(t,n);const{typeFieldName:a,types:l}=S(o);if((e.isSubtypeField||t===a)&&n!==r){if("subtype-sublayer"===o.type){const e=o.parent?.findSublayerForFeature(s);this.feature&&(this.feature.sourceLayer=e),s.sourceLayer=e}const e=new Set;for(const t of l)if(t.domains&&"object"==typeof t.domains)for(const n of Object.keys(t.domains))e.add(n);for(const t of e){const e=this.findField(t);e&&e.notifyChange("domain")}this.notifyChange("joinedContingentValues")}if(null!=i){const{description:e,title:n}=i;n&&d(n,t)&&this.notifyChange("formTitle"),e&&d(e,t)&&this.notifyChange("formDescription")}this._emitChangeEvent(e)}_afterExpressionsEvaluated(){const{_featureClone:e}=this;for(const t of this.allFieldInputs)t.value!==e.getAttribute(t.name)&&this._afterValueChange(t)}_joinContingentValues(){const e=this._contingentValuesCache;if(null==e)return[];const{typeFieldName:t}=S(this.layer),n=t?this.getValue(t):null,s=[];for(const r of e.fieldGroups){const{contingencies:e,fields:t,name:i}=r,o=[];for(const s of e)s.isRetired||null!=s.subtype&&s.subtype.code!==n||o.push({values:s.values});o.length>0&&s.push({name:i,fields:t,contingencies:o})}const[i,o]=this._generateJoinPlan(s);return[...i.flatMap((e=>this._joinFieldGroupContingencies(e))),...o.flatMap((e=>e.contingencies))]}_generateJoinPlan(e){const t=new Map,n=[],s=new Set;for(const l of e)for(const e of l.fields)if(t.has(e)){const i=t.get(e),o=l,r=[i.name,o.name].sort().join("|");if(s.has(r))continue;n.push([i,o]),s.add(r),t.set(e,o)}else t.set(e,l);const i=new Set(n.flat()),o=new Set(e);for(const l of i)o.delete(l);const r=new Map,a=new Map;for(const l of new Set(n.flat())){const e=Symbol(l.name);r.set(e,new Set([l])),a.set(l,e)}for(const[l,u]of n){const e=a.get(l),t=a.get(u);if(e===t)continue;const n=r.get(e),s=r.get(t);for(const i of s)n.add(i),a.set(i,e);r.delete(t)}return[[...r.values()].map((e=>[...e])),[...o]]}_joinFieldGroupContingencies(e){const t=e.slice(),n=t.shift();let s=t.shift(),i=this._generateJoinKey(n.fields,s.fields),o=new Set([...n.fields,...s.fields]),r=new Map;for(const l of n.contingencies){const[e]=this._hashContingency(l,i.codedValueFields,!0);r.has(e)?r.get(e)?.push(l):r.set(e,[l])}for(;t.length>0;){const e=new Map,n=t.shift(),a=this._generateJoinKey(o,n.fields);for(const t of s.contingencies){const[n,s]=this._hashContingency(t,i.codedValueFields),o=s?this._findMatchingContingenciesWithAnyHashMask(r,n):r.get(n);if(r.has(B)&&o?.push(...this._findMatchingContingenciesContainingAny(t,r.get(B),i.codedValueFields)),null!=o)for(const r of o){const n=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(r,t,i.rangeFields):this._joinContingencies(r,t);if(null==n)break;const[s]=this._hashContingency(n,a.codedValueFields,!0);e.has(s)?e.get(s)?.push(n):e.set(s,[n])}}r=e,s=n,i=a,o=new Set([...o,...s.fields])}const a=[];for(const l of s.contingencies){const[e,t]=this._hashContingency(l,i.codedValueFields),n=t?this._findMatchingContingenciesWithAnyHashMask(r,e):r.get(e);if(r.has(B)&&n.push(...this._findMatchingContingenciesContainingAny(l,r.get(B),i.codedValueFields)),null!=n)for(const s of n){const e=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(s,l,i.rangeFields):this._joinContingencies(s,l);null!=e&&a.push(e)}}return a}_joinContingencies(e,t){const n={values:{...e.values,...t.values}};for(const[s,i]of Object.entries(n.values))"any"===i.objectType&&null!=e.values[s]&&(n.values[s]=e.values[s]);return n}_joinContingenciesWithRangeDomains(e,t,n){const s=this._joinContingencies(e,t);for(const i of n){const n=e.values[i],o=t.values[i],{leftIsNull:r,rightIsNull:a,bothAreNull:l,leftIsAny:u,rightIsAny:p,bothAreAny:c,leftIsRange:d,rightIsRange:h}=this._compareObjectTypes(n.objectType,o.objectType);if(l||c)continue;if(r&&p||a&&u){s.values[i]=new E({objectType:"null"});continue}if(r&&h||a&&d)return null;u?(n.minValue=-1/0,n.maxValue=1/0):p&&(o.minValue=-1/0,o.maxValue=1/0);const f=Math.max(n.minValue,o.minValue),m=Math.min(n.maxValue,o.maxValue);if(f>m)return null;s.values[i]=new E({objectType:"range",minValue:f,maxValue:m})}return s}_findMatchingContingenciesContainingAny(e,t,n){return t.filter((t=>n.every((n=>{const s=t.values[n],i=e.values[n];return"any"===s.objectType||"any"===i.objectType||s.codedValue?.code===i.codedValue?.code}))))}_findMatchingContingenciesWithAnyHashMask(e,t){const n=RegExp(`${t}$`),s=[];for(const[i,o]of e){if(i===B)break;n.test(i)&&s.push(...o)}return s}_generateJoinKey(e,t){const n=Array.isArray(e)?new Set(e):e,s=Array.isArray(t)?new Set(t):t,i=n.size<s.size?n:s,o=i===n?s:n,{feature:r}=this,a=new Set,l=new Set;for(const u of i)if(o.has(u)){const e=this.layer?.getFieldDomain(u,{feature:r??void 0,excludeImpliedDomains:!0});if(null==e)continue;switch(e.type){case"coded-value":a.add(u);break;case"range":l.add(u)}}return{codedValueFields:[...a],rangeFields:[...l]}}_contingencyIsValid(e,t){const n={};for(const{name:s,value:i}of this.allFieldInputs)this.fieldsWithContingentValues.has(s)&&null!=i&&s!==e&&(n[s]=i);return Object.entries(n).every((([e,n])=>!t.values.hasOwnProperty(e)||H(n,t.values[e])))}_getContingentValueOptionsForField(e,t){const n=this.joinedContingentValues.slice(),s=new Map,i={code:"",name:t??"No value"};for(const o of n){const t=o.values[e];if("code"===t?.objectType||"null"===t?.objectType){const{code:n,name:r}=t.codedValue&&"null"!==t.objectType?t.codedValue:i;!s.has(n)&&this._contingencyIsValid(e,o)&&s.set(n,{name:r,value:n})}}return[...s.values()]}_hashContingency(e,t,n=!1){if(t.length<1)return[J,!1];const s=[];let i=!1;for(const o of t){const t=e.values[o];if("any"===t.objectType){if(n)return[B,!0];i=!0,s.push(`${o}:.*`)}else"null"===t.objectType?s.push(`${o}:${K}`):s.push(`${o}:${t.codedValue?.code}`)}return[s.sort().join("&"),i]}_compareObjectTypes(e,t){return{leftIsNull:"null"===e,rightIsNull:"null"===t,bothAreNull:"null"===e&&"null"===t,leftIsAny:"any"===e,rightIsAny:"any"===t,bothAreAny:"any"===e&&"any"===t,leftIsRange:"range"===e,rightIsRange:"range"===t}}get test(){return{featureClone:this._featureClone}}};function X(e){return"field"===e.type||"group"===e.type||"relationship"===e.type||"text"===e.type||"utilityNetworkAssociations"===e.type||(q().warn("form-info::unsupported-element-type","Only element types 'field', 'group' and 'relationship' are supported",`Element ${e.label} has unsupported type '${e.type}'`),!1)}function ee(e,t){const{feature:n,layer:s}=t;return new P({element:e,inputs:[],feature:n,layer:s})}function te(e,t,n=null){const{feature:s,layer:i,timeZone:o}=t;return new W({element:e,feature:s,group:n,layer:i,timeZone:o})}e([h()],Q.prototype,"_expressionInfosLookup",null),e([h()],Q.prototype,"_featureClone",void 0),e([h()],Q.prototype,"_timeZone",void 0),e([h()],Q.prototype,"activeAssociation",void 0),e([h()],Q.prototype,"activeAssociationInput",null),e([h()],Q.prototype,"activeRelationshipInput",null),e([h()],Q.prototype,"_arcadeContextInfo",null),e([h()],Q.prototype,"associationId",null),e([h()],Q.prototype,"associatedLayer",null),e([h()],Q.prototype,"allAssociationInputs",null),e([h()],Q.prototype,"allFieldInputs",null),e([h()],Q.prototype,"allGroupInputs",null),e([h()],Q.prototype,"allRelationshipInputs",null),e([h()],Q.prototype,"_layerFieldsByName",null),e([h()],Q.prototype,"arcadeEditType",void 0),e([h()],Q.prototype,"contingencyConstraintViolations",void 0),e([h()],Q.prototype,"disabled",void 0),e([h()],Q.prototype,"feature",null),e([h()],Q.prototype,"fieldsWithContingentValues",null),e([h({type:g})],Q.prototype,"formTemplate",null),e([h()],Q.prototype,"formDescription",null),e([h()],Q.prototype,"formTitle",null),e([h()],Q.prototype,"formHeaderVisible",null),e([h()],Q.prototype,"highlightHelper",void 0),e([h()],Q.prototype,"inputs",void 0),e([h()],Q.prototype,"joinedContingentValues",null),e([h()],Q.prototype,"layer",null),e([h()],Q.prototype,"map",void 0),e([h()],Q.prototype,"callbacks",void 0),e([h()],Q.prototype,"relationshipId",null),e([h()],Q.prototype,"spatialReference",null),e([h()],Q.prototype,"state",null),e([h()],Q.prototype,"strict",void 0),e([h()],Q.prototype,"submittable",null),e([h()],Q.prototype,"timeZone",null),e([h()],Q.prototype,"updating",null),e([h()],Q.prototype,"valid",null),e([h()],Q.prototype,"pendingSubtypeChoice",void 0),e([h()],Q.prototype,"getValues",null),e([h()],Q.prototype,"submit",null),e([h()],Q.prototype,"test",null),Q=e([f(Y)],Q);const ne=Q;export{ne 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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import r from"../../core/Accessor.js";import{createTask as o}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import{abortMaybe as a}from"../../core/maybe.js";import{ignoreAbortErrors as i,debounce as n}from"../../core/promiseUtils.js";import{watch as u,initial as l}from"../../core/reactiveUtils.js";import{sqlAnd as c}from"../../core/sql.js";import{property as y}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as p}from"../../core/support/UpdatingHandles.js";import{isLayerFromCatalog as d}from"../../layers/catalog/catalogUtils.js";import{isSubtypeSublayer as g,isKnowledgeGraphLayer as _,isSubtypeGroupLayer as m}from"../../layers/support/layerUtils.js";import{isAssociatedFeatureSupportedLayer as f}from"../Feature/support/featureUtils.js";import{isMapImageLayer as C}from"../FeatureTable/support/tableUtils.js";import{createAssociation as b,getFeatureTitle as A}from"../support/UtilityNetworkAssociations/utilityNetworkUtils.js";const F=100,q="association-key";let w=class extends r{constructor(e){super(e),this.graphic=null,this.layer=null,this.map=null,this.utilityNetwork=null,this.associationType=null,this.featureCount=0,this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.featuresPerPage=30,this.selectedFeature=null,this.association=null,this.filterOptionsVisible=!1,this.filterWhereClause=null,this._rulesTable=null,this._canAssociate=!1,this._whereClause=null,this._setUpItemsTask=null,this._updatingHandlesSetUp=new p,this._validateAssociationTask=null,this._updatingHandlesAssociation=new p,this._cancelQuery=()=>{const{_queryAbortController:e}=this;e&&e.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{const{_queryFeatureCountAbortController:e}=this;e&&e.abort(),this._queryFeatureCountAbortController=null},this._cancelQueryPage=()=>{const{_queryPageAbortController:e}=this;e&&e.abort(),this._queryPageAbortController=null},this._queryController=async()=>{this._cancelQuery();const e=new AbortController;this._queryAbortController=e,await i(this._query()).catch((()=>this._cancelQuery())),this._queryAbortController===e&&(this._queryAbortController=null)},this._queryFeatureCountController=async e=>{this._cancelQueryFeatureCount();const t=new AbortController;this._queryFeatureCountAbortController=t,await i(this._queryFeatureCount(e)).catch((()=>this._cancelQueryFeatureCount())),this._queryFeatureCountAbortController===t&&(this._queryFeatureCountAbortController=null)},this._queryPageController=async()=>{const e=new AbortController;this._queryPageAbortController=e,await i(this._queryPage()).catch((()=>this._cancelQueryPage())),this._queryPageAbortController===e&&(this._queryPageAbortController=null)},this._queryDebounced=n(this._queryController,F),this._queryFeatureCountDebounced=n(this._queryFeatureCountController,F),this._queryPageDebounced=n(this._queryPageController,F)}initialize(){this.addHandles([u((()=>[this.graphic,this.layer,this.map,this.utilityNetwork,this.globalId,this.associationType]),(()=>this._syncLayerItems()),l),u((()=>[this.selectedLayer,this.filterWhereClause]),(()=>{this.selectedLayer&&this._setUpFeatures()})),u((()=>this.selectedFeature),(()=>{this._setUpAssociation()})),u((()=>[this.featureCount,this.featuresPerPage,this.map,this.graphic,this.associationType]),(()=>this._queryDebounced())),u((()=>this.featurePage),(()=>this._queryPageDebounced()))])}destroy(){this._setUpItemsTask=a(this._setUpItemsTask),this._updatingHandlesSetUp.destroy(),this._validateAssociationTask=a(this._validateAssociationTask),this._updatingHandlesAssociation.destroy(),this._cancelQuery(),this._cancelQueryFeatureCount(),this._cancelQueryPage()}get mapLayers(){const{map:e}=this;if(!e)return null;const t=new Set,r=e=>{!f(e)||m(e)||t.has(e)||t.add(e)},o=e=>{d(e)||"catalog-footprint"===e.type||(_(e)?(e.layers?.forEach(r),e.tables?.forEach(r)):C(e)?(e.sublayers?.forEach(r),e.subtables?.forEach(r)):m(e)?e.sublayers?.forEach(r):r(e))};return e.allLayers.forEach(o),e.allTables.forEach(o),new s([...t])}get state(){const{_queryAbortController:e,_queryPageAbortController:t,canQuery:r}=this;return this.canLoad&&this._updatingHandlesSetUp.updating?"loading":this._updatingHandlesAssociation.updating?"validating":e||t?"querying":r?"ready":"disabled"}get canAddAssociation(){return!(this.updating||!this.association)&&this._canAssociate}get globalId(){return(this.globalIdField&&this.graphic?.attributes?.[this.globalIdField])??null}get globalIdField(){const{layer:e}=this;return e?.globalIdField??null}get layerItems(){return this._get("layerItems")||new s}get featureItems(){return this._get("featureItems")||new s}set featurePage(e){const{featuresPerPage:t,featureCount:r}=this,o=1,s=Math.ceil(r/t)||1;this._set("featurePage",Math.min(Math.max(e,o),s))}get featurePage(){return this._get("featurePage")}get canLoad(){const{map:e,utilityNetwork:t,graphic:r,associationType:o}=this;return!!(e&&t&&r&&o)}get canQuery(){const{utilityNetwork:e,graphic:t,associationType:r,selectedLayer:o}=this;return!!(e&&t&&r&&o)}get updating(){return this._updatingHandlesSetUp.updating||this._updatingHandlesAssociation.updating}get selectedLayer(){return this._get("selectedLayer")}set selectedLayer(e){e!==this.selectedLayer&&(this.filterWhereClause=null),this._set("selectedLayer",e)}get queryWhereClause(){const{_whereClause:e,filterWhereClause:t}=this;return c(e,t)}async _queryFeatureCount(e){const{selectedLayer:t,_queryFeatureCountAbortController:r}=this;if(this._set("featureCount",0),!t)return;await t.load();const o=t.createQuery();o.returnGeometry=!1,o.where=c(o.where,e);const s=await t.queryFeatureCount(o,{signal:r?.signal});s>0&&this._set("featureCount",s)}async _query(){const{canQuery:e,queryWhereClause:t,_queryAbortController:r,featureItems:o}=this;e&&(this.featurePage=1,o.destroyAll(),this.featureCount&&!this.destroyed&&o.addMany(await this._queryAssociatedFeatures(t,{signal:r?.signal})))}async _queryPage(){const{canQuery:e,queryWhereClause:t,featurePage:r,_queryPageAbortController:o,featureCount:s,featureItems:a}=this;e&&(r<2||!s||a.addMany(await this._queryAssociatedFeatures(t,{signal:o?.signal})))}_convertTypeToDirection(e){switch(e){case"attachment":return[{type:"attachment",direction:"from"}];case"connectivity":return[{type:"junction-junction-connectivity"},{type:"junction-edge-from-connectivity"},{type:"junction-edge-midspan-connectivity"},{type:"junction-edge-to-connectivity"}];case"container":return[{type:"containment",direction:"to"}];case"content":return[{type:"containment",direction:"from"}];case"structure":return[{type:"attachment",direction:"to"}]}}async getRulesTable(){const{utilityNetwork:e}=this;if(!e)return null;if(this._rulesTable)return this._rulesTable;const t=await e.getRulesTable();return await(t?.load()),this._rulesTable=t,t}async _syncLayerItems(){a(this._setUpItemsTask);const{graphic:e,associationType:t,layerItems:r,canLoad:s}=this,i=o((async o=>{if(this.selectedLayer=null,r.destroyAll(),!s)return;const a=this.mapLayers?.toArray();if(!a)return;if(o.aborted)return;const i=await this.getRulesTable(),n=this._convertTypeToDirection(t.type),u=i?.getLayersCanAssociateWith(e,a,n);o.aborted||r.addMany(u||[])}));this._updatingHandlesSetUp.addPromise(i.promise),this._setUpItemsTask=i}async _setUpFeatures(){a(this._setUpItemsTask);const{graphic:e,associationType:t,selectedLayer:r,canQuery:s}=this;if(!s)return;const i=o((async o=>{const s=await this.getRulesTable(),a=this._convertTypeToDirection(t.type),i=s?.getFeaturesCanAssociateWithClause(e,r,a);this._whereClause=i,o.aborted||this._queryFeatureCountDebounced(this.queryWhereClause)}));this._updatingHandlesSetUp.addPromise(i.promise),this._setUpItemsTask=i}_determineFromAndTo(e,t,r){return"from"===r?{fromFeature:e,toFeature:t}:{fromFeature:t,toFeature:e}}_determineJunctionEdgeConnectivity(e,t){const{utilityNetwork:r}=this,o=g(e.sourceLayer)?e.sourceLayer.parent:e.sourceLayer,s=g(t.sourceLayer)?t.sourceLayer.parent:t.sourceLayer;if(!(r&&o&&"layerId"in o&&s&&"layerId"in s))return{fromFeature:e,toFeature:t,type:"junction-junction-connectivity"};const a=r.getSourceIdByLayerId(o.layerId),i=r.getSourceIdByLayerId(s.layerId);if(!a||!i)return{fromFeature:e,toFeature:t,type:"junction-junction-connectivity"};const n="junction"===r.getSourceTypeById(a),u="junction"===r.getSourceTypeById(i);return n&&u?{fromFeature:e,toFeature:t,type:"junction-junction-connectivity"}:u?{fromFeature:t,toFeature:e,type:"junction-edge-midspan-connectivity"}:{fromFeature:e,toFeature:t,type:"junction-edge-midspan-connectivity"}}_setUpAssociationHandles(){this.removeHandles(q),this.association&&this.addHandles(u((()=>[this.association?.associationType,this.association?.fromNetworkElement,this.association?.fromNetworkElement?.terminalId,this.association?.toNetworkElement,this.association?.toNetworkElement?.terminalId]),(()=>this.validateAssociation()),l),q)}_setUpAssociation(){const{utilityNetwork:e,graphic:t,selectedFeature:r,associationType:o}=this;if(!(e&&t&&r&&o))return void(this.association=null);const s=this._convertTypeToDirection(o.type);if(s.length>1){const{fromFeature:o,toFeature:s,type:a}=this._determineJunctionEdgeConnectivity(t,r.feature);return this.association=b({fromFeature:o,toFeature:s,utilityNetwork:e,associationType:a}),void this._setUpAssociationHandles()}const{fromFeature:a,toFeature:i}=this._determineFromAndTo(t,r.feature,s[0].direction);this.association=b({fromFeature:a,toFeature:i,utilityNetwork:e,associationType:s[0].type}),this._setUpAssociationHandles()}async _processFeatures(e){return Promise.all(e.map((async e=>{const{sourceLayer:t}=e;return t&&"getFeatureTitle"in t?{label:await t.getFeatureTitle(e),feature:e}:{label:A(e),feature:e}})))}async _queryAssociatedFeatures(e,t){const{featuresPerPage:r,layer:o,featurePage:s,featureCount:a,selectedLayer:i}=this,{canQuery:n,globalId:u}=this;if(!n||!o||!i||null==u)return[];const l=((s-1)*r+a)%a,y=r,{historicMoment:h,gdbVersion:p}=i,d=i.createQuery();d.where=c(d.where,e),d.start=l,d.num=y,d.returnGeometry=!1,d.historicMoment=h,d.gdbVersion=p,d.outFields=["*"];const g=await i.queryFeatures(d,{signal:t?.signal});return await this._processFeatures(g.features)}validateAssociation(){a(this._validateAssociationTask);const{utilityNetwork:e,association:t}=this,r=o((async()=>{e&&t&&(this._canAssociate=await e.canAddAssociation(t))}));this._updatingHandlesAssociation.addPromise(r.promise),this._validateAssociationTask=r}};e([y({type:t})],w.prototype,"graphic",void 0),e([y()],w.prototype,"layer",void 0),e([y()],w.prototype,"map",void 0),e([y({readOnly:!0})],w.prototype,"mapLayers",null),e([y()],w.prototype,"utilityNetwork",void 0),e([y()],w.prototype,"associationType",void 0),e([y()],w.prototype,"state",null),e([y({readOnly:!0})],w.prototype,"canAddAssociation",null),e([y({readOnly:!0})],w.prototype,"globalId",null),e([y({readOnly:!0})],w.prototype,"globalIdField",null),e([y()],w.prototype,"featureCount",void 0),e([y({readOnly:!0})],w.prototype,"layerItems",null),e([y({readOnly:!0})],w.prototype,"featureItems",null),e([y()],w.prototype,"_queryAbortController",void 0),e([y()],w.prototype,"_queryPageAbortController",void 0),e([y()],w.prototype,"_queryFeatureCountAbortController",void 0),e([y({value:1})],w.prototype,"featurePage",null),e([y()],w.prototype,"featuresPerPage",void 0),e([y({readOnly:!0})],w.prototype,"canLoad",null),e([y({readOnly:!0})],w.prototype,"canQuery",null),e([y({readOnly:!0})],w.prototype,"updating",null),e([y()],w.prototype,"selectedLayer",null),e([y()],w.prototype,"selectedFeature",void 0),e([y()],w.prototype,"association",void 0),e([y()],w.prototype,"filterOptionsVisible",void 0),e([y()],w.prototype,"filterWhereClause",void 0),e([y()],w.prototype,"queryWhereClause",null),e([y()],w.prototype,"_rulesTable",void 0),e([y()],w.prototype,"_canAssociate",void 0),e([y()],w.prototype,"_whereClause",void 0),w=e([h("esri.widgets.FeatureForm.UtilityNetworkAssociationAddAssociationViewModel")],w);const T=w;export{T as default};
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../Graphic.js";import r from"../../core/Accessor.js";import{createTask as o}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import{abortMaybe as a}from"../../core/maybe.js";import{ignoreAbortErrors as i,debounce as n}from"../../core/promiseUtils.js";import{watch as u,initial as l}from"../../core/reactiveUtils.js";import{sqlAnd as c}from"../../core/sql.js";import{property as y}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as p}from"../../core/support/UpdatingHandles.js";import{isLayerFromCatalog as d}from"../../layers/catalog/catalogUtils.js";import{isSubtypeSublayer as g,isKnowledgeGraphLayer as m,isSubtypeGroupLayer as _}from"../../layers/support/layerUtils.js";import{isAssociatedFeatureSupportedLayer as f}from"../Feature/support/featureUtils.js";import{isMapImageLayer as C}from"../FeatureTable/support/tableUtils.js";import{createAssociation as b}from"../support/UtilityNetworkAssociations/utils/createAssociation.js";import{getFeatureTitle as A}from"../support/UtilityNetworkAssociations/utils/getFeatureTitle.js";const F=100,q="association-key";let w=class extends r{constructor(t){super(t),this.graphic=null,this.layer=null,this.map=null,this.utilityNetwork=null,this.associationType=null,this.featureCount=0,this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.featuresPerPage=30,this.selectedFeature=null,this.association=null,this.filterOptionsVisible=!1,this.filterWhereClause=null,this._rulesTable=null,this._canAssociate=!1,this._whereClause=null,this._setUpItemsTask=null,this._updatingHandlesSetUp=new p,this._validateAssociationTask=null,this._updatingHandlesAssociation=new p,this._cancelQuery=()=>{const{_queryAbortController:t}=this;t&&t.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{const{_queryFeatureCountAbortController:t}=this;t&&t.abort(),this._queryFeatureCountAbortController=null},this._cancelQueryPage=()=>{const{_queryPageAbortController:t}=this;t&&t.abort(),this._queryPageAbortController=null},this._queryController=async()=>{this._cancelQuery();const t=new AbortController;this._queryAbortController=t,await i(this._query()).catch((()=>this._cancelQuery())),this._queryAbortController===t&&(this._queryAbortController=null)},this._queryFeatureCountController=async t=>{this._cancelQueryFeatureCount();const e=new AbortController;this._queryFeatureCountAbortController=e,await i(this._queryFeatureCount(t)).catch((()=>this._cancelQueryFeatureCount())),this._queryFeatureCountAbortController===e&&(this._queryFeatureCountAbortController=null)},this._queryPageController=async()=>{const t=new AbortController;this._queryPageAbortController=t,await i(this._queryPage()).catch((()=>this._cancelQueryPage())),this._queryPageAbortController===t&&(this._queryPageAbortController=null)},this._queryDebounced=n(this._queryController,F),this._queryFeatureCountDebounced=n(this._queryFeatureCountController,F),this._queryPageDebounced=n(this._queryPageController,F)}initialize(){this.addHandles([u((()=>[this.graphic,this.layer,this.map,this.utilityNetwork,this.globalId,this.associationType]),(()=>this._syncLayerItems()),l),u((()=>[this.selectedLayer,this.filterWhereClause]),(()=>{this.selectedLayer&&this._setUpFeatures()})),u((()=>this.selectedFeature),(()=>{this._setUpAssociation()})),u((()=>[this.featureCount,this.featuresPerPage,this.map,this.graphic,this.associationType]),(()=>this._queryDebounced())),u((()=>this.featurePage),(()=>this._queryPageDebounced()))])}destroy(){this._setUpItemsTask=a(this._setUpItemsTask),this._updatingHandlesSetUp.destroy(),this._validateAssociationTask=a(this._validateAssociationTask),this._updatingHandlesAssociation.destroy(),this._cancelQuery(),this._cancelQueryFeatureCount(),this._cancelQueryPage()}get mapLayers(){const{map:t}=this;if(!t)return null;const e=new Set,r=t=>{!f(t)||_(t)||e.has(t)||e.add(t)},o=t=>{d(t)||"catalog-footprint"===t.type||(m(t)?(t.layers?.forEach(r),t.tables?.forEach(r)):C(t)?(t.sublayers?.forEach(r),t.subtables?.forEach(r)):_(t)?t.sublayers?.forEach(r):r(t))};return t.allLayers.forEach(o),t.allTables.forEach(o),new s([...e])}get state(){const{_queryAbortController:t,_queryPageAbortController:e,canQuery:r}=this;return this.canLoad&&this._updatingHandlesSetUp.updating?"loading":this._updatingHandlesAssociation.updating?"validating":t||e?"querying":r?"ready":"disabled"}get canAddAssociation(){return!(this.updating||!this.association)&&this._canAssociate}get globalId(){return(this.globalIdField&&this.graphic?.attributes?.[this.globalIdField])??null}get globalIdField(){const{layer:t}=this;return t?.globalIdField??null}get layerItems(){return this._get("layerItems")||new s}get featureItems(){return this._get("featureItems")||new s}set featurePage(t){const{featuresPerPage:e,featureCount:r}=this,o=1,s=Math.ceil(r/e)||1;this._set("featurePage",Math.min(Math.max(t,o),s))}get featurePage(){return this._get("featurePage")}get canLoad(){const{map:t,utilityNetwork:e,graphic:r,associationType:o}=this;return!!(t&&e&&r&&o)}get canQuery(){const{utilityNetwork:t,graphic:e,associationType:r,selectedLayer:o}=this;return!!(t&&e&&r&&o)}get updating(){return this._updatingHandlesSetUp.updating||this._updatingHandlesAssociation.updating}get selectedLayer(){return this._get("selectedLayer")}set selectedLayer(t){t!==this.selectedLayer&&(this.filterWhereClause=null),this._set("selectedLayer",t)}get queryWhereClause(){const{_whereClause:t,filterWhereClause:e}=this;return c(t,e)}async _queryFeatureCount(t){const{selectedLayer:e,_queryFeatureCountAbortController:r}=this;if(this._set("featureCount",0),!e)return;await e.load();const o=e.createQuery();o.returnGeometry=!1,o.where=c(o.where,t);const s=await e.queryFeatureCount(o,{signal:r?.signal});s>0&&this._set("featureCount",s)}async _query(){const{canQuery:t,queryWhereClause:e,_queryAbortController:r,featureItems:o}=this;t&&(this.featurePage=1,o.destroyAll(),this.featureCount&&!this.destroyed&&o.addMany(await this._queryAssociatedFeatures(e,{signal:r?.signal})))}async _queryPage(){const{canQuery:t,queryWhereClause:e,featurePage:r,_queryPageAbortController:o,featureCount:s,featureItems:a}=this;t&&(r<2||!s||a.addMany(await this._queryAssociatedFeatures(e,{signal:o?.signal})))}_convertTypeToDirection(t){switch(t){case"attachment":return[{type:"attachment",direction:"from"}];case"connectivity":return[{type:"junction-junction-connectivity"},{type:"junction-edge-from-connectivity"},{type:"junction-edge-midspan-connectivity"},{type:"junction-edge-to-connectivity"}];case"container":return[{type:"containment",direction:"to"}];case"content":return[{type:"containment",direction:"from"}];case"structure":return[{type:"attachment",direction:"to"}]}}async getRulesTable(){const{utilityNetwork:t}=this;if(!t)return null;if(this._rulesTable)return this._rulesTable;const e=await t.getRulesTable();return await(e?.load()),this._rulesTable=e,e}async _syncLayerItems(){a(this._setUpItemsTask);const{graphic:t,associationType:e,layerItems:r,canLoad:s}=this,i=o((async o=>{if(this.selectedLayer=null,r.destroyAll(),!s)return;const a=this.mapLayers?.toArray();if(!a)return;if(o.aborted)return;const i=await this.getRulesTable(),n=this._convertTypeToDirection(e.type),u=i?.getLayersCanAssociateWith(t,a,n);o.aborted||r.addMany(u||[])}));this._updatingHandlesSetUp.addPromise(i.promise),this._setUpItemsTask=i}async _setUpFeatures(){a(this._setUpItemsTask);const{graphic:t,associationType:e,selectedLayer:r,canQuery:s}=this;if(!s)return;const i=o((async o=>{const s=await this.getRulesTable(),a=this._convertTypeToDirection(e.type),i=s?.getFeaturesCanAssociateWithClause(t,r,a);this._whereClause=i,o.aborted||this._queryFeatureCountDebounced(this.queryWhereClause)}));this._updatingHandlesSetUp.addPromise(i.promise),this._setUpItemsTask=i}_determineFromAndTo(t,e,r){return"from"===r?{fromFeature:t,toFeature:e}:{fromFeature:e,toFeature:t}}_determineJunctionEdgeConnectivity(t,e){const{utilityNetwork:r}=this,o=g(t.sourceLayer)?t.sourceLayer.parent:t.sourceLayer,s=g(e.sourceLayer)?e.sourceLayer.parent:e.sourceLayer;if(!(r&&o&&"layerId"in o&&s&&"layerId"in s))return{fromFeature:t,toFeature:e,type:"junction-junction-connectivity"};const a=r.getSourceIdByLayerId(o.layerId),i=r.getSourceIdByLayerId(s.layerId);if(!a||!i)return{fromFeature:t,toFeature:e,type:"junction-junction-connectivity"};const n="junction"===r.getSourceTypeById(a),u="junction"===r.getSourceTypeById(i);return n&&u?{fromFeature:t,toFeature:e,type:"junction-junction-connectivity"}:u?{fromFeature:e,toFeature:t,type:"junction-edge-midspan-connectivity"}:{fromFeature:t,toFeature:e,type:"junction-edge-midspan-connectivity"}}_setUpAssociationHandles(){this.removeHandles(q),this.association&&this.addHandles(u((()=>[this.association?.associationType,this.association?.fromNetworkElement,this.association?.fromNetworkElement?.terminalId,this.association?.toNetworkElement,this.association?.toNetworkElement?.terminalId]),(()=>this.validateAssociation()),l),q)}_setUpAssociation(){const{utilityNetwork:t,graphic:e,selectedFeature:r,associationType:o}=this;if(!(t&&e&&r&&o))return void(this.association=null);const s=this._convertTypeToDirection(o.type);if(s.length>1){const{fromFeature:o,toFeature:s,type:a}=this._determineJunctionEdgeConnectivity(e,r.feature);return this.association=b({fromFeature:o,toFeature:s,utilityNetwork:t,associationType:a}),void this._setUpAssociationHandles()}const{fromFeature:a,toFeature:i}=this._determineFromAndTo(e,r.feature,s[0].direction);this.association=b({fromFeature:a,toFeature:i,utilityNetwork:t,associationType:s[0].type}),this._setUpAssociationHandles()}async _processFeatures(t){return Promise.all(t.map((async t=>{const{sourceLayer:e}=t;return e&&"getFeatureTitle"in e?{label:await e.getFeatureTitle(t),feature:t}:{label:A(t),feature:t}})))}async _queryAssociatedFeatures(t,e){const{featuresPerPage:r,layer:o,featurePage:s,featureCount:a,selectedLayer:i}=this,{canQuery:n,globalId:u}=this;if(!n||!o||!i||null==u)return[];const l=((s-1)*r+a)%a,y=r,{historicMoment:h,gdbVersion:p}=i,d=i.createQuery();d.where=c(d.where,t),d.start=l,d.num=y,d.returnGeometry=!1,d.historicMoment=h,d.gdbVersion=p,d.outFields=["*"];const g=await i.queryFeatures(d,{signal:e?.signal});return await this._processFeatures(g.features)}validateAssociation(){a(this._validateAssociationTask);const{utilityNetwork:t,association:e}=this,r=o((async()=>{t&&e&&(this._canAssociate=await t.canAddAssociation(e))}));this._updatingHandlesAssociation.addPromise(r.promise),this._validateAssociationTask=r}};t([y({type:e})],w.prototype,"graphic",void 0),t([y()],w.prototype,"layer",void 0),t([y()],w.prototype,"map",void 0),t([y({readOnly:!0})],w.prototype,"mapLayers",null),t([y()],w.prototype,"utilityNetwork",void 0),t([y()],w.prototype,"associationType",void 0),t([y()],w.prototype,"state",null),t([y({readOnly:!0})],w.prototype,"canAddAssociation",null),t([y({readOnly:!0})],w.prototype,"globalId",null),t([y({readOnly:!0})],w.prototype,"globalIdField",null),t([y()],w.prototype,"featureCount",void 0),t([y({readOnly:!0})],w.prototype,"layerItems",null),t([y({readOnly:!0})],w.prototype,"featureItems",null),t([y()],w.prototype,"_queryAbortController",void 0),t([y()],w.prototype,"_queryPageAbortController",void 0),t([y()],w.prototype,"_queryFeatureCountAbortController",void 0),t([y({value:1})],w.prototype,"featurePage",null),t([y()],w.prototype,"featuresPerPage",void 0),t([y({readOnly:!0})],w.prototype,"canLoad",null),t([y({readOnly:!0})],w.prototype,"canQuery",null),t([y({readOnly:!0})],w.prototype,"updating",null),t([y()],w.prototype,"selectedLayer",null),t([y()],w.prototype,"selectedFeature",void 0),t([y()],w.prototype,"association",void 0),t([y()],w.prototype,"filterOptionsVisible",void 0),t([y()],w.prototype,"filterWhereClause",void 0),t([y()],w.prototype,"queryWhereClause",null),t([y()],w.prototype,"_rulesTable",void 0),t([y()],w.prototype,"_canAssociate",void 0),t([y()],w.prototype,"_whereClause",void 0),w=t([h("esri.widgets.FeatureForm.UtilityNetworkAssociationAddAssociationViewModel")],w);const T=w;export{T 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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Identifiable.js";import{ignoreAbortErrors as s}from"../../core/promiseUtils.js";import{watch as i,on as o,initial as a}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 n}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as l}from"../../core/support/UpdatingHandles.js";import{isAssociatedFeatureSupportedLayer as p}from"../Feature/support/featureUtils.js";import u from"./EditableInput.js";import c from"../support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js";import{getFeatureTitle as d}from"../support/UtilityNetworkAssociations/
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Identifiable.js";import{ignoreAbortErrors as s}from"../../core/promiseUtils.js";import{watch as i,on as o,initial as a}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 n}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as l}from"../../core/support/UpdatingHandles.js";import{isAssociatedFeatureSupportedLayer as p}from"../Feature/support/featureUtils.js";import u from"./EditableInput.js";import c from"../support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js";import{getFeatureTitle as d}from"../support/UtilityNetworkAssociations/utils/getFeatureTitle.js";let y=class extends(e.IdentifiableMixin(u)){constructor(t){super(t),this.group=null,this.type="utilityNetworkAssociations",this.featureItem=null,this._updatingHandlesSetUp=new l,this.addHandles([i((()=>({feature:this.feature,element:this.element,layer:this.layer})),(t=>this._createAssociationVM(t)),a),i((()=>this.feature),(()=>this._setFeatureItem())),i((()=>this.associatedLayer),((t,e)=>this._updateLayerEditHandle(t,e)),a)])}destroy(){this._associationsVM?.destroy(),this._updatingHandlesSetUp.destroy()}get activeAssociationType(){return this._associationsVM?.activeAssociationType}get associatedFeatures(){const{associatedLayer:t}=this;if(t)return this.associatedFeatureInfos.get(t)}get associatedFeatureInfos(){const{_associationsVM:t}=this;if(!t?.associationFeatures?.size||!t?.utilityNetwork)return new Map;const{associationFeatures:e}=t,s=new Map;return e.forEach(((t,e)=>{const i=t.map((t=>{if(null==t.title){const e=d(t.feature);return{...t,title:e}}return t}));s.set(e,i)})),s}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&&!this._updatingHandlesSetUp.updating}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}async refresh(){await s(this._associationsVM.refresh())}_updateLayerEditHandle(t,e){e&&"layerId"in e&&this.removeHandles(e?.layerId),p(t)&&this.addHandles(o((()=>t),"edits",(()=>this.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;p(i)&&(this._associationsVM=new c({graphic:e,layer:i,map:o,associationTypes:a,source:"featureForm",title:this.label,description:this.description}))}_setFeatureItem(){this._updatingHandlesSetUp.addPromise((async()=>{const{feature:t,layer:e}=this;t&&e&&"getFeatureTitle"in e&&(this.featureItem={feature:t,label:await e.getFeatureTitle(t)})})())}};t([r()],y.prototype,"_associationsVM",void 0),t([r()],y.prototype,"activeAssociationType",null),t([r()],y.prototype,"associatedFeatures",null),t([r()],y.prototype,"associatedFeatureInfos",null),t([r()],y.prototype,"associatedLayer",null),t([r()],y.prototype,"associationsViewModel",null),t([r()],y.prototype,"canAddAssociation",null),t([r()],y.prototype,"editable",null),t([r()],y.prototype,"featureCount",null),t([r()],y.prototype,"viewModel",null),t([r()],y.prototype,"group",void 0),t([r()],y.prototype,"loaded",null),t([r()],y.prototype,"map",null),t([r()],y.prototype,"utilityNetwork",null),t([r()],y.prototype,"associationTypes",null),t([r({readOnly:!0})],y.prototype,"type",void 0),t([r()],y.prototype,"visible",null),t([r()],y.prototype,"updating",null),t([r()],y.prototype,"featureItem",void 0),y=t([n("esri.widgets.FeatureForm.UtilityNetworkAssociationInput")],y);const h=y;export{h 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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../intl.js";import{isSome as e}from"../../core/arrayUtils.js";import{neverReached as t}from"../../core/compilerUtils.js";import{equalsShallow as r}from"../../core/lang.js";import n from"../../core/Logger.js";import{templateHasKey as o,replace as i}from"../../core/string.js";import{isFieldElement as s}from"../../form/support/formUtils.js";import{DomainValidationError as l}from"../../layers/support/domainUtils.js";import{isTimeOnlyField as u,NumericRangeValidationError as a,TypeValidationError as p}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as m,getSubtypesFromLayer as f}from"../../layers/support/layerUtils.js";import{isAnyDateField as d}from"../../smartMapping/support/utils.js";import{getLabelForDateFieldValue as c,getIntlOptionsForField as y}from"../support/dateUtils.js";import{InputValidationError as b,getRangeErrorMessage as g,shouldUseScientificNotation as j,scientificNumberFormatOptions as
|
|
5
|
+
import"../../intl.js";import{isSome as e}from"../../core/arrayUtils.js";import{neverReached as t}from"../../core/compilerUtils.js";import{equalsShallow as r}from"../../core/lang.js";import n from"../../core/Logger.js";import{templateHasKey as o,replace as i}from"../../core/string.js";import{isFieldElement as s}from"../../form/support/formUtils.js";import{DomainValidationError as l}from"../../layers/support/domainUtils.js";import{isTimeOnlyField as u,NumericRangeValidationError as a,TypeValidationError as p}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as m,getSubtypesFromLayer as f}from"../../layers/support/layerUtils.js";import{isAnyDateField as d}from"../../smartMapping/support/utils.js";import{getLabelForDateFieldValue as c,getIntlOptionsForField as y}from"../support/dateUtils.js";import{InputValidationError as b,getRangeErrorMessage as g,shouldUseScientificNotation as j,scientificNumberFormatOptions as T,numberFormatOptions as N}from"../support/forms/formUtils.js";import{getFeatureTitle as x}from"../support/UtilityNetworkAssociations/utils/getFeatureTitle.js";import{substitute as F}from"../../intl/substitute.js";const O=e=>"field"===e?.type,V=e=>"group"===e?.type,h=e=>"relationship"===e?.type,U=e=>"text"===e.type,v=e=>"utilityNetworkAssociations"===e.type,E=e=>!V(e)&&null!=e.group,_=e=>e.reduce(((e,t)=>V(t)?[...e,...t.inputs]:[...e,t]),[]),L=e=>_(e).filter(O),A=e=>_(e).filter(h),I=e=>_(e).filter(v),$=e=>null!=e&&(w(e,"combo-box")||w(e,"radio-buttons")),w=(e,t)=>null!=e&&e.input?.type===t,C=({domain:e,inputType:t="text-box",dataType:r})=>"number"===r&&"text-box"===t&&(!e||"coded-value"!==e.type);function Z(e,t){const{title:r,feature:n}=e??{};return r||(n?x(n):null)||t||""}function D(t){const{attributes:r,fieldsIndex:n,label:i,timeZone:s}=t;if(!r||"object"!=typeof r)return i;const l=Object.keys(r).filter((e=>o(i,e))),u=l.map((e=>r[e])),a=l.map((e=>n.get(e))).filter(e);return H(i,Y({values:u,fields:a,timeZone:s}))}const k="expression/",G="expr/",R="field/";function S(e){const[t,r]=e.split(k);return""===t&&r?r:(n.getLogger("esri.widgets.FeatureForm/featureFormUtils").error("extractExpressionNameFromString:invalid-input",`The string ${e} is not a valid expression reference of the form '${k}/expressionName'`),"")}function B(e){return`${k}${e}`}function M(e){return`${R}${e}`}function P(e){return e.startsWith(k)}function W(e){return e.startsWith(G)}function Y(e){const{fields:t,values:r}=e,n=e.timeZone??void 0,o=t.map(((e,t)=>{let o=r[t];if(e.domain&&"coded-value"===e.domain.type){const t=e.domain.codedValues.find((e=>e.code===o));t?.name&&(o=t.name)}return(d(e)||u(e))&&(o=c(e,o,{timeZone:n,...y(e)})),[e.name,o]}));return Object.fromEntries(o)}function H(e,t){return i(i(e,(e=>`{${e.toLowerCase()}}`)),Object.fromEntries(Object.entries(t).map((([e,t])=>[e.toLowerCase(),t]))))}const q=e=>{const t={typeFieldName:null,types:[]};return e?(m(e)?(t.typeFieldName=e.parent?.subtypeField,t.types=e.parent?.subtypes??[]):"subtype-group"===e.type||"feature"===e.type&&e.subtypes?.length?(t.typeFieldName=e.subtypeField,t.types=e.subtypes??[]):"types"in e&&e.types&&(t.typeFieldName=e.typeIdField,t.types=e.types.map((({id:e,name:t,domains:r})=>({code:e,name:t,domains:r})))),null!=t.typeFieldName&&(t.typeFieldName=e.getField(t.typeFieldName)?.name??t.typeFieldName),t):t},z=(e,t,r)=>{const{dataType:n,error:o,minLength:i}=e,s=t?.validationErrors;if(!s||!o)return null;if(o===b.CANNOT_BE_EMPTY)return s.cannotBeNull;if(o===l.VALUE_OUT_OF_RANGE||o===a.OUT_OF_RANGE){const{field:t,range:o}=e,i={type:"date",intlOptions:{timeZone:"date"===t.type&&r?r:void 0,...y(t)}},l=g(o,s);return F(l,o,{format:{max:"date"===n?i:null!=o.max&&j(o.max)?T:N,min:"date"===n?i:null!=o.min&&j(o.min)?T:N}})}return o===l.INVALID_CODED_VALUE?s.invalidCodedValue:o===p.INVALID_TYPE?s.invalidType:o===b.TOO_SHORT?F(s.tooShort,{min:i}):(b.TOO_LONG,null)},J=e=>{if(!e)return;const t=e.layer,r=t&&"geometryType"in t?t.geometryType:void 0,n=e.geometry?.type;return"polyline"===n||"polyline"===r?"line":"mesh"===n||"mesh"===r||"multipatch"===r?"cube":"multipoint"===n||"multipoint"===r?"point":n||r||"table"},K=e=>{const t=[];if(e.formTemplate){const{description:r,title:n}=e.formTemplate;e.fields?.forEach((e=>{const i=n&&o(n,e.name),s=r&&o(r,e.name);(i||s)&&t.push(e.name)}))}return t};function Q(e,t){const r=t??("formTemplate"in e&&e.formTemplate);if(r){return(r.elements?.filter(s)??[]).some((({fieldName:t})=>!e.fieldsIndex.get(t)))}return!1}function X(e,t){return null==e||t.onValue!==e&&t.offValue!==e}function ee(e,r){switch(r.objectType){case"any":return!0;case"null":return null==e;case"code":return e===r.codedValue?.code;case"range":return null!=e&&null!=r.minValue&&null!=r.maxValue&&+e>=r.minValue&&+e<=r.maxValue;default:return t(r.objectType),!1}}function te(e,t,n){const o=f(e),i=o?.find((e=>e.code===n));if(!i)return!1;const s=o?.find((e=>e.code===t));return!r(i.defaultValues,s?.defaultValues)&&Object.values(i.defaultValues).some((e=>null!=e))}export{S as extractExpressionNameFromString,I as flattenAssociationInputs,L as flattenFieldInputs,_ as flattenInputs,A as flattenRelationshipInputs,Q as formTemplateHasInvalidFields,Y as getComputedAttributes,z as getErrorMessageForFieldInput,Z as getFeatureFormTitle,K as getFieldsInTitleAndDesc,J as getIconForFeature,q as getNormalizedFeatureTypeInfo,P as isExpressionReference,w as isFieldElementWithInputType,$ as isFieldElementWithShowNoValueOptionInput,O as isFieldInput,V as isGroupInput,E as isInputInGroupInput,W as isLegacyFieldMapsExpressionReference,C as isNumberFieldInput,h as isRelationshipInput,U as isTextElementInput,v as isUtilityNetworkAssociationInput,D as parseFormTemplateString,B as prependExpressionPrefix,M as prependFieldPrefix,H as substituteFieldTemplatesInString,te as subtypeChangeShouldPrompt,X as valueIsInvalidSwitchValue,ee as valueIsValidContingentValue};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Logger.js";import{property as i}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{convertDateFormatToIntlOptions as o}from"../../intl/date.js";import{convertNumberFormatToIntlOptions as l,formatNumber as r}from"../../intl/number.js";import{isEditableLayer as a}from"../../layers/support/editableLayers.js";import{computeDomainFromTypes as s}from"../../layers/support/featureLayerUtils.js";import u from"../../layers/support/Field.js";import{validateFieldValue as p,isDateField as d,isTimeOnlyField as c,isIntegerField as m,isNumericField as f,isStringField as h,isDateOnlyField as g,isTimestampOffsetField as y}from"../../layers/support/fieldUtils.js";import{isAnyDateField as v}from"../../smartMapping/support/utils.js";import{getTimeZoneFormattingOptions as F,system as _}from"../../time/timeZoneUtils.js";import C from"../FeatureForm/FieldInput.js";import b from"./Grid/EditorColumn.js";import{isEmptyStringOrWhitespace as D}from"./support/tableUtils.js";import{dateFieldsWithStringFieldValue as x,getLabelForDateFieldValue as I,valueIsInRange as E,dateTimeIsInRange as w,getUnixFieldValueFromDateComponents as T,getISOFieldValueFromDateComponents as V,normalizeTimeOnlyString as L,prepareISOFieldValueForDateComponents as O,prepareUnixFieldValueForDateComponents as Z}from"../support/dateUtils.js";import{renderingSanitizer as R,setFocus as j}from"../support/widgetUtils.js";const S={cancelEdit:"Escape"},N="esri-column",A={input:`${N}__cell-input`,inputContainer:`${N}__cell__input-container`},U=o("short-date-short-time"),q=o("short-date"),k={useGrouping:!0,maximumFractionDigits:20};let z=class extends b{constructor(e){super(e),this._activeFieldInput=null,this.cellValueFormatFunction=({root:e,rowData:t,value:i})=>{const{formatFunction:n}=this;if(n&&t){const{index:o,item:{attachments:l,feature:r,relatedRecords:a}}=t;return n({attachments:l,column:this,feature:r,field:this.field,index:o,relatedRecords:a,value:R.sanitize(i),virtualIndex:this.getVirtualRowIndex(e)})}if(null===i)return" ";const{field:o}=this,a=this._getDomainForFeature(t?.item?.feature);if(a){const e=this._getComputedDomain(i,a);if("date"===o.type&&"range"===a.type)return this._formatDateValueForDisplay(o,e);if(this._isNumericField&&"range"===a.type){const e=this.template?.format,t=e?l(e):k;return r(parseFloat(i),t)}return x.has(o.type)?"range"===a.type?R.sanitize(I(o,e)):R.sanitize(e):e}if("date"===o.type||x.has(o.type))return this._formatDateValueForDisplay(o,i);if(this._isNumericField){const e=this.template?.format,t=e?l(e):k;return r(parseFloat(i),t)}return R.sanitize(i)},this.cellValueValidatorFunction=({oldValue:e,value:i})=>{const{_effectiveRange:n,field:o}=this,{max:l,min:r}=n;if(this.effectiveRequired&&(null==i||""===i))return!1;if(this._isNumericField&&(p(o,i)||!E({max:l,min:r,value:i})))return t.getLogger(this).warn("value-exceeds-valid-range","Field value exceeds valid range. Attempted edit was rejected."),!1;if(this._isAnyDateOrTimeField){const e=o.type;if(!w({type:e,range:n,value:i}))return!1}return e!==i},this.field=null,this.formatFunction=null,this.inputRenderFunction=async({root:e,column:i,rowData:n})=>{if(this.editInfo||!this.effectiveEditable)return;const o=this.getCellValue(n),{field:l}=this;if("big-integer"===l.type&&p(l,o))return void t.getLogger(this).warn("value-exceeds-valid-range","Field value is beyond supported limit. Editing is disabled for this field value.");const r=n?.item.feature;if(!r)return;this._activeFieldInput=this._setUpFieldInput(r,o);const a=document.createElement("div");a.classList.add(A.inputContainer);const s=[],u="coded-value"===this._effectiveDomain?.type;if(this._isAnyDateOrTimeField&&!u){const e=document.createElement("div"),t=this._setUpDateComponents(o),i=this._setUpDateActionBar();t.forEach((t=>e.appendChild(t))),a.appendChild(e),a.appendChild(i),s.push(...t)}else{const e=this.createInputElement({value:o});a.appendChild(e),s.push(e)}this._set("editInfo",{column:i,inputs:s,root:e,rowData:n,oldValue:o}),this.removeCellContent(e),e.appendChild(a),this._syncRowEditingState(e,!0),this.grid?.generateCellPartNames();const d=s[0];await j(d),"selectText"in d&&await d.selectText()},this.layer=null,this.parseInputValueFunction=({inputs:e})=>{const{editInfo:t,field:i,includeTime:n}=this;if(!t||!e.length)return null;const o=e[0];if(this._isAnyDateOrTimeField){if("coded-value"===this._effectiveDomain?.type){if(null==o.value)return null;const e=String(o.value);return d(i)?parseFloat(e):e}const{timeZone:l}=this.effectiveTimeZoneOptions,r=t.oldValue??void 0;switch(i.type){case"date-only":{const e=o.value;return""!==e?e:null}case"time-only":{const e=L(o.value);return""!==e?e:null}case"timestamp-offset":{const t=n?e[1]:void 0,i=e.at(-1);return V({oldValue:r,dateComponent:o,timeComponent:t,timeZoneComponent:i,defaultTimeZone:l})}case"date":{const{max:t,min:i}=this._effectiveRange;return T({oldValue:r,dateComponent:o,timeComponent:e[1],timeZone:l,max:t,min:i})}}return null}const l=o.value,{effectiveRequired:r}=this;return r||null!=l&&""!==l?this._isNumericField?parseFloat(l):this._isStringField?l.trim():l:null},this.sortable=!0,this.store=null,this.template=null,this.view=null}get _effectiveDomain(){const e=this._activeFieldInput?.feature;return e?this._getDomainForFeature(e):null}get _effectiveRange(){return this._activeFieldInput?.range??{max:null,min:null}}get _isAnyDateOrTimeField(){const{field:e}=this;return v(e)||c(e)}get _isIntegerField(){return m(this.field)}get _isNumericField(){return f(this.field)}get _isStringField(){return h(this.field)}get _isSubtypeField(){const{layer:e}=this;if(e?.subtypeField){const{subtypeField:t,fieldsIndex:i}=e;return(i.get(t)?.name??t)===this.fieldName}return!1}get alias(){return this.field?.alias}get defaultValue(){return this.field?.defaultValue}get effectiveDescription(){const{description:e,field:t}=this,i=t.description,n=D(e)?D(i)?null:i:e;return null==n?null:R.sanitize(n)}get effectiveEditable(){const{editable:e,field:t,layer:i,tableEditingEnabled:n}=this;if(!t||!i)return!1;const o=a(i),l=i.effectiveCapabilities??i.capabilities,r=l?.operations?.supportsUpdate;return!!(t.editable&&o&&r&&"oid"!==t.type&&n)&&e}get effectiveLabel(){return R.sanitize(this.label||this.alias||this.fieldName)}get effectiveRequired(){return!this.nullable||this._isSubtypeField||this._activeFieldInput?.required||this.required}get effectiveTimeZoneOptions(){const{layer:e,field:t}=this;if(!e||"date"!==t?.type&&"timestamp-offset"!==t?.type)return{timeZone:void 0,timeZoneName:void 0};const{tableTimeZone:i,timeZone:n,view:l}=this;return F(e.preferredTimeZone||null,!!e.datesInUnknownTimezone,n??i??l?.timeZone??_,o("short-time"),t.type)}get includeTime(){const{field:e,template:t}=this;return"time-only"===e.type||"date-only"!==e.type&&(!t?.input||"includeTime"in t.input&&!1!==t.input.includeTime)}get loadingMessage(){return this.messages?.loading||"..."}get maxLength(){const{field:e,template:t}=this,i=e?.length??-1,n=t?.input&&"maxLength"in t.input?t.input.maxLength:null;return null!=n&&!isNaN(n)&&n>=-1&&(-1===i||n<=i)?n:i}get minLength(){const{template:e,maxLength:t}=this,i=e?.input&&"minLength"in e.input?e.input.minLength:null;return t&&i<=t?i:null}get name(){return this.field?.name}get nullable(){return!1!==this.field.nullable}get shouldShowPrompt(){return this._isSubtypeField}createInputElement({value:e}){const{_effectiveDomain:t,maxLength:i,minLength:n,effectiveRequired:o}=this;let l;if("coded-value"===t?.type)l=this.createCalciteSelect(e,t.codedValues.map((({code:e,name:t})=>({value:e,name:t})))),l.addEventListener("calciteSelectChange",(()=>this.onInputBlur(l)));else if(this._isNumericField){const{_effectiveRange:{max:t,min:i}}=this;l=document.createElement("calcite-input"),l.type="number",this._isIntegerField&&(l.step=1),null!=t&&(l.max=t),null!=i&&(l.min=i),l.status=E({max:t,min:i,value:e})?"idle":"invalid"}else l=document.createElement("calcite-input"),l.addEventListener("calciteInputChange",(()=>this.onInputBlur(l))),i>-1&&(l.maxLength=i),n>0&&(l.minLength=n);return l.classList.add(A.input),l.required=o,l.value=null!=e?e.toString():"",l.onkeydown=e=>{e.key===S.cancelEdit&&this.onInputBlur(l,!0)},l.onblur=()=>this.onInputBlur(l),l}onEditComplete(){const e=this.editInfo?.root;e&&this._syncRowEditingState(e,!1),this._activeFieldInput=null,super.onEditComplete()}_clearActiveEditValues(){this.editInfo?.inputs?.forEach((e=>e.value=""))}_setUpDateActionBar(){const{messagesCommon:e}=this,t=e?.cancel??"",i=e?.clear??"",n=e?.save??"",o=document.createElement("calcite-action-bar");return o.expandDisabled=!0,o.layout="horizontal",o.appendChild(this.createCalciteAction({text:n,icon:"save",onclick:()=>this.submit()})),this.effectiveRequired||o.appendChild(this.createCalciteAction({text:i,icon:"trash",onclick:()=>{this._clearActiveEditValues(),this.submit()}})),o.appendChild(this.createCalciteAction({text:t,icon:"x",onclick:()=>this.cancel()})),o}_formatDateValueForDisplay(e,t){const{timeZone:i,timeZoneName:n}=this.effectiveTimeZoneOptions;return null!=t?I(e,t,{...this._getDateFormatOptions(),timeZone:i,timeZoneName:n}):null}_setUpDateComponents(e){const{_effectiveRange:{max:t,min:i,rawMax:n,rawMin:o},field:l,effectiveRequired:r}=this,a=this._getDateFieldValuesForComponents(l,e),s=[];if(v(l)){const e=this.createDateComponent(),u=g(l)||y(l)?n:t,p=g(l)||y(l)?o:i,d=this._getDateFieldValuesForComponents(l,u??null),c=this._getDateFieldValuesForComponents(l,p??null);e.value=a.date??"",e.max=d.date??"",e.min=c.date??"",e.required=r,e.addEventListener("calciteInputDatePickerOpen",(()=>this._onDateComponentOpen(e))),s.push(e)}if(this.includeTime){const e=this.createTimeComponent();e.value=a.time??"",e.required=r,e.addEventListener("calciteInputTimePickerOpen",(()=>this._onDateComponentOpen(e))),s.push(e)}if("timestamp-offset"===l.type){const e=this.createTimeZoneComponent();e.value=a.timeZoneOffset??"0",e.addEventListener("calciteInputTimeZoneOpen",(()=>this._onDateComponentOpen(e))),s.push(e)}return s}_onDateComponentOpen(e){this.editInfo?.inputs.forEach((t=>{t!==e&&"open"in t&&(t.open=!1)}))}_syncRowEditingState(e,t=!1){const i=this.grid?.getRowContainingNode(e);i&&(t?i.setAttribute("editing","true"):i.removeAttribute("editing"))}_getDateFieldValuesForComponents(e,t){switch(e.type){case"date":return Z(t,this.effectiveTimeZoneOptions.timeZone);case"date-only":return{date:t};case"time-only":return{time:t};case"timestamp-offset":return O(t);default:return{}}}_setUpFieldInput(e,t){const{field:i,layer:n,effectiveTimeZoneOptions:{timeZone:o}}=this,l=new C({feature:e,field:i,initialFeature:e.clone(),layer:n,timeZone:o});return l.set("value",t),l}_isDomainCompatible(e){if(!e)return!1;const{_isNumericField:t,_isStringField:i}=this,{type:n}=e;if("coded-value"===n){const n=typeof e.codedValues[0].code;if("string"===n&&i||"number"===n&&t)return!0}return!("range"!==n||!t)}_getDomainForFeature(e){const{fieldName:t,layer:i,template:n}=this;if(!e||!i?.getFieldDomain)return null;if("wfs"===i.type||"geojson"===i.type||"csv"===i.type||"knowledge-graph-sublayer"===i.type)return null;if(n?.domain&&this._isDomainCompatible(n.domain))return n.domain;if("feature"!==i.type&&"subtype-group"!==i.type&&null==i.getField(t)?.domain){const e=s(i,t);if(e)return e}return i.getFieldDomain(t,{feature:e})}_getComputedDomain(e,t){if(!t)return null;if("range"===t.type)return e;if("coded-value"===t.type){const i=t.codedValues.filter((t=>t.hasOwnProperty("code")&&t.code===e));return i&&i.length?i[0].name:e}return null}_getDateFormatOptions(){const{template:e}=this,t=e?.format?.dateFormat;return t?o(t):e?.input&&"includeTime"in e.input&&!1===e.input.includeTime?q:U}};e([i()],z.prototype,"_effectiveDomain",null),e([i()],z.prototype,"_activeFieldInput",void 0),e([i()],z.prototype,"_effectiveRange",null),e([i()],z.prototype,"_isAnyDateOrTimeField",null),e([i()],z.prototype,"_isIntegerField",null),e([i()],z.prototype,"_isNumericField",null),e([i()],z.prototype,"_isStringField",null),e([i()],z.prototype,"_isSubtypeField",null),e([i({readOnly:!0})],z.prototype,"alias",null),e([i()],z.prototype,"cellValueFormatFunction",void 0),e([i()],z.prototype,"cellValueValidatorFunction",void 0),e([i({readOnly:!0})],z.prototype,"defaultValue",null),e([i()],z.prototype,"effectiveDescription",null),e([i()],z.prototype,"effectiveEditable",null),e([i()],z.prototype,"effectiveLabel",null),e([i()],z.prototype,"effectiveRequired",null),e([i()],z.prototype,"effectiveTimeZoneOptions",null),e([i({type:u})],z.prototype,"field",void 0),e([i()],z.prototype,"formatFunction",void 0),e([i()],z.prototype,"includeTime",null),e([i()],z.prototype,"inputRenderFunction",void 0),e([i()],z.prototype,"layer",void 0),e([i({readOnly:!0})],z.prototype,"loadingMessage",null),e([i()],z.prototype,"maxLength",null),e([i()],z.prototype,"minLength",null),e([i({readOnly:!0})],z.prototype,"name",null),e([i({readOnly:!0})],z.prototype,"nullable",null),e([i()],z.prototype,"parseInputValueFunction",void 0),e([i()],z.prototype,"shouldShowPrompt",null),e([i()],z.prototype,"sortable",void 0),e([i()],z.prototype,"store",void 0),e([i()],z.prototype,"template",void 0),e([i()],z.prototype,"view",void 0),z=e([n("esri.widgets.FeatureTable.FieldColumn")],z);const B=z;export{B as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Logger.js";import{property as i}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{convertDateFormatToIntlOptions as o}from"../../intl/date.js";import{convertNumberFormatToIntlOptions as l,formatNumber as r}from"../../intl/number.js";import{isEditableLayer as a}from"../../layers/support/editableLayers.js";import{computeDomainFromTypes as s}from"../../layers/support/featureLayerUtils.js";import u from"../../layers/support/Field.js";import{validateFieldValue as p,isDateField as d,isTimeOnlyField as c,isIntegerField as m,isNumericField as f,isStringField as h,isDateOnlyField as g,isTimestampOffsetField as y}from"../../layers/support/fieldUtils.js";import{isAnyDateField as v}from"../../smartMapping/support/utils.js";import{system as F}from"../../time/constants.js";import{getTimeZoneFormattingOptions as _}from"../../time/timeZoneUtils.js";import C from"../FeatureForm/FieldInput.js";import b from"./Grid/EditorColumn.js";import{isEmptyStringOrWhitespace as D}from"./support/tableUtils.js";import{dateFieldsWithStringFieldValue as x,getLabelForDateFieldValue as I,valueIsInRange as E,dateTimeIsInRange as w,getUnixFieldValueFromDateComponents as T,getISOFieldValueFromDateComponents as V,normalizeTimeOnlyString as L,prepareISOFieldValueForDateComponents as O,prepareUnixFieldValueForDateComponents as Z}from"../support/dateUtils.js";import{renderingSanitizer as R,setFocus as j}from"../support/widgetUtils.js";const S={cancelEdit:"Escape"},N="esri-column",A={input:`${N}__cell-input`,inputContainer:`${N}__cell__input-container`},U=o("short-date-short-time"),q=o("short-date"),k={useGrouping:!0,maximumFractionDigits:20};let z=class extends b{constructor(e){super(e),this._activeFieldInput=null,this.cellValueFormatFunction=({root:e,rowData:t,value:i})=>{const{formatFunction:n}=this;if(n&&t){const{index:o,item:{attachments:l,feature:r,relatedRecords:a}}=t;return n({attachments:l,column:this,feature:r,field:this.field,index:o,relatedRecords:a,value:R.sanitize(i),virtualIndex:this.getVirtualRowIndex(e)})}if(null===i)return" ";const{field:o}=this,a=this._getDomainForFeature(t?.item?.feature);if(a){const e=this._getComputedDomain(i,a);if("date"===o.type&&"range"===a.type)return this._formatDateValueForDisplay(o,e);if(this._isNumericField&&"range"===a.type){const e=this.template?.format,t=e?l(e):k;return r(parseFloat(i),t)}return x.has(o.type)?"range"===a.type?R.sanitize(I(o,e)):R.sanitize(e):e}if("date"===o.type||x.has(o.type))return this._formatDateValueForDisplay(o,i);if(this._isNumericField){const e=this.template?.format,t=e?l(e):k;return r(parseFloat(i),t)}return R.sanitize(i)},this.cellValueValidatorFunction=({oldValue:e,value:i})=>{const{_effectiveRange:n,field:o}=this,{max:l,min:r}=n;if(this.effectiveRequired&&(null==i||""===i))return!1;if(this._isNumericField&&(p(o,i)||!E({max:l,min:r,value:i})))return t.getLogger(this).warn("value-exceeds-valid-range","Field value exceeds valid range. Attempted edit was rejected."),!1;if(this._isAnyDateOrTimeField){const e=o.type;if(!w({type:e,range:n,value:i}))return!1}return e!==i},this.field=null,this.formatFunction=null,this.inputRenderFunction=async({root:e,column:i,rowData:n})=>{if(this.editInfo||!this.effectiveEditable)return;const o=this.getCellValue(n),{field:l}=this;if("big-integer"===l.type&&p(l,o))return void t.getLogger(this).warn("value-exceeds-valid-range","Field value is beyond supported limit. Editing is disabled for this field value.");const r=n?.item.feature;if(!r)return;this._activeFieldInput=this._setUpFieldInput(r,o);const a=document.createElement("div");a.classList.add(A.inputContainer);const s=[],u="coded-value"===this._effectiveDomain?.type;if(this._isAnyDateOrTimeField&&!u){const e=document.createElement("div"),t=this._setUpDateComponents(o),i=this._setUpDateActionBar();t.forEach((t=>e.appendChild(t))),a.appendChild(e),a.appendChild(i),s.push(...t)}else{const e=this.createInputElement({value:o});a.appendChild(e),s.push(e)}this._set("editInfo",{column:i,inputs:s,root:e,rowData:n,oldValue:o}),this.removeCellContent(e),e.appendChild(a),this._syncRowEditingState(e,!0),this.grid?.generateCellPartNames();const d=s[0];await j(d),"selectText"in d&&await d.selectText()},this.layer=null,this.parseInputValueFunction=({inputs:e})=>{const{editInfo:t,field:i,includeTime:n}=this;if(!t||!e.length)return null;const o=e[0];if(this._isAnyDateOrTimeField){if("coded-value"===this._effectiveDomain?.type){if(null==o.value)return null;const e=String(o.value);return d(i)?parseFloat(e):e}const{timeZone:l}=this.effectiveTimeZoneOptions,r=t.oldValue??void 0;switch(i.type){case"date-only":{const e=o.value;return""!==e?e:null}case"time-only":{const e=L(o.value);return""!==e?e:null}case"timestamp-offset":{const t=n?e[1]:void 0,i=e.at(-1);return V({oldValue:r,dateComponent:o,timeComponent:t,timeZoneComponent:i,defaultTimeZone:l})}case"date":{const{max:t,min:i}=this._effectiveRange;return T({oldValue:r,dateComponent:o,timeComponent:e[1],timeZone:l,max:t,min:i})}}return null}const l=o.value,{effectiveRequired:r}=this;return r||null!=l&&""!==l?this._isNumericField?parseFloat(l):this._isStringField?l.trim():l:null},this.sortable=!0,this.store=null,this.template=null,this.view=null}get _effectiveDomain(){const e=this._activeFieldInput?.feature;return e?this._getDomainForFeature(e):null}get _effectiveRange(){return this._activeFieldInput?.range??{max:null,min:null}}get _isAnyDateOrTimeField(){const{field:e}=this;return v(e)||c(e)}get _isIntegerField(){return m(this.field)}get _isNumericField(){return f(this.field)}get _isStringField(){return h(this.field)}get _isSubtypeField(){const{layer:e}=this;if(e?.subtypeField){const{subtypeField:t,fieldsIndex:i}=e;return(i.get(t)?.name??t)===this.fieldName}return!1}get alias(){return this.field?.alias}get defaultValue(){return this.field?.defaultValue}get effectiveDescription(){const{description:e,field:t}=this,i=t.description,n=D(e)?D(i)?null:i:e;return null==n?null:R.sanitize(n)}get effectiveEditable(){const{editable:e,field:t,layer:i,tableEditingEnabled:n}=this;if(!t||!i)return!1;const o=a(i),l=i.effectiveCapabilities??i.capabilities,r=l?.operations?.supportsUpdate;return!!(t.editable&&o&&r&&"oid"!==t.type&&n)&&e}get effectiveLabel(){return R.sanitize(this.label||this.alias||this.fieldName)}get effectiveRequired(){return!this.nullable||this._isSubtypeField||this._activeFieldInput?.required||this.required}get effectiveTimeZoneOptions(){const{layer:e,field:t}=this;if(!e||"date"!==t?.type&&"timestamp-offset"!==t?.type)return{timeZone:void 0,timeZoneName:void 0};const{tableTimeZone:i,timeZone:n,view:l}=this;return _(e.preferredTimeZone||null,!!e.datesInUnknownTimezone,n??i??l?.timeZone??F,o("short-time"),t.type)}get includeTime(){const{field:e,template:t}=this;return"time-only"===e.type||"date-only"!==e.type&&(!t?.input||"includeTime"in t.input&&!1!==t.input.includeTime)}get loadingMessage(){return this.messages?.loading||"..."}get maxLength(){const{field:e,template:t}=this,i=e?.length??-1,n=t?.input&&"maxLength"in t.input?t.input.maxLength:null;return null!=n&&!isNaN(n)&&n>=-1&&(-1===i||n<=i)?n:i}get minLength(){const{template:e,maxLength:t}=this,i=e?.input&&"minLength"in e.input?e.input.minLength:null;return t&&i<=t?i:null}get name(){return this.field?.name}get nullable(){return!1!==this.field.nullable}get shouldShowPrompt(){return this._isSubtypeField}createInputElement({value:e}){const{_effectiveDomain:t,maxLength:i,minLength:n,effectiveRequired:o}=this;let l;if("coded-value"===t?.type)l=this.createCalciteSelect(e,t.codedValues.map((({code:e,name:t})=>({value:e,name:t})))),l.addEventListener("calciteSelectChange",(()=>this.onInputBlur(l)));else if(this._isNumericField){const{_effectiveRange:{max:t,min:i}}=this;l=document.createElement("calcite-input"),l.type="number",this._isIntegerField&&(l.step=1),null!=t&&(l.max=t),null!=i&&(l.min=i),l.status=E({max:t,min:i,value:e})?"idle":"invalid"}else l=document.createElement("calcite-input"),l.addEventListener("calciteInputChange",(()=>this.onInputBlur(l))),i>-1&&(l.maxLength=i),n>0&&(l.minLength=n);return l.classList.add(A.input),l.required=o,l.value=null!=e?e.toString():"",l.onkeydown=e=>{e.key===S.cancelEdit&&this.onInputBlur(l,!0)},l.onblur=()=>this.onInputBlur(l),l}onEditComplete(){const e=this.editInfo?.root;e&&this._syncRowEditingState(e,!1),this._activeFieldInput=null,super.onEditComplete()}_clearActiveEditValues(){this.editInfo?.inputs?.forEach((e=>e.value=""))}_setUpDateActionBar(){const{messagesCommon:e}=this,t=e?.cancel??"",i=e?.clear??"",n=e?.save??"",o=document.createElement("calcite-action-bar");return o.expandDisabled=!0,o.layout="horizontal",o.appendChild(this.createCalciteAction({text:n,icon:"save",onclick:()=>this.submit()})),this.effectiveRequired||o.appendChild(this.createCalciteAction({text:i,icon:"trash",onclick:()=>{this._clearActiveEditValues(),this.submit()}})),o.appendChild(this.createCalciteAction({text:t,icon:"x",onclick:()=>this.cancel()})),o}_formatDateValueForDisplay(e,t){const{timeZone:i,timeZoneName:n}=this.effectiveTimeZoneOptions;return null!=t?I(e,t,{...this._getDateFormatOptions(),timeZone:i,timeZoneName:n}):null}_setUpDateComponents(e){const{_effectiveRange:{max:t,min:i,rawMax:n,rawMin:o},field:l,effectiveRequired:r}=this,a=this._getDateFieldValuesForComponents(l,e),s=[];if(v(l)){const e=this.createDateComponent(),u=g(l)||y(l)?n:t,p=g(l)||y(l)?o:i,d=this._getDateFieldValuesForComponents(l,u??null),c=this._getDateFieldValuesForComponents(l,p??null);e.value=a.date??"",e.max=d.date??"",e.min=c.date??"",e.required=r,e.addEventListener("calciteInputDatePickerOpen",(()=>this._onDateComponentOpen(e))),s.push(e)}if(this.includeTime){const e=this.createTimeComponent();e.value=a.time??"",e.required=r,e.addEventListener("calciteInputTimePickerOpen",(()=>this._onDateComponentOpen(e))),s.push(e)}if("timestamp-offset"===l.type){const e=this.createTimeZoneComponent();e.value=a.timeZoneOffset??"0",e.addEventListener("calciteInputTimeZoneOpen",(()=>this._onDateComponentOpen(e))),s.push(e)}return s}_onDateComponentOpen(e){this.editInfo?.inputs.forEach((t=>{t!==e&&"open"in t&&(t.open=!1)}))}_syncRowEditingState(e,t=!1){const i=this.grid?.getRowContainingNode(e);i&&(t?i.setAttribute("editing","true"):i.removeAttribute("editing"))}_getDateFieldValuesForComponents(e,t){switch(e.type){case"date":return Z(t,this.effectiveTimeZoneOptions.timeZone);case"date-only":return{date:t};case"time-only":return{time:t};case"timestamp-offset":return O(t);default:return{}}}_setUpFieldInput(e,t){const{field:i,layer:n,effectiveTimeZoneOptions:{timeZone:o}}=this,l=new C({feature:e,field:i,initialFeature:e.clone(),layer:n,timeZone:o});return l.set("value",t),l}_isDomainCompatible(e){if(!e)return!1;const{_isNumericField:t,_isStringField:i}=this,{type:n}=e;if("coded-value"===n){const n=typeof e.codedValues[0].code;if("string"===n&&i||"number"===n&&t)return!0}return!("range"!==n||!t)}_getDomainForFeature(e){const{fieldName:t,layer:i,template:n}=this;if(!e||!i?.getFieldDomain)return null;if("wfs"===i.type||"geojson"===i.type||"csv"===i.type||"knowledge-graph-sublayer"===i.type)return null;if(n?.domain&&this._isDomainCompatible(n.domain))return n.domain;if("feature"!==i.type&&"subtype-group"!==i.type&&null==i.getField(t)?.domain){const e=s(i,t);if(e)return e}return i.getFieldDomain(t,{feature:e})}_getComputedDomain(e,t){if(!t)return null;if("range"===t.type)return e;if("coded-value"===t.type){const i=t.codedValues.filter((t=>t.hasOwnProperty("code")&&t.code===e));return i&&i.length?i[0].name:e}return null}_getDateFormatOptions(){const{template:e}=this,t=e?.format?.dateFormat;return t?o(t):e?.input&&"includeTime"in e.input&&!1===e.input.includeTime?q:U}};e([i()],z.prototype,"_effectiveDomain",null),e([i()],z.prototype,"_activeFieldInput",void 0),e([i()],z.prototype,"_effectiveRange",null),e([i()],z.prototype,"_isAnyDateOrTimeField",null),e([i()],z.prototype,"_isIntegerField",null),e([i()],z.prototype,"_isNumericField",null),e([i()],z.prototype,"_isStringField",null),e([i()],z.prototype,"_isSubtypeField",null),e([i({readOnly:!0})],z.prototype,"alias",null),e([i()],z.prototype,"cellValueFormatFunction",void 0),e([i()],z.prototype,"cellValueValidatorFunction",void 0),e([i({readOnly:!0})],z.prototype,"defaultValue",null),e([i()],z.prototype,"effectiveDescription",null),e([i()],z.prototype,"effectiveEditable",null),e([i()],z.prototype,"effectiveLabel",null),e([i()],z.prototype,"effectiveRequired",null),e([i()],z.prototype,"effectiveTimeZoneOptions",null),e([i({type:u})],z.prototype,"field",void 0),e([i()],z.prototype,"formatFunction",void 0),e([i()],z.prototype,"includeTime",null),e([i()],z.prototype,"inputRenderFunction",void 0),e([i()],z.prototype,"layer",void 0),e([i({readOnly:!0})],z.prototype,"loadingMessage",null),e([i()],z.prototype,"maxLength",null),e([i()],z.prototype,"minLength",null),e([i({readOnly:!0})],z.prototype,"name",null),e([i({readOnly:!0})],z.prototype,"nullable",null),e([i()],z.prototype,"parseInputValueFunction",void 0),e([i()],z.prototype,"shouldShowPrompt",null),e([i()],z.prototype,"sortable",void 0),e([i()],z.prototype,"store",void 0),e([i()],z.prototype,"template",void 0),e([i()],z.prototype,"view",void 0),z=e([n("esri.widgets.FeatureTable.FieldColumn")],z);const B=z;export{B 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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{isSome as i}from"../../core/arrayUtils.js";import s from"../../core/Error.js";import r from"../../core/Logger.js";import{debounce as o,isAbortError as a}from"../../core/promiseUtils.js";import n from"../../core/ReactiveSet.js";import{watch as l,when as u,sync as h}from"../../core/reactiveUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../geometry/Point.js";import{initializeProjection as g,project as f}from"../../geometry/projection.js";import m from"../../geometry/SpatialReference.js";import{getPointFromGeometry as y}from"../../geometry/support/geometryUtils.js";import{geographicToWebMercator as w}from"../../geometry/support/webMercatorUtils.js";import F from"../../layers/Layer.js";import{fallbackObjectIDAttribute as v}from"../../layers/LayerConstants.js";import _ from"../../layers/support/SubtypeSublayer.js";import b from"../../symbols/SimpleFillSymbol.js";import{getDisplayedSymbol as C}from"../../symbols/support/symbolUtils.js";import{system as P}from"../../time/timeZoneUtils.js";import{highlightsSupported as M}from"../../views/support/layerViewUtils.js";import E from"../Feature/FeatureViewModel.js";import{ActionsCollection as j,zoomToFeature as V,zoomToClusteredFeatures as L,browseClusteredFeatures as A}from"../Popup/actions.js";import{triggerAction as I,isClusterFeature as R,removeClusteredFeaturesForBrowsing as x,displayClusterExtent as S,browseAggregateFeatures as T,getSelectedTarget as O}from"../Popup/actionUtils.js";import B from"../support/AnchorElementViewModel.js";import H from"../support/GoTo.js";const U="location-scale-handle",G=()=>[V.clone()],Z=()=>[L.clone(),A.clone()];let z=null;function D(e,t){return"building-scene"===e||"2d"===t&&("map-image"===e||"tile"===e||"imagery"===e||"imagery-tile"===e)}let W=class extends(H(B)){constructor(e){super(e),this._pendingPromises=new n,this._fetchFeaturesController=null,this._highlightPromises={"highlight-active-feature":null,"highlight-selected-feature":null},this._selectedClusterFeature=null,this.actions=new j,this.activeFeature=null,this.autoCloseEnabled=!1,this.browseClusterEnabled=!1,this.content=null,this.defaultPopupTemplateEnabled=!1,this.featurePage=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureMenuTitle=null,this.featureViewModelAbilities=null,this.featureViewModels=[],this.highlightEnabled=!0,this.includeDefaultActions=!0,this.initialDisplayMode="feature",this.selectedClusterBoundaryFeature=new t({symbol:new b({outline:{width:1.5,color:"cyan"},style:"none"})}),this.title=null,this.updateLocationEnabled=!1,this.view=null,this.visible=!1,this.zoomFactor=4,this.zoomToLocation=null,this._debouncedLocationUpdate=o((async e=>{const{spatialReference:t}=this,i=this.selectedFeature?.geometry?.type,s=this.location??e;if(i&&"mesh"!==i&&t&&s&&this.selectedFeature)if("point"!==i)try{const e=this.selectedFeature;let i=e.geometry;const r=this._getHighlightLayer(e),o=e.getObjectId();if(!r||!this.view)return;if(o){const e=this.view?.allLayerViews.find((e=>e.layer.uid===r.uid));if(!e||!("queryFeatures"in e))return;const s=e.createQuery();s.outSpatialReference=t,s.objectIds=[o],s.returnGeometry=!0;const{features:a}=await e.queryFeatures(s);i=a[0]?.geometry}if(!i||"mesh"===i.type)return;if(i=f(i,t),z||(z=await import("../../geometry/geometryEngineAsync.js")),!await z.intersects(i,s)){const t=(await z.nearestCoordinate(i,s)).coordinate??s;this.selectedFeature===e&&(this.location=t)}}catch(o){a(o)||r.getLogger(this).error(o)}else this.location=y(this.selectedFeature.geometry)??s}))}initialize(){this.addHandles([this.on("view-change",(()=>this._autoClose())),l((()=>[this.highlightEnabled,this.selectedFeature,this.visible,this.view]),(()=>this._highlightSelectedFeature())),l((()=>[this.highlightEnabled,this.activeFeature,this.visible,this.view]),(()=>this._highlightActiveFeature())),l((()=>this.view?.animation?.state),(e=>this._animationStateChange(e))),l((()=>this.location),(e=>this._locationChange(e))),l((()=>this.selectedFeature),(e=>this._selectedFeatureChange(e))),l((()=>[this.selectedFeatureIndex,this.featureCount,this.featuresPerPage]),(()=>this._selectedFeatureIndexChange())),l((()=>[this.featurePage,this.selectedFeatureIndex,this.featureCount,this.featuresPerPage,this.featureViewModels]),(()=>this._setGraphicOnFeatureViewModels())),l((()=>this.featureViewModels),(()=>this._featureViewModelsChange())),this.on("trigger-action",(e=>I({event:e,viewModel:this,view:this.view}))),u((()=>!this.waitingForResult),(()=>this._waitingForResultChange()),h),l((()=>[this.features,this.map,this.spatialReference,this.timeZone]),(()=>this._updateFeatureVMs())),l((()=>this.view?.scale),(()=>this._viewScaleChange())),u((()=>!this.visible),(()=>this.browseClusterEnabled=!1)),l((()=>this.browseClusterEnabled),(e=>e?this.enableClusterBrowsing():this.disableClusterBrowsing()))])}destroy(){this._cancelFetchingFeatures(),this._pendingPromises.clear(),this.browseClusterEnabled=!1,this.view=null,this.map=null,this.spatialReference=null,this.timeZone=null}get active(){return!(!this.visible||this.waitingForResult)}get allActions(){const e=this._get("allActions")||new j;e.removeAll();const{actions:t,defaultActions:i,defaultPopupTemplateEnabled:s,includeDefaultActions:r,selectedFeature:o}=this,a=r?i.concat(t):t,n=o&&("function"==typeof o.getEffectivePopupTemplate&&o.getEffectivePopupTemplate(s)||o.popupTemplate),l=n?.actions,u=n?.overwriteActions?l:l?.concat(a)??a;return u?.filter(Boolean).forEach((t=>e.add(t))),e}get defaultActions(){const e=this._get("defaultActions")||new j;return e.removeAll(),e.addMany(R(this.selectedFeature)?Z():G()),e}get featureCount(){return this.features.length}set features(e){const t=e||[];this._set("features",t);const{pendingPromisesCount:i,promiseCount:s,selectedFeatureIndex:r}=this,o=s&&t.length;"list"!==this.initialDisplayMode?o&&i&&-1===r?this.selectedFeatureIndex=0:o&&-1!==r||(this.selectedFeatureIndex=t.length?0:-1):(!o||o&&i===s)&&(this.selectedFeatureIndex=-1)}set location(e){let t=e;const i=this.spatialReference?.isWebMercator,s=e?.spatialReference?.isWGS84;s&&i&&(t=w(e)),this._set("location",t)}get map(){return this.view?.map??null}set map(e){this._override("map",e)}get pendingPromisesCount(){return this._pendingPromises.size}get promiseCount(){return this.promises.length}get promises(){return this._get("promises")||[]}set promises(e){this._pendingPromises.clear(),this.features=[],Array.isArray(e)&&e.length?(this._set("promises",e),(e=e.slice()).forEach((e=>this._pendingPromises.add(e))),e.reduce(((e,t)=>e.finally((()=>t.then((e=>{this._pendingPromises.has(t)&&this._updateFeatures(e)})).finally((()=>this._pendingPromises.delete(t))).catch((()=>{}))))),Promise.resolve())):this._set("promises",[])}get selectedFeature(){const{features:e,selectedFeatureIndex:t}=this;if(-1===t)return null;return e[t]||null}get selectedFeatureIndex(){const e=this._get("selectedFeatureIndex");return"number"==typeof e?e:-1}set selectedFeatureIndex(e){const{featureCount:t}=this;(isNaN(e)||e<0||!t)&&(e=-1),this.activeFeature=null,this._set("selectedFeatureIndex",e)}get selectedFeatureViewModel(){return this.featureViewModels[this.selectedFeatureIndex]||null}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){const{view:e,map:t}=this;return e?e.ready?"ready":"disabled":t?"ready":"disabled"}get timeZone(){return this.view?.timeZone??P}set timeZone(e){this._overrideIfSome("timeZone",e)}get waitingForContents(){return this.featureViewModels.some((e=>e.waitingForContent))}get waitingForResult(){return!(!(!!this._fetchFeaturesController||this.pendingPromisesCount>0)||0!==this.featureCount)}centerAtLocation(){const{view:e}=this,t=O(this);return t&&e?this.callGoTo({target:{target:t,scale:e.scale}}):Promise.reject(new s("center-at-location:invalid-target-or-view","Cannot center at a location without a target and view.",{target:t,view:e}))}zoomTo(e){return this.callGoTo(e)}clear(){this.set({promises:[],features:[],content:null,title:null,location:null,activeFeature:null})}fetchFeatures(e,t){const{view:i}=this;if(!i||!e)throw new s("fetch-features:invalid-screenpoint-or-view","Cannot fetch features without a screenPoint and view.",{screenPoint:e,view:i});return i.fetchPopupFeatures(e,{pointerType:t?.event?.pointerType,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:t?.signal})}open(e){const t={updateLocationEnabled:!1,promises:[],fetchFeatures:!1,...e,visible:!0},{fetchFeatures:i}=t;delete t.fetchFeatures,i&&this._setFetchFeaturesPromises(t.location);const s=["actionsMenuOpen","collapsed"];for(const r of s)delete t[r];this.set(t)}triggerAction(e){const t=this.allActions.at(e);t&&!t.disabled&&this.emit("trigger-action",{action:t})}next(){return this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex+1,this.featureCount),this}previous(){return this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex-1,this.featureCount),this}disableClusterBrowsing(){x(this),this._clearBrowsedClusterGraphics()}async enableClusterBrowsing(){const{view:e,selectedFeature:t}=this;"2d"===e?.type?R(t)?(await S(this),await T(this)):r.getLogger(this).warn("enableClusterBrowsing:invalid-selectedFeature: Selected feature must represent an aggregate/cluster graphic.",t):r.getLogger(this).warn("enableClusterBrowsing:invalid-view: View must be 2d MapView.",t)}handleViewClick(e){this._fetchFeaturesAndOpen(e)}_getRoundRobinIndex(e,t){return(e+t)%t}_animationStateChange(e){this.zoomToLocation||(V.disabled="waiting-for-target"===e)}_clearBrowsedClusterGraphics(){const e=[this.selectedClusterBoundaryFeature,this._selectedClusterFeature].filter(i);this.view?.graphics?.removeMany(e),this._selectedClusterFeature=null,this.selectedClusterBoundaryFeature.geometry=null}_viewScaleChange(){if(R(this.selectedFeature))return this.browseClusterEnabled=!1,this.visible=!1,void this.clear();this.browseClusterEnabled&&(this.features=this.selectedFeature?[this.selectedFeature]:[])}_locationChange(e){const{selectedFeature:t,updateLocationEnabled:i,view:s}=this;s&&i&&e&&(!t||t.geometry)&&this.centerAtLocation()}_selectedFeatureIndexChange(){this.featurePage=this.featureCount>0?Math.floor((this.selectedFeatureIndex+1)/this.featuresPerPage):null}_featureViewModelsChange(){this.featurePage=this.featureCount>0?1:null}_setGraphicOnFeatureViewModels(){const{features:e,featureCount:t,featurePage:i,featuresPerPage:s,featureViewModels:r}=this;if(null==i)return;const o=((i-1)*s+t)%t,a=o+s;r.slice(o,a).forEach(((t,i)=>{t&&(t.graphic??=e[o+i])}))}async _selectedFeatureChange(e){const{location:t,updateLocationEnabled:i,view:s}=this;if(!e||!s)return;if(this.browseClusterEnabled){if(this._selectedClusterFeature&&(s.graphics.remove(this._selectedClusterFeature),this._selectedClusterFeature=null),R(e))return;return e.symbol=await C(e),this._selectedClusterFeature=e,void s.graphics.add(this._selectedClusterFeature)}const r=e.sourceLayer?.type;if("map-image"!==r&&"imagery"!==r&&"imagery-tile"!==r||(e.symbol=await C(e)),!i&&t||!e.geometry){if(i&&!e.geometry){await this.centerAtLocation();const e=s.center?.clone();e&&(this.location=e)}}else this.location=y(e.geometry)}_waitingForResultChange(){!this.featureCount&&this.promises&&(this.visible=!1)}async _setFetchFeaturesPromises(e){const{pendingFeatures:t}=await this._fetchFeaturesWithController({mapPoint:e});this.promises=t}_destroyFeatureVMs(){this.featureViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",[])}_updateFeatureVMs(){const{selectedFeature:e,features:t,featureViewModels:i,view:s,spatialReference:r,map:o,timeZone:a,location:n}=this;if(R(t[0])||(this.browseClusterEnabled=!1),this._destroyFeatureVMs(),!t?.length)return;const l=i.slice(),u=[];t.forEach(((t,i)=>{if(!t)return;let h=null;if(l.some(((e,i)=>(e&&e.graphic===t&&(h=e,l.splice(i,1)),!!h))),h)u[i]=h;else{const l=new E({abilities:this.featureViewModelAbilities,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:r,graphic:t===e?t:null,location:n,map:o,view:s,timeZone:a});u[i]=l}})),l.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",u)}async _getScreenPoint(e,t){const{spatialReference:i,view:s}=this;if(!s)return null;await(s?.when());const r=e?.spatialReference;return r&&i?(await g(r,i,null,t),s.toScreen(e)):null}_cancelFetchingFeatures(){const e=this._fetchFeaturesController;e&&e.abort(),this._fetchFeaturesController=null}async _projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,event:i,signal:s}){return this.fetchFeatures(t??await this._getScreenPoint(e??this.location,{signal:s}),{signal:s,event:i})}_fetchFeaturesWithController({mapPoint:e,screenPoint:t,event:i}){this._cancelFetchingFeatures();const s=new AbortController,{signal:r}=s;this._fetchFeaturesController=s;const o=this._projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,signal:r,event:i});return o.catch((()=>{})).then((()=>{this._fetchFeaturesController=null})),o}async _fetchFeaturesAndOpen(e){const{mapPoint:t,screenPoint:i}=e,{view:s}=this;this.removeHandles(U),this.addHandles([l((()=>this.view?.scale),(()=>this._debouncedLocationUpdate(t).catch((e=>{a(e)||r.getLogger(this).error(e)})))),u((()=>!this.visible),(()=>{this.removeHandles(U)}),{once:!0})],U);const{pendingFeatures:o}=await this._fetchFeaturesWithController({mapPoint:t,screenPoint:i,event:e});s?.popup&&"open"in s.popup&&s.popup.open({location:t??void 0,promises:o})}_autoClose(){this.autoCloseEnabled&&(this.visible=!1)}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){const{layer:t,sourceLayer:i}=e;return i&&"layer"in i&&i.layer?i.layer:"map-notes"===i?.type||"subtype-group"===i?.type?i:t}_getHighlightLayerView(e,t){return t instanceof F&&this._mapIncludesLayer(t)?this._getLayerView(e,t):t instanceof _&&t.parent&&this._mapIncludesLayer(t.parent)?this._getLayerView(e,t.parent):null}_getHighlightTarget(e,t,i){if(D(t.type,i))return e;const s=e.getObjectId();if(null!=s)return s;const r="imagery"===t.type?void 0:"objectIdField"in t?t.objectIdField||v:null,o=e.attributes;return o&&r&&o[r]||e}_mapIncludesLayer(e){return!!this.map?.allLayers?.includes(e)}async _highlightFeature(e,t){this.removeHandles(e);const i=this[t];if(!i)return;const{highlightEnabled:s,view:r,visible:o}=this;if(!r||!s||!o)return;const a=this._getHighlightLayer(i);if(!a)return;const n=this._getHighlightLayerView(r,a);if(!n)return;this._highlightPromises[e]=n;const l=await n;if(!(l&&M(l)&&this._highlightPromises[e]===n&&this[t]&&this.highlightEnabled))return;const u=l.highlight(this._getHighlightTarget(i,a,r.type));this.addHandles(u,e)}async _highlightActiveFeature(){return this._highlightFeature("highlight-active-feature","activeFeature")}async _highlightSelectedFeature(){return this._highlightFeature("highlight-selected-feature","selectedFeature")}_updateFeatures(e){const{features:t}=this,i=e.filter((e=>!t.includes(e)));i?.length&&(this.features=t.concat(i))}};e([c()],W.prototype,"_fetchFeaturesController",void 0),e([c({type:j})],W.prototype,"actions",void 0),e([c({readOnly:!0})],W.prototype,"active",null),e([c()],W.prototype,"activeFeature",void 0),e([c({readOnly:!0})],W.prototype,"allActions",null),e([c()],W.prototype,"autoCloseEnabled",void 0),e([c()],W.prototype,"browseClusterEnabled",void 0),e([c()],W.prototype,"content",void 0),e([c({type:j,readOnly:!0})],W.prototype,"defaultActions",null),e([c({type:Boolean})],W.prototype,"defaultPopupTemplateEnabled",void 0),e([c({readOnly:!0})],W.prototype,"featureCount",null),e([c()],W.prototype,"featurePage",void 0),e([c({value:[]})],W.prototype,"features",null),e([c()],W.prototype,"featuresPerPage",void 0),e([c()],W.prototype,"featureMenuOpen",void 0),e([c()],W.prototype,"featureMenuTitle",void 0),e([c()],W.prototype,"featureViewModelAbilities",void 0),e([c({readOnly:!0})],W.prototype,"featureViewModels",void 0),e([c()],W.prototype,"highlightEnabled",void 0),e([c()],W.prototype,"includeDefaultActions",void 0),e([c()],W.prototype,"initialDisplayMode",void 0),e([c({type:p})],W.prototype,"location",null),e([c()],W.prototype,"map",null),e([c({readOnly:!0})],W.prototype,"pendingPromisesCount",null),e([c({readOnly:!0})],W.prototype,"promiseCount",null),e([c()],W.prototype,"promises",null),e([c({readOnly:!0})],W.prototype,"selectedClusterBoundaryFeature",void 0),e([c({value:null,readOnly:!0})],W.prototype,"selectedFeature",null),e([c({value:-1})],W.prototype,"selectedFeatureIndex",null),e([c({readOnly:!0})],W.prototype,"selectedFeatureViewModel",null),e([c({type:m})],W.prototype,"spatialReference",null),e([c({readOnly:!0})],W.prototype,"state",null),e([c()],W.prototype,"timeZone",null),e([c()],W.prototype,"title",void 0),e([c()],W.prototype,"updateLocationEnabled",void 0),e([c()],W.prototype,"view",void 0),e([c()],W.prototype,"visible",void 0),e([c({readOnly:!0})],W.prototype,"waitingForContents",null),e([c({readOnly:!0})],W.prototype,"waitingForResult",null),e([c()],W.prototype,"zoomFactor",void 0),e([c()],W.prototype,"zoomToLocation",void 0),e([c()],W.prototype,"centerAtLocation",null),W=e([d("esri.widgets.Features.FeaturesViewModel")],W);const k=W;export{k as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{isSome as i}from"../../core/arrayUtils.js";import s from"../../core/Error.js";import r from"../../core/Logger.js";import{debounce as o,isAbortError as a}from"../../core/promiseUtils.js";import n from"../../core/ReactiveSet.js";import{watch as l,when as u,sync as h}from"../../core/reactiveUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../geometry/Point.js";import{initializeProjection as g,project as f}from"../../geometry/projection.js";import m from"../../geometry/SpatialReference.js";import{getPointFromGeometry as y}from"../../geometry/support/geometryUtils.js";import{geographicToWebMercator as w}from"../../geometry/support/webMercatorUtils.js";import F from"../../layers/Layer.js";import{fallbackObjectIDAttribute as v}from"../../layers/LayerConstants.js";import _ from"../../layers/support/SubtypeSublayer.js";import b from"../../symbols/SimpleFillSymbol.js";import{getDisplayedSymbol as C}from"../../symbols/support/symbolUtils.js";import{system as P}from"../../time/constants.js";import{highlightsSupported as M}from"../../views/support/layerViewUtils.js";import E from"../Feature/FeatureViewModel.js";import{ActionsCollection as j,zoomToFeature as V,zoomToClusteredFeatures as L,browseClusteredFeatures as A}from"../Popup/actions.js";import{triggerAction as I,isClusterFeature as R,removeClusteredFeaturesForBrowsing as x,displayClusterExtent as S,browseAggregateFeatures as T,getSelectedTarget as O}from"../Popup/actionUtils.js";import B from"../support/AnchorElementViewModel.js";import H from"../support/GoTo.js";const G="location-scale-handle",U=()=>[V.clone()],Z=()=>[L.clone(),A.clone()];let z=null;function D(e,t){return"building-scene"===e||"2d"===t&&("map-image"===e||"tile"===e||"imagery"===e||"imagery-tile"===e)}let W=class extends(H(B)){constructor(e){super(e),this._pendingPromises=new n,this._fetchFeaturesController=null,this._highlightPromises={"highlight-active-feature":null,"highlight-selected-feature":null},this._selectedClusterFeature=null,this.actions=new j,this.activeFeature=null,this.autoCloseEnabled=!1,this.browseClusterEnabled=!1,this.content=null,this.defaultPopupTemplateEnabled=!1,this.featurePage=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureMenuTitle=null,this.featureViewModelAbilities=null,this.featureViewModels=[],this.highlightEnabled=!0,this.includeDefaultActions=!0,this.initialDisplayMode="feature",this.selectedClusterBoundaryFeature=new t({symbol:new b({outline:{width:1.5,color:"cyan"},style:"none"})}),this.title=null,this.updateLocationEnabled=!1,this.view=null,this.visible=!1,this.zoomFactor=4,this.zoomToLocation=null,this._debouncedLocationUpdate=o((async e=>{const{spatialReference:t}=this,i=this.selectedFeature?.geometry?.type,s=this.location??e;if(i&&"mesh"!==i&&t&&s&&this.selectedFeature)if("point"!==i)try{const e=this.selectedFeature;let i=e.geometry;const r=this._getHighlightLayer(e),o=e.getObjectId();if(!r||!this.view)return;if(o){const e=this.view?.allLayerViews.find((e=>e.layer.uid===r.uid));if(!e||!("queryFeatures"in e))return;const s=e.createQuery();s.outSpatialReference=t,s.objectIds=[o],s.returnGeometry=!0;const{features:a}=await e.queryFeatures(s);i=a[0]?.geometry}if(!i||"mesh"===i.type)return;if(i=f(i,t),z||(z=await import("../../geometry/geometryEngineAsync.js")),!await z.intersects(i,s)){const t=(await z.nearestCoordinate(i,s)).coordinate??s;this.selectedFeature===e&&(this.location=t)}}catch(o){a(o)||r.getLogger(this).error(o)}else this.location=y(this.selectedFeature.geometry)??s}))}initialize(){this.addHandles([this.on("view-change",(()=>this._autoClose())),l((()=>[this.highlightEnabled,this.selectedFeature,this.visible,this.view]),(()=>this._highlightSelectedFeature())),l((()=>[this.highlightEnabled,this.activeFeature,this.visible,this.view]),(()=>this._highlightActiveFeature())),l((()=>this.view?.animation?.state),(e=>this._animationStateChange(e))),l((()=>this.location),(e=>this._locationChange(e))),l((()=>this.selectedFeature),(e=>this._selectedFeatureChange(e))),l((()=>[this.selectedFeatureIndex,this.featureCount,this.featuresPerPage]),(()=>this._selectedFeatureIndexChange())),l((()=>[this.featurePage,this.selectedFeatureIndex,this.featureCount,this.featuresPerPage,this.featureViewModels]),(()=>this._setGraphicOnFeatureViewModels())),l((()=>this.featureViewModels),(()=>this._featureViewModelsChange())),this.on("trigger-action",(e=>I({event:e,viewModel:this,view:this.view}))),u((()=>!this.waitingForResult),(()=>this._waitingForResultChange()),h),l((()=>[this.features,this.map,this.spatialReference,this.timeZone]),(()=>this._updateFeatureVMs())),l((()=>this.view?.scale),(()=>this._viewScaleChange())),u((()=>!this.visible),(()=>this.browseClusterEnabled=!1)),l((()=>this.browseClusterEnabled),(e=>e?this.enableClusterBrowsing():this.disableClusterBrowsing()))])}destroy(){this._cancelFetchingFeatures(),this._pendingPromises.clear(),this.browseClusterEnabled=!1,this.view=null,this.map=null,this.spatialReference=null,this.timeZone=null}get active(){return!(!this.visible||this.waitingForResult)}get allActions(){const e=this._get("allActions")||new j;e.removeAll();const{actions:t,defaultActions:i,defaultPopupTemplateEnabled:s,includeDefaultActions:r,selectedFeature:o}=this,a=r?i.concat(t):t,n=o&&("function"==typeof o.getEffectivePopupTemplate&&o.getEffectivePopupTemplate(s)||o.popupTemplate),l=n?.actions,u=n?.overwriteActions?l:l?.concat(a)??a;return u?.filter(Boolean).forEach((t=>e.add(t))),e}get defaultActions(){const e=this._get("defaultActions")||new j;return e.removeAll(),e.addMany(R(this.selectedFeature)?Z():U()),e}get featureCount(){return this.features.length}set features(e){const t=e||[];this._set("features",t);const{pendingPromisesCount:i,promiseCount:s,selectedFeatureIndex:r}=this,o=s&&t.length;"list"!==this.initialDisplayMode?o&&i&&-1===r?this.selectedFeatureIndex=0:o&&-1!==r||(this.selectedFeatureIndex=t.length?0:-1):(!o||o&&i===s)&&(this.selectedFeatureIndex=-1)}set location(e){let t=e;const i=this.spatialReference?.isWebMercator,s=e?.spatialReference?.isWGS84;s&&i&&(t=w(e)),this._set("location",t)}get map(){return this.view?.map??null}set map(e){this._override("map",e)}get pendingPromisesCount(){return this._pendingPromises.size}get promiseCount(){return this.promises.length}get promises(){return this._get("promises")||[]}set promises(e){this._pendingPromises.clear(),this.features=[],Array.isArray(e)&&e.length?(this._set("promises",e),(e=e.slice()).forEach((e=>this._pendingPromises.add(e))),e.reduce(((e,t)=>e.finally((()=>t.then((e=>{this._pendingPromises.has(t)&&this._updateFeatures(e)})).finally((()=>this._pendingPromises.delete(t))).catch((()=>{}))))),Promise.resolve())):this._set("promises",[])}get selectedFeature(){const{features:e,selectedFeatureIndex:t}=this;if(-1===t)return null;return e[t]||null}get selectedFeatureIndex(){const e=this._get("selectedFeatureIndex");return"number"==typeof e?e:-1}set selectedFeatureIndex(e){const{featureCount:t}=this;(isNaN(e)||e<0||!t)&&(e=-1),this.activeFeature=null,this._set("selectedFeatureIndex",e)}get selectedFeatureViewModel(){return this.featureViewModels[this.selectedFeatureIndex]||null}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){const{view:e,map:t}=this;return e?e.ready?"ready":"disabled":t?"ready":"disabled"}get timeZone(){return this.view?.timeZone??P}set timeZone(e){this._overrideIfSome("timeZone",e)}get waitingForContents(){return this.featureViewModels.some((e=>e.waitingForContent))}get waitingForResult(){return!(!(!!this._fetchFeaturesController||this.pendingPromisesCount>0)||0!==this.featureCount)}centerAtLocation(){const{view:e}=this,t=O(this);return t&&e?this.callGoTo({target:{target:t,scale:e.scale}}):Promise.reject(new s("center-at-location:invalid-target-or-view","Cannot center at a location without a target and view.",{target:t,view:e}))}zoomTo(e){return this.callGoTo(e)}clear(){this.set({promises:[],features:[],content:null,title:null,location:null,activeFeature:null})}fetchFeatures(e,t){const{view:i}=this;if(!i||!e)throw new s("fetch-features:invalid-screenpoint-or-view","Cannot fetch features without a screenPoint and view.",{screenPoint:e,view:i});return i.fetchPopupFeatures(e,{pointerType:t?.event?.pointerType,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:t?.signal})}open(e){const t={updateLocationEnabled:!1,promises:[],fetchFeatures:!1,...e,visible:!0},{fetchFeatures:i}=t;delete t.fetchFeatures,i&&this._setFetchFeaturesPromises(t.location);const s=["actionsMenuOpen","collapsed"];for(const r of s)delete t[r];this.set(t)}triggerAction(e){const t=this.allActions.at(e);t&&!t.disabled&&this.emit("trigger-action",{action:t})}next(){return this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex+1,this.featureCount),this}previous(){return this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex-1,this.featureCount),this}disableClusterBrowsing(){x(this),this._clearBrowsedClusterGraphics()}async enableClusterBrowsing(){const{view:e,selectedFeature:t}=this;"2d"===e?.type?R(t)?(await S(this),await T(this)):r.getLogger(this).warn("enableClusterBrowsing:invalid-selectedFeature: Selected feature must represent an aggregate/cluster graphic.",t):r.getLogger(this).warn("enableClusterBrowsing:invalid-view: View must be 2d MapView.",t)}handleViewClick(e){this._fetchFeaturesAndOpen(e)}_getRoundRobinIndex(e,t){return(e+t)%t}_animationStateChange(e){this.zoomToLocation||(V.disabled="waiting-for-target"===e)}_clearBrowsedClusterGraphics(){const e=[this.selectedClusterBoundaryFeature,this._selectedClusterFeature].filter(i);this.view?.graphics?.removeMany(e),this._selectedClusterFeature=null,this.selectedClusterBoundaryFeature.geometry=null}_viewScaleChange(){if(R(this.selectedFeature))return this.browseClusterEnabled=!1,this.visible=!1,void this.clear();this.browseClusterEnabled&&(this.features=this.selectedFeature?[this.selectedFeature]:[])}_locationChange(e){const{selectedFeature:t,updateLocationEnabled:i,view:s}=this;s&&i&&e&&(!t||t.geometry)&&this.centerAtLocation()}_selectedFeatureIndexChange(){this.featurePage=this.featureCount>0?Math.floor((this.selectedFeatureIndex+1)/this.featuresPerPage):null}_featureViewModelsChange(){this.featurePage=this.featureCount>0?1:null}_setGraphicOnFeatureViewModels(){const{features:e,featureCount:t,featurePage:i,featuresPerPage:s,featureViewModels:r}=this;if(null==i)return;const o=((i-1)*s+t)%t,a=o+s;r.slice(o,a).forEach(((t,i)=>{t&&(t.graphic??=e[o+i])}))}async _selectedFeatureChange(e){const{location:t,updateLocationEnabled:i,view:s}=this;if(!e||!s)return;if(this.browseClusterEnabled){if(this._selectedClusterFeature&&(s.graphics.remove(this._selectedClusterFeature),this._selectedClusterFeature=null),R(e))return;return e.symbol=await C(e),this._selectedClusterFeature=e,void s.graphics.add(this._selectedClusterFeature)}const r=e.sourceLayer?.type;if("map-image"!==r&&"imagery"!==r&&"imagery-tile"!==r||(e.symbol=await C(e)),!i&&t||!e.geometry){if(i&&!e.geometry){await this.centerAtLocation();const e=s.center?.clone();e&&(this.location=e)}}else this.location=y(e.geometry)}_waitingForResultChange(){!this.featureCount&&this.promises&&(this.visible=!1)}async _setFetchFeaturesPromises(e){const{pendingFeatures:t}=await this._fetchFeaturesWithController({mapPoint:e});this.promises=t}_destroyFeatureVMs(){this.featureViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",[])}_updateFeatureVMs(){const{selectedFeature:e,features:t,featureViewModels:i,view:s,spatialReference:r,map:o,timeZone:a,location:n}=this;if(R(t[0])||(this.browseClusterEnabled=!1),this._destroyFeatureVMs(),!t?.length)return;const l=i.slice(),u=[];t.forEach(((t,i)=>{if(!t)return;let h=null;if(l.some(((e,i)=>(e&&e.graphic===t&&(h=e,l.splice(i,1)),!!h))),h)u[i]=h;else{const l=new E({abilities:this.featureViewModelAbilities,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:r,graphic:t===e?t:null,location:n,map:o,view:s,timeZone:a});u[i]=l}})),l.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",u)}async _getScreenPoint(e,t){const{spatialReference:i,view:s}=this;if(!s)return null;await(s?.when());const r=e?.spatialReference;return r&&i?(await g(r,i,null,t),s.toScreen(e)):null}_cancelFetchingFeatures(){const e=this._fetchFeaturesController;e&&e.abort(),this._fetchFeaturesController=null}async _projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,event:i,signal:s}){return this.fetchFeatures(t??await this._getScreenPoint(e??this.location,{signal:s}),{signal:s,event:i})}_fetchFeaturesWithController({mapPoint:e,screenPoint:t,event:i}){this._cancelFetchingFeatures();const s=new AbortController,{signal:r}=s;this._fetchFeaturesController=s;const o=this._projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,signal:r,event:i});return o.catch((()=>{})).then((()=>{this._fetchFeaturesController=null})),o}async _fetchFeaturesAndOpen(e){const{mapPoint:t,screenPoint:i}=e,{view:s}=this;this.removeHandles(G),this.addHandles([l((()=>this.view?.scale),(()=>this._debouncedLocationUpdate(t).catch((e=>{a(e)||r.getLogger(this).error(e)})))),u((()=>!this.visible),(()=>{this.removeHandles(G)}),{once:!0})],G);const{pendingFeatures:o}=await this._fetchFeaturesWithController({mapPoint:t,screenPoint:i,event:e});s?.popup&&"open"in s.popup&&s.popup.open({location:t??void 0,promises:o})}_autoClose(){this.autoCloseEnabled&&(this.visible=!1)}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){const{layer:t,sourceLayer:i}=e;return i&&"layer"in i&&i.layer?i.layer:"map-notes"===i?.type||"subtype-group"===i?.type?i:t}_getHighlightLayerView(e,t){return t instanceof F&&this._mapIncludesLayer(t)?this._getLayerView(e,t):t instanceof _&&t.parent&&this._mapIncludesLayer(t.parent)?this._getLayerView(e,t.parent):null}_getHighlightTarget(e,t,i){if(D(t.type,i))return e;const s=e.getObjectId();if(null!=s)return s;const r="imagery"===t.type?void 0:"objectIdField"in t?t.objectIdField||v:null,o=e.attributes;return o&&r&&o[r]||e}_mapIncludesLayer(e){return!!this.map?.allLayers?.includes(e)}async _highlightFeature(e,t){this.removeHandles(e);const i=this[t];if(!i)return;const{highlightEnabled:s,view:r,visible:o}=this;if(!r||!s||!o)return;const a=this._getHighlightLayer(i);if(!a)return;const n=this._getHighlightLayerView(r,a);if(!n)return;this._highlightPromises[e]=n;const l=await n;if(!(l&&M(l)&&this._highlightPromises[e]===n&&this[t]&&this.highlightEnabled))return;const u=l.highlight(this._getHighlightTarget(i,a,r.type));this.addHandles(u,e)}async _highlightActiveFeature(){return this._highlightFeature("highlight-active-feature","activeFeature")}async _highlightSelectedFeature(){return this._highlightFeature("highlight-selected-feature","selectedFeature")}_updateFeatures(e){const{features:t}=this,i=e.filter((e=>!t.includes(e)));i?.length&&(this.features=t.concat(i))}};e([c()],W.prototype,"_fetchFeaturesController",void 0),e([c({type:j})],W.prototype,"actions",void 0),e([c({readOnly:!0})],W.prototype,"active",null),e([c()],W.prototype,"activeFeature",void 0),e([c({readOnly:!0})],W.prototype,"allActions",null),e([c()],W.prototype,"autoCloseEnabled",void 0),e([c()],W.prototype,"browseClusterEnabled",void 0),e([c()],W.prototype,"content",void 0),e([c({type:j,readOnly:!0})],W.prototype,"defaultActions",null),e([c({type:Boolean})],W.prototype,"defaultPopupTemplateEnabled",void 0),e([c({readOnly:!0})],W.prototype,"featureCount",null),e([c()],W.prototype,"featurePage",void 0),e([c({value:[]})],W.prototype,"features",null),e([c()],W.prototype,"featuresPerPage",void 0),e([c()],W.prototype,"featureMenuOpen",void 0),e([c()],W.prototype,"featureMenuTitle",void 0),e([c()],W.prototype,"featureViewModelAbilities",void 0),e([c({readOnly:!0})],W.prototype,"featureViewModels",void 0),e([c()],W.prototype,"highlightEnabled",void 0),e([c()],W.prototype,"includeDefaultActions",void 0),e([c()],W.prototype,"initialDisplayMode",void 0),e([c({type:p})],W.prototype,"location",null),e([c()],W.prototype,"map",null),e([c({readOnly:!0})],W.prototype,"pendingPromisesCount",null),e([c({readOnly:!0})],W.prototype,"promiseCount",null),e([c()],W.prototype,"promises",null),e([c({readOnly:!0})],W.prototype,"selectedClusterBoundaryFeature",void 0),e([c({value:null,readOnly:!0})],W.prototype,"selectedFeature",null),e([c({value:-1})],W.prototype,"selectedFeatureIndex",null),e([c({readOnly:!0})],W.prototype,"selectedFeatureViewModel",null),e([c({type:m})],W.prototype,"spatialReference",null),e([c({readOnly:!0})],W.prototype,"state",null),e([c()],W.prototype,"timeZone",null),e([c()],W.prototype,"title",void 0),e([c()],W.prototype,"updateLocationEnabled",void 0),e([c()],W.prototype,"view",void 0),e([c()],W.prototype,"visible",void 0),e([c({readOnly:!0})],W.prototype,"waitingForContents",null),e([c({readOnly:!0})],W.prototype,"waitingForResult",null),e([c()],W.prototype,"zoomFactor",void 0),e([c()],W.prototype,"zoomToLocation",void 0),e([c()],W.prototype,"centerAtLocation",null),W=e([d("esri.widgets.Features.FeaturesViewModel")],W);const k=W;export{k as default};
|