@arcgis/core 5.2.0-next.61 → 5.2.0-next.63
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/WebDocument2D.d.ts +17 -1
- package/WebDocument2D.js +1 -1
- package/WebLinkChart.js +1 -1
- package/WebMap.js +1 -1
- package/WebScene.js +1 -1
- package/applications/Components/imageryUtils.d.ts +10 -0
- package/applications/Components/imageryUtils.js +1 -1
- package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
- package/arcgisGlobal.d.ts +7 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/02dd79beb13eff6be85e.js +1 -0
- package/assets/esri/core/workers/chunks/04ffe788d2efc0a076dd.js +1 -0
- package/assets/esri/core/workers/chunks/0623acb2bd14a61b65c9.js +29 -0
- package/assets/esri/core/workers/chunks/08c2bf9defcece9e049a.js +1 -0
- package/assets/esri/core/workers/chunks/0d61c8d348b09179777a.js +1 -0
- package/assets/esri/core/workers/chunks/{3abc12d2407e4214963d.js → 13033178de9f637a2356.js} +1 -1
- package/assets/esri/core/workers/chunks/14cd8bb1ad4da8d1d2ca.js +1 -0
- package/assets/esri/core/workers/chunks/23a3d8f91caf3136b2aa.js +1 -0
- package/assets/esri/core/workers/chunks/{3157f85bb319294878ca.js → 2426601b8cae7f06af4d.js} +2 -2
- package/assets/esri/core/workers/chunks/2a1c6df073e6ca6a6365.js +1 -0
- package/assets/esri/core/workers/chunks/{a615a644086e98a90579.js → 3f775deea48e268411f1.js} +3 -3
- package/assets/esri/core/workers/chunks/{e3623e557ab463580fd2.js → 41e821ce229bc56dc1a1.js} +1 -1
- package/assets/esri/core/workers/chunks/{17acbf40e7c1cb42d9bd.js → 44b1cdf28269b4fa8a39.js} +1 -1
- package/assets/esri/core/workers/chunks/44e8cd4b3dad777ab0c9.js +1 -0
- package/assets/esri/core/workers/chunks/456e616f32e7de696d38.js +1 -0
- package/assets/esri/core/workers/chunks/{127b111ee53e4b9184f8.js → 4dcd4a052b40047a9230.js} +1 -1
- package/assets/esri/core/workers/chunks/54b9667450d066c6f6ce.js +1 -0
- package/assets/esri/core/workers/chunks/{aaa66a04b882b0ba2961.js → 5600fc334d20c4f0c83d.js} +1 -1
- package/assets/esri/core/workers/chunks/5dbd8ca7e7b8eb9a0bf7.js +1 -0
- package/assets/esri/core/workers/chunks/5e3d5347223f0111f40f.js +1 -0
- package/assets/esri/core/workers/chunks/62f3ca0719ac6bc76512.js +1 -0
- package/assets/esri/core/workers/chunks/{14c066c31fe37b7f6e63.js → 638ed1297efdb24f4711.js} +1 -1
- package/assets/esri/core/workers/chunks/63ede7295938f7010808.js +1 -0
- package/assets/esri/core/workers/chunks/687cf21e027f49b44d22.js +1 -0
- package/assets/esri/core/workers/chunks/6c98a64d92c9bca78203.js +1 -0
- package/assets/esri/core/workers/chunks/{e7402dfd683f82878360.js → 752343d92ed48e674351.js} +1 -1
- package/assets/esri/core/workers/chunks/7538a0fe0cec3156769e.js +1 -0
- package/assets/esri/core/workers/chunks/{42692a4ce3fb364e321e.js → 763cbb6716e398436a6d.js} +1 -1
- package/assets/esri/core/workers/chunks/{d6aad815fc0ee8e24bb5.js → 7ce52b850dd785bfa33f.js} +1 -1
- package/assets/esri/core/workers/chunks/{64247e439ef3e1f712e9.js → 7fdd6a5fa062778be55d.js} +1 -1
- package/assets/esri/core/workers/chunks/8369edafab7bdc59b95a.js +1 -0
- package/assets/esri/core/workers/chunks/{94e9cf8e729ec36de5be.js → 8c535c6a39d2be2ed655.js} +1 -1
- package/assets/esri/core/workers/chunks/8e1d4867406753c5483c.js +1 -0
- package/assets/esri/core/workers/chunks/92696cce2b980373f9ad.js +1 -0
- package/assets/esri/core/workers/chunks/{580451761cadfe308919.js → 9954149def644c371894.js} +1 -1
- package/assets/esri/core/workers/chunks/9f65cc6d9f7390bb1d5b.js +1 -0
- package/assets/esri/core/workers/chunks/a09ce34fc7c8abe64ed5.js +1 -0
- package/assets/esri/core/workers/chunks/{81659d121ed732bda907.js → a12803108c3b12808698.js} +2 -2
- package/assets/esri/core/workers/chunks/{83991475aa54fd5aa008.js → a965d151515b76dd7566.js} +1 -1
- package/assets/esri/core/workers/chunks/{128799741dd3c6fc69b9.js → ac4131121230cfc14f21.js} +1 -1
- package/assets/esri/core/workers/chunks/afeeb11b39e140303b5a.js +1 -0
- package/assets/esri/core/workers/chunks/b13d2da33ec07e9d41ff.js +1 -0
- package/assets/esri/core/workers/chunks/{33bd9785bd0b6ccef21b.js → b2cf1d3f0d48eac23a84.js} +1 -1
- package/assets/esri/core/workers/chunks/{498d29e8c8be4a12ba12.js → b958f87f23f984131d09.js} +1 -1
- package/assets/esri/core/workers/chunks/c53b2be005721591e29b.js +1 -0
- package/assets/esri/core/workers/chunks/{edf87407dd20685c82ab.js → c82ab4f0908290e70ee9.js} +1 -1
- package/assets/esri/core/workers/chunks/{4e2f3dd158a5228c87ba.js → c85ba0700eafdc8d6f9e.js} +1 -1
- package/assets/esri/core/workers/chunks/d456520e4b119a2816b6.js +1 -0
- package/assets/esri/core/workers/chunks/d83ea3e4e9ab45334068.js +1 -0
- package/assets/esri/core/workers/chunks/{4f59357f535f30a6b5cc.js → d9b83d7dd7d1f7729a91.js} +1 -1
- package/assets/esri/core/workers/chunks/dbcec48c4ba104a6d0b5.js +1 -0
- package/assets/esri/core/workers/chunks/e02f02040b63d9c2e654.js +1 -0
- package/assets/esri/core/workers/chunks/e08c64e4ae5a68eae2be.js +1 -0
- package/assets/esri/core/workers/chunks/e2ddfc96ddba92302e0c.js +1 -0
- package/assets/esri/core/workers/chunks/{61d3fcb419d6bf7e355e.js → e65ee26feca0564aeb9b.js} +1 -1
- package/assets/esri/core/workers/chunks/{35cbf00f0c37a86517af.js → ed1de8b7406269e217b9.js} +1 -1
- package/assets/esri/core/workers/chunks/ed4ac5568dc2815b066d.js +1 -0
- package/assets/esri/core/workers/chunks/f029c12f1afee0e9b2a1.js +1 -0
- package/assets/esri/core/workers/chunks/{461c2de938bf4c9b1442.js → f6715b8765cd36d81ec8.js} +1 -1
- package/assets/esri/core/workers/chunks/{4fb549f11e176fc2f24a.js → f7fa932ade85cb2847b6.js} +1 -1
- package/assets/esri/core/workers/chunks/f9a4f4efd63b8189a4eb.js +1 -0
- package/assets/esri/core/workers/chunks/{26a2d4b95cda0a41d980.js → fa1c58e5b582d61a03ab.js} +1 -1
- package/assets/esri/core/workers/chunks/fa377112ef3b78f6ed18.js +1 -0
- package/chunks/VolumeMask.glsl.js +3 -0
- package/chunks/persistableUrlUtils.js +1 -1
- package/config.js +1 -1
- package/core/Collection.d.ts +42 -6
- package/core/Collection.js +1 -1
- package/core/screenUtils.js +1 -1
- package/geometry/SpatialReference.d.ts +1 -4
- package/geometry/support/intersectsBase.js +1 -1
- package/interfaces.d.ts +14 -0
- package/kernel.js +1 -1
- package/layers/BaseElevationLayer.js +1 -1
- package/layers/ElevationLayer.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/KnowledgeGraphLayer.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/StreamLayer.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/graphics/sources/connections/createConnection.js +1 -1
- package/layers/graphics/sources/parquet/ParquetFileStatistics.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/graphics/sources/support/QueryTask.js +1 -1
- package/layers/mixins/SceneService.js +1 -1
- package/layers/raster/datasets/BaseRaster.js +1 -1
- package/layers/save/groupLayerUtils.js +1 -1
- package/layers/save/mediaLayerUtils.js +1 -1
- package/layers/support/ElevationQueryTileCache.js +1 -1
- package/layers/video/types.d.ts +17 -1
- package/linkChart/LinkChartProperties.js +1 -1
- package/package.json +3 -3
- package/popup/FeatureContent.d.ts +311 -0
- package/popup/FeatureContent.js +2 -0
- package/popup/FeatureContentCollection.d.ts +569 -0
- package/popup/FeatureContentCollection.js +2 -0
- package/portal/support/jsonContext.js +1 -1
- package/support/persistableUrlUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/views/2d/layers/BaseLayerView2D.d.ts +2 -2
- package/views/2d/layers/BaseLayerViewGL2D.d.ts +2 -2
- package/views/2d/layers/features/sources/strategies/AFeatureLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/FeatureHybridTileLoadStrategy.js +1 -1
- package/views/2d/layers/graphics/GraphicStore.js +1 -1
- package/views/2d/support/hitTestUtils.js +1 -1
- package/views/3d/GroundView3D.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
- package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/layers/support/Tiles3DMeshIntersectionHandler.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/support/buffer/glUtil.js +1 -1
- package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatFadeTexture.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatHeaderTexture.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
- package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticBVH.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectFixedBVH.js +1 -1
- package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/FBOCacheUsage.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +11 -11
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMask.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillVisualization.js +1 -1
- package/views/3d/webgl-engine/lib/Intersector.js +1 -1
- package/views/3d/webgl-engine/lib/IntersectorResult.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBuffer.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFieldCreation.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
- package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/intersectWithPolygonOffset.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastMaskTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/{CutFillMask.glsl.js → VolumeMask.glsl.js} +1 -1
- package/views/3d/webgl-engine/shaders/VolumeMaskTechnique.js +2 -0
- package/views/View2D.d.ts +2 -2
- package/views/interactive/snapping/featureSources/WorkerTileTreeDebugger.js +1 -1
- package/views/webgl/FramebufferObject.js +1 -1
- package/webdoc/support/resourceUtils.js +1 -1
- package/webdoc/support/types.d.ts +2 -0
- package/webdoc/support/utils.js +2 -0
- package/webdoc/support/webdocLoadUtils.js +1 -1
- package/webdoc/support/webdocSaveUtils.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
- package/widgets/BatchAttributeForm/expressions/ArcadeExecutorProvider.js +1 -1
- package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
- package/widgets/BatchAttributeForm/expressions/ExpressionsModel.js +1 -1
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/BatchFormInputs.js +1 -1
- package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
- package/widgets/BatchAttributeForm/rendered-content/RelationshipDetails.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable/Grid/Column.d.ts +6 -0
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Legend/support/heatmapRampUtils.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/support/SelectionList/FeatureItem.d.ts +116 -0
- package/widgets/support/SelectionList/GroupLayerItem.d.ts +94 -0
- package/widgets/support/SelectionList/ItemBase.d.ts +70 -0
- package/widgets/support/SelectionList/LayerItem.d.ts +140 -0
- package/widgets/support/SelectionList/LayerItem.js +1 -1
- package/widgets/support/SelectionList/SelectionListViewModel.d.ts +265 -0
- package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
- package/widgets/support/SelectionList/types.d.ts +42 -0
- package/widgets/support/forms/formUtils.js +1 -1
- package/assets/esri/core/workers/chunks/003a87b16f8a4b476e14.js +0 -1
- package/assets/esri/core/workers/chunks/0a50efb07eee36237e21.js +0 -1
- package/assets/esri/core/workers/chunks/129fdd1636e67997337c.js +0 -1
- package/assets/esri/core/workers/chunks/12e0c5b7cc5c3f9e6f0f.js +0 -1
- package/assets/esri/core/workers/chunks/26f1fd3f2be5102aae1d.js +0 -1
- package/assets/esri/core/workers/chunks/34fbeeeeef4bd01672c6.js +0 -1
- package/assets/esri/core/workers/chunks/36fe6adf6517d8f80125.js +0 -1
- package/assets/esri/core/workers/chunks/403f08e0c1a9203f7fba.js +0 -1
- package/assets/esri/core/workers/chunks/4f2170609742b51bd7b8.js +0 -1
- package/assets/esri/core/workers/chunks/5133083222588799493f.js +0 -1
- package/assets/esri/core/workers/chunks/52993a9dc0c56e9bda19.js +0 -1
- package/assets/esri/core/workers/chunks/5527b2da4abe0faa98bb.js +0 -1
- package/assets/esri/core/workers/chunks/5e35828216020f33e26b.js +0 -1
- package/assets/esri/core/workers/chunks/5f0d6c853873a7f32527.js +0 -1
- package/assets/esri/core/workers/chunks/6121cd0264b6841a5bac.js +0 -1
- package/assets/esri/core/workers/chunks/6823ba1688dfedba0107.js +0 -1
- package/assets/esri/core/workers/chunks/705d6b108fd121cea887.js +0 -1
- package/assets/esri/core/workers/chunks/73aa1bfa6e1dc271c9d7.js +0 -1
- package/assets/esri/core/workers/chunks/825eb845216762a1ed2f.js +0 -1
- package/assets/esri/core/workers/chunks/88df19742edb0cdc3e67.js +0 -1
- package/assets/esri/core/workers/chunks/8977c85aecc7e08ab13c.js +0 -1
- package/assets/esri/core/workers/chunks/8bdca809dd88eab9e5d8.js +0 -29
- package/assets/esri/core/workers/chunks/8c5726c7ce40a92901e6.js +0 -1
- package/assets/esri/core/workers/chunks/8c5e65982c3f9295e844.js +0 -1
- package/assets/esri/core/workers/chunks/8ce649e55fefc8eca55c.js +0 -1
- package/assets/esri/core/workers/chunks/90ae80b797642bff0efa.js +0 -1
- package/assets/esri/core/workers/chunks/97c758f736f28c5dab84.js +0 -1
- package/assets/esri/core/workers/chunks/a8ade34612e73862de6f.js +0 -1
- package/assets/esri/core/workers/chunks/a9d391071803b1e9e8a0.js +0 -1
- package/assets/esri/core/workers/chunks/aa3abc07de2921ef6ca1.js +0 -1
- package/assets/esri/core/workers/chunks/b03f09ee2224f0cc526a.js +0 -1
- package/assets/esri/core/workers/chunks/b3f1a442d6b7826e917f.js +0 -1
- package/assets/esri/core/workers/chunks/b819a9187426d0c146df.js +0 -1
- package/assets/esri/core/workers/chunks/d205edd949f3e6e24eb9.js +0 -1
- package/assets/esri/core/workers/chunks/f0225829f7d941914815.js +0 -1
- package/assets/esri/core/workers/chunks/fb34d6d96c8c0d53fcf6.js +0 -1
- package/chunks/CutFillMask.glsl.js +0 -3
- package/chunks/FocusAreaMask.glsl.js +0 -3
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMask.glsl.js +0 -2
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskTechnique.js +0 -2
- package/views/3d/webgl-engine/shaders/CutFillMaskTechnique.js +0 -2
- /package/assets/esri/core/workers/chunks/{81659d121ed732bda907.js.LICENSE.txt → a12803108c3b12808698.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{substitute as e}from"../../intl.js";import{equalsShallow as t}from"../../core/lang.js";import{throwIfAborted as i}from"../../core/promiseUtils.js";import{isLayerWithHistoricMoment as n}from"../../layers/mixins/EditBusLayer.js";import{isSubtypeSublayer as
|
|
2
|
+
import{substitute as e}from"../../intl.js";import{equalsShallow as t}from"../../core/lang.js";import{throwIfAborted as i}from"../../core/promiseUtils.js";import{isLayerWithHistoricMoment as n}from"../../layers/mixins/EditBusLayer.js";import{isSubtypeSublayer as r,getSubtypesFromLayer as o}from"../../layers/support/layerUtils.js";import a from"../../rest/support/AttachmentQuery.js";import{unknown as s,utc as l}from"../../time/constants.js";import{ReactiveGraphic as u}from"./ReactiveGraphic.js";import{isMultipleChoiceFieldInput as c,isGroupInput as d}from"./inputs/support/inputUtils.js";import{getIntlOptionsForField as p}from"../support/dateUtils.js";import{isEmptyValue as f,getRangeErrorMessage as m,shouldUseScientificNotation as y,scientificNumberFormatOptions as v,numberFormatOptions as h}from"../support/forms/formUtils.js";const b=(e,t)=>null!=e&&e.input?.type===t;function g(e){return new u({source:e})}function j(t,i,n,r){const{dataType:o,minLength:a}=t,s=n?.validationErrors;if(!s||!i)return null;if("batch-attribute-form-validation::features-have-different-errors"===i)return s.invalidBatchFormType;if("input-validation-error::cannot-be-empty"===i)return s.cannotBeNull;if("domain-validation-error::value-out-of-range"===i||"numeric-range-validation-error::out-of-range"===i){const{field:i,range:n}=t,a={type:"date",intlOptions:{timeZone:"date"===i.type&&r?r:void 0,...p(i)}},l=m(n,s);return e(l,n,{format:{max:"date"===o?a:null!=n.max&&y(n.max)?v:h,min:"date"===o?a:null!=n.min&&y(n.min)?v:h}})}if("domain-validation-error::invalid-coded-value"===i)return s.invalidCodedValue;if("type-validation-error::invalid-type"===i)return s.invalidType;if("length-validation-error::too-short"===i)return e(s.tooShort,{min:a});if(c(t)){if("multiple-choice-validation-error::too-few-selected-choices"===i)return e(s.tooFewSelectedChoices,{min:t.input.minimumChoices});if("multiple-choice-validation-error::too-many-selected-choices"===i)return e(s.tooManySelectedChoices,{max:t.input.maximumChoices})}return"length-validation-error::too-long"===i?null:"contingent-values-validation-error::contingency-violation-warning"===i||"contingent-values-validation-error::contingency-violation-error"===i?s.valuesIncompatible:null}function w(e,t,i){const n=i?.validationErrors;if(!n)return null;let r=null;for(const o of e.invalidHiddenInputs)switch(o.effectiveVisibilityCode){case"hidden:visibility-expression:all-features":case"hidden:group-visibility-expression:all-features":case"hidden:field-definition":return"single"===t?n.nonVisibleError_changeValues:n.nonVisibleError_checkIndividualFeatures;case"hidden:no-domain-in-common":case"hidden:visibility-expression:some-features":case"hidden:group-visibility-expression:some-features":case"hidden:not-in-all-layers":r=n.nonVisibleError_checkIndividualFeatures;break;case"visible":continue;default:o.effectiveVisibilityCode}return r}function x(e){return null!=e&&"object"==typeof e&&"type"in e&&("feature"===e.type||"geojson"===e.type||"knowledge-graph-sublayer"===e.type||"oriented-imagery"===e.type||"scene"===e.type||"subtype-sublayer"===e.type)}function I(e){return!!x(e)||!!(null!=e&&"object"==typeof e&&"type"in e&&e.type&&"id"in e&&e.id&&"fields"in e&&e.fields&&"fieldsIndex"in e&&e.fieldsIndex&&"objectIdField"in e&&e.objectIdField&&"capabilities"in e&&"getField"in e&&e.getField)}function T(e){return I(e)&&"queryAttachments"in e}function V(e){return null!=e&&"object"==typeof e&&"type"in e&&("feature"===e.type||"subtype-sublayer"===e.type)}function k(e){if(!T(e))return!1;const t=e?.effectiveCapabilities??e?.capabilities;return!!t?.data?.supportsAttachment}async function C(e,t,o,s){const l=new Set;let u=!1;for(const i of o){if("attachment"===i.input?.type&&("any"===i.input.attachmentAssociationType||"exactOrNone"===i.input.attachmentAssociationType)){u=!0;break}if(f(i.attachmentKeyword)){u=!0;break}l.add(i.attachmentKeyword)}const c=l.size&&!u?Array.from(l):void 0,d=new a({objectIds:[t],returnMetadata:!0,keywords:c}),p=r(e)?e.parent:e;n(p)&&p.historicMoment&&(d.historicMoment=p.historicMoment);const m=await e.queryAttachments(d,{signal:s});return i(s),m[t]??[]}function F(e,i,n){const r=o(e),a=r?.find(e=>e.code===n);if(!a)return!1;const s=r?.find(e=>e.code===i);return!t(a.defaultValues,s?.defaultValues)&&Object.values(a.defaultValues).some(e=>null!=e)}function A(e){return e.reduce((e,t)=>d(t)?[...e,...t.inputs]:[...e,t],[])}function U(e){return r(e)&&e.parent&&(e=e.parent),e&&"datesInUnknownTimezone"in e&&e.datesInUnknownTimezone?s:e&&"preferredTimeZone"in e&&e.preferredTimeZone?e.preferredTimeZone:null}function E(e,t){return e||t?t===s?l:e&&e!==s?e:t??"system":"system"}export{g as createReactiveGraphic,A as flattenInputs,E as getEffectiveTimeZone,w as getHiddenFieldsValidationErrorMessage,U as getLayerTimeZone,j as getVisibleFieldInputValidationErrorMessage,V as isAssociationsLayerUnion,I as isAttributeFormSupportedLayer,x as isAttributeFormSupportedLayerUnion,T as isAttributeFormSupportedLayerWithAttachments,b as isElementTemplateWithInputType,k as layerSupportsAttachments,C as queryAttachmentsForElements,F as subtypeChangeShouldPrompt};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{createArcadeProfile as e,createArcadeExecutor as t}from"../../../arcade.js";const s=e("form-calculation");class
|
|
2
|
+
import{createArcadeProfile as e,createArcadeExecutor as t}from"../../../arcade.js";import r from"../../../core/Logger.js";const s=()=>r.getLogger("esri.widgets.BatchAttributeForm.expressions.ExpressionsManager"),o=e("form-calculation");class c{constructor(){this._executors=new Map,this._executorPromises=new Map}async getArcadeExecutor(e){return this._executors.has(e)?this._executors.get(e):this._executorPromises.has(e)?this._executorPromises.get(e):this._createExecutor(e)}async _createExecutor(e){try{const r=t(e,o);this._executorPromises.set(e,r);const s=await r;return this._executors.set(e,s),s}catch(r){return void s().error("Arcade expression failed to compile.",r,{expression:e})}finally{this._executorPromises.delete(e)}}}export{c as ArcadeExecutorProvider};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import r from"../../../core/Error.js";import
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import r from"../../../core/Error.js";import o from"../../../core/Logger.js";import{getOrCreateMapValue as s}from"../../../core/MapUtils.js";import{whenOrAbort as a}from"../../../core/promiseUtils.js";import n from"../../../core/ReactiveMap.js";import{property as i,subclass as l}from"../../../core/accessorSupport/decorators.js";import{DateOnly as u}from"../../../core/sql/DateOnly.js";import{TimeOnly as c}from"../../../core/sql/TimeOnly.js";import{makeUseId as d}from"../inputs/support/inputUtils.js";import{isFieldElementTemplate as p,isGroupElementTemplate as f}from"../templates/support/templateUtils.js";let h=null;const m=()=>o.getLogger("esri.widgets.BatchAttributeForm.expressions.ExpressionsManager");let g=class extends t{constructor(e){super(e),this.calculating=!1,this.arcadeContext=null,this._abortController=new AbortController,this.layerExpressionsModelMap=new Map,this.evaluatedExpressions=new n,this.expressionEvaluationFailed=!1}destroy(){this.abort()}abort(){this._abortController.abort()}async runAllExpressions(e,t){return this._evaluateSpecifiedComponentsForEachFeature(e,w,t)}async runGeometryDependentExpressions(e,t){return this._evaluateSpecifiedComponentsForEachFeature(e,E,t)}async runOriginalFeatureDependentExpressions(e,t){return this._evaluateSpecifiedComponentsForEachFeature([e],C,t)}async runExpressionsDependentOnChangedFields(e){try{this.calculating=!0;const t=Array.from(e.changes).map(([t,r])=>this.runExpressionsDependentOnChangedFieldsForFeature([...r.keys()],t,e));F(await Promise.allSettled(t))}catch(t){m().error(t),this.expressionEvaluationFailed=!0}finally{this.calculating=!1}}async runExpressionsDependentOnChangedFieldsForFeature(e,t,r){if(this._abortController.signal.aborted)return;const o=this.layerExpressionsModelMap.get(t.layer);if(!o||0===o.components.length)return;const s=new Set,a=new Set(e),n=new Set;for(;a.size>0;){const[e]=a;if(a.delete(e),s.has(e))continue;s.add(e);const i=o.fieldReferencesMap.get(e.toLowerCase());if(!i)continue;for(const t of i)n.has(t)&&i.delete(t);if(0===i.size)continue;const l=new Set;await this.evaluateAffectedComponents([...i],t,o,r,l);for(const t of i)n.add(t);for(const t of l)s.has(t)||a.add(t)}}async evaluateAffectedComponents(e,t,r,o,s){const i=new Map;for(const a of e)i.has(a)||i.set(a,this.createSccEvaluator(a,t,i,r));if(0===i.size)return;const l=[...i.values()],u={transaction:o,changedFields:s,previousOutcomes:new n},c=l.map(e=>e.evaluate(u));F(await a(Promise.allSettled(c),this._abortController))}createSccEvaluator(e,t,r,o){const a=new v(e,t,this.arcadeContext,o,this.evaluatedExpressions,this._abortController);for(const n of e.adjacencyList)a.dependentEvaluators.push(s(r,n,()=>this.createSccEvaluator(n,t,r,o)));return a}async _evaluateSpecifiedComponentsForEachFeature(e,t,r){this.calculating=!0;try{const o=[];for(const s of e){const e=this.layerExpressionsModelMap.get(s.layer);if(!e||0===e.components.length)continue;const a=new Set;o.push(this.evaluateAffectedComponents(t(e),s,e,r,a))}F(await a(Promise.allSettled(o),this._abortController))}catch(o){m().error(o),this.expressionEvaluationFailed=!0}finally{this.calculating=!1}}};e([i()],g.prototype,"calculating",void 0),e([i({constructOnly:!0})],g.prototype,"arcadeContext",void 0),e([i()],g.prototype,"_abortController",void 0),e([i()],g.prototype,"layerExpressionsModelMap",void 0),e([i()],g.prototype,"evaluatedExpressions",void 0),e([i()],g.prototype,"expressionEvaluationFailed",void 0),g=e([l("esri.widgets.BatchAttributeForm.expressions.ExpressionsManager")],g);class v{constructor(e,t,r,o,s,a){this.scc=e,this.feature=t,this.arcadeContextInfo=r,this.expressionsModel=o,this.evaluatedExpressions=s,this._abortController=a,this.dependentEvaluators=[],this._evaluatorPromise=null}get baseContext(){const{editType:e,map:t,spatialReference:r,timeZone:o}=this.arcadeContextInfo,s=this.feature.layer,a="scene"===s?.type&&null!=s.associatedLayer?s.associatedLayer:s;return{variables:{$originalfeature:this.feature.original,$editcontext:{editType:e},$layer:a,$featureset:a,$datastore:a?.url,$feature:this.feature.plainGraphic,$map:t},executeContext:{rawOutput:!0,spatialReference:r??void 0,timeZone:o,abortSignal:this._abortController.signal}}}evaluate(e){return null==this._evaluatorPromise&&(this._evaluatorPromise=this._evaluate(e)),this._evaluatorPromise}async _evaluate(e){null===h&&(h=await import("../../../arcade/languageUtils.js"));const t=[],o=this.dependentEvaluators.map(t=>t.evaluate(e));F(await a(Promise.allSettled(o),this._abortController));for(const a of this.scc.executors){const o=this.baseContext;if(this._abortController.signal.aborted)break;const u=this.expressionsModel.arcadeExecutorUses.get(a)??[],c=s(this.evaluatedExpressions,this.feature,()=>new n);let p=null,f=null;try{p=a.isAsync?await a.executeAsync(o.variables,o.executeContext):a.execute(o.variables,o.executeContext),f={result:p,status:"success"}}catch(i){f={error:i,status:"error"}}const{transaction:h,changedFields:g,previousOutcomes:v}=e;for(const t of u){const r=d(t),o=c.get(r);o&&v.set(r,o);const s=this.expressionsModel.elementTemplateMap.get(t.elementId);switch(t.executorPurpose){case"editable":case"required":case"text":c.set(d(t),f);break;case"value":{if("error"===f?.status)continue;const e=s.getExpressionExecutorsForLayer(this.feature.layer);let t=!0;if(e?.editableExpression&&(t=!1===c.get(d({elementId:s.elementId,executorPurpose:"editable"}))?.result),t){const e=s.fieldName,t=this.feature.getAttribute(e)??null;try{const r=y(f.result,this.feature,e,this.arcadeContextInfo.timeZone);r!==t&&(h.setValue(this.feature,e,r),g.add(e))}catch(l){m().error(`Failed to set calculated value for field '${e}'`,l)}}}break;case"visibility":c.set(d(t),f),this.expressionsModel.preserveFieldValuesWhenHidden||!0!==o?.result||!1!==f.result||"user"!==h.originActor||M(s,this.feature,c,e)}}if("error"===f?.status){const e=new Set;for(const t of u){const r=this.expressionsModel.elementTemplateMap.get(t.elementId);if(r)switch(t.executorPurpose){case"editable":e.add(r.label+" - Editable expression");break;case"required":e.add(r.label+" - Required expression");break;case"value":e.add(r.label+" - Value expression");break;case"visibility":e.add(r.label+" - Visibility expression")}}t.push(e.size>0?new r("expression-evaluation-failed","Arcade evaluation failed ("+[...e].join(",")+")"):new r("expression-evaluation-failed","Arcade evaluation failed "))}}if(t.length>0)throw S(t)}}function y(e,t,o,s){if(null===e)return null;const a=t.layer.fieldsIndex.get(o);if(!a)throw new r("field-not-found",`Field '${o}' not found on layer.`);switch(a.type){case"big-integer":case"integer":case"long":case"oid":case"small-integer":{const t=x(e);return null==t?null:Math.floor(t)}case"single":case"double":return x(e);case"global-id":case"guid":case"string":return h.toString(e);case"date":{const t=b(e,s);if(t)return t.getTime();const o=x(e);if(null!==o&&!isNaN(o)&&Number.isInteger(o))return o;throw new r("unsupported-value-type",`Unable to convert value ${e} to a date`)}case"date-only":{if(h.isDateOnly(e))return e.toStorageFormat();const t=b(e,s);if(!t)throw new r("unsupported-value-type",`Unable to convert value ${e} to a date-only string`);return u.fromDateTime(t.toDateTime()).toStorageFormat()}case"time-only":{if(h.isTime(e))return e.toStorageString();if(h.isDate(e)){return c.fromDateTime(e.toDateTime()).toStorageString()}const t=c.fromString(h.toString(e));if(!t)throw new r("unsupported-value-type",`Unable to convert value ${e} to a time-only string`);return t.toStorageString()}case"timestamp-offset":{const t=b(e,s);if(!t)throw new r("unsupported-value-type",`Unable to convert value ${e} to a timestamp-offset string`);return t.toISOString(!1)}}throw new r("unsupported-value-type",`Unable to convert value ${e} to a value matching field type`)}function x(e){if(""===e)return null;const t=h.toNumber(e);return Number.isNaN(t)?null:t}function b(e,t){if(h.isDate(e))return e;if(h.isDateOnly(e))return e.toArcadeDate();const r=h.toString(e),o=h.toDate(r,t);return o&&/\d{4}-\d{2}-\d{2}/.test(r)?o:null}function w(e){return e.components}function E(e){return Array.from(e.geometryReferences)}function C(e){return Array.from(e.originalFeatureReferences)}function S(e){return new AggregateError(e,`One or more expression executions failed. First error message: ${e[0].message}`)}function F(e){const t=[],r=new Set;for(const o of e){if("fulfilled"===o.status)continue;const e=o.reason instanceof AggregateError?o.reason.errors:[o.reason];for(const o of e)r.has(o)||(r.add(o),t.push(o))}if(t.length>0)throw S(t)}function M(e,t,r,o){p(e)?A(e,t,r,o):f(e)&&_(e,t,r,o)}function A(e,t,r,o){const{group:s}=e;s&&!O(s,r,o.previousOutcomes)||D(t,e,o)}function _(e,t,r,o){for(const s of e.elements)p(s)&&O(s,r,o.previousOutcomes)&&D(t,s,o)}function D(e,{fieldName:t},r){null!==e.getAttribute(t)&&r.changedFields.add(t),r.transaction.setValue(e,t,null)}function O(e,t,r){const o=d({elementId:e.elementId,executorPurpose:"visibility"}),s=r.get(o)??t.get(o);return!s||!!s.result}export{g as ExpressionsManager};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{isSome as e,addMany as t,pushIfSome as n}from"../../../core/arrayUtils.js";import{getOrCreateMapValue as s}from"../../../core/MapUtils.js";import o from"../../../core/Queue.js";import{addMany as r,last as i}from"../../../core/SetUtils.js";import{isFieldElementTemplate as a}from"../templates/support/templateUtils.js";let c=0;class l{constructor(e){this.arcadeExecutorUses=new Map,this.components=[],this.preserveFieldValuesWhenHidden=!1,this.executorMap=e.executorMap,this.preserveFieldValuesWhenHidden=!0===e.preserveFieldValuesWhenHidden,this.elementTemplateMap=new Map;for(const t of this.executorMap.keys())this.elementTemplateMap.set(t.elementId,t);this._buildDependencyGraph()}_buildDependencyGraph(){const e=f(this.executorMap),t={components:[],arcadeExecutorUses:this.arcadeExecutorUses,elementTemplatesById:new Map([...this.executorMap.keys()].map(e=>[e.elementId,e])),executorMap:this.executorMap,fieldElementTemplateMap:x(this.executorMap),fieldReferencesMap:new Map,geometryReferences:new Set,originalFeatureReferences:new Set,nextIndex:0,nodeInfoMap:e,nodeStack:new o(i),shouldConsiderVisibility:!this.preserveFieldValuesWhenHidden};for(const n of this.executorMap.keys()){const e=this.executorMap.get(n);null!=e&&(e.editableExpression&&s(this.arcadeExecutorUses,e.editableExpression,()=>[]).push({elementId:n.elementId,executorPurpose:"editable"}),e.valueExpression&&s(this.arcadeExecutorUses,e.valueExpression,()=>[]).push({elementId:n.elementId,executorPurpose:"value"}),e.visibilityExpression&&s(this.arcadeExecutorUses,e.visibilityExpression,()=>[]).push({elementId:n.elementId,executorPurpose:"visibility"}),e.requiredExpression&&s(this.arcadeExecutorUses,e.requiredExpression,()=>[]).push({elementId:n.elementId,executorPurpose:"required"}),e.textExpressions&&e.textExpressions.forEach((e,t)=>{s(this.arcadeExecutorUses,e,()=>[]).push({elementId:n.elementId,executorPurpose:"text",textExpressionIndex:t})}))}for(const n of this.arcadeExecutorUses.values())n.sort(e=>"editable"===e.executorPurpose?-1:1);for(const n of e.values())-1===n.index&&p(n,t);this.dependencyGraphComponents=m(e),this.fieldReferencesMap=h(t),this.geometryReferences=M(t.geometryReferences,e),this.originalFeatureReferences=M(t.originalFeatureReferences,e),this.components=t.components}}function p(e,t){e.index=e.lowlink=t.nextIndex++,t.nodeStack.push(e);for(const n of d(e,t))-1===n.index?(p(n,t),e.lowlink=Math.min(e.lowlink,n.lowlink)):n.index<e.index&&t.nodeStack.contains(n)&&(e.lowlink=Math.min(e.lowlink,n.index)),t.nodeStack.contains(n)||e.crossLinkNeighbors.add(n);if(e.lowlink===e.index){const n=E();for(t.components.push(n);y(t.nodeStack)>=e.index;){const e=t.nodeStack.pop();if(null!=e){e.component=n,n.executors.add(e.executor);for(const t of e.crossLinkNeighbors)null!=t.component&&n.adjacencyList.add(t.component)}}}}function d({executor:t},n){const o=new Set;for(const e of t.fieldsUsed){const i=e.toLowerCase();s(n.fieldReferencesMap,i,()=>new Set).add(t),r(o,u(i,n))}t.geometryUsed&&n.geometryReferences.add(t),t.variablesUsed.includes("$originalfeature")&&n.originalFeatureReferences.add(t);const i=n.arcadeExecutorUses.get(t)??[];for(const e of i)switch(e.executorPurpose){case"value":{const s=n.executorMap.get(n.elementTemplatesById.get(e.elementId));s?.editableExpression&&s.editableExpression!==t&&o.add(s.editableExpression);break}case"visibility":{const t=n.elementTemplatesById.get(e.elementId);if(n.shouldConsiderVisibility&&t&&a(t)){const e=t.group,s=e?n.executorMap.get(e):null;s?.visibilityExpression&&o.add(s.visibilityExpression)}break}}return Array.from(o).map(e=>n.nodeInfoMap.get(e)).filter(e)}function u(e,{executorMap:t,fieldElementTemplateMap:s,shouldConsiderVisibility:o}){const r=[],i=s.get(e);if(null==i)return r;const a=t.get(i);if(null==a)return r;if(n(r,a.editableExpression),n(r,a.valueExpression),o){n(r,a.visibilityExpression);const{group:e}=i;if(null!=e){const s=t.get(e)?.visibilityExpression;n(r,s)}}return r}function x(e){const t=new Map;for(const n of e.keys())a(n)&&t.set(n.fieldName.toLowerCase(),n);return t}function f(n){const s=Array.from(n.values()).filter(e),o=new Set(s.flatMap(e=>{const{textExpressions:n,...s}=e,o=[];return n?.length&&t(o,n),t(o,Object.values(s)),o})),r=Array.from(o).map(e=>({component:null,crossLinkNeighbors:new Set,executor:e,index:-1,lowlink:-1,onStack:!1}));return new Map(r.map(e=>[e.executor,e]))}function m(e){return new Map([...e.values()].map(({component:e,executor:t})=>[t,e]))}function h({fieldReferencesMap:e,nodeInfoMap:t}){const n=new Map;for(const[s,o]of e.entries())n.set(s,M(o,t));return n}function M(e,t){const n=new Set;for(const s of e){const e=t.get(s);e?.component&&n.add(e.component)}return n}function E(){c++;const e=c.toString();return{executors:new Set,adjacencyList:new Set,componentId:e}}function y(e){return e.peek()?.index??-1}export{l as ExpressionsModel,d as getDirectDependencies};
|
|
2
|
+
import{isSome as e,addMany as t,pushIfSome as n}from"../../../core/arrayUtils.js";import{getOrCreateMapValue as s}from"../../../core/MapUtils.js";import o from"../../../core/Queue.js";import{addMany as r,last as i}from"../../../core/SetUtils.js";import{isFieldElementTemplate as a}from"../templates/support/templateUtils.js";let c=0;class l{constructor(e){this.arcadeExecutorUses=new Map,this.components=[],this.preserveFieldValuesWhenHidden=!1,this.executorMap=e.executorMap,this.preserveFieldValuesWhenHidden=!0===e.preserveFieldValuesWhenHidden,this.elementTemplateMap=new Map;for(const t of this.executorMap.keys())this.elementTemplateMap.set(t.elementId,t);this._buildDependencyGraph()}_buildDependencyGraph(){const e=f(this.executorMap),t={components:[],arcadeExecutorUses:this.arcadeExecutorUses,elementTemplatesById:new Map([...this.executorMap.keys()].map(e=>[e.elementId,e])),executorMap:this.executorMap,fieldElementTemplateMap:x(this.executorMap),fieldReferencesMap:new Map,geometryReferences:new Set,originalFeatureReferences:new Set,nextIndex:0,nodeInfoMap:e,nodeStack:new o(i),shouldConsiderVisibility:!this.preserveFieldValuesWhenHidden};for(const n of this.executorMap.keys()){const e=this.executorMap.get(n);null!=e&&(e.editableExpression&&s(this.arcadeExecutorUses,e.editableExpression,()=>[]).push({elementId:n.elementId,executorPurpose:"editable"}),e.valueExpression&&s(this.arcadeExecutorUses,e.valueExpression,()=>[]).push({elementId:n.elementId,executorPurpose:"value"}),e.visibilityExpression&&s(this.arcadeExecutorUses,e.visibilityExpression,()=>[]).push({elementId:n.elementId,executorPurpose:"visibility"}),e.requiredExpression&&s(this.arcadeExecutorUses,e.requiredExpression,()=>[]).push({elementId:n.elementId,executorPurpose:"required"}),e.textExpressions&&e.textExpressions.forEach((e,t)=>{s(this.arcadeExecutorUses,e,()=>[]).push({elementId:n.elementId,executorPurpose:"text",textExpressionIndex:t})}))}for(const n of this.arcadeExecutorUses.values())n.sort(e=>"editable"===e.executorPurpose?-1:1);for(const n of e.values())-1===n.index&&p(n,t);this.dependencyGraphComponents=m(e),this.fieldReferencesMap=h(t),this.geometryReferences=M(t.geometryReferences,e),this.originalFeatureReferences=M(t.originalFeatureReferences,e),this.components=t.components}}function p(e,t){e.index=e.lowlink=t.nextIndex++,t.nodeStack.push(e);for(const n of d(e,t))-1===n.index?(p(n,t),e.lowlink=Math.min(e.lowlink,n.lowlink)):n.index<e.index&&t.nodeStack.contains(n)&&(e.lowlink=Math.min(e.lowlink,n.index)),t.nodeStack.contains(n)||e.crossLinkNeighbors.add(n);if(e.lowlink===e.index){const n=E();for(t.components.push(n);y(t.nodeStack)>=e.index;){const e=t.nodeStack.pop();if(null!=e){e.component=n,n.executors.add(e.executor);for(const t of e.crossLinkNeighbors)null!=t.component&&n.adjacencyList.add(t.component)}}}}function d({executor:t},n){const o=new Set;for(const e of t.fieldsUsed){const i=e.toLowerCase();s(n.fieldReferencesMap,i,()=>new Set).add(t),r(o,u(i,n))}t.geometryUsed&&n.geometryReferences.add(t),t.variablesUsed.includes("$originalfeature")&&n.originalFeatureReferences.add(t);const i=n.arcadeExecutorUses.get(t)??[];for(const e of i)switch(e.executorPurpose){case"value":{const s=n.executorMap.get(n.elementTemplatesById.get(e.elementId));s?.editableExpression&&s.editableExpression!==t&&o.add(s.editableExpression);break}case"visibility":{const t=n.elementTemplatesById.get(e.elementId);if(n.shouldConsiderVisibility&&t&&a(t)){const e=t.group,s=e?n.executorMap.get(e):null;s?.visibilityExpression&&o.add(s.visibilityExpression)}break}}return Array.from(o).map(e=>n.nodeInfoMap.get(e)).filter(e)}function u(e,{executorMap:t,fieldElementTemplateMap:s,shouldConsiderVisibility:o}){const r=[],i=s.get(e);if(null==i)return r;const a=t.get(i);if(null==a)return r;if(n(r,a.editableExpression),n(r,a.valueExpression),o){n(r,a.visibilityExpression);const{group:e}=i;if(null!=e){const s=t.get(e)?.visibilityExpression;n(r,s)}}return r}function x(e){const t=new Map;for(const n of e.keys())a(n)&&t.set(n.fieldName.toLowerCase(),n);return t}function f(n){const s=Array.from(n.values()).filter(e),o=new Set(s.flatMap(e=>{const{textExpressions:n,...s}=e,o=[];return n?.length&&t(o,n),t(o,Object.values(s)),o})),r=Array.from(o).filter(e).map(e=>({component:null,crossLinkNeighbors:new Set,executor:e,index:-1,lowlink:-1,onStack:!1}));return new Map(r.map(e=>[e.executor,e]))}function m(e){return new Map([...e.values()].map(({component:e,executor:t})=>[t,e]))}function h({fieldReferencesMap:e,nodeInfoMap:t}){const n=new Map;for(const[s,o]of e.entries())n.set(s,M(o,t));return n}function M(e,t){const n=new Set;for(const s of e){const e=t.get(s);e?.component&&n.add(e.component)}return n}function E(){c++;const e=c.toString();return{executors:new Set,adjacencyList:new Set,componentId:e}}function y(e){return e.peek()?.index??-1}export{l as ExpressionsModel,d as getDirectDependencies};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import e from"../../../request.js";import a from"../../../core/Collection.js";import n from"../../../core/Error.js";import i from"../../../core/Logger.js";import{isAbortError as s}from"../../../core/promiseUtils.js";import r from"../../../core/ReactiveMap.js";import o from"../../../core/ReactiveSet.js";import{generateBracedUUID as d}from"../../../core/uuid.js";import{property as l,subclass as h}from"../../../core/accessorSupport/decorators.js";import{getEffectiveLayerCapabilities as c}from"../../../layers/support/layerUtils.js";import m from"../../../rest/query/support/AttachmentInfo.js";import{getAttachmentCategoryForFile as p}from"../../Attachments/support/attachmentUtils.js";import{getAttachmentKey as u,getAttachmentUrl as g,preserveAttachmentFilenameExtension as y,attachmentValidationUtils as f}from"../attachmentUtils.js";import _ from"./EditableInput.js";import A from"./SingleFeatureInputAdapter.js";let U=-1;const v=["maximum-audio-length","maximum-file-size","maximum-image-size","minimum-number-of-files","maximum-number-of-files","maximum-video-length"];let S=class extends _{constructor(t){super(t),this.attachments=[],this.displayCount=3,this.group=null,this.single=new A({input:this}),this.type="attachment",this._initialAttachments=[],this._stagedAdds=new a,this._stagedDeletes=new o,this._stagedUpdates=new r,this._failedStagedUpdateHydrations=new o,this._pendingStagedUpdateHydrations=new r,this._temporaryAttachmentUrls=new r,this._validationCriterionStates=new r,this._hasUnsupportedFileTypeValidationError=!1}get allowUserRename(){return this.template.allowUserRename}get addDisabled(){const t=this.maxAttachmentCount,e=this.effectiveAttachmentCount;return!this.editable||null!=t&&e>=t}get effectiveAttachmentCount(){return this._initialAttachments.length-this._stagedDeletes.size+this._stagedAdds.length}get accept(){const{categories:t}=this;if(!t.size)return;const e=[];return t.has("image")&&e.push("image/*"),t.has("audio")&&e.push("audio/*"),t.has("video")&&e.push("video/*"),t.has("document")&&e.push("text/*","application/*","model/*"),e.length>0?e.join(","):void 0}get categories(){const t=new Set;for(const e of this._nestableInputs)b(t,e.type);return t}get _nestableInputs(){const{input:t}=this;return null==t?[]:"attachment"===t.type?t.inputTypes??[]:[t]}get attachmentKeyword(){return this.template.attachmentKeyword?.trim()}get displayFilename(){return this.template.displayFilename}get allAttachmentsVisibleOnDefaultPage(){return this.defaultPageAttachments.length===this.attachments.length}get canUploadFiles(){const t=this._nestableInputs;return!t.length||t.some(x)}get hasCaptureInputs(){return this._nestableInputs.some(w)}get captureMediaType(){const t=new Set;for(const e of this._nestableInputs)if(w(e))switch(e.type){case"audio":t.add("audio");break;case"video":t.add("video");break;case"image":case"signature":t.add("image")}return 1===t.size?Array.from(t)[0]:null}get isCaptureOnly(){const t=this._nestableInputs;return!!t.length&&t.every(T)}get defaultPageAttachments(){return this.attachments.slice(0,this.displayCount)}get feature(){return this.single.feature}get hasAttachmentChanges(){return this._stagedAdds.length>0||this._stagedUpdates.size>0||this._stagedDeletes.size>0}get hasInvalidAttachmentName(){return!!this.allowUserRename&&this.attachments.some(t=>0===t.name.trim().length)}get attachmentCount(){return this.attachments.length}get hasMinimumAttachmentCountNotMet(){const t=this.minAttachmentCount;return null!=t&&(this.effectiveAttachmentCount<t&&!this.isCaptureOnly)}get hasReachedAttachmentLimit(){const t=this.maxAttachmentCount,e=this.effectiveAttachmentCount;return null!=t&&e===t}get hasExceededAttachmentLimit(){const t=this.maxAttachmentCount,e=this.effectiveAttachmentCount;return null!=t&&e>t}get hasPendingAttachmentUpdateData(){return this._pendingStagedUpdateHydrations.size>0}get input(){return this.template.input}get layer(){return this.single.layer}get maxAttachmentCount(){return this.template.maxAttachmentCount}get minAttachmentCount(){return this.template.minAttachmentCount}get supportsResize(){const{layer:t}=this;if(!t)return!1;const e=c(t);return!!e&&("attachment"in e&&!!e.attachment?.supportsResize)}get useOriginalFilename(){return this.template.useOriginalFilename}get valid(){return!(this._failedStagedUpdateHydrations.size>0||this.hasInvalidAttachmentName||this.hasExceededAttachmentLimit||this.hasMinimumAttachmentCountNotMet)}get _expressionLayer(){const t=this.layer;if(t)return"scene"===t.type&&"associatedLayer"in t&&null!=t.associatedLayer?t.associatedLayer:"feature"===t.type?t:void 0}destroy(){this._clearTemporaryAttachmentUrls()}applyFetchedAttachments(t){for(const e of t)this._normalizeAttachmentName(e);this._initialAttachments=t,this._failedStagedUpdateHydrations.clear(),this._recomputeAttachments()}applyStashedEdits(t){const{adds:e,deletes:a,updates:n}=t;for(const i of e){const t=this._getAttachmentKey(i.info);this._stagedAdds.add({data:i.data,globalId:i.globalId??d(),info:i.info,key:t}),this._setTemporaryAttachmentUrl(t,i.data)}for(const i of n){const t=this._getAttachmentKey(i.info);this._stagedUpdates.set(t,{contentType:i.contentType,data:i.data,info:i.info,key:t,name:i.name,size:F(i)}),this._setTemporaryAttachmentUrl(t,i.data)}for(const i of a){const t=this._getAttachmentKey(i.info);this._stagedDeletes.add(t)}this._recomputeAttachments()}clearAttachmentChanges(){this.clearValidationCriteriaState(),this._clearTemporaryAttachmentUrls(),this._stagedAdds.removeAll(),this._stagedUpdates.clear(),this._stagedDeletes.clear(),this._failedStagedUpdateHydrations.clear(),this._pendingStagedUpdateHydrations.clear(),this._recomputeAttachments()}clearValidationCriteriaState(){this._validationCriterionStates.clear(),this._hasUnsupportedFileTypeValidationError=!1}get hasInvalidValidationCriteria(){for(const t of this._validationCriterionStates.values())if("danger"===t)return!0;return!1}get hasUnsupportedFileTypeValidationError(){return this._hasUnsupportedFileTypeValidationError}get validationCriterionStates(){return this._validationCriterionStates}getValidationCriterionState(t){return this._validationCriterionStates.get(t)??null}stageAddAttachment(t){if(!this._assertEditable())throw new n("batch-attribute-form:not-editable","Cannot modify attachments when editableExpression is false.");const{contentType:e,data:a,name:i}=t,s=t.globalId??d(),r=a instanceof Blob?a.size:void 0,o=i.trim(),l=new m({contentType:e??void 0,globalId:s,id:U--,keywords:this.attachmentKeyword??void 0,name:o,size:r});return this._setTemporaryAttachmentUrl(s,a),this._stagedAdds.add({key:s,globalId:s,info:l,data:a}),this._recomputeAttachments(),l}async stageAddAttachments(t,e){if(this.clearValidationCriteriaState(),!this._assertEditable())return[];const a=t.filter(t=>this.isFileAllowed(t));if(this._setUnsupportedFileTypeValidationError(a.length!==t.length),0===a.length)return[];const n=[],i=new Map,s=Date.now(),r={},o=this.effectiveAttachmentCount,d=o+a.length;if(null!=this.minAttachmentCount&&this.minAttachmentCount>0&&this._setValidationCriterionState(r,"minimum-number-of-files",d>=this.minAttachmentCount?"success":"danger"),null!=this.maxAttachmentCount){const t=d<=this.maxAttachmentCount;if(this._setValidationCriterionState(r,"maximum-number-of-files",t?"success":"danger"),!t)return this._setValidationCriteriaState(r),[]}let l=!0;for(let h=0;h<a.length;h++){const t=a[h];await this._validateAttachmentFile(t,o+h+1,r)||(l=!1)}if(!l)return this._setValidationCriteriaState(r),[];for(let h=0;h<a.length;h++){const t=a[h],r=t instanceof File?t.name:`attachment-${s}_${h+1}`,o=await this._resolveAttachmentFilename(r,e),d=this._makeUniqueFilenameForOperation(i,o);n.push(this.stageAddAttachment({contentType:t.type,data:t,name:d}))}return this._setValidationCriteriaState(r),n}findAttachment(t){if(t)return this.attachments.find(e=>u(e)===t)}getAttachmentEditState(t){const e=this._getAttachmentKey(t),a=e?this._initialAttachments.find(t=>this._getAttachmentKey(t)===e):void 0,n=a?.name??null,i=e?this._stagedUpdates.get(e):void 0,s=i?.name??t.name??null;return{initialName:n,isDeleted:!!e&&this._stagedDeletes.has(e),isRenamed:null!=s&&null!=n&&s!==n,isReplaced:!0===i?.isReplacement}}getAttachmentPreviewUrl(t,e){const a=this._getAttachmentKey(t);return(a?this._temporaryAttachmentUrls.get(a):void 0)??g({attachment:t,supportsResizeAttachments:this.supportsResize,layer:this.layer,thumbnailSize:e})}async ensureStagedUpdateData(t){const e=this._getAttachmentKey(t);if(!e)return!1;const a=this._stagedUpdates.get(e);if(!a||a.data||this._stagedDeletes.has(e))return this._failedStagedUpdateHydrations.delete(e),!1;const n=this._pendingStagedUpdateHydrations.get(e);if(n)return await n;const i=this._hydrateStagedUpdateData(t);this._pendingStagedUpdateHydrations.set(e,i);try{return await i}finally{this._pendingStagedUpdateHydrations.get(e)===i&&this._pendingStagedUpdateHydrations.delete(e)}}async waitForPendingAttachmentUpdateData(){await Promise.allSettled(Array.from(this._pendingStagedUpdateHydrations.values()))}discardStagedEdits(t){if(!this._assertEditable())return;const e=this._getAttachmentKey(t);if(!e)return;const a=this._stagedAdds.findIndex(t=>t.key===e);if(a>-1)return this._clearTemporaryAttachmentUrl(e),this._stagedAdds.removeAt(a),this._failedStagedUpdateHydrations.delete(e),this._pendingStagedUpdateHydrations.delete(e),void this._recomputeAttachments();this._clearTemporaryAttachmentUrl(e),this._stagedDeletes.delete(e),this._clearStagedUpdateTracking(e),this._recomputeAttachments()}isFileAllowed(t){const{categories:e}=this;if(!e.size)return!0;const a=p(t);return null!=a&&e.has(a)}isStagedAttachmentAddition(t){return"number"==typeof t.id&&t.id<0}stageDeleteAttachment(t){if(!this._assertEditable())return;const e=this._getAttachmentKey(t);if(!e)return;const a=this._stagedAdds.findIndex(t=>t.key===e);if(a>-1)return this._clearTemporaryAttachmentUrl(e),this._stagedAdds.removeAt(a),this._failedStagedUpdateHydrations.delete(e),this._pendingStagedUpdateHydrations.delete(e),void this._recomputeAttachments();this._clearTemporaryAttachmentUrl(e),this._stagedDeletes.add(e),this._clearStagedUpdateTracking(e),this._recomputeAttachments()}stageRenameAttachment(t,e){if(!this._assertEditable())return;const a=this._getAttachmentKey(t);if(!a)return;const n=this._stagedAdds.find(t=>t.key===a);if(n){const a=y(t.name,e);return n.info.name=a,void this._recomputeAttachments()}const i=this._stagedUpdates.get(a),s=this._getInitialAttachment(a)?.name??null,r=0===t.name.trim().length?s??t.name:t.name,o=y(r,!0===i?.isReplacement&&null!=s&&e===s?I(s).base:e),d=null!=s&&o===s;if(d&&!0!==i?.isReplacement)return this._stagedUpdates.delete(a),this._failedStagedUpdateHydrations.delete(a),this._pendingStagedUpdateHydrations.delete(a),void this._recomputeAttachments();const l={key:a,...i,info:t};d?delete l.name:l.name=o,this._stagedUpdates.set(a,l),this._recomputeAttachments(),this.ensureStagedUpdateData(t)}async stageReplaceAttachment(t,e,a){if(this.clearValidationCriteriaState(),!this._assertEditable())return!1;if(!this.isFileAllowed(e))return this._setUnsupportedFileTypeValidationError(!0),!1;const n={},i=await this._validateAttachmentFile(e,void 0,n);if(this._setValidationCriteriaState(n),!i)return!1;const s=e instanceof File?e.name:t.name,r=await this._resolveAttachmentFilename(s,a);return this._stageReplaceAttachment(t,e,r),!0}toSubmitEdits(){const t=[],e=[],a=[],n=this.feature?.plainGraphic;if(!n||0===this._stagedAdds.length&&0===this._stagedUpdates.size&&0===this._stagedDeletes.size)return null;const i=this.attachmentKeyword;for(const s of this._stagedAdds)null!=s.data&&t.push({feature:n,contentType:s.info.contentType,data:s.data,info:s.info,globalId:s.info.globalId,keywords:i,name:s.info.name});for(const s of this._stagedUpdates.values()){const t=null==s.name||s.name.trim().length>0;if(null==s.data||!t)continue;const a=s.name??this._getInitialAttachment(s.key)?.name??s.info.name;e.push({feature:n,contentType:s.contentType,data:s.data,globalId:s.info.globalId,id:s.info.id,info:s.info,keywords:i,name:a})}for(const s of this._stagedDeletes.values()){const t=this._getInitialAttachment(s);t&&a.push({feature:n,contentType:t.contentType,globalId:t.globalId,id:t.id,info:t,keywords:i,name:t.name})}return 0===t.length&&0===e.length&&0===a.length?null:{label:this.template.label,keywords:i,adds:t,deletes:a,updates:e}}_assertEditable(){return!!this.editable||(i.getLogger(this).error("batch-attribute-form:not-editable","Cannot modify attachments when editableExpression is false."),!1)}_recomputeAttachments(){const t=[];for(const e of this._stagedAdds)t.push(e.info);for(const e of this._initialAttachments){const a=this._getAttachmentKey(e);if(a&&this._stagedUpdates.has(a)){const n=this._stagedUpdates.get(a),i=e.clone();null!=n.name&&(i.name=n.name),null!=n.contentType&&(i.contentType=n.contentType),null!=n.size&&(i.size=n.size),t.push(i);continue}t.push(e)}this.attachments=t}async _computeAttachmentFilename(t,e){const a=this.template.filenameExpressionExecutor;if(!a)return t;const n=this.single.feature,r=n?.plainGraphic,o=this._expressionLayer,{attachmentKeyword:d,description:l,label:h}=this.template,c={$originalfeature:n?.original,$editcontext:{editType:e.editType},$layer:o,$featureset:o,$datastore:o?.url,$feature:r,$map:e.map,$formElement:{attachmentKeyword:d,description:l,label:h}},m={rawOutput:!0,spatialReference:e.spatialReference,timeZone:e.timeZone};try{const e=a.isAsync?await a.executeAsync(c,m):a.execute(c,m);if("string"==typeof e&&e.trim().length>0){const{extension:a}=I(t);return z(e.trim(),a)}}catch(p){s(p)||i.getLogger(this).error("Failed evaluating attachment filename expression",p)}return t}async _resolveAttachmentFilename(t,e){return!1===this.useOriginalFilename?await this._computeAttachmentFilename(t,e):t}_makeUniqueFilenameForOperation(t,e){const a=e.toLowerCase(),n=t.get(a)??0;if(t.set(a,n+1),0===n)return e;const{base:i,extension:s}=I(e);return z(`${i}_${n}`,s)}_setValidationCriteriaState(t){this._validationCriterionStates.clear();for(const e of v){const a=t[e];a&&this._validationCriterionStates.set(e,a)}}_setUnsupportedFileTypeValidationError(t){this._hasUnsupportedFileTypeValidationError!==t&&(this._hasUnsupportedFileTypeValidationError=t)}_setValidationCriterionState(t,e,a){"danger"!==t[e]&&(t[e]=a)}async _validateAttachmentFile(t,e,a){let n=!0;const i=p(t);for(const s of this._nestableInputs){const e=f.getAttachmentCategoryForInputType(s.type);if(null==i||e===i){if("document"===s.type&&null!=s.maxFileSize){const e=t.size<=1048576*s.maxFileSize;this._setValidationCriterionState(a,"maximum-file-size",e?"success":"danger"),n=n&&e}if(("audio"===s.type||"video"===s.type)&&null!=s.maxDuration){const e=await f.getMediaDurationInSeconds(t,s.type),i=null!=e&&e<=s.maxDuration;this._setValidationCriterionState(a,"audio"===s.type?"maximum-audio-length":"maximum-video-length",i?"success":"danger"),n=n&&i}if("image"===s.type&&null!=s.maxImageSize){const e=await f.getImageDimensionsInPixels(t),i=e?Math.max(e.width,e.height):null,r=null==i||i<=s.maxImageSize;this._setValidationCriterionState(a,"maximum-image-size",r?"success":"danger"),n=n&&r}}}if(null!=e&&null!=this.maxAttachmentCount){const t=e<=this.maxAttachmentCount;this._setValidationCriterionState(a,"maximum-number-of-files",t?"success":"danger"),n=n&&t}return n}_stageReplaceAttachment(t,e,a){const n=this._getAttachmentKey(t);if(!n)return;const i=this._stagedAdds.find(t=>t.key===n);if(i)return i.data=e,i.info.name=a,i.info.contentType=e.type,i.info.size=e.size,this._setTemporaryAttachmentUrl(n,e),void this._recomputeAttachments();const s=this._stagedUpdates.get(n);this._setTemporaryAttachmentUrl(n,e),this._failedStagedUpdateHydrations.delete(n),this._pendingStagedUpdateHydrations.delete(n),this._stagedUpdates.set(n,{...s,key:n,info:t,isReplacement:!0,contentType:e.type||s?.contentType||t.contentType,data:e,name:a,size:e.size}),this._recomputeAttachments()}_getInitialAttachment(t){return this._initialAttachments.find(e=>this._getAttachmentKey(e)===t)}_normalizeAttachmentName(t){const{name:e}=t;"string"==typeof e&&(t.name=e.trim())}_getAttachmentKey(t){return u(t)}_clearStagedUpdateTracking(t){this._stagedUpdates.delete(t),this._failedStagedUpdateHydrations.delete(t),this._pendingStagedUpdateHydrations.delete(t)}async _hydrateStagedUpdateData(t){const a=this._getAttachmentKey(t),n=t.url;if(!a||!n)return!1;try{const{data:i}=await e(n,{responseType:"blob"});this._failedStagedUpdateHydrations.delete(a);const s=this._stagedUpdates.get(a);return!(!s||s.data||this._stagedDeletes.has(a))&&(this._stagedUpdates.set(a,{...s,info:t,isReplacement:s.isReplacement??!1,contentType:s.contentType??t.contentType??i.type,data:i}),!0)}catch(r){const t=this._stagedUpdates.get(a);return!t||t.data||this._stagedDeletes.has(a)||this._failedStagedUpdateHydrations.add(a),s(r)||i.getLogger(this).error("Failed to fetch attachment data for staged update",r),!1}}_setTemporaryAttachmentUrl(t,e){if(this._clearTemporaryAttachmentUrl(t),!(e instanceof Blob))return;const a=URL.createObjectURL(e);return this._temporaryAttachmentUrls.set(t,a),a}_clearTemporaryAttachmentUrl(t){const e=this._temporaryAttachmentUrls.get(t);e&&(URL.revokeObjectURL(e),this._temporaryAttachmentUrls.delete(t))}_clearTemporaryAttachmentUrls(){for(const t of this._temporaryAttachmentUrls.values())URL.revokeObjectURL(t);this._temporaryAttachmentUrls.clear()}};t([l()],S.prototype,"allowUserRename",null),t([l()],S.prototype,"addDisabled",null),t([l()],S.prototype,"effectiveAttachmentCount",null),t([l()],S.prototype,"accept",null),t([l()],S.prototype,"categories",null),t([l()],S.prototype,"attachmentKeyword",null),t([l()],S.prototype,"attachments",void 0),t([l()],S.prototype,"displayFilename",null),t([l({readOnly:!0})],S.prototype,"allAttachmentsVisibleOnDefaultPage",null),t([l()],S.prototype,"canUploadFiles",null),t([l()],S.prototype,"hasCaptureInputs",null),t([l()],S.prototype,"captureMediaType",null),t([l()],S.prototype,"isCaptureOnly",null),t([l({readOnly:!0})],S.prototype,"defaultPageAttachments",null),t([l()],S.prototype,"displayCount",void 0),t([l()],S.prototype,"feature",null),t([l()],S.prototype,"group",void 0),t([l()],S.prototype,"hasAttachmentChanges",null),t([l()],S.prototype,"hasInvalidAttachmentName",null),t([l()],S.prototype,"attachmentCount",null),t([l()],S.prototype,"hasMinimumAttachmentCountNotMet",null),t([l()],S.prototype,"hasReachedAttachmentLimit",null),t([l()],S.prototype,"hasExceededAttachmentLimit",null),t([l({readOnly:!0})],S.prototype,"hasPendingAttachmentUpdateData",null),t([l()],S.prototype,"input",null),t([l()],S.prototype,"layer",null),t([l()],S.prototype,"maxAttachmentCount",null),t([l()],S.prototype,"minAttachmentCount",null),t([l({readOnly:!0})],S.prototype,"single",void 0),t([l({readOnly:!0})],S.prototype,"type",void 0),t([l({readOnly:!0})],S.prototype,"supportsResize",null),t([l()],S.prototype,"useOriginalFilename",null),t([l({readOnly:!0})],S.prototype,"valid",null),t([l()],S.prototype,"_initialAttachments",void 0),t([l()],S.prototype,"_expressionLayer",null),t([l()],S.prototype,"_stagedAdds",void 0),t([l()],S.prototype,"_stagedDeletes",void 0),t([l()],S.prototype,"_stagedUpdates",void 0),t([l()],S.prototype,"_failedStagedUpdateHydrations",void 0),t([l()],S.prototype,"_pendingStagedUpdateHydrations",void 0),t([l()],S.prototype,"_temporaryAttachmentUrls",void 0),t([l()],S.prototype,"_hasUnsupportedFileTypeValidationError",void 0),t([l()],S.prototype,"hasInvalidValidationCriteria",null),t([l()],S.prototype,"hasUnsupportedFileTypeValidationError",null),t([l()],S.prototype,"validationCriterionStates",null),S=t([h("esri.widgets.BatchAttributeForm.inputs.AttachmentElementInput")],S);const C=S;function b(t,e){switch(e){case"audio":t.add("audio");break;case"document":t.add("document");break;case"image":case"signature":t.add("image");break;case"video":t.add("video")}}function T(t){return"document"!==t.type&&"capture"===t.inputMethod}function w(t){return T(t)}function x(t){return"document"===t.type||"capture"!==t.inputMethod}function F(t){return t.data&&"string"!=typeof t.data?t.data.size:t.info.size}function I(t){const e=t.lastIndexOf(".");return-1===e?{base:t,extension:null}:{base:t.slice(0,e),extension:t.slice(e+1)}}function z(t,e){return e?`${t}.${e}`:t}export{C as default};
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../../request.js";import a from"../../../core/Collection.js";import i from"../../../core/Error.js";import n from"../../../core/Logger.js";import{isAbortError as s}from"../../../core/promiseUtils.js";import r from"../../../core/ReactiveMap.js";import o from"../../../core/ReactiveSet.js";import{generateBracedUUID as l}from"../../../core/uuid.js";import{property as d,subclass as h}from"../../../core/accessorSupport/decorators.js";import{getEffectiveLayerCapabilities as c}from"../../../layers/support/layerUtils.js";import m from"../../../rest/query/support/AttachmentInfo.js";import{getAttachmentCategoryForFile as p}from"../../Attachments/support/attachmentUtils.js";import{getAttachmentKey as u,getAttachmentUrl as g,preserveAttachmentFilenameExtension as y,attachmentValidationUtils as f}from"../attachmentUtils.js";import _ from"./EditableInput.js";import A from"./SingleFeatureInputAdapter.js";import{visibilityCodeToBoolean as U}from"./support/inputUtils.js";let v=-1;const b=["maximum-audio-length","maximum-file-size","maximum-image-size","minimum-number-of-files","maximum-number-of-files","maximum-video-length"];let C=class extends _{constructor(t){super(t),this.attachments=[],this.displayCount=3,this.group=null,this.single=new A({input:this}),this.type="attachment",this._initialAttachments=[],this._stagedAdds=new a,this._stagedDeletes=new o,this._stagedUpdates=new r,this._failedStagedUpdateHydrations=new o,this._pendingStagedUpdateHydrations=new r,this._temporaryAttachmentUrls=new r,this._validationCriterionStates=new r,this._hasUnsupportedFileTypeValidationError=!1}get allowUserRename(){return this.template.allowUserRename}get addDisabled(){const t=this.maxAttachmentCount,e=this.effectiveAttachmentCount;return!this.editable||null!=t&&e>=t}get effectiveAttachmentCount(){return this._initialAttachments.length-this._stagedDeletes.size+this._stagedAdds.length}get effectiveVisible(){return U(this.effectiveVisibilityCode)}get effectiveVisibilityCode(){const{visibilityCode:t}=this;if("visible"!==t)return t;const{group:e}=this;if(null==e)return t;const a=e.visibilityCode;return"hidden:visibility-expression:all-features"===a?"hidden:group-visibility-expression:all-features":"hidden:visibility-expression:some-features"===a?"hidden:group-visibility-expression:some-features":t}get accept(){const{categories:t}=this;if(!t.size)return;const e=[];return t.has("image")&&e.push("image/*"),t.has("audio")&&e.push("audio/*"),t.has("video")&&e.push("video/*"),t.has("document")&&e.push("text/*","application/*","model/*"),e.length>0?e.join(","):void 0}get categories(){const t=new Set;for(const e of this._nestableInputs)x(t,e.type);return t}get _nestableInputs(){const{input:t}=this;return null==t?[]:"attachment"===t.type?t.inputTypes??[]:[t]}get attachmentKeyword(){return this.template.attachmentKeyword?.trim()}get displayFilename(){return this.template.displayFilename}get allAttachmentsVisibleOnDefaultPage(){return this.defaultPageAttachments.length===this.attachments.length}get canUploadFiles(){const t=this._nestableInputs;return!t.length||t.some(F)}get hasCaptureInputs(){return this._nestableInputs.some(w)}get captureMediaType(){const t=new Set;for(const e of this._nestableInputs)if(w(e))switch(e.type){case"audio":t.add("audio");break;case"video":t.add("video");break;case"image":case"signature":t.add("image")}return 1===t.size?Array.from(t)[0]:null}get isCaptureOnly(){const t=this._nestableInputs;return!!t.length&&t.every(T)}get defaultPageAttachments(){return this.attachments.slice(0,this.displayCount)}get feature(){return this.single.feature}get hasAttachmentChanges(){return this._stagedAdds.length>0||this._stagedUpdates.size>0||this._stagedDeletes.size>0}get hasInvalidAttachmentName(){return!!this.allowUserRename&&this.attachments.some(t=>0===t.name.trim().length)}get attachmentCount(){return this.attachments.length}get hasMinimumAttachmentCountNotMet(){const t=this.minAttachmentCount;return!(null==t||!this.effectiveVisible)&&(this.effectiveAttachmentCount<t&&!this.isCaptureOnly)}get hasReachedAttachmentLimit(){const t=this.maxAttachmentCount,e=this.effectiveAttachmentCount;return null!=t&&e===t}get hasExceededAttachmentLimit(){const t=this.maxAttachmentCount;return!(null==t||!this.effectiveVisible)&&this.effectiveAttachmentCount>t}get hasPendingAttachmentUpdateData(){return this._pendingStagedUpdateHydrations.size>0}get input(){return this.template.input}get layer(){return this.single.layer}get maxAttachmentCount(){return this.template.maxAttachmentCount}get minAttachmentCount(){return this.template.minAttachmentCount}get supportsResize(){const{layer:t}=this;if(!t)return!1;const e=c(t);return!!e&&("attachment"in e&&!!e.attachment?.supportsResize)}get useOriginalFilename(){return this.template.useOriginalFilename}get valid(){return!(this._failedStagedUpdateHydrations.size>0||this.hasInvalidAttachmentName||this.hasExceededAttachmentLimit||this.hasMinimumAttachmentCountNotMet)}get _expressionLayer(){const t=this.layer;if(t)return"scene"===t.type&&"associatedLayer"in t&&null!=t.associatedLayer?t.associatedLayer:"feature"===t.type?t:void 0}destroy(){this._clearTemporaryAttachmentUrls()}applyFetchedAttachments(t){for(const e of t)this._normalizeAttachmentName(e);this._initialAttachments=t,this._failedStagedUpdateHydrations.clear(),this._recomputeAttachments()}applyStashedEdits(t){const{adds:e,deletes:a,updates:i}=t;for(const n of e){const t=this._getAttachmentKey(n.info);this._stagedAdds.add({data:n.data,globalId:n.globalId??l(),info:n.info,key:t}),this._setTemporaryAttachmentUrl(t,n.data)}for(const n of i){const t=this._getAttachmentKey(n.info);this._stagedUpdates.set(t,{contentType:n.contentType,data:n.data,info:n.info,key:t,name:n.name,size:I(n)}),this._setTemporaryAttachmentUrl(t,n.data)}for(const n of a){const t=this._getAttachmentKey(n.info);this._stagedDeletes.add(t)}this._recomputeAttachments()}clearAttachmentChanges(){this.clearValidationCriteriaState(),this._clearTemporaryAttachmentUrls(),this._stagedAdds.removeAll(),this._stagedUpdates.clear(),this._stagedDeletes.clear(),this._failedStagedUpdateHydrations.clear(),this._pendingStagedUpdateHydrations.clear(),this._recomputeAttachments()}clearValidationCriteriaState(){this._validationCriterionStates.clear(),this._hasUnsupportedFileTypeValidationError=!1}get hasInvalidValidationCriteria(){for(const t of this._validationCriterionStates.values())if("danger"===t)return!0;return!1}get hasUnsupportedFileTypeValidationError(){return this._hasUnsupportedFileTypeValidationError}get validationCriterionStates(){return this._validationCriterionStates}getValidationCriterionState(t){return this._validationCriterionStates.get(t)??null}stageAddAttachment(t){if(!this._assertEditable())throw new i("batch-attribute-form:not-editable","Cannot modify attachments when editableExpression is false.");const{contentType:e,data:a,name:n}=t,s=t.globalId??l(),r=a instanceof Blob?a.size:void 0,o=n.trim(),d=new m({contentType:e??void 0,globalId:s,id:v--,keywords:this.attachmentKeyword??void 0,name:o,size:r});return this._setTemporaryAttachmentUrl(s,a),this._stagedAdds.add({key:s,globalId:s,info:d,data:a}),this._recomputeAttachments(),d}async stageAddAttachments(t,e){if(this.clearValidationCriteriaState(),!this._assertEditable())return[];const a=t.filter(t=>this.isFileAllowed(t));if(this._setUnsupportedFileTypeValidationError(a.length!==t.length),0===a.length)return[];const i=[],n=new Map,s=Date.now(),r={},o=this.effectiveAttachmentCount,l=o+a.length;if(null!=this.minAttachmentCount&&this.minAttachmentCount>0&&this._setValidationCriterionState(r,"minimum-number-of-files",l>=this.minAttachmentCount?"success":"danger"),null!=this.maxAttachmentCount){const t=l<=this.maxAttachmentCount;if(this._setValidationCriterionState(r,"maximum-number-of-files",t?"success":"danger"),!t)return this._setValidationCriteriaState(r),[]}let d=!0;for(let h=0;h<a.length;h++){const t=a[h];await this._validateAttachmentFile(t,o+h+1,r)||(d=!1)}if(!d)return this._setValidationCriteriaState(r),[];for(let h=0;h<a.length;h++){const t=a[h],r=t instanceof File?t.name:`attachment-${s}_${h+1}`,o=await this._resolveAttachmentFilename(r,e),l=this._makeUniqueFilenameForOperation(n,o);i.push(this.stageAddAttachment({contentType:t.type,data:t,name:l}))}return this._setValidationCriteriaState(r),i}findAttachment(t){if(t)return this.attachments.find(e=>u(e)===t)}getAttachmentEditState(t){const e=this._getAttachmentKey(t),a=e?this._initialAttachments.find(t=>this._getAttachmentKey(t)===e):void 0,i=a?.name??null,n=e?this._stagedUpdates.get(e):void 0,s=n?.name??t.name??null;return{initialName:i,isDeleted:!!e&&this._stagedDeletes.has(e),isRenamed:null!=s&&null!=i&&s!==i,isReplaced:!0===n?.isReplacement}}getAttachmentPreviewUrl(t,e){const a=this._getAttachmentKey(t);return(a?this._temporaryAttachmentUrls.get(a):void 0)??g({attachment:t,supportsResizeAttachments:this.supportsResize,layer:this.layer,thumbnailSize:e})}async ensureStagedUpdateData(t){const e=this._getAttachmentKey(t);if(!e)return!1;const a=this._stagedUpdates.get(e);if(!a||a.data||this._stagedDeletes.has(e))return this._failedStagedUpdateHydrations.delete(e),!1;const i=this._pendingStagedUpdateHydrations.get(e);if(i)return await i;const n=this._hydrateStagedUpdateData(t);this._pendingStagedUpdateHydrations.set(e,n);try{return await n}finally{this._pendingStagedUpdateHydrations.get(e)===n&&this._pendingStagedUpdateHydrations.delete(e)}}async waitForPendingAttachmentUpdateData(){await Promise.allSettled(Array.from(this._pendingStagedUpdateHydrations.values()))}discardStagedEdits(t){if(!this._assertEditable())return;const e=this._getAttachmentKey(t);if(!e)return;const a=this._stagedAdds.findIndex(t=>t.key===e);if(a>-1)return this._clearTemporaryAttachmentUrl(e),this._stagedAdds.removeAt(a),this._failedStagedUpdateHydrations.delete(e),this._pendingStagedUpdateHydrations.delete(e),void this._recomputeAttachments();this._clearTemporaryAttachmentUrl(e),this._stagedDeletes.delete(e),this._clearStagedUpdateTracking(e),this._recomputeAttachments()}isFileAllowed(t){const{categories:e}=this;if(!e.size)return!0;const a=p(t);return null!=a&&e.has(a)}isStagedAttachmentAddition(t){return"number"==typeof t.id&&t.id<0}stageDeleteAttachment(t){if(!this._assertEditable())return;const e=this._getAttachmentKey(t);if(!e)return;const a=this._stagedAdds.findIndex(t=>t.key===e);if(a>-1)return this._clearTemporaryAttachmentUrl(e),this._stagedAdds.removeAt(a),this._failedStagedUpdateHydrations.delete(e),this._pendingStagedUpdateHydrations.delete(e),void this._recomputeAttachments();this._clearTemporaryAttachmentUrl(e),this._stagedDeletes.add(e),this._clearStagedUpdateTracking(e),this._recomputeAttachments()}stageRenameAttachment(t,e){if(!this._assertEditable())return;const a=this._getAttachmentKey(t);if(!a)return;const i=this._stagedAdds.find(t=>t.key===a);if(i){const a=y(t.name,e);return i.info.name=a,void this._recomputeAttachments()}const n=this._stagedUpdates.get(a),s=this._getInitialAttachment(a)?.name??null,r=0===t.name.trim().length?s??t.name:t.name,o=y(r,!0===n?.isReplacement&&null!=s&&e===s?z(s).base:e),l=null!=s&&o===s;if(l&&!0!==n?.isReplacement)return this._stagedUpdates.delete(a),this._failedStagedUpdateHydrations.delete(a),this._pendingStagedUpdateHydrations.delete(a),void this._recomputeAttachments();const d={key:a,...n,info:t};l?delete d.name:d.name=o,this._stagedUpdates.set(a,d),this._recomputeAttachments(),this.ensureStagedUpdateData(t)}async stageReplaceAttachment(t,e,a){if(this.clearValidationCriteriaState(),!this._assertEditable())return!1;if(!this.isFileAllowed(e))return this._setUnsupportedFileTypeValidationError(!0),!1;const i={},n=await this._validateAttachmentFile(e,void 0,i);if(this._setValidationCriteriaState(i),!n)return!1;const s=e instanceof File?e.name:t.name,r=await this._resolveAttachmentFilename(s,a);return this._stageReplaceAttachment(t,e,r),!0}toSubmitEdits(){const t=[],e=[],a=[],i=this.feature?.plainGraphic;if(!i||0===this._stagedAdds.length&&0===this._stagedUpdates.size&&0===this._stagedDeletes.size)return null;const n=this.attachmentKeyword;for(const s of this._stagedAdds)null!=s.data&&t.push({feature:i,contentType:s.info.contentType,data:s.data,info:s.info,globalId:s.info.globalId,keywords:n,name:s.info.name});for(const s of this._stagedUpdates.values()){const t=null==s.name||s.name.trim().length>0;if(null==s.data||!t)continue;const a=s.name??this._getInitialAttachment(s.key)?.name??s.info.name;e.push({feature:i,contentType:s.contentType,data:s.data,globalId:s.info.globalId,id:s.info.id,info:s.info,keywords:n,name:a})}for(const s of this._stagedDeletes.values()){const t=this._getInitialAttachment(s);t&&a.push({feature:i,contentType:t.contentType,globalId:t.globalId,id:t.id,info:t,keywords:n,name:t.name})}return 0===t.length&&0===e.length&&0===a.length?null:{label:this.template.label,keywords:n,adds:t,deletes:a,updates:e}}_assertEditable(){return!!this.editable||(n.getLogger(this).error("batch-attribute-form:not-editable","Cannot modify attachments when editableExpression is false."),!1)}_recomputeAttachments(){const t=[];for(const e of this._stagedAdds)t.push(e.info);for(const e of this._initialAttachments){const a=this._getAttachmentKey(e);if(a&&this._stagedUpdates.has(a)){const i=this._stagedUpdates.get(a),n=e.clone();null!=i.name&&(n.name=i.name),null!=i.contentType&&(n.contentType=i.contentType),null!=i.size&&(n.size=i.size),t.push(n);continue}t.push(e)}this.attachments=t}async _computeAttachmentFilename(t,e){const a=this.template.filenameExpressionExecutor;if(!a)return t;const i=this.single.feature,r=i?.plainGraphic,o=this._expressionLayer,{attachmentKeyword:l,description:d,label:h}=this.template,c={$originalfeature:i?.original,$editcontext:{editType:e.editType},$layer:o,$featureset:o,$datastore:o?.url,$feature:r,$map:e.map,$formElement:{attachmentKeyword:l,description:d,label:h}},m={rawOutput:!0,spatialReference:e.spatialReference,timeZone:e.timeZone};try{const e=a.isAsync?await a.executeAsync(c,m):a.execute(c,m);if("string"==typeof e&&e.trim().length>0){const{extension:a}=z(t);return V(e.trim(),a)}}catch(p){s(p)||n.getLogger(this).error("Failed evaluating attachment filename expression",p)}return t}async _resolveAttachmentFilename(t,e){return!1===this.useOriginalFilename?await this._computeAttachmentFilename(t,e):t}_makeUniqueFilenameForOperation(t,e){const a=e.toLowerCase(),i=t.get(a)??0;if(t.set(a,i+1),0===i)return e;const{base:n,extension:s}=z(e);return V(`${n}_${i}`,s)}_setValidationCriteriaState(t){this._validationCriterionStates.clear();for(const e of b){const a=t[e];a&&this._validationCriterionStates.set(e,a)}}_setUnsupportedFileTypeValidationError(t){this._hasUnsupportedFileTypeValidationError!==t&&(this._hasUnsupportedFileTypeValidationError=t)}_setValidationCriterionState(t,e,a){"danger"!==t[e]&&(t[e]=a)}async _validateAttachmentFile(t,e,a){let i=!0;const n=p(t);for(const s of this._nestableInputs){const e=f.getAttachmentCategoryForInputType(s.type);if(null==n||e===n){if("document"===s.type&&null!=s.maxFileSize){const e=t.size<=1048576*s.maxFileSize;this._setValidationCriterionState(a,"maximum-file-size",e?"success":"danger"),i=i&&e}if(("audio"===s.type||"video"===s.type)&&null!=s.maxDuration){const e=await f.getMediaDurationInSeconds(t,s.type),n=null!=e&&e<=s.maxDuration;this._setValidationCriterionState(a,"audio"===s.type?"maximum-audio-length":"maximum-video-length",n?"success":"danger"),i=i&&n}if("image"===s.type&&null!=s.maxImageSize){const e=await f.getImageDimensionsInPixels(t),n=e?Math.max(e.width,e.height):null,r=null==n||n<=s.maxImageSize;this._setValidationCriterionState(a,"maximum-image-size",r?"success":"danger"),i=i&&r}}}if(null!=e&&null!=this.maxAttachmentCount){const t=e<=this.maxAttachmentCount;this._setValidationCriterionState(a,"maximum-number-of-files",t?"success":"danger"),i=i&&t}return i}_stageReplaceAttachment(t,e,a){const i=this._getAttachmentKey(t);if(!i)return;const n=this._stagedAdds.find(t=>t.key===i);if(n)return n.data=e,n.info.name=a,n.info.contentType=e.type,n.info.size=e.size,this._setTemporaryAttachmentUrl(i,e),void this._recomputeAttachments();const s=this._stagedUpdates.get(i);this._setTemporaryAttachmentUrl(i,e),this._failedStagedUpdateHydrations.delete(i),this._pendingStagedUpdateHydrations.delete(i),this._stagedUpdates.set(i,{...s,key:i,info:t,isReplacement:!0,contentType:e.type||s?.contentType||t.contentType,data:e,name:a,size:e.size}),this._recomputeAttachments()}_getInitialAttachment(t){return this._initialAttachments.find(e=>this._getAttachmentKey(e)===t)}_normalizeAttachmentName(t){const{name:e}=t;"string"==typeof e&&(t.name=e.trim())}_getAttachmentKey(t){return u(t)}_clearStagedUpdateTracking(t){this._stagedUpdates.delete(t),this._failedStagedUpdateHydrations.delete(t),this._pendingStagedUpdateHydrations.delete(t)}async _hydrateStagedUpdateData(t){const a=this._getAttachmentKey(t),i=t.url;if(!a||!i)return!1;try{const{data:n}=await e(i,{responseType:"blob"});this._failedStagedUpdateHydrations.delete(a);const s=this._stagedUpdates.get(a);return!(!s||s.data||this._stagedDeletes.has(a))&&(this._stagedUpdates.set(a,{...s,info:t,isReplacement:s.isReplacement??!1,contentType:s.contentType??t.contentType??n.type,data:n}),!0)}catch(r){const t=this._stagedUpdates.get(a);return!t||t.data||this._stagedDeletes.has(a)||this._failedStagedUpdateHydrations.add(a),s(r)||n.getLogger(this).error("Failed to fetch attachment data for staged update",r),!1}}_setTemporaryAttachmentUrl(t,e){if(this._clearTemporaryAttachmentUrl(t),!(e instanceof Blob))return;const a=URL.createObjectURL(e);return this._temporaryAttachmentUrls.set(t,a),a}_clearTemporaryAttachmentUrl(t){const e=this._temporaryAttachmentUrls.get(t);e&&(URL.revokeObjectURL(e),this._temporaryAttachmentUrls.delete(t))}_clearTemporaryAttachmentUrls(){for(const t of this._temporaryAttachmentUrls.values())URL.revokeObjectURL(t);this._temporaryAttachmentUrls.clear()}};t([d()],C.prototype,"allowUserRename",null),t([d()],C.prototype,"addDisabled",null),t([d()],C.prototype,"effectiveAttachmentCount",null),t([d()],C.prototype,"effectiveVisible",null),t([d()],C.prototype,"effectiveVisibilityCode",null),t([d()],C.prototype,"accept",null),t([d()],C.prototype,"categories",null),t([d()],C.prototype,"attachmentKeyword",null),t([d()],C.prototype,"attachments",void 0),t([d()],C.prototype,"displayFilename",null),t([d({readOnly:!0})],C.prototype,"allAttachmentsVisibleOnDefaultPage",null),t([d()],C.prototype,"canUploadFiles",null),t([d()],C.prototype,"hasCaptureInputs",null),t([d()],C.prototype,"captureMediaType",null),t([d()],C.prototype,"isCaptureOnly",null),t([d({readOnly:!0})],C.prototype,"defaultPageAttachments",null),t([d()],C.prototype,"displayCount",void 0),t([d()],C.prototype,"feature",null),t([d()],C.prototype,"group",void 0),t([d()],C.prototype,"hasAttachmentChanges",null),t([d()],C.prototype,"hasInvalidAttachmentName",null),t([d()],C.prototype,"attachmentCount",null),t([d()],C.prototype,"hasMinimumAttachmentCountNotMet",null),t([d()],C.prototype,"hasReachedAttachmentLimit",null),t([d()],C.prototype,"hasExceededAttachmentLimit",null),t([d({readOnly:!0})],C.prototype,"hasPendingAttachmentUpdateData",null),t([d()],C.prototype,"input",null),t([d()],C.prototype,"layer",null),t([d()],C.prototype,"maxAttachmentCount",null),t([d()],C.prototype,"minAttachmentCount",null),t([d({readOnly:!0})],C.prototype,"single",void 0),t([d({readOnly:!0})],C.prototype,"type",void 0),t([d({readOnly:!0})],C.prototype,"supportsResize",null),t([d()],C.prototype,"useOriginalFilename",null),t([d({readOnly:!0})],C.prototype,"valid",null),t([d()],C.prototype,"_initialAttachments",void 0),t([d()],C.prototype,"_expressionLayer",null),t([d()],C.prototype,"_stagedAdds",void 0),t([d()],C.prototype,"_stagedDeletes",void 0),t([d()],C.prototype,"_stagedUpdates",void 0),t([d()],C.prototype,"_failedStagedUpdateHydrations",void 0),t([d()],C.prototype,"_pendingStagedUpdateHydrations",void 0),t([d()],C.prototype,"_temporaryAttachmentUrls",void 0),t([d()],C.prototype,"_hasUnsupportedFileTypeValidationError",void 0),t([d()],C.prototype,"hasInvalidValidationCriteria",null),t([d()],C.prototype,"hasUnsupportedFileTypeValidationError",null),t([d()],C.prototype,"validationCriterionStates",null),C=t([h("esri.widgets.BatchAttributeForm.inputs.AttachmentElementInput")],C);const S=C;function x(t,e){switch(e){case"audio":t.add("audio");break;case"document":t.add("document");break;case"image":case"signature":t.add("image");break;case"video":t.add("video")}}function T(t){return"document"!==t.type&&"capture"===t.inputMethod}function w(t){return T(t)}function F(t){return"document"===t.type||"capture"!==t.inputMethod}function I(t){return t.data&&"string"!=typeof t.data?t.data.size:t.info.size}function z(t){const e=t.lastIndexOf(".");return-1===e?{base:t,extension:null}:{base:t.slice(0,e),extension:t.slice(e+1)}}function V(t,e){return e?`${t}.${e}`:t}export{S as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import e from"../../../core/Accessor.js";import{destroyMaybe as l}from"../../../core/maybe.js";import{property as i,subclass as n}from"../../../core/accessorSupport/decorators.js";import{deepFilterInputs as s,isGroupInput as r,isFieldInput as p,isAttachmentElementInput as o,isEditableInput as u,isUtilityNetworkAssociationsElementInput as a}from"./support/inputUtils.js";let d=class extends e{constructor(t){super(t),this.inputs=[],this.staleInputs=new Map,this.template=null}destroy(){this.inputs.forEach(t=>l(t))}get allFieldInputs(){return s(this.inputs,p)}get allAttachmentElementInputs(){return s(this.inputs,o)}get allEditableInputs(){return s(this.inputs,u)}get allGroupInputs(){return this.inputs.filter(r)}get allUtilityNetworkAssociationsElementInputs(){return s(this.inputs,a)}get description(){return this.template?.description??null}get hasInvalidHiddenInputs(){return this.invalidHiddenInputs.length>0}get invalidFeatures(){return Array.from(new Set(this.allFieldInputs.flatMap(t=>t.invalidFeatures)))}get invalidHiddenInputs(){return this.allFieldInputs.filter(t=>!t.valid&&!t.effectiveVisible)}get title(){return this.template?.title??null}get valid(){return this.allEditableInputs.every(t=>t.valid)}};t([i()],d.prototype,"allFieldInputs",null),t([i()],d.prototype,"allAttachmentElementInputs",null),t([i()],d.prototype,"allEditableInputs",null),t([i()],d.prototype,"allGroupInputs",null),t([i()],d.prototype,"allUtilityNetworkAssociationsElementInputs",null),t([i()],d.prototype,"description",null),t([i()],d.prototype,"inputs",void 0),t([i()],d.prototype,"hasInvalidHiddenInputs",null),t([i()],d.prototype,"invalidFeatures",null),t([i()],d.prototype,"invalidHiddenInputs",null),t([i()],d.prototype,"template",void 0),t([i()],d.prototype,"title",null),t([i()],d.prototype,"valid",null),d=t([n("esri.widgets.BatchAttributeForm.inputs.BatchFormInputs")],d);const m=d;export{m as default};
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../../core/Accessor.js";import{destroyMaybe as l}from"../../../core/maybe.js";import{property as i,subclass as n}from"../../../core/accessorSupport/decorators.js";import{deepFilterInputs as s,isGroupInput as r,isFieldInput as p,isAttachmentElementInput as o,isEditableInput as u,isUtilityNetworkAssociationsElementInput as a}from"./support/inputUtils.js";let d=class extends e{constructor(t){super(t),this.inputs=[],this.staleInputs=new Map,this.template=null}destroy(){this.inputs.forEach(t=>l(t))}get allFieldInputs(){return s(this.inputs,p)}get allAttachmentElementInputs(){return s(this.inputs,o)}get allEditableInputs(){return s(this.inputs,u)}get allGroupInputs(){return this.inputs.filter(r)}get allUtilityNetworkAssociationsElementInputs(){return s(this.inputs,a)}get description(){return this.template?.description??null}get hasInvalidHiddenInputs(){return this.invalidHiddenInputs.length>0}get invalidFeatures(){return Array.from(new Set(this.allFieldInputs.flatMap(t=>t.invalidFeatures)))}get invalidHiddenInputs(){return this.allFieldInputs.filter(t=>!t.valid&&!t.effectiveVisible)}get title(){return this.template?.title??null}get valid(){return this.allEditableInputs.filter(t=>t.visible).every(t=>t.valid)}};t([i()],d.prototype,"allFieldInputs",null),t([i()],d.prototype,"allAttachmentElementInputs",null),t([i()],d.prototype,"allEditableInputs",null),t([i()],d.prototype,"allGroupInputs",null),t([i()],d.prototype,"allUtilityNetworkAssociationsElementInputs",null),t([i()],d.prototype,"description",null),t([i()],d.prototype,"inputs",void 0),t([i()],d.prototype,"hasInvalidHiddenInputs",null),t([i()],d.prototype,"invalidFeatures",null),t([i()],d.prototype,"invalidHiddenInputs",null),t([i()],d.prototype,"template",void 0),t([i()],d.prototype,"title",null),t([i()],d.prototype,"valid",null),d=t([n("esri.widgets.BatchAttributeForm.inputs.BatchFormInputs")],d);const m=d;export{m as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{isSome as t}from"../../../core/arrayUtils.js";import{getOrCreateMapValue as i}from"../../../core/MapUtils.js";import{property as l,subclass as r}from"../../../core/accessorSupport/decorators.js";import{isMultipleChoiceInput as o}from"../../../form/elements/inputs/inputUtils.js";import n from"../../../layers/support/CodedValue.js";import s from"../../../layers/support/CodedValueDomain.js";import{getDomainRange as a,dateTimeFieldValuesToNumericRange as u,isDomainValidForField as h}from"../../../layers/support/domainUtils.js";import{isNumericField as p,isStringField as c,isTimeOnlyField as m,getFieldRange as d,isDateOnlyField as f,isTimestampOffsetField as C}from"../../../layers/support/fieldUtils.js";import{supportsFieldConfiguration as g}from"../../../layers/support/layerUtils.js";import y from"../../../layers/support/RangeDomain.js";import{isAnyDateField as x}from"../../../smartMapping/support/utils.js";import{isNumber as b}from"../../../support/guards.js";import v from"./EditableInput.js";import{visibilityCodeToBoolean as F,differentValuesString as O,isFieldInputWithShowNoValueOptionInput as V}from"./support/inputUtils.js";import{otherChoiceCheckedPlaceholderValue as M,multipleChoiceOtherChoiceCheckedStateByExpressionsManager as _}from"./support/multipleChoiceInputUtils.js";import{timeResolutionToStepMap as S}from"../../support/dateUtils.js";import{isEmptyValue as E,getMaxLength as w,getMinLength as k,dateIsValid as D,validateFormValue as N}from"../../support/forms/formUtils.js";let R=class extends v{constructor(e){super(e),this.getExternalErrorForFeature=null,this.getFieldValueOptionsForFeature=null,this.group=null,this.type="field",this.userHasChangedValue=!1,this._hasIntersectionWithElementFieldDomain=!1}get compositeError(){if(this.valid)return null;const{errors:e}=this;if(e.length<this.features.length)return"batch-attribute-form-validation::features-have-different-errors";const t=e[0];for(const i of e)if(i.error!==t.error)return"batch-attribute-form-validation::features-have-different-errors";return t.error}get dataType(){const{field:e}=this;return p(e)?"number":c(e)?"text":x(e)||m(e)?"date":"unsupported"}get domain(){const e=this._allDomains.toArray();return this.calculateDomain(e)}get distinctValues(){if(this.featuresHaveSameValue)return[this.value];const e=new Set;for(const t of this.features)e.add(t.getAttribute(this.fieldName));return Array.from(e)}get editable(){return!!this.field.editable&&(this._evaluatedEditableExpression??!0)}get label(){const{label:e}=this.template,t=this._computeStringLiteralText(e);if(t)return t;const{field:i,layers:l}=this;if(1===l.length){const e=l[0];if(g(e)){const t=e.getFieldAlias(i.name);if(null!=t&&""!==t)return t}}return i.alias||i.name}get effectiveVisible(){return F(this.effectiveVisibilityCode)}get effectiveVisibilityCode(){const{visibilityCode:e}=this;if("visible"!==e)return e;const{group:t}=this;if(null==t)return e;const i=t.visibilityCode;return"hidden:visibility-expression:all-features"===i?"hidden:group-visibility-expression:all-features":"hidden:visibility-expression:some-features"===i?"hidden:group-visibility-expression:some-features":e}get errors(){return this._validate()}get featuresHaveSameValue(){const{fieldName:e}=this,t=this.features.at(0)?.getAttribute(e);return this.features.every(i=>i.getAttribute(e)===t)}get field(){return this.template.field}get fieldName(){return this.field.name}get input(){return this.template.input}get multipleChoiceInput(){const{input:e}=this;return e&&o(e)?e:null}get multipleChoiceChoices(){const{multipleChoiceInput:e}=this;if(!e)return null;const t=new Map;for(const i of e.choices)t.has(i.value)||t.set(i.value,i);return Array.from(t.values())}get multipleChoiceValues(){return this.multipleChoiceChoices?.map(e=>e.value)??null}get multipleChoiceOtherChoiceFieldName(){return this.multipleChoiceInput?.otherChoice?.fieldName??null}get multipleChoiceOtherChoiceHint(){return this.multipleChoiceInput?.otherChoice?.hint??""}get multipleChoiceOtherChoiceLabel(){return this.multipleChoiceInput?.otherChoice?.label??null}get hasMultipleChoiceOtherChoiceField(){const{multipleChoiceOtherChoiceFieldName:e}=this;return!!e&&this.layers.every(t=>null!=t.getField(e))}get shouldShowMultipleChoiceOtherChoice(){return null!=this.multipleChoiceInput?.otherChoice&&this.hasMultipleChoiceOtherChoiceField}set shouldShowMultipleChoiceOtherChoice(e){this._overrideIfSome("shouldShowMultipleChoiceOtherChoice",e)}get multipleChoiceOtherChoiceValue(){const{multipleChoiceOtherChoiceFieldName:e}=this;if(!e||!this.shouldShowMultipleChoiceOtherChoice)return null;const t=this.features.map(t=>t.getAttribute(e));if(0===t.length)return null;const[i]=t;return t.every(e=>e===i)?i:O}get multipleChoiceOtherChoiceMaxLength(){const{multipleChoiceOtherChoiceFieldName:e}=this;if(!e||!this.shouldShowMultipleChoiceOtherChoice)return;let t;for(const i of this.layers){const l=i.getField(e)?.length;null==l||l<0||(t=null==t?l:Math.min(t,l))}return t}getMultipleChoiceOtherChoiceRenderState(e){const t=this.multipleChoiceOtherChoiceFieldName??void 0,i=this.shouldShowMultipleChoiceOtherChoice,l=this.multipleChoiceOtherChoiceValue,r=i?this.multipleChoiceOtherChoiceCheckboxState:{checked:!1,indeterminate:!1},o=i?this.getExplicitMultipleChoiceOtherChoiceCheckedState():void 0,n=void 0===o?r:{checked:o,indeterminate:!1};return{fieldName:t,hint:this.multipleChoiceOtherChoiceHint,label:this.multipleChoiceOtherChoiceLabel??e,shouldShow:i,checkboxState:n,value:l,normalizedValue:l===M?"":l,maxLength:this.multipleChoiceOtherChoiceMaxLength}}get multipleChoiceOtherChoiceCheckboxState(){const e=this.multipleChoiceOtherChoiceFieldName;if(!e)return{checked:!1,indeterminate:!1};const t=this.features.map(t=>t.getAttribute(e));return{checked:t.length>0&&t.every(e=>!E(e)),indeterminate:t.some(e=>!E(e))&&t.some(e=>E(e))}}initializeExplicitMultipleChoiceOtherChoiceCheckedState(){this.hasExplicitMultipleChoiceOtherChoiceCheckedState()||this.setExplicitMultipleChoiceOtherChoiceCheckedState(this.multipleChoiceOtherChoiceCheckboxState.checked)}hasExplicitMultipleChoiceOtherChoiceCheckedState(){return void 0!==this.getExplicitMultipleChoiceOtherChoiceCheckedState()}getExplicitMultipleChoiceOtherChoiceCheckedState(){const e=this._multipleChoiceOtherChoiceCheckedStateKey;if(e)return this._multipleChoiceOtherChoiceCheckedStateStore.get(e)}setExplicitMultipleChoiceOtherChoiceCheckedState(e){const t=this._multipleChoiceOtherChoiceCheckedStateKey;t&&this._multipleChoiceOtherChoiceCheckedStateStore.set(t,e)}stashMultipleChoiceOtherChoiceDraftValueForFeatures(e,t){const i=this.multipleChoiceOtherChoiceFieldName;if(i)for(const l of e)l.stashAttribute(i,t)}setMultipleChoiceOtherChoiceDraftValuesFromFeatures(e){const t=this.multipleChoiceOtherChoiceFieldName;if(t)for(const i of e)i.stashAttribute(t,i.getAttribute(t))}getMultipleChoiceOtherChoiceDraftValue(e){const t=this.multipleChoiceOtherChoiceFieldName;if(t)return e.getStashedAttribute(t)}get invalidFeatures(){return this.errors.map(e=>e.feature)}get _multipleChoiceOtherChoiceCheckedStateKey(){return null!=this.multipleChoiceOtherChoiceFieldName?this.template.elementId:null}get _multipleChoiceOtherChoiceCheckedStateStore(){const e=this.expressionsManager;return e?i(_,e,()=>new Map):new Map}get isSubtypeField(){return this.layers.some(e=>{if(e&&"subtypeField"in e){const{subtypeField:t,fieldsIndex:i}=e;return(i.get(t)?.name??t)===this.fieldName}return!1})}get showNoValueOptionEnabled(){const{input:e}=this;return!this.required&&(!V(e)||!0===e?.showNoValueOption)}get showNoValueLabel(){const{input:e}=this;return V(e)?e?.noValueOptionLabel:null}get includeTime(){const{template:e,field:t}=this;return"date"===this.dataType&&("time-only"===t.type||"date-only"!==t.type&&("datetime-picker"!==e.input?.type||e.input.includeTime))}get includeTimeOffset(){if("timestamp-offset"!==this.field.type)return!1;const{input:e}=this;return!e||"timestampoffset-picker"===e.type&&e.includeTimeOffset}get inputType(){return this.input?.type}get maxLength(){return w({dataType:this.dataType,field:this.field,input:this.input})}get minLength(){return k({dataType:this.dataType,field:this.field,input:this.input})}get range(){if("date"===this.dataType)return this._dateRange;const{domain:e,field:t}=this;if(e){const i=a(t,e);return{max:i?.max,min:i?.min}}const i=this._allDomains.toArray().every(e=>!e)?d(t):null;return{max:i?.max===Number.MAX_VALUE?null:i?.max??null,min:i?.min===-Number.MAX_VALUE?null:i?.min??null}}get required(){if(!this.editable)return!1;if(!this.field.nullable||this.isSubtypeField)return!0;const e=this.visible&&!1!==this.group?.visible,t=this._evaluatedRequiredExpression;return!(!e||null==t)&&t}get timeResolution(){const e=this.input;if(e&&("timestampoffset-picker"===e.type||"time-picker"===e.type))return e.timeResolution??"minutes"}get timeStep(){return null!=this.timeResolution?S.get(this.timeResolution):void 0}get valid(){return 0===this.errors.length}get value(){return this.featuresHaveSameValue?this.features.at(0)?.getAttribute(this.fieldName)??null:O}get visibilityCode(){return this.field.visible?this._fieldShouldHaveDomain&&null==this.domain?"hidden:no-domain-in-common":this._baseVisibilityCode:"hidden:field-definition"}get codedValueDomainOptions(){return"coded-value"===this.domain?.type?this.domain.codedValues.map(({name:e,code:t})=>({name:e,value:t})):[]}get codedValueOptions(){const{getFieldValueOptionsForFeature:e}=this;if(1===this.features.length&&e){const t=this.features.at(0);return e({domain:this.domain??void 0,feature:t,fieldName:this.fieldName,layer:t.layer})}const t=this.codedValueDomainOptions,{value:i}=this,l=null==i||i===O||t.some(e=>e.value===i)?[]:[{name:`${i}`,value:i}];return{recommended:t,other:[],unsupported:l,containsEmptyOption:!1}}get _evaluatedRequiredExpression(){let e=!1,t=!0;const i=this.template;for(const l of this.features){if(null==i.getExpressionExecutorsForLayer(l.layer)?.requiredExpression)continue;t=!1;const r=this._lookupEvaluatedExpression(l,"required");"success"===r?.status?e=e||!0===r.result:e=!0}return t?null:e}get _allDomains(){const e=this.template.domain;return this.features.map(t=>{const i=t.layer.getFieldDomain(this.fieldName,{feature:t.plainGraphic});return"range"===i?.type||"range"===e?.type?i??this.template.domain:i})}get _fieldShouldHaveDomain(){return!!this._hasIntersectionWithElementFieldDomain||this._allDomains.some(t)}get _dateFormRange(){if("date"!==this.dataType)return{};const{input:e}=this;if(!e)return{};const{type:t}=e;let i={};if("date-picker"!==t&&"time-picker"!==t&&"timestampoffset-picker"!==t||(i=u(this.field,e.max,e.min)),"datetime-picker"===t){const{max:t,min:l}=e;i={max:null!=t&&D(t)?t.getTime():null,min:null!=l&&D(l)?l.getTime():null}}return{min:i.min,max:i.max,rawMax:i?.rawMax??null,rawMin:i?.rawMin??null}}get _dateRange(){const{_dateFormRange:e,template:t,field:i,domain:l}=this;if("date"!==this.dataType)return{};if(!l)return this._fieldShouldHaveDomain?{}:e;const r=a(i,l);if(!r)return e;const{max:o,min:n,rawMax:s,rawMin:u}=e,{type:h}=t.field;if("date"===h){const{max:e,min:t}=r;return{max:b(o)&&(null===e||null!=e&&o<=e)?o:e??null,min:b(n)&&(null===t||null!=t&&n>=t)?n:t??null}}if("date-only"===h||"time-only"===h||"timestamp-offset"===h){const{max:e,min:t,rawMax:i,rawMin:l}=r,a=b(o)&&s&&(null==e||o<e),h=b(n)&&u&&(null==t||n>t);return{max:a?o:e,min:h?n:t,rawMax:a?s:i,rawMin:h?u:l}}return{}}_validate(){const{dataType:e,fieldName:t,maxLength:i,minLength:l,range:r}=this,o=[],{multipleChoiceInput:n}=this;for(const s of this.features){const{layer:a}=s,u=a.getField(t)??this.field,h=a.getFieldDomain(t,{feature:s.plainGraphic}),p=this.calculateDomain([h]),c=this._requiredForFeature(s),m=s.getAttribute(t),d=N(m,{dataType:e,domain:p,field:u,maxLength:i,minLength:l,multipleChoice:n,range:r,required:c})??this.getExternalErrorForFeature?.(s,t);d&&o.push({error:d,feature:s.source})}return o}_editableForFeature(e){if(!this.field.editable)return!1;if(null==this.template.getExpressionExecutorsForLayer(e.layer)?.editableExpression)return!0;const t=this._lookupEvaluatedExpression(e,"editable");return"success"===t?.status&&!0===t.result}_effectiveVisibleFeature(e){if(this.group&&!this.group.visibleForFeature(e))return!1;if(null==this.template.getExpressionExecutorsForLayer(e.layer)?.visibilityExpression)return!0;const t=this._lookupEvaluatedExpression(e,"visibility");return"success"===t?.status&&!0===t.result}_requiredForFeature(e){if(!this._editableForFeature(e))return!1;if(!this.field.nullable||this.isSubtypeField)return!0;const t=this._effectiveVisibleFeature(e);if(null==this.template.getExpressionExecutorsForLayer(e.layer)?.requiredExpression)return!1;const i=this._lookupEvaluatedExpression(e,"required");return"success"!==i?.status?t:t&&!0===i.result}calculateDomain(e){const t=e.find(e=>null!=e),i=this.template.domain;if(!t)return i&&h(this.field,i)?i:null;switch(t.type){case"coded-value":if(e.some(e=>!e)){if(!i)return null;e=e.filter(e=>null!==e)}break;case"range":e=e.filter(e=>null!==e)}if(!e.every(e=>e?.type===t?.type))return null;let l=null;switch(t?.type){case"range":l=this._intersectRangeDomains(e);break;case"coded-value":l=this._intersectCodedValueDomains(e)}return l}_intersectCodedValueDomains(e){if(!e.length)return null;const t=new Map(e[0].codedValues.map(({code:e,name:t})=>[e,t])),i=this.template.domain?new Map(this.template.domain.codedValues.map(({code:e,name:t})=>[e,t])):null;for(const o of e)for(const[e,i]of t){o.codedValues.some(t=>t.code===e&&t.name===i)||t.delete(e)}let l=t;if(i){l=new Map;for(const[e,r]of i)t.has(e)&&l.set(e,r)}const r=Array.from(l.entries()).map(([e,t])=>new n({code:e,name:t}));return r.length?new s({codedValues:r}):null}_intersectRangeDomains(e){if(!e.length)return null;let t=e[0];for(let l=1;l<e.length;l++){if(!t)return null;t=this._findMinMaxValuesBetweenTwoDomains(t,e[l])}if(t&&!h(this.field,t))return null;const{domain:i}=this.template;if(t&&i&&i instanceof y){const e=this._findMinMaxValuesBetweenTwoDomains(t,i);return this._hasIntersectionWithElementFieldDomain=!!e,e}return t}_getMinMaxFromRangeDomain(e){const t=e.minValue,i=e.maxValue,{field:l}=this;return f(l)||m(l)||C(l)?u(l,i,t):{min:null!=t&&"number"==typeof t?t:null,max:null!=i&&"number"==typeof i?i:null}}_findMinMaxValuesBetweenTwoDomains(e,t){const i=new y,l=this._getMinMaxFromRangeDomain(e),r=this._getMinMaxFromRangeDomain(t),{field:o}=this,n=this._getValidRangeValue(l.min,-1/0),s=this._getValidRangeValue(l.max,1/0),a=this._getValidRangeValue(r.min,-1/0),u=this._getValidRangeValue(r.max,1/0);return i.minValue=Math.max(n,a),i.maxValue=Math.min(s,u),i.minValue===-1/0||i.maxValue===1/0||i.minValue>i.maxValue?null:((f(o)||m(o)||C(o))&&(i.minValue=Number(l.min)>Number(r.min)?l.rawMin:r.rawMin,i.maxValue=Number(l.max)<Number(r.max)?l.rawMax:r.rawMax),i.name="intersection",i)}_getValidRangeValue(e,t){return b(e)?e:t}};e([l()],R.prototype,"dataType",null),e([l()],R.prototype,"domain",null),e([l()],R.prototype,"distinctValues",null),e([l()],R.prototype,"editable",null),e([l()],R.prototype,"label",null),e([l()],R.prototype,"effectiveVisible",null),e([l()],R.prototype,"effectiveVisibilityCode",null),e([l()],R.prototype,"errors",null),e([l()],R.prototype,"featuresHaveSameValue",null),e([l()],R.prototype,"field",null),e([l()],R.prototype,"fieldName",null),e([l()],R.prototype,"getExternalErrorForFeature",void 0),e([l()],R.prototype,"getFieldValueOptionsForFeature",void 0),e([l()],R.prototype,"group",void 0),e([l()],R.prototype,"input",null),e([l()],R.prototype,"multipleChoiceInput",null),e([l()],R.prototype,"multipleChoiceChoices",null),e([l()],R.prototype,"multipleChoiceValues",null),e([l()],R.prototype,"multipleChoiceOtherChoiceFieldName",null),e([l()],R.prototype,"multipleChoiceOtherChoiceHint",null),e([l()],R.prototype,"multipleChoiceOtherChoiceLabel",null),e([l()],R.prototype,"hasMultipleChoiceOtherChoiceField",null),e([l()],R.prototype,"shouldShowMultipleChoiceOtherChoice",null),e([l()],R.prototype,"multipleChoiceOtherChoiceValue",null),e([l()],R.prototype,"multipleChoiceOtherChoiceMaxLength",null),e([l()],R.prototype,"multipleChoiceOtherChoiceCheckboxState",null),e([l()],R.prototype,"invalidFeatures",null),e([l()],R.prototype,"_multipleChoiceOtherChoiceCheckedStateStore",null),e([l()],R.prototype,"isSubtypeField",null),e([l()],R.prototype,"showNoValueOptionEnabled",null),e([l()],R.prototype,"showNoValueLabel",null),e([l()],R.prototype,"includeTime",null),e([l()],R.prototype,"includeTimeOffset",null),e([l({readOnly:!0})],R.prototype,"inputType",null),e([l()],R.prototype,"maxLength",null),e([l()],R.prototype,"minLength",null),e([l()],R.prototype,"range",null),e([l()],R.prototype,"required",null),e([l()],R.prototype,"timeResolution",null),e([l()],R.prototype,"timeStep",null),e([l({readOnly:!0})],R.prototype,"type",void 0),e([l()],R.prototype,"userHasChangedValue",void 0),e([l()],R.prototype,"valid",null),e([l()],R.prototype,"value",null),e([l()],R.prototype,"visibilityCode",null),e([l()],R.prototype,"codedValueDomainOptions",null),e([l()],R.prototype,"codedValueOptions",null),e([l()],R.prototype,"_evaluatedRequiredExpression",null),e([l()],R.prototype,"_hasIntersectionWithElementFieldDomain",void 0),e([l()],R.prototype,"_allDomains",null),e([l()],R.prototype,"_fieldShouldHaveDomain",null),e([l()],R.prototype,"_dateFormRange",null),e([l()],R.prototype,"_dateRange",null),R=e([r("esri.widgets.BatchAttributeForm.inputs.FieldInput")],R);const T=R;export{T as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{isSome as t}from"../../../core/arrayUtils.js";import{getOrCreateMapValue as i}from"../../../core/MapUtils.js";import l from"../../../core/ReactiveMap.js";import{property as r,subclass as o}from"../../../core/accessorSupport/decorators.js";import{isMultipleChoiceInput as n}from"../../../form/elements/inputs/inputUtils.js";import a from"../../../layers/support/CodedValue.js";import s from"../../../layers/support/CodedValueDomain.js";import{getDomainRange as u,validateDomainValue as h,dateTimeFieldValuesToNumericRange as p,isDomainValidForField as c}from"../../../layers/support/domainUtils.js";import{getFieldRange as m,isDateOnlyField as d,isTimeOnlyField as f,isTimestampOffsetField as C}from"../../../layers/support/fieldUtils.js";import{supportsFieldConfiguration as g}from"../../../layers/support/layerUtils.js";import y from"../../../layers/support/RangeDomain.js";import{isNumber as x}from"../../../support/guards.js";import b from"./EditableInput.js";import{getFieldInputDataType as v,visibilityCodeToBoolean as O,differentValuesString as F,isFieldInputWithShowNoValueOptionInput as V}from"./support/inputUtils.js";import{otherChoiceCheckedPlaceholderValue as M,multipleChoiceOtherChoiceCheckedStateByExpressionsManager as _}from"./support/multipleChoiceInputUtils.js";import{timeResolutionToStepMap as S}from"../../support/dateUtils.js";import{valuesAreEquivalent as E,isEmptyValue as w,getMaxLength as k,getMinLength as D,dateIsValid as N,validateFormValue as T}from"../../support/forms/formUtils.js";let L=class extends b{constructor(e){super(e),this.getExternalErrorForFeature=null,this.getFieldValueOptionsForFeature=null,this.group=null,this.type="field",this.userHasChangedValue=!1,this._hasIntersectionWithElementFieldDomain=!1}get compositeError(){if(this.valid)return null;const{errors:e}=this;if(e.length<this.features.length)return"batch-attribute-form-validation::features-have-different-errors";const t=e[0];for(const i of e)if(i.error!==t.error)return"batch-attribute-form-validation::features-have-different-errors";return t.error}get dataType(){return v(this.field)}get domain(){const e=this._allDomains.toArray();return this.calculateDomain(e)}get distinctValues(){if(this.featuresHaveSameValue)return[this.value];const e=new Set;for(const t of this.features)e.add(t.getAttribute(this.fieldName));return Array.from(e)}get editable(){return!!this.field.editable&&(this._evaluatedEditableExpression??!0)}get label(){const{label:e}=this.template,t=this._computeStringLiteralText(e);if(t)return t;const{field:i,layers:l}=this;if(1===l.length){const e=l[0];if(g(e)){const t=e.getFieldAlias(i.name);if(null!=t&&""!==t)return t}}return i.alias||i.name}get effectiveVisible(){return O(this.effectiveVisibilityCode)}get effectiveVisibilityCode(){const{visibilityCode:e}=this;if("visible"!==e)return e;const{group:t}=this;if(null==t)return e;const i=t.visibilityCode;return"hidden:visibility-expression:all-features"===i?"hidden:group-visibility-expression:all-features":"hidden:visibility-expression:some-features"===i?"hidden:group-visibility-expression:some-features":e}get errors(){return this._validate()}get featuresHaveSameValue(){const{fieldName:e}=this,t=this.features.at(0)?.getAttribute(e);return this.features.every(i=>E(i.getAttribute(e),t))}get field(){return this.template.field}get fieldName(){return this.field.name}get input(){return this.template.input}get multipleChoiceInput(){const{input:e}=this;return e&&n(e)?e:null}get multipleChoiceChoices(){const{multipleChoiceInput:e}=this;if(!e)return null;const t=new Map;for(const i of e.choices)t.has(i.value)||t.set(i.value,i);return Array.from(t.values())}get multipleChoiceValues(){return this.multipleChoiceChoices?.map(e=>e.value)??null}get multipleChoiceOtherChoiceFieldName(){return this.multipleChoiceInput?.otherChoice?.fieldName??null}get multipleChoiceOtherChoiceHint(){return this.multipleChoiceInput?.otherChoice?.hint??""}get multipleChoiceOtherChoiceLabel(){return this.multipleChoiceInput?.otherChoice?.label??null}get hasMultipleChoiceOtherChoiceField(){const{multipleChoiceOtherChoiceFieldName:e}=this;return!!e&&this.layers.every(t=>null!=t.getField(e))}get shouldShowMultipleChoiceOtherChoice(){return null!=this.multipleChoiceInput?.otherChoice&&this.hasMultipleChoiceOtherChoiceField}set shouldShowMultipleChoiceOtherChoice(e){this._overrideIfSome("shouldShowMultipleChoiceOtherChoice",e)}get multipleChoiceOtherChoiceValue(){const{multipleChoiceOtherChoiceFieldName:e}=this;if(!e||!this.shouldShowMultipleChoiceOtherChoice)return null;const t=this.features.map(t=>t.getAttribute(e));if(0===t.length)return null;const[i]=t;return t.every(e=>e===i)?i:F}get multipleChoiceOtherChoiceMaxLength(){const{multipleChoiceOtherChoiceFieldName:e}=this;if(!e||!this.shouldShowMultipleChoiceOtherChoice)return;let t;for(const i of this.layers){const l=i.getField(e)?.length;null==l||l<0||(t=null==t?l:Math.min(t,l))}return t}getMultipleChoiceOtherChoiceRenderState(e){const t=this.errors?.some(e=>"input-validation-error::cannot-be-empty"===e.error),{multipleChoiceOtherChoiceFieldName:i,shouldShowMultipleChoiceOtherChoice:l,multipleChoiceOtherChoiceValue:r}=this,o=this._getMultipleChoiceOtherChoiceCheckboxState(),n=o.checked&&t?"invalid":"idle";return{fieldName:i,hint:this.multipleChoiceOtherChoiceHint,label:this.multipleChoiceOtherChoiceLabel??e,shouldShow:l,checkboxState:o,value:r,normalizedValue:r===M?"":r,maxLength:this.multipleChoiceOtherChoiceMaxLength,status:n}}get multipleChoiceOtherChoiceCheckboxState(){const e=this.multipleChoiceOtherChoiceFieldName;if(!e)return{checked:!1,indeterminate:!1};const t=this.features.map(t=>t.getAttribute(e));return{checked:t.length>0&&t.every(e=>!w(e)),indeterminate:t.some(e=>!w(e))&&t.some(e=>w(e))}}initializeExplicitMultipleChoiceOtherChoiceCheckedState(){this.hasExplicitMultipleChoiceOtherChoiceCheckedState()||this.setExplicitMultipleChoiceOtherChoiceCheckedState(this.multipleChoiceOtherChoiceCheckboxState.checked)}hasExplicitMultipleChoiceOtherChoiceCheckedState(){return void 0!==this.getExplicitMultipleChoiceOtherChoiceCheckedState()}getExplicitMultipleChoiceOtherChoiceCheckedState(){const e=this._multipleChoiceOtherChoiceCheckedStateKey;if(e)return this._multipleChoiceOtherChoiceCheckedStateStore.get(e)}setExplicitMultipleChoiceOtherChoiceCheckedState(e){const t=this._multipleChoiceOtherChoiceCheckedStateKey;t&&this._multipleChoiceOtherChoiceCheckedStateStore.set(t,e)}stashMultipleChoiceOtherChoiceDraftValueForFeatures(e,t){const i=this.multipleChoiceOtherChoiceFieldName;if(i)for(const l of e)l.stashAttribute(i,t)}setMultipleChoiceOtherChoiceDraftValuesFromFeatures(e){const t=this.multipleChoiceOtherChoiceFieldName;if(t)for(const i of e)i.stashAttribute(t,i.getAttribute(t))}getMultipleChoiceOtherChoiceDraftValue(e){const t=this.multipleChoiceOtherChoiceFieldName;if(t)return e.getStashedAttribute(t)}get invalidFeatures(){return this.errors.map(e=>e.feature)}get _multipleChoiceOtherChoiceCheckedStateKey(){return null!=this.multipleChoiceOtherChoiceFieldName?this.template.elementId:null}get _multipleChoiceOtherChoiceCheckedStateStore(){const e=this.expressionsManager;return e?i(_,e,()=>new l):new l}get isSubtypeField(){return this.layers.some(e=>{if(e&&"subtypeField"in e){const{subtypeField:t,fieldsIndex:i}=e;return(i.get(t)?.name??t)===this.fieldName}return!1})}get showNoValueOptionEnabled(){const{input:e}=this;return!this.required&&(!V(e)||!0===e?.showNoValueOption)}get showNoValueLabel(){const{input:e}=this;return V(e)?e?.noValueOptionLabel:null}get includeTime(){const{template:e,field:t}=this;return"date"===this.dataType&&("time-only"===t.type||"date-only"!==t.type&&("datetime-picker"!==e.input?.type||e.input.includeTime))}get includeTimeOffset(){if("timestamp-offset"!==this.field.type)return!1;const{input:e}=this;return!e||"timestampoffset-picker"===e.type&&e.includeTimeOffset}get inputType(){return this.input?.type}get maxLength(){return k({dataType:this.dataType,field:this.field,input:this.input})}get minLength(){return D({dataType:this.dataType,field:this.field,input:this.input})}get range(){if("date"===this.dataType)return this._dateRange;const{domain:e,field:t}=this;if(e){const i=u(t,e);return{max:i?.max,min:i?.min}}const i=this._allDomains.toArray().every(e=>!e)?m(t):null;return{max:i?.max===Number.MAX_VALUE?null:i?.max??null,min:i?.min===-Number.MAX_VALUE?null:i?.min??null}}get required(){if(!this.editable)return!1;if(!this.field.nullable||this.isSubtypeField)return!0;const e=this.visible&&!1!==this.group?.visible,t=this._evaluatedRequiredExpression;return!(!e||null==t)&&t}get timeResolution(){const e=this.input;if(e&&("timestampoffset-picker"===e.type||"time-picker"===e.type))return e.timeResolution??"minutes"}get timeStep(){return null!=this.timeResolution?S.get(this.timeResolution):void 0}get valid(){return 0===this.errors.length||!this.editable}get value(){return this.featuresHaveSameValue?this.features.at(0)?.getAttribute(this.fieldName)??null:F}get valueIsOutOfDomain(){const{domain:e,value:t,field:i}=this;return!(!e||null==t)&&null!==h(i,t,e)}get visibilityCode(){return this.field.visible?this._fieldShouldHaveDomain&&null==this.domain?"hidden:no-domain-in-common":this._baseVisibilityCode:"hidden:field-definition"}get codedValueDomainOptions(){return"coded-value"===this.domain?.type?this.domain.codedValues.map(({name:e,code:t})=>({name:e,value:t})):[]}get codedValueOptions(){const{getFieldValueOptionsForFeature:e}=this;if(1===this.features.length&&e){const t=this.features.at(0);return e({domain:this.domain??void 0,feature:t,fieldName:this.fieldName,layer:t.layer})}const t=this.codedValueDomainOptions,{value:i}=this,l=null==i||i===F||t.some(e=>e.value===i)?[]:[{name:`${i}`,value:i}];return{recommended:t,other:[],unsupported:l,containsEmptyOption:!1}}get _evaluatedRequiredExpression(){let e=!1,t=!0;const i=this.template;for(const l of this.features){if(null==i.getExpressionExecutorsForLayer(l.layer)?.requiredExpression)continue;t=!1;const r=this._lookupEvaluatedExpression(l,"required");"success"===r?.status?e=e||!0===r.result:e=!0}return t?null:e}get _allDomains(){const e=this.template.domain;return this.features.map(t=>{const i=t.layer.getFieldDomain(this.fieldName,{feature:t.plainGraphic});return"range"===i?.type||"range"===e?.type?i??this.template.domain:i})}get _fieldShouldHaveDomain(){return!!this._hasIntersectionWithElementFieldDomain||this._allDomains.some(t)}get _dateFormRange(){if("date"!==this.dataType)return{};const{input:e}=this;if(!e)return{};const{type:t}=e;let i={};if("date-picker"!==t&&"time-picker"!==t&&"timestampoffset-picker"!==t||(i=p(this.field,e.max,e.min)),"datetime-picker"===t){const{max:t,min:l}=e;i={max:null!=t&&N(t)?t.getTime():null,min:null!=l&&N(l)?l.getTime():null}}return{min:i.min,max:i.max,rawMax:i?.rawMax??null,rawMin:i?.rawMin??null}}get _dateRange(){const{_dateFormRange:e,template:t,field:i,domain:l}=this;if("date"!==this.dataType)return{};if(!l)return this._fieldShouldHaveDomain?{}:e;const r=u(i,l);if(!r)return e;const{max:o,min:n,rawMax:a,rawMin:s}=e,{type:h}=t.field;if("date"===h){const{max:e,min:t}=r;return{max:x(o)&&(null===e||null!=e&&o<=e)?o:e??null,min:x(n)&&(null===t||null!=t&&n>=t)?n:t??null}}if("date-only"===h||"time-only"===h||"timestamp-offset"===h){const{max:e,min:t,rawMax:i,rawMin:l}=r,u=x(o)&&a&&(null==e||o<e),h=x(n)&&s&&(null==t||n>t);return{max:u?o:e,min:h?n:t,rawMax:u?a:i,rawMin:h?s:l}}return{}}_validate(){const{dataType:e,fieldName:t,maxLength:i,minLength:l,range:r}=this,o=[],{multipleChoiceInput:n}=this;for(const a of this.features){const{layer:s}=a,u=s.getField(t)??this.field,h=s.getFieldDomain(t,{feature:a.plainGraphic}),p=this.calculateDomain([h]),c=p&&"coded-value"!==p.type?p:null,m=this._requiredForFeature(a),d=a.getAttribute(t);let f=T(d,{dataType:e,domain:c,field:u,maxLength:i,minLength:l,multipleChoice:n,range:r,required:m})??this.getExternalErrorForFeature?.(a,t);if(!f&&n){const{otherChoice:e}=n,{multipleChoiceOtherChoiceFieldName:t,multipleChoiceOtherChoiceValue:i,shouldShowMultipleChoiceOtherChoice:l}=this,r=this._getMultipleChoiceOtherChoiceCheckboxState();if(l&&e&&t&&r.checked){const e=s.getField(t),l=i===M?null:i;if(e){const t=v(e);f=T(l,{dataType:t,domain:e.domain,field:e,maxLength:k({dataType:t,field:e,input:null}),minLength:D({dataType:t,field:e,input:null}),multipleChoice:null,range:{max:void 0,min:void 0},required:!0})}}}f&&o.push({error:f,feature:a.source})}return o}_editableForFeature(e){if(!this.field.editable)return!1;if(null==this.template.getExpressionExecutorsForLayer(e.layer)?.editableExpression)return!0;const t=this._lookupEvaluatedExpression(e,"editable");return"success"===t?.status&&!0===t.result}_effectiveVisibleFeature(e){if(this.group&&!this.group.visibleForFeature(e))return!1;if(null==this.template.getExpressionExecutorsForLayer(e.layer)?.visibilityExpression)return!0;const t=this._lookupEvaluatedExpression(e,"visibility");return"success"===t?.status&&!0===t.result}_getMultipleChoiceOtherChoiceCheckboxState(){const{shouldShowMultipleChoiceOtherChoice:e,multipleChoiceOtherChoiceCheckboxState:t}=this,i=e?t:{checked:!1,indeterminate:!1},l=e?this.getExplicitMultipleChoiceOtherChoiceCheckedState():void 0;return void 0===l?i:{checked:l,indeterminate:!1}}_requiredForFeature(e){if(!this._editableForFeature(e))return!1;if(!this.field.nullable||this.isSubtypeField)return!0;const t=this._effectiveVisibleFeature(e);if(null==this.template.getExpressionExecutorsForLayer(e.layer)?.requiredExpression)return!1;const i=this._lookupEvaluatedExpression(e,"required");return"success"!==i?.status?t:t&&!0===i.result}calculateDomain(e){const t=e.find(e=>null!=e),i=this.template.domain;if(!t)return i&&c(this.field,i)?i:null;switch(t.type){case"coded-value":if(e.some(e=>!e)){if(!i)return null;e=e.filter(e=>null!==e)}break;case"range":e=e.filter(e=>null!==e)}if(!e.every(e=>e?.type===t?.type))return null;let l=null;switch(t?.type){case"range":l=this._intersectRangeDomains(e);break;case"coded-value":l=this._intersectCodedValueDomains(e)}return l}_intersectCodedValueDomains(e){if(!e.length)return null;const t=new Map(e[0].codedValues.map(({code:e,name:t})=>[e,t])),i=this.template.domain?new Map(this.template.domain.codedValues.map(({code:e,name:t})=>[e,t])):null;for(const o of e)for(const[e,i]of t){o.codedValues.some(t=>t.code===e&&t.name===i)||t.delete(e)}let l=t;if(i){l=new Map;for(const[e,r]of i)t.has(e)&&l.set(e,r)}const r=Array.from(l.entries()).map(([e,t])=>new a({code:e,name:t}));return r.length?new s({codedValues:r}):null}_intersectRangeDomains(e){if(!e.length)return null;let t=e[0];for(let l=1;l<e.length;l++){if(!t)return null;t=this._findMinMaxValuesBetweenTwoDomains(t,e[l])}if(t&&!c(this.field,t))return null;const{domain:i}=this.template;if(t&&i&&i instanceof y){const e=this._findMinMaxValuesBetweenTwoDomains(t,i);return this._hasIntersectionWithElementFieldDomain=!!e,e}return t}_getMinMaxFromRangeDomain(e){const t=e.minValue,i=e.maxValue,{field:l}=this;return d(l)||f(l)||C(l)?p(l,i,t):{min:null!=t&&"number"==typeof t?t:null,max:null!=i&&"number"==typeof i?i:null}}_findMinMaxValuesBetweenTwoDomains(e,t){const i=new y,l=this._getMinMaxFromRangeDomain(e),r=this._getMinMaxFromRangeDomain(t),{field:o}=this,n=this._getValidRangeValue(l.min,-1/0),a=this._getValidRangeValue(l.max,1/0),s=this._getValidRangeValue(r.min,-1/0),u=this._getValidRangeValue(r.max,1/0);return i.minValue=Math.max(n,s),i.maxValue=Math.min(a,u),i.minValue===-1/0||i.maxValue===1/0||i.minValue>i.maxValue?null:((d(o)||f(o)||C(o))&&(i.minValue=Number(l.min)>Number(r.min)?l.rawMin:r.rawMin,i.maxValue=Number(l.max)<Number(r.max)?l.rawMax:r.rawMax),i.name="intersection",i)}_getValidRangeValue(e,t){return x(e)?e:t}};e([r()],L.prototype,"dataType",null),e([r()],L.prototype,"domain",null),e([r()],L.prototype,"distinctValues",null),e([r()],L.prototype,"editable",null),e([r()],L.prototype,"label",null),e([r()],L.prototype,"effectiveVisible",null),e([r()],L.prototype,"effectiveVisibilityCode",null),e([r()],L.prototype,"errors",null),e([r()],L.prototype,"featuresHaveSameValue",null),e([r()],L.prototype,"field",null),e([r()],L.prototype,"fieldName",null),e([r()],L.prototype,"getExternalErrorForFeature",void 0),e([r()],L.prototype,"getFieldValueOptionsForFeature",void 0),e([r()],L.prototype,"group",void 0),e([r()],L.prototype,"input",null),e([r()],L.prototype,"multipleChoiceInput",null),e([r()],L.prototype,"multipleChoiceChoices",null),e([r()],L.prototype,"multipleChoiceValues",null),e([r()],L.prototype,"multipleChoiceOtherChoiceFieldName",null),e([r()],L.prototype,"multipleChoiceOtherChoiceHint",null),e([r()],L.prototype,"multipleChoiceOtherChoiceLabel",null),e([r()],L.prototype,"hasMultipleChoiceOtherChoiceField",null),e([r()],L.prototype,"shouldShowMultipleChoiceOtherChoice",null),e([r()],L.prototype,"multipleChoiceOtherChoiceValue",null),e([r()],L.prototype,"multipleChoiceOtherChoiceMaxLength",null),e([r()],L.prototype,"multipleChoiceOtherChoiceCheckboxState",null),e([r()],L.prototype,"invalidFeatures",null),e([r()],L.prototype,"_multipleChoiceOtherChoiceCheckedStateStore",null),e([r()],L.prototype,"isSubtypeField",null),e([r()],L.prototype,"showNoValueOptionEnabled",null),e([r()],L.prototype,"showNoValueLabel",null),e([r()],L.prototype,"includeTime",null),e([r()],L.prototype,"includeTimeOffset",null),e([r({readOnly:!0})],L.prototype,"inputType",null),e([r()],L.prototype,"maxLength",null),e([r()],L.prototype,"minLength",null),e([r()],L.prototype,"range",null),e([r()],L.prototype,"required",null),e([r()],L.prototype,"timeResolution",null),e([r()],L.prototype,"timeStep",null),e([r({readOnly:!0})],L.prototype,"type",void 0),e([r()],L.prototype,"userHasChangedValue",void 0),e([r()],L.prototype,"valid",null),e([r()],L.prototype,"value",null),e([r()],L.prototype,"valueIsOutOfDomain",null),e([r()],L.prototype,"visibilityCode",null),e([r()],L.prototype,"codedValueDomainOptions",null),e([r()],L.prototype,"codedValueOptions",null),e([r()],L.prototype,"_evaluatedRequiredExpression",null),e([r()],L.prototype,"_hasIntersectionWithElementFieldDomain",void 0),e([r()],L.prototype,"_allDomains",null),e([r()],L.prototype,"_fieldShouldHaveDomain",null),e([r()],L.prototype,"_dateFormRange",null),e([r()],L.prototype,"_dateRange",null),L=e([o("esri.widgets.BatchAttributeForm.inputs.FieldInput")],L);const R=L;export{R as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{destroyMaybe as t}from"../../../core/maybe.js";import{on as l}from"../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{isSubtypeGroupLayer as o,getEffectiveLayerCapabilities as s}from"../../../layers/support/layerUtils.js";import{isRelatableFeatureSupportedLayer as a}from"../../../popup/support/featureUtils.js";import{getComputedAttributes as n,parseFormTemplateString as p}from"../stringUtils.js";import d from"./EditableInput.js";import h from"./SingleFeatureInputAdapter.js";import u from"../../Feature/FeatureRelationship/FeatureRelationshipViewModel.js";let y=class extends d{constructor(e){super(e),this._relationshipVM=new u,this._showAllCategories=!1,this._showAllRelatedRecords=!1,this.group=null,this.map=null,this.single=new h({input:this}),this.type="relationship"}initialize(){this._setRelationshipVMProps(),this.addHandles([l(()=>this.relatedLayer,"edits",()=>this._relationshipVM?.refresh())])}destroy(){t(this._relationshipVM)}get activeCategory(){return this._relationshipVM.activeCategory}get allCategories(){const{relatedLayer:e,_relationshipVM:t}=this;if(!o(e))return;const l=t?.categories,r=(e.subtypes??[]).map(({code:e,name:t})=>{const r=l?.find(e=>e.name===t);return{name:t,count:r?.count??0,value:r?.value??e}});return r.length?r:null}get categories(){return this.showAllEnabled?this.allCategories:this.allCategories?.slice(0,this.displayCount)}get canAddRelatedFeature(){const{editable:e,relatedFeatureCount:t,relationship:l}=this;if(!l||!this.loaded||!this._relatedLayerAllowsAdds)return!1;if(this.allCategories?.length&&!this.activeCategory)return!1;const{cardinality:r,role:i}=l;return!("one-to-one"===r&&t>0)&&("many-to-many"!==r&&(!("one-to-many"===r&&"destination"===i&&t>0)&&e))}get displayCount(){return this.template.displayCount}get displayType(){return this.template.displayType}get editable(){return!!this.
|
|
2
|
+
import{__decorate as e}from"tslib";import{destroyMaybe as t}from"../../../core/maybe.js";import{on as l}from"../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{isSubtypeGroupLayer as o,getEffectiveLayerCapabilities as s}from"../../../layers/support/layerUtils.js";import{isRelatableFeatureSupportedLayer as a}from"../../../popup/support/featureUtils.js";import{getComputedAttributes as n,parseFormTemplateString as p}from"../stringUtils.js";import d from"./EditableInput.js";import h from"./SingleFeatureInputAdapter.js";import u from"../../Feature/FeatureRelationship/FeatureRelationshipViewModel.js";let y=class extends d{constructor(e){super(e),this._relationshipVM=new u,this._showAllCategories=!1,this._showAllRelatedRecords=!1,this.group=null,this.map=null,this.single=new h({input:this}),this.type="relationship"}initialize(){this._setRelationshipVMProps(),this.addHandles([l(()=>this.relatedLayer,"edits",()=>this._relationshipVM?.refresh())])}destroy(){t(this._relationshipVM)}get activeCategory(){return this._relationshipVM.activeCategory}get allCategories(){const{relatedLayer:e,_relationshipVM:t}=this;if(!o(e))return;const l=t?.categories,r=(e.subtypes??[]).map(({code:e,name:t})=>{const r=l?.find(e=>e.name===t);return{name:t,count:r?.count??0,value:r?.value??e}});return r.length?r:null}get categories(){return this.showAllEnabled?this.allCategories:this.allCategories?.slice(0,this.displayCount)}get canAddRelatedFeature(){const{editable:e,relatedFeatureCount:t,relationship:l}=this;if(!l||!this.loaded||!this._relatedLayerAllowsAdds)return!1;if(this.allCategories?.length&&!this.activeCategory)return!1;const{cardinality:r,role:i}=l;return!("one-to-one"===r&&t>0)&&("many-to-many"!==r&&(!("one-to-many"===r&&"destination"===i&&t>0)&&e))}get displayCount(){return this.template.displayCount}get displayType(){return this.template.displayType}get editable(){return!!this._relatedLayerAllowsEdits&&(this._evaluatedEditableExpression??!0)}get feature(){return this.single.feature}get relatedFeatureCount(){return this._relationshipVM?.featureCount??0}get label(){return this.activeCategory?.name?this.activeCategory.name:this._computeStringLiteralText(this.template.label)}get layer(){return this.single.layer}get loaded(){return"loading"!==this._relationshipVM?.state}get orderByFields(){return this.template.orderByFields}get originHasValidKey(){return!!this.relationship&&null!=this.feature?.getAttribute(this.relationship.keyField)}get relationship(){return this._relationshipVM?.relationship}get relationshipId(){return this.template.relationshipId}get relatedFeatureInfos(){const{_relationshipVM:e,effectiveTimeZone:t}=this;if(!e?.relatedFeatures?.length||!e?.relatedLayer)return[];const{itemDescriptionFieldName:l,relatedFeatures:r,relatedLayer:i}=e,o=i?.formTemplate?.title||void 0;return r.map(e=>{let r;if(l){const o=e.getAttribute(l),s=i.fieldsIndex.get(l);if(s){const e=n({fields:[s],layer:i,values:[o],timeZone:t})[l];null!=e&&(r=e.toString())}}return{feature:e,description:r,title:o?p({attributes:e.attributes,label:o,layer:i,timeZone:t}):void 0}}).toArray()}get relatedLayer(){return this._relationshipVM?.relatedLayer}get relatedLayerIsTable(){return!!this.relatedLayer?.isTable}get showAllEnabled(){return this._relationshipVM.showAllEnabled}get showAllActionVisible(){return!this.showAllEnabled&&this.relatedFeatureCount>0&&this.relatedFeatureCount>this.displayCount}get showAllCategories(){return this._showAllCategories}get showAllCategoriesVisible(){const e=this.allCategories?.length??0;return!this.showAllEnabled&&e>0&&e>this.displayCount}get showAllRelatedRecords(){return this._showAllRelatedRecords}get updating(){return"loading"===this._relationshipVM?.state||"querying"===this._relationshipVM?.state}incrementPage(){this._relationshipVM&&this._relationshipVM.featurePage++}setActiveCategory(e){this._relationshipVM.activeCategory=e,this.setShowAllRelatedRecords(!!e)}setShowAllCategories(e){this._showAllCategories=e,this._showAllRelatedRecords||this._setShowAllEnabled(e)}setShowAllRelatedRecords(e){this._showAllRelatedRecords=e,this._showAllCategories||this._setShowAllEnabled(e)}get _relatedLayerAllowsAdds(){const{relatedLayer:e}=this;if(!e||!this._relatedLayerAllowsEdits)return!1;const t=s(e);return!!t?.operations?.supportsAdd}get _relatedLayerAllowsEdits(){const{relatedLayer:e}=this;if(!e)return!1;const t=s(e);return!!t?.operations?.supportsEditing}_setRelationshipVMProps(){const{displayCount:e,feature:t,layer:l,orderByFields:r,map:i,relationshipId:o,showAllEnabled:s}=this;t&&l&&a(l)&&this._relationshipVM.set({displayCount:e,graphic:t.plainGraphic,layer:l,map:i,orderByFields:r,relationshipId:o,showAllEnabled:s})}_setShowAllEnabled(e){this._relationshipVM.showAllEnabled=e}};e([r()],y.prototype,"_relationshipVM",void 0),e([r()],y.prototype,"_showAllCategories",void 0),e([r()],y.prototype,"_showAllRelatedRecords",void 0),e([r()],y.prototype,"activeCategory",null),e([r()],y.prototype,"allCategories",null),e([r()],y.prototype,"categories",null),e([r()],y.prototype,"canAddRelatedFeature",null),e([r()],y.prototype,"displayCount",null),e([r()],y.prototype,"displayType",null),e([r()],y.prototype,"editable",null),e([r()],y.prototype,"feature",null),e([r()],y.prototype,"group",void 0),e([r()],y.prototype,"label",null),e([r()],y.prototype,"layer",null),e([r()],y.prototype,"loaded",null),e([r()],y.prototype,"map",void 0),e([r()],y.prototype,"orderByFields",null),e([r()],y.prototype,"originHasValidKey",null),e([r()],y.prototype,"relationship",null),e([r()],y.prototype,"relationshipId",null),e([r()],y.prototype,"relatedFeatureInfos",null),e([r()],y.prototype,"relatedLayer",null),e([r()],y.prototype,"relatedLayerIsTable",null),e([r({readOnly:!0})],y.prototype,"single",void 0),e([r()],y.prototype,"showAllEnabled",null),e([r()],y.prototype,"showAllActionVisible",null),e([r()],y.prototype,"showAllCategories",null),e([r()],y.prototype,"showAllCategoriesVisible",null),e([r()],y.prototype,"showAllRelatedRecords",null),e([r({readOnly:!0})],y.prototype,"type",void 0),e([r()],y.prototype,"updating",null),e([r()],y.prototype,"_relatedLayerAllowsAdds",null),e([r()],y.prototype,"_relatedLayerAllowsEdits",null),y=e([i("esri.widgets.BatchAttributeForm.inputs.RelationshipElementInput")],y);const g=y;export{g as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
const
|
|
2
|
+
import{isNumericField as t,isStringField as n,isTimeOnlyField as e}from"../../../../layers/support/fieldUtils.js";import{isAnyDateField as r}from"../../../../smartMapping/support/utils.js";const u="esri_BatchAttributeForm_different_values";function o(t){return"visible"===t}function i(t){return"field"===t.type}function p(t){return i(t)&&"multiple-choice"===t.input?.type}function s(t){return"group"===t.type}function c(t){return"relationship"===t.type}function f(t){return"text"===t.type}function l(t){return"attachment"===t.type}function a(t){return i(t)||l(t)||c(t)||y(t)}function m(t){return i(t)||l(t)||c(t)||y(t)||f(t)}function x(t){return m(t)&&null!=t.group}function y(t){return"utilityNetworkAssociations"===t.type}function d(t){const n=`${t.elementId}:${t.executorPurpose}`;return null!=t.textExpressionIndex?`${n}:${t.textExpressionIndex}`:n}const b=t=>null!=t&&(h(t,"combo-box")||h(t,"radio-buttons"));function h(t,n){return t?.type===n}function g(t,n,e=[]){for(const r of t)n(r)?e.push(r):s(r)&&g(r.inputs,n,e);return e}function $(t,n){return t.layers[0]?.getField(n)?.name??n}function I(u){return t(u)?"number":n(u)?"text":r(u)||e(u)?"date":"unsupported"}export{g as deepFilterInputs,u as differentValuesString,I as getFieldInputDataType,$ as getNormalizedFieldName,l as isAttachmentElementInput,a as isEditableInput,i as isFieldInput,b as isFieldInputWithShowNoValueOptionInput,s as isGroupInput,m as isGroupableInput,x as isGroupedInput,h as isInputWithInputType,p as isMultipleChoiceFieldInput,c as isRelationshipElementInput,f as isTextElementInput,y as isUtilityNetworkAssociationsElementInput,d as makeUseId,o as visibilityCodeToBoolean};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{formatNumber as e}from"../../../intl/number.js";import{substitute as t}from"../../../intl/substitute.js";import{isSubtypeGroupLayer as i}from"../../../layers/support/layerUtils.js";import{isRelatableFeatureSupportedLayer as n}from"../../../popup/support/featureUtils.js";import{css as
|
|
2
|
+
import{formatNumber as e}from"../../../intl/number.js";import{substitute as t}from"../../../intl/substitute.js";import{isSubtypeGroupLayer as i}from"../../../layers/support/layerUtils.js";import{isRelatableFeatureSupportedLayer as n}from"../../../popup/support/featureUtils.js";import{css as o}from"../css.js";import{loadCalciteComponents as l}from"../../support/componentsUtils.js";import{getIconForFeature as a}from"../../support/iconUtils.js";import{tsx as s,classes as r}from"../../support/widget.js";const c=()=>l({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice")});function d(e){const{input:t}=e,{template:i}=t;return s("div",{class:r({[o.relationshipElementInput]:!0,[o.relationshipElementInputShowingAll]:t.showAllEnabled}),"data-testid":`relationship-element-${i.elementId}`,key:`relationship-${t.relationshipId}-container`},p(t,e.messagesCommon),u(t),t.showAllEnabled&&R(e),m(e),!t.showAllEnabled&&R(e))}function p(e,t){const i=e.updating||!e.loaded;return s("div",{class:o.relatedRecordsHeader,key:`relationship-${e.relationshipId}-header`},s("span",null,e.label),i?s("calcite-loader",{inline:!0,key:"loader",label:t?.loading,scale:"s",type:"indeterminate"}):void 0)}function u(e){const{activeCategory:t,description:i}=e;if(!t&&i)return s("calcite-input-message",{class:r(o.description,o.relatedRecordsDescription)},i)}function m(e){const{input:t,messages:i}=e,{activeCategory:n,relatedFeatureCount:o}=t;return o>0?f(e):n&&!o?L(e.messages):t.allCategories?.length?I(e):t.loaded?t.originHasValidKey?L(i):F(e):void 0}function f(e){const{viewModel:t,input:i,messages:n}=e,l=!i.editable||t.readOnly;return s("calcite-list",{class:o.relatedRecordsList,label:n.relatedRecords.relatedRecordsTitle},i.relatedFeatureInfos.map(t=>h(t,l,e)),g(e),y(e))}function h(e,t,i){const{feature:n,description:o,title:l}=e,{viewModel:r,input:c}=i,{relationshipId:d,single:p}=c,{feature:u}=p,m=r.callbacks?.editRelatedRecord,{highlightHelper:f}=r;if(!u||!m)return;const h=()=>{f?.removeAll(),m({parentFeature:u.plainGraphic,readOnly:t,relatedFeature:n,relationshipId:d})},g=f?()=>f.add(n):void 0,v=f?()=>f.remove(n):void 0;return s("calcite-list-item",{description:o,key:`${d}-${n.uid}`,label:l,value:l,onCalciteListItemSelect:h,onmouseenter:g,onmouseleave:v},s("calcite-icon",{icon:a(n),slot:"content-start"}),s("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}function g(e){const{input:i,messages:n}=e;if(i.showAllActionVisible)return s("calcite-list-item",{description:t(n.totalCount,{count:i.relatedFeatureCount}),key:"show-all-related-features",label:n.showAll,value:!0,onCalciteListItemSelect:()=>b(e)},s("calcite-icon",{icon:"list",scale:"s",slot:"content-end"}))}function v(e){e.input.setShowAllCategories(!0),e.viewModel.setActiveRelationshipInput(e.input)}function b(e){e.input.setShowAllRelatedRecords(!0),e.viewModel.setActiveRelationshipInput(e.input)}function y(e){const{afterObserverCreated:t,afterObserverRemoved:i,viewModel:n}=e;if(n.activeRelationshipInput?.showAllEnabled)return s("div",{afterCreate:t,afterRemoved:i,class:o.relatedRecordsListObserver,key:"feature-observer"})}function R(e){const{input:t,viewModel:i,messages:n}=e,{canAddRelatedFeature:l,relationshipId:a,relatedLayer:c,editable:d}=t,{callbacks:p}=i;if(!(l&&p?.addRelatedRecord&&c&&d))return;const u=i.disabled||t.updating||!t.originHasValidKey;return s("calcite-button",{alignment:"center",appearance:"outline-fill",class:r(o.centeredButton,o.relatedRecordsAddButton),disabled:u,iconStart:"plus",key:`${a}-add-button`,round:!0,scale:"s",width:"full",onclick:()=>w(e)},t.relatedLayerIsTable?n.addRecord:n.addFeature)}function w(e){const{input:t,viewModel:o}=e,{relationshipId:l,relatedLayer:a,single:s}=t,{feature:r}=s,{callbacks:c}=o;if(!r||!c?.addRelatedRecord)return;let d=a;if(i(a)&&t.activeCategory){const e=t.activeCategory.value,i=a.findSublayerForSubtypeCode(e);i&&n(i)&&(d=i)}d&&c.addRelatedRecord({parentFeature:r.plainGraphic,relatedLayer:d,relationshipId:l})}function I(e){const{input:t,messages:i}=e;return s("calcite-list",{displayMode:"flat",label:i.relatedRecords.relatedRecordsTitle,loading:t.updating},t.categories?.map(t=>C(t,e)),k(e))}function C(t,i){const{count:n,name:o,value:l}=t,a=e(n);return s("calcite-list-item",{key:`${o}-${l}`,label:o,onCalciteListItemSelect:()=>A(t,i)},s("calcite-chip",{label:a,scale:"s",slot:"content-end"},a),s("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}function A(e,t){t.viewModel.setActiveRelationshipCategory(e,t.input)}function k(e){const{input:i,messages:n}=e;if(i.showAllCategoriesVisible)return s("calcite-list-item",{description:t(n.totalCount,{count:i.allCategories?.length??0}),key:"show-all-categories",label:n.showAll,value:!0,onCalciteListItemSelect:()=>v(e)},s("calcite-icon",{icon:"list",scale:"s",slot:"content-end"}))}function F(e){const{viewModel:i,input:n,messages:o}=e,l=n.relatedLayerIsTable?o.relatedRecords.noOriginKeyRecord:o.relatedRecords.noOriginKeyFeature,a=n.relationship?.keyField,s=i.findFieldInput(a),r=n.layer?.fieldsIndex.get(a),c=s?.label||r?.alias||a;return M(t(l,{relatedLayerName:n.relatedLayer?.title??o.relatedRecords.untitledLayer,originKeyField:c}))}function L(e){return M(e.relatedRecords.noRecordsFound)}function M(e){return s("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},s("div",{slot:"message"},e))}export{d as RelationshipDetails,c as loadRelationshipDetailsComponents};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{createArcadeProfile as e,createArcadeExecutor as t}from"../../../../arcade.js";import r from"../../../../core/Error.js";import
|
|
2
|
+
import{createArcadeProfile as e,createArcadeExecutor as t}from"../../../../arcade.js";import{isSome as r}from"../../../../core/arrayUtils.js";import n from"../../../../core/Error.js";import o from"../../../../core/Logger.js";import{getEffectiveFieldAlias as i}from"../../../../editing/fieldUtils.js";import s from"../../../../form/ExpressionInfo.js";import a from"../../../../form/elements/AttachmentElement.js";import{isMultipleChoiceInput as m}from"../../../../form/elements/inputs/inputUtils.js";import l from"../../../../form/elements/inputs/attachments/AttachmentInput.js";import p from"../../../../form/elements/inputs/attachments/AudioInput.js";import c from"../../../../form/elements/inputs/attachments/DocumentInput.js";import d from"../../../../form/elements/inputs/attachments/ImageInput.js";import f from"../../../../form/elements/inputs/attachments/VideoInput.js";import{isAttachmentElement as u,isFieldElement as x,isGroupElement as y,isRelationshipElement as h,isTextElement as w,isUtilityNetworkAssociationsElement as E}from"../../../../form/support/formUtils.js";import{getLowerCaseEditTrackingFields as T,isFieldVisibleByDefault as I}from"../../../../layers/support/fieldUtils.js";import{isNumber as v}from"../../../../support/guards.js";import{layerSupportsAttachments as b,getLayerTimeZone as j}from"../../batchAttributeFormUtils.js";import{makeExpressionInfosMap as P,makeExecutorSetForFormElement as g}from"../../expressions/expressionUtils.js";import{AttachmentElementTemplate as Z}from"../AttachmentElementTemplate.js";import A from"../BatchFormTemplate.js";import{FieldElementTemplate as F}from"../FieldElementTemplate.js";import{GroupElementTemplate as U}from"../GroupElementTemplate.js";import{RelationshipElementTemplate as C}from"../RelationshipElementTemplate.js";import{TextElementTemplate as L}from"../TextElementTemplate.js";import{UtilityNetworkAssociationsElementTemplate as B}from"../UtilityNetworkAssociationsElementTemplate.js";import{isGroupElementTemplate as H}from"./templateUtils.js";import{compileTextElementMarkdownToHTML as N}from"./textElementTemplateUtils.js";const V="expression/dea57012-47ca4b55a000-8df62742ed0c",R=e("form-attachment-filename-calculation"),S=()=>o.getLogger("esri.widgets.BatchAttributeForm.templates.templateUtils");async function W(e,t,r=e.formTemplate){return await e.load(),r?.elements&&r.elements.length>0?D(r,e,t):k(e,t)}async function k(e,{arcadeExecutorProvider:t,attachmentsEnabled:r,formTimeZone:n}){const o=new Set(T(e)),i={arcadeExecutorProvider:t,formTimeZone:n,layer:e},s=[];for(const m of e.fields)Y(m,e,o)&&s.push(X(m,i));const a=await Promise.all(s);return r&&await O(a,{arcadeExecutorProvider:t,expressionInfos:P(void 0),layer:e}),new A({elements:a,title:e.formTemplate?.title,preserveFieldValuesWhenHidden:!0})}function K(e,t){for(const r of e??[])if("group"!==r.type){if("field"===r.type&&!1===r.editable&&!r.editableExpression)return!0}else if(K(r.elements??[]))return!0;return!1}async function O(e,{arcadeExecutorProvider:t,expressionInfos:r,layer:n}){if(!b(n))return;const o=await G(new a({displayFilename:!0,input:new l({attachmentAssociationType:"any",inputTypes:[new d,new c,new f,new p]})}),{arcadeExecutorProvider:t,expressionInfos:r,layer:n});e.push(o)}async function D(e,t,r){let n=null;K(e.elements??[])&&(n=new s({title:"",name:V,expression:"false"}));const o=P(n?[...e.expressionInfos??[],n]:e.expressionInfos),i={description:e.description,elements:new Array,title:e.title,preserveFieldValuesWhenHidden:e.preserveFieldValuesWhenHidden,supportsAttachmentElements:e.supportsAttachmentElements},{elements:a}=e;if(!a)return new A(i);let m=!1;const{arcadeExecutorProvider:l,formTimeZone:p}=r;for(const s of a){const e=await $(s,{arcadeExecutorProvider:l,expressionInfos:o,layer:t,formTimeZone:p});if(e){if(i.elements.push(e),m)continue;"attachment"===e.type&&(m=!0),H(e)&&e.elements.some(e=>("attachment"===e.type&&(m=!0),m))}}return e.supportsAttachmentElements||!r.attachmentsEnabled||m||await O(i.elements,{arcadeExecutorProvider:l,expressionInfos:o,layer:t}),new A(i)}async function G(e,{arcadeExecutorProvider:r,expressionInfos:n,layer:o}){let i=null;if(e.filenameExpression)try{i=await t(e.filenameExpression,R)}catch(m){S().error("Failed to compile attachment filename expression",m)}const s=new Z({allowUserRename:e.allowUserRename,attachmentKeyword:e.attachmentKeyword,description:e.description,displayFilename:e.displayFilename,filenameExpressionExecutor:i,input:e.input,label:e.label,maxAttachmentCount:e.maxAttachmentCount,minAttachmentCount:e.minAttachmentCount,useOriginalFilename:e.useOriginalFilename}),a=await g({element:e,expressionInfos:n,provider:r});return s.addLayer(o,a),s}async function $(e,t){return u(e)?G(e,{arcadeExecutorProvider:t.arcadeExecutorProvider,expressionInfos:t.expressionInfos,layer:t.layer}):x(e)?q(e,t):y(e)?z(e,t):h(e)?J(e,t):w(e)?M(e,t):E(e)?Q(e,t):null}async function q(e,{arcadeExecutorProvider:t,expressionInfos:r,layer:o,formTimeZone:i}){const{fieldsIndex:s}=o,{description:a,domain:l,fieldName:p,hint:c,input:d,label:f}=e;if(null==p||!s.has(p))return S().warn(new n("batch-attribute-form:invalid-form-element-field",`Field element with label '${f}' does not refer to a valid field`)),null;if(!1!==e.editable||e.editableExpression||((e=e.clone()).editableExpression=V),d&&m(d)&&d.otherChoice){const e=d.otherChoice.fieldName,t=s.get(e);t&&t.name!==e&&(d.otherChoice=d.otherChoice.clone(),d.otherChoice.fieldName=t.name)}const u=new F({description:a,domain:l,field:s.get(p),hint:c,input:d,formTimeZone:i,layerTimeZone:j(o),label:f}),x=await g({element:e,expressionInfos:r,provider:t});return u.addLayer(o,x),u}async function z(e,t){const{arcadeExecutorProvider:r,expressionInfos:n,layer:o}=t,{description:i,label:s,initialState:a}=e,m=[];for(const c of e.elements){const e=await $(c,t);e&&m.push(e)}const l=new U({description:i,elements:m,label:s,initialState:a??"expanded"}),p=await g({element:e,expressionInfos:n,provider:r});return l.addLayer(o,p),l}async function J(e,t){const{description:r,label:n,displayCount:o,displayType:i,orderByFields:s,relationshipId:a}=e,{arcadeExecutorProvider:m,expressionInfos:l,layer:p,formTimeZone:c}=t,d=new C({description:r,...v(o)&&{displayCount:o},displayType:i,formTimeZone:c,label:n,layerTimeZone:j(p),orderByFields:s,relationshipId:a}),f=await g({element:e,expressionInfos:l,provider:m});return d.addLayer(p,f),d}async function M(e,{arcadeExecutorProvider:t,expressionInfos:n,layer:o,formTimeZone:i}){const{description:s,label:a,text:m,textFormat:l}=e,{fieldsIndex:p}=o,c=m&&"markdown"===l?await N(m):m,d=new L({compiledText:c,description:s,fieldsIndex:p,formTimeZone:i,label:a,layerTimeZone:j(o)}),f=await g({element:e,expressionInfos:n,provider:t}),{expressionParts:u}=d;if(u.length){const e=await Promise.all(u.map(e=>{const r=n.get(e)?.expression??e;return t.getArcadeExecutor(r)}));f.textExpressions=e.filter(r)}return d.addLayer(o,f),d}async function Q(e,t){const{associationTypes:r,description:n,label:o}=e,{arcadeExecutorProvider:i,expressionInfos:s,formTimeZone:a,layer:m}=t,l=new B({associationTypes:r,description:n,formTimeZone:a,label:o,layerTimeZone:j(m)}),p=await g({element:e,expressionInfos:s,provider:i});return l.addLayer(m,p),l}async function X(e,{arcadeExecutorProvider:t,layer:r,formTimeZone:n}){const o=i(e,r)||e.name,s=new F({field:e,formTimeZone:n,label:o,layerTimeZone:j(r)}),a={};return e.editable&&r.userHasUpdateItemPrivileges&&(a.editableExpression=await t.getArcadeExecutor("true")),s.addLayer(r,a),s}function Y(e,t,r){return!r.has(e.name.toLowerCase())&&I(e,t)}export{W as createBatchFormTemplate,k as createBatchFormTemplateFromFields};
|