@arcgis/core 5.0.0-next.44 → 5.0.0-next.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/063045ac5553e91c0c4c.js +1 -0
- package/assets/esri/core/workers/chunks/{20ad34f9d45c64392022.js → 08c1ea29678da27136f3.js} +1 -1
- package/assets/esri/core/workers/chunks/{5dc2f2e28c30386efadf.js → 10094eb2b94e98dd4a8a.js} +1 -1
- package/assets/esri/core/workers/chunks/169be08394c5e7703628.js +1 -0
- package/assets/esri/core/workers/chunks/1a6f3531ef3d671e0289.js +1 -0
- package/assets/esri/core/workers/chunks/{b809d499ff050976d9ed.js → 1c58064ea80e6a4a4a3b.js} +1 -1
- package/assets/esri/core/workers/chunks/1c816aff8613d1e4bf38.js +1 -0
- package/assets/esri/core/workers/chunks/{ee67c8a7c1f8b482cd99.js → 1ced78750c61600b2d4e.js} +1 -1
- package/assets/esri/core/workers/chunks/{98175b454e807b1a3c5f.js → 1e152a34e368bd810a0f.js} +1 -1
- package/assets/esri/core/workers/chunks/1e17ad6cdffa5016a3db.js +1 -0
- package/assets/esri/core/workers/chunks/1e2d42e9984ed3437ba2.js +1 -0
- package/assets/esri/core/workers/chunks/2008b22f76071a2dde4e.js +1 -0
- package/assets/esri/core/workers/chunks/2107c93d1fe87f3b8dfa.js +1 -0
- package/assets/esri/core/workers/chunks/2209550b6510e25da375.js +1 -0
- package/assets/esri/core/workers/chunks/229e1ed4282005aa0b83.js +1 -0
- package/assets/esri/core/workers/chunks/22b8eaa6afab0e5ffc47.js +1 -0
- package/assets/esri/core/workers/chunks/{1c0fb4795a52204882a8.js → 2550d2ba935cfdf30236.js} +1 -1
- package/assets/esri/core/workers/chunks/{49e6219dd08cb6c27023.js → 273ac1066095d63d6a6f.js} +1 -1
- package/assets/esri/core/workers/chunks/2e2867bc66c94aba7dc7.js +1 -0
- package/assets/esri/core/workers/chunks/{cda5c95fd49b8901f7d4.js → 3298e96d3f2e49e338d2.js} +1 -1
- package/assets/esri/core/workers/chunks/34613b288cf174983f8b.js +1 -0
- package/assets/esri/core/workers/chunks/{e5baa30944061418cb13.js → 35f086a2ae0585348ae6.js} +1 -1
- package/assets/esri/core/workers/chunks/{f441fc74451330384fb0.js → 37ea150dec5e491f691e.js} +1 -1
- package/assets/esri/core/workers/chunks/3c94db7ecdcd38eeb1b1.js +1 -0
- package/assets/esri/core/workers/chunks/3f7749f06ae54a4437d9.js +1 -0
- package/assets/esri/core/workers/chunks/40a722933af28823953b.js +1 -0
- package/assets/esri/core/workers/chunks/{7aa730e5ac7b268e3c98.js → 424daef7b5dec1b99aba.js} +1 -1
- package/assets/esri/core/workers/chunks/456684b1c1417ed0e611.js +1 -0
- package/assets/esri/core/workers/chunks/{d14e75b160aa432233c6.js → 461093ce28ceadd7853d.js} +1 -1
- package/assets/esri/core/workers/chunks/4a48b8ec5f3f2fd139b5.js +1 -0
- package/assets/esri/core/workers/chunks/4b084f985bc4100e7aec.js +1 -0
- package/assets/esri/core/workers/chunks/4b1de1fcd13677b615a8.js +1 -0
- package/assets/esri/core/workers/chunks/{31186e83fe009aa0fd36.js → 4d933de84afb2e3b7d18.js} +1 -1
- package/assets/esri/core/workers/chunks/{83aa39fbb1fad3b9d143.js → 4ff771942531fb2755c4.js} +1 -1
- package/assets/esri/core/workers/chunks/{e0017c6739d2532793e6.js → 513a4ef960e27500f986.js} +1 -1
- package/assets/esri/core/workers/chunks/56b693baa376bb990925.js +1 -0
- package/assets/esri/core/workers/chunks/{1d4ea8db272655c0608c.js → 57fd5e1260269002d18a.js} +1 -1
- package/assets/esri/core/workers/chunks/5fe40bb0e9ab333f6854.js +1 -0
- package/assets/esri/core/workers/chunks/{b56c07c0b43cb1999070.js → 60362c5651ef41fa7e5f.js} +1 -1
- package/assets/esri/core/workers/chunks/{e8a9971c8354569cb81d.js → 609919428305d8c8c243.js} +1 -1
- package/assets/esri/core/workers/chunks/{ab88577987cf2fe1cb32.js → 61373d2fa7e7638d3395.js} +1 -1
- package/assets/esri/core/workers/chunks/6202922b1c2637e9aaa5.js +1 -0
- package/assets/esri/core/workers/chunks/633368ae6fbb46373328.js +1 -0
- package/assets/esri/core/workers/chunks/6d702cb26cef46a76963.js +1 -0
- package/assets/esri/core/workers/chunks/{35272810c2ed04eb403d.js → 6f3943bebe2d5f4994f7.js} +1 -1
- package/assets/esri/core/workers/chunks/708aba69a1870ea41a61.js +1 -0
- package/assets/esri/core/workers/chunks/{7ba13b52fce1060fbb2a.js → 7147fc7502b385b302b2.js} +1 -1
- package/assets/esri/core/workers/chunks/{9ba8a2e1c0fb4e1efc7c.js → 7364fb5e99933533890d.js} +1 -1
- package/assets/esri/core/workers/chunks/74b1028e95f7cfff387b.js +1 -0
- package/assets/esri/core/workers/chunks/78fccea3445fb2f9120a.js +1 -0
- package/assets/esri/core/workers/chunks/7ba31425caa404f86424.js +1 -0
- package/assets/esri/core/workers/chunks/{040f3d8e1099c4843390.js → 81a60dfa600b690098f9.js} +1 -1
- package/assets/esri/core/workers/chunks/833fd2bc42c5cb459084.js +1 -0
- package/assets/esri/core/workers/chunks/{75643711d9585ee26a15.js → 83c8e5a92d8d6193cb32.js} +1 -1
- package/assets/esri/core/workers/chunks/{e537e1d37f3fcb14fce2.js → 870022661376442411e4.js} +1 -1
- package/assets/esri/core/workers/chunks/898ab7db220e81e921c6.js +1 -0
- package/assets/esri/core/workers/chunks/{31b074ae2162a3508d2a.js → 8b578ffc3a83089aa782.js} +1 -1
- package/assets/esri/core/workers/chunks/{48c8ef4170e803a564d6.js → 8b75861196d1ce5cba63.js} +1 -1
- package/assets/esri/core/workers/chunks/8be61e13530fd0dc2fd1.js +1 -0
- package/assets/esri/core/workers/chunks/90b8ccee883738917a6d.js +1 -0
- package/assets/esri/core/workers/chunks/90bc9c299ae0e8b8b5e5.js +1 -0
- package/assets/esri/core/workers/chunks/91d9ade78854f40a962d.js +1 -0
- package/assets/esri/core/workers/chunks/{74881340e040bfd0580f.js → 934bc1028b287f8df4aa.js} +1 -1
- package/assets/esri/core/workers/chunks/96055de47831e59a28bf.js +1 -0
- package/assets/esri/core/workers/chunks/963ba863e0f87abfca25.js +1 -0
- package/assets/esri/core/workers/chunks/9aa8d60483ad905fe13b.js +1 -0
- package/assets/esri/core/workers/chunks/9fed9946241bb2a5cfa4.js +1 -0
- package/assets/esri/core/workers/chunks/a2662e98857f0abf8e82.js +1 -0
- package/assets/esri/core/workers/chunks/a5a9b0a35849b9f2e86d.js +1 -0
- package/assets/esri/core/workers/chunks/a60006c9ccf6817fc0d2.js +1 -0
- package/assets/esri/core/workers/chunks/a627b7eb94b7fca33210.js +1 -0
- package/assets/esri/core/workers/chunks/a651dc3b8f1fc1ab34cc.js +1 -0
- package/assets/esri/core/workers/chunks/aab93e885b6c7c6aa76e.js +316 -0
- package/assets/esri/core/workers/chunks/adfe28c1c1619cdd3ca1.js +1019 -0
- package/assets/esri/core/workers/chunks/b88dc7d8ae105747e6a4.js +1 -0
- package/assets/esri/core/workers/chunks/b90c786dd474ea1a409c.js +1 -0
- package/assets/esri/core/workers/chunks/b92e9e5df8154a128982.js +1 -0
- package/assets/esri/core/workers/chunks/{9a855a10798348a21bab.js → bff814d34b38ec80c44d.js} +1 -1
- package/assets/esri/core/workers/chunks/c36d699a75b6e8fb93eb.js +1 -0
- package/assets/esri/core/workers/chunks/c50fdf723f2d4316862e.js +1 -0
- package/assets/esri/core/workers/chunks/{9461cc37ab3397265270.js → c5e8ff4721b15ac3c6eb.js} +1 -1
- package/assets/esri/core/workers/chunks/{4cda42b94e9cb58dd372.js → ca61077e0a598654f33f.js} +1 -1
- package/assets/esri/core/workers/chunks/{61a9ffd4cf07d8bb7a9b.js → ca81be5bdb88ef557bf3.js} +1 -1
- package/assets/esri/core/workers/chunks/{ca1c65eb7f5900c60170.js → cd8fec3500e6503ae020.js} +1 -1
- package/assets/esri/core/workers/chunks/ce90e8489143228262e7.js +1 -0
- package/assets/esri/core/workers/chunks/d0320ca67abca4f8b0d2.js +1 -0
- package/assets/esri/core/workers/chunks/{4b6a44c6265c8959abd8.js → d3db7244fac7398cc700.js} +1 -1
- package/assets/esri/core/workers/chunks/{19820cddba13a3585c0b.js → d561624ddb9388732b25.js} +1 -1
- package/assets/esri/core/workers/chunks/d65ca3b8fccae8c3c3fa.js +1 -0
- package/assets/esri/core/workers/chunks/{630eba99f48ea79a9560.js → d705410c369bd03b1875.js} +1 -1
- package/assets/esri/core/workers/chunks/{9c7682b300b877f60095.js → d76513a6260d9ec4ea25.js} +1 -1
- package/assets/esri/core/workers/chunks/{7c08c0824ad354177787.js → d7878fba02814adaf19f.js} +1 -1
- package/assets/esri/core/workers/chunks/d82e17522ed946c2d809.js +1 -0
- package/assets/esri/core/workers/chunks/d8dc130ea559be1f68c6.js +1 -0
- package/assets/esri/core/workers/chunks/{768ae52b4e5c3e571ef5.js → dc29cb16704e2e4d0a46.js} +1 -1
- package/assets/esri/core/workers/chunks/e8c2e2fbe9cef4c8a8c6.js +1 -0
- package/assets/esri/core/workers/chunks/{3f33708eb39c7169a226.js → f2ba50eb29f93df885d6.js} +1 -1
- package/assets/esri/core/workers/chunks/{6e5d41f51572e3e7cf92.js → f7163048146ddaedfc36.js} +1 -1
- package/assets/esri/core/workers/chunks/fdaa10a588db394e2f65.js +1 -0
- package/chunks/GaussianSplat.glsl.js +2 -2
- package/chunks/Laserlines.glsl.js +1 -1
- package/chunks/boundedPlane.js +1 -1
- package/chunks/cameraUtilsSpherical.js +1 -1
- package/chunks/vec32.js +1 -1
- package/config.js +1 -1
- package/core/libs/gl-matrix-2/math/quat.js +1 -1
- package/core/libs/gl-matrix-2/math/vec3.js +1 -1
- package/core/urlUtils.d.ts +1 -0
- package/core/workers/workerFactory.js +1 -1
- package/geometry/FlatGeometry.js +1 -1
- package/geometry/operators/support/apiConverter.js +1 -1
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/geometry/support/curves/circleUtils.js +1 -1
- package/geometry/support/lineSegment.js +1 -1
- package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
- package/geometry/support/meshUtils/merge.js +1 -1
- package/geometry/support/sphere.js +1 -1
- package/interfaces.d.ts +148 -21
- package/kernel.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/orientedImagery/transformations/worldToImage.js +1 -1
- package/layers/support/tiles3DUtils.js +1 -1
- package/layers/voxel/VoxelVolume.js +1 -1
- package/package.json +2 -2
- package/rest/print.js +1 -1
- package/rest/support/LegendLayer.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/effects/EffectSuppress.js +1 -1
- package/views/2d/interactive/SegmentLabels2D.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedScaleOrientManipulation.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
- package/views/3d/animation/pointToPoint/Camera.js +1 -1
- package/views/3d/camera/constraintUtils/distance.js +1 -1
- package/views/3d/camera/constraintUtils/tilt.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/CloudsParameters.js +1 -1
- package/views/3d/environment/EnvironmentManager.js +1 -1
- package/views/3d/environment/MarsAtmosphere.js +1 -1
- package/views/3d/glTF/internal/Resource.js +1 -1
- package/views/3d/glTF/loader.js +1 -1
- package/views/3d/interactive/SegmentLabels3D.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
- package/views/3d/interactive/editingTools/media/MediaElementManipulator3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/edgeOffsetUtils.js +1 -1
- package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/ObjectResourceCache.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/RenderCommandContext.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/IconSymbolLayerRenderer.js +1 -1
- package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
- package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
- package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
- package/views/3d/state/Frustum.js +1 -1
- package/views/3d/state/controllers/FovController.js +1 -1
- package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
- package/views/3d/state/controllers/momentum/ZoomPlanarMomentumController.js +1 -1
- package/views/3d/support/FrustumExtentIntersection.js +1 -1
- package/views/3d/support/cameraUtils.js +1 -1
- package/views/3d/support/intersectionUtils.js +1 -1
- package/views/3d/support/orientedBoundingBox.js +1 -1
- package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/Focus.js +1 -1
- package/views/3d/support/viewpointUtils.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/terrain/SphericalPatch.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/webgl/RenderCamera.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
- package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
- package/views/3d/webgl-engine/lib/triangleIntersectionUtils.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/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/pbrUtils.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedBuffer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/PerOriginData.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatColorTechnique.js +5 -0
- package/views/3d/webgl-engine/shaders/GaussianSplatDepthTechnique.js +5 -0
- package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/SphereDepthInterpolate.glsl.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/interactive/GraphicManipulator.js +1 -1
- package/views/interactive/coordinateHelper.js +1 -1
- package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
- package/views/interactive/sketch/constraints.js +1 -1
- package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
- package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
- package/views/interactive/snapping/hints/LineSnappingHint.js +1 -1
- package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
- package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
- package/views/support/euclideanAreaMeasurementUtils.js +1 -1
- package/views/support/euclideanLengthMeasurementUtils.js +1 -1
- package/views/support/geometry3dUtils.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/css.js +1 -1
- package/widgets/BatchAttributeForm/inputs/SingleFeatureInput.d.ts +4 -0
- package/widgets/BatchAttributeForm/inputs/SingleFeatureInput.js +5 -0
- package/widgets/BatchAttributeForm/inputs/TextElementInput.d.ts +4 -0
- package/widgets/BatchAttributeForm/inputs/TextElementInput.js +5 -0
- package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
- package/widgets/BatchAttributeForm/templates/GroupElementTemplate.js +1 -1
- package/widgets/BatchAttributeForm/templates/TextElementTemplate.js +5 -0
- package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/templateUtils.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/FeatureForm/TextElementInput.d.ts +2 -2
- package/widgets/FeatureTable/AttachmentsColumn.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Column.js +1 -1
- package/widgets/FeatureTable/Grid/EditorColumn.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/PanoramicViewer/PanoramicVideoViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer/PanoramicZoomManager.js +1 -1
- package/widgets/PanoramicViewer/support/PanoramicMedia.js +5 -0
- package/widgets/PanoramicViewer/support/PanoramicMediaCollection.js +5 -0
- package/widgets/PanoramicViewer/support/PanoramicMediaError.js +5 -0
- package/widgets/PanoramicViewer/utils.js +1 -1
- package/widgets/PanoramicViewer.js +1 -1
- package/widgets/Print/CustomTemplate.js +1 -1
- package/widgets/Print/PrintViewModel.js +1 -1
- package/widgets/Print/TemplateOptions.js +1 -1
- package/widgets/Print.js +1 -1
- package/assets/esri/core/workers/chunks/04a0685ee53ef74883aa.js +0 -1
- package/assets/esri/core/workers/chunks/1e0e7cef7ef947894bbe.js +0 -1019
- package/assets/esri/core/workers/chunks/20988e116f3723228f36.js +0 -1
- package/assets/esri/core/workers/chunks/2613e482450b57f2d4f5.js +0 -1
- package/assets/esri/core/workers/chunks/274f2b5e6dbc58505142.js +0 -1
- package/assets/esri/core/workers/chunks/27dfbe3d903b95d4c67a.js +0 -1
- package/assets/esri/core/workers/chunks/28a5a7c6b3d6902146f6.js +0 -1
- package/assets/esri/core/workers/chunks/2c4218306747f5d15575.js +0 -1
- package/assets/esri/core/workers/chunks/2db7a7607657f1d669f7.js +0 -1
- package/assets/esri/core/workers/chunks/3767617c0dfc7d801441.js +0 -1
- package/assets/esri/core/workers/chunks/44b6b7418cbf7f778bef.js +0 -1
- package/assets/esri/core/workers/chunks/4675ed3ca3e0104d00bf.js +0 -1
- package/assets/esri/core/workers/chunks/4df7cc3477bc46fc39af.js +0 -1
- package/assets/esri/core/workers/chunks/538ddb267aa328814865.js +0 -1
- package/assets/esri/core/workers/chunks/555a0ea44ba77819d493.js +0 -1
- package/assets/esri/core/workers/chunks/55818fe7a7aa1e5c8bbd.js +0 -1
- package/assets/esri/core/workers/chunks/5f781ef46ce7c4048c2f.js +0 -1
- package/assets/esri/core/workers/chunks/60f2de8dd8876bfd715a.js +0 -1
- package/assets/esri/core/workers/chunks/679088064420a906aa7f.js +0 -1
- package/assets/esri/core/workers/chunks/706423d801fa9cbf2e90.js +0 -1
- package/assets/esri/core/workers/chunks/71dd80231ea656a6380c.js +0 -1
- package/assets/esri/core/workers/chunks/725819839434c59102f3.js +0 -1
- package/assets/esri/core/workers/chunks/72cebf18da5ec5eeb666.js +0 -1
- package/assets/esri/core/workers/chunks/768d9b6eaba7bfa18dde.js +0 -1
- package/assets/esri/core/workers/chunks/77b45957cfe42523c1c8.js +0 -1
- package/assets/esri/core/workers/chunks/852de585a72d902344a6.js +0 -1
- package/assets/esri/core/workers/chunks/871dd5e1f016a04b8d98.js +0 -1
- package/assets/esri/core/workers/chunks/892c417f5130b003889d.js +0 -1
- package/assets/esri/core/workers/chunks/907083c427d7fb4354e9.js +0 -1
- package/assets/esri/core/workers/chunks/93c5f097bb7b380bb175.js +0 -1
- package/assets/esri/core/workers/chunks/9f0172b83f25ef5f8d40.js +0 -1
- package/assets/esri/core/workers/chunks/ae793d814cf32db9fbde.js +0 -1
- package/assets/esri/core/workers/chunks/b21cf62652ca772108c8.js +0 -1
- package/assets/esri/core/workers/chunks/c5c02ace54fe4ab9214b.js +0 -1
- package/assets/esri/core/workers/chunks/c82a974c8448407885e6.js +0 -1
- package/assets/esri/core/workers/chunks/d08ee45c501102deea20.js +0 -1
- package/assets/esri/core/workers/chunks/d239a4ef60e348cfb05a.js +0 -1
- package/assets/esri/core/workers/chunks/da2ba40bc017bff0fe49.js +0 -1
- package/assets/esri/core/workers/chunks/dc3a4ad62bc041a4f899.js +0 -1
- package/assets/esri/core/workers/chunks/e093e745708f722bc1b9.js +0 -1
- package/assets/esri/core/workers/chunks/e501d68a1464805c4b4e.js +0 -1
- package/assets/esri/core/workers/chunks/ea3cba01c60d9bc72719.js +0 -316
- package/assets/esri/core/workers/chunks/f3c232fc56a29d51196a.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{onLocaleChange as t,substitute as i,fetchMessageBundle as s}from"../../intl.js";import{isSome as l}from"../../core/arrayUtils.js";import o from"../../core/Collection.js";import{referenceSetter as n}from"../../core/collectionUtils.js";import{deprecatedFunction as r}from"../../core/deprecate.js";import a from"../../core/Error.js";import h from"../../core/Handles.js";import d from"../../core/Logger.js";import{abortMaybe as m}from"../../core/maybe.js";import{debounce as c,ignoreAbortErrors as p,after as u,throwIfAborted as g,createResolver as b}from"../../core/promiseUtils.js";import{watch as f,on as y,initial as T}from"../../core/reactiveUtils.js";import{throttle as w}from"../../core/throttle.js";import{property as _,subclass as C}from"../../core/accessorSupport/decorators.js";import{getEffectiveFieldAlias as I}from"../../editing/fieldUtils.js";import{geometryTypes as v}from"../../geometry/support/typeUtils.js";import{getLowerCaseDefaultHiddenFields as E}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as A,getSubtypesFromLayer as F,isSubtypeGroupLayer as S}from"../../layers/support/layerUtils.js";import{createFieldInfos as j}from"../../support/popupUtils.js";import R from"../../tables/AttributeTableTemplate.js";import x from"../../tables/support/FieldOrder.js";import U from"../../time/TimeExtent.js";import{defaultHighlightName as O,temporaryHighlightName as V}from"../../views/support/HighlightDefaults.js";import{highlightsSupported as z}from"../../views/support/layerViewUtils.js";import{isISelectableLayer as W}from"../../views/support/selectionUtils.js";import P from"./ActionColumn.js";import H from"./AttachmentsColumn.js";import L from"./FieldColumn.js";import B from"./RelationshipColumn.js";import Z from"./Grid/Column.js";import G from"./Grid/Grid.js";import k from"./Grid/GridViewModel.js";import N from"./Grid/GroupColumn.js";import D from"./support/AttachmentsColumnTemplate.js";import M from"./support/AttachmentsViewOptions.js";import{isAttachmentsColumn as $,isFieldColumn as q,isRelationshipColumn as Q}from"./support/columnUtils.js";import{downloadAttachmentInfo as K,exportToCSV as J}from"./support/exportUtils.js";import X from"./support/FeatureStore.js";import Y from"./support/FieldColumnTemplate.js";import ee from"./support/RelationshipColumnTemplate.js";import te from"./support/TableTemplate.js";import{isIFeatureTableSupportedLayerWithFieldConfigurations as ie,isIFeatureTableSupportedLayerWithRelationships as se,findRelatedLayerInSources as le,findRelationship as oe,uniqueColumnNames as ne,hasColumnForField as re,findField as ae,isIFeatureTableSupportedLayerWithAttachments as he,getTableHighlightKey as de,getRelationshipIdsToShow as me}from"./support/tableUtils.js";import{createAttributeTableElements as ce}from"./support/templateUtils.js";import{goTo as pe}from"../support/goToUtils.js";import{messageBundle as ue}from"../support/widget.js";const ge="80px";let be=class extends k{constructor(e){super(e),this._currentTemporaryHighlight=null,this._highlights=new h,this._refreshDebounced=c(()=>this._refresh()),this._syncTemplateThrottled=w(()=>this._syncAttributeTableTemplate()),this._temporaryHighlightAbortController=null,this.attachmentsViewOptions=new M,this.attributeTableTemplate=null,this.autoRefreshEnabled=!0,this.columns=new o,this.dataProvider=async(e,t)=>{const{layer:i,store:s}=this;if(!t)return;if(!i||!s)return void(t&&t([]));await i.load();const{objectIds:l}=this;if(this.filterBySelectionEnabled&&!this.highlightIds.length||1===l.length&&-1===l.items[0])return void t([]);"loaded"!==s.state&&"loading"!==s.state&&await s.load();const o=this.paginationEnabled?this.pageIndex:e.page,n=await s.fetchItems({...e,page:o});t&&t(n)},this.grid=null,this.highlightEnabled=!0,this.layers=null,this.maxSize=null,this.menuConfig=null,this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this.messagesURIUtils=null,this.prompt=null,this.relatedTables=new o,this.relationshipColumnConfigs=null,this.selectionSource="table",this.showRelatedTableCallback=null,this.store=null,this.syncTemplateOnChangesEnabled=!0,this.tableController=null,this.tableParent=null,this.tableTemplate=null,this.tableTemplateOverride=null,this._onLayerRefresh=this._onLayerRefresh.bind(this),this._onShowPromptCallback=this._onShowPromptCallback.bind(this),this._set("store",new X),this._set("grid",new G({viewModel:this}))}initialize(){const e=async()=>{this.messages=await s("esri/widgets/FeatureTable/t9n/FeatureTable"),this.messagesCommon=await s("esri/t9n/common"),this.messagesUnits=await s("esri/core/t9n/Units"),this.messagesURIUtils=await s("esri/widgets/support/t9n/uriUtils")};e(),this.addHandles([t(()=>{e(),this._generateColumns()}),f(()=>[this.messages,this.messagesCommon,this.messagesURIUtils],()=>{const e=this.messages;this.grid&&(this.grid.messages=e),this.allColumns.forEach(t=>{t.messages=e,t.messagesCommon=this.messagesCommon,t.messagesURIUtils=this.messagesURIUtils}),this.refreshCellContent()},T),y(()=>this.highlightIds,"change",e=>this._onHighlightIdsChange(e),{onListenerAdd:()=>this._syncSelection(),onListenerRemove:()=>this._highlights.removeAll()}),f(()=>this.grid?.temporaryHighlightId,e=>{this._temporaryHighlightAbortController?.abort(),this._temporaryHighlightAbortController=new AbortController,p(this._syncTemporaryHighlight(e,this._temporaryHighlightAbortController.signal))}),f(()=>this.attachmentsEnabled,()=>this.layer?.loaded&&this._generateColumns()),f(()=>this._viewSelection,()=>{this._viewSelectionReady&&(this.highlightIds.items=this._viewSelection)}),f(()=>[this._tableHighlightsReady,this._viewSelectionReady],()=>this._syncSelection()),f(()=>this.layer,async(e,t)=>{const i=this.grid;i&&(i.clearSort(),e&&t&&await this.reset()),this.goToPage(0),this._drainColumns(),this.store.layer=e,e&&(e.loaded?this._onLayerLoad():e.load().catch(()=>{})),t&&null!=this.attachmentsViewOptions.objectId&&(this.attachmentsViewOptions.objectId=null)}),f(()=>this.layer?.loaded,e=>e&&this._onLayerLoad()),f(()=>this.store.state,e=>{"loaded"===e&&(this.scrollToTop(),this.refreshCellContent())}),f(()=>this._effectiveTableTemplate,()=>{this.scrollLeft(),this.layer?.loaded&&this._generateColumns()}),f(()=>this.editingEnabled,e=>{this.editableColumns.forEach(t=>t.tableEditingEnabled=e),this.refreshCellContent()}),f(()=>this.timeZone??this.view?.timeZone,()=>this.refreshCellContent()),f(()=>this.store.effectiveWhere,()=>"loaded"===this.store.state&&this.reset()),f(()=>this.layer?.timeExtent,(e,t)=>(e||t)&&!this.timeExtent&&"loaded"===this.store.state&&this.reset()),y(()=>this.layer,"refresh",e=>this._onLayerRefresh(e)),y(()=>this.grid,["cell-click","cell-dblclick","cell-pointerover","cell-pointerout","cell-keydown","column-reorder"],({index:e,item:t,native:i,path:s,type:l})=>{const o=t?.feature,n=o?.getObjectId(),r="cell-keydown"===l&&i&&i instanceof KeyboardEvent&&"Enter"===i.key;this.emit(l,{feature:o,index:e,native:i,type:l,fieldName:s??void 0,objectId:n}),(r||"cell-click"===l)&&this._onCellInteraction(n)}),f(()=>this.actionColumnConfig,e=>{const{actionColumn:t,columns:i}=this;t?e?t.set(e):i.remove(t):e&&i.length&&i.add(this._generateActionColumn(),!1!==e.frozenToEnd?void 0:this._getIndexOfFirstFrozenToEndColumn())}),f(()=>this.relatedRecordsEnabled,()=>this.layer?.loaded&&this._generateColumns()),y(()=>this.objectIds,"change",()=>this._onObjectIdsChange(),{onListenerAdd:()=>this._onObjectIdsChange()}),f(()=>[this.paginationEnabled,this.pageIndex],()=>this.refreshPageCache()),f(()=>this.activeSortOrders,e=>{this.store.sortOrders=e,this._syncTemplateThrottled()}),f(()=>this.allVisibleColumns,()=>this._syncTemplateThrottled()),f(()=>this.pageCount,()=>{this.pageIndex>=this.pageCount&&this.goToPage(0)}),f(()=>this.state,e=>{"disabled"===e&&this.relatedTables.length&&this.drainRelatedTables()}),y(()=>this.tableParent?.highlightIds,"change",({added:e})=>{const{relationshipConfig:t}=this,i=e[0];if(null==i||!t)return;const{relatedLayer:s,relationshipId:l}=t;this.relationshipConfig={objectId:i,relatedLayer:s,relationshipId:l}}),y(()=>this.tableParent,"cell-click",e=>{const{tableParent:t}=this,{objectId:i}=e;t&&null!=i&&t.highlightIds.add(i)}),f(()=>this.attachmentsViewOptions.objectId,(e,t)=>{null!=e?null==t&&this.showAttachmentsView({objectId:e}):this.hideAttachmentsView()}),f(()=>this.layerFieldConfigurations,()=>this.refreshCellContent())])}destroy(){this._drainColumns(),this._highlights.removeAll(),this._highlights.destroy(),this._currentTemporaryHighlight?.handle.remove(),this._temporaryHighlightAbortController=m(this._temporaryHighlightAbortController),this.grid?.destroy(),this.columns.destroyed||this.columns.destroy(),this.layer=null,this.view=null}get _defaultHiddenFields(){return E(this.layer)}get _effectiveTableTemplate(){return this.tableTemplateOverride||this.tableTemplate}get _effectiveAttributeTableTemplate(){return this.attributeTableTemplate||this.layer?.attributeTableTemplate}get _highlightableLayerView(){const e=this.layerView;return z(e)?e:null}get _selectionManager(){const{view:e}=this;return!e||e.destroyed?null:e.selectionManager?.sources?.length?e.selectionManager:null}get _selectableLayer(){const{layer:e}=this;if(W(e)||A(e)){const t=e;return this._selectionManager?.sources?.includes(t)?t:null}return null}get _subtypes(){return F(this.layer)}get _tableHighlightsReady(){return!("table"!==this.selectionSource||!this.highlightEnabled||!this._highlightableLayerView)}get _viewSelection(){const{_selectableLayer:e}=this;return e?this._selectionManager?.getSelection(e)??[]:[]}get _viewSelectionReady(){return!(!this.layer||"view"!==this.selectionSource||!this._selectionManager)}get actionColumn(){return super.actionColumn}get activeFilters(){const{filterGeometry:e,objectIds:t,filterBySelectionEnabled:i,highlightIds:s}=this,l=new o;return e&&l.push({type:"geometry",geometry:e}),i?l.push({type:"selection",objectIds:s.toArray()}):t.length&&l.push({type:"objectId",objectIds:t.toArray()}),l}get activeSortOrders(){return this.grid?.sortOrders?this.grid.sortOrders.map(({path:e,direction:t})=>({fieldName:e,direction:t})).filter(e=>e.fieldName&&e.direction):[]}get allColumns(){return super.allColumns}get allRelatedTablesVisible(){return!!(this.relatedRecordsEnabled&&this.relatedTables.length&&this.showAllRelatedTables)}get allVisibleColumns(){return super.allVisibleColumns}get attachmentsColumns(){return this.allColumns.filter(e=>$(e))}get attachmentsEnabled(){return this.store.attachmentsEnabled}set attachmentsEnabled(e){this.store.attachmentsEnabled=e}get clearPrompt(){return()=>this.prompt=null}set clearPrompt(e){this._overrideIfSome("clearPrompt",e)}get definitionExpression(){return this.store.where}set definitionExpression(e){this.store.where=e}get effectiveSize(){return super.effectiveSize}get fieldColumns(){return this.allColumns.filter(e=>q(e))}get filterGeometry(){return this.store.filterGeometry}set filterGeometry(e){this.store.filterGeometry=e}get filterBySelectionEnabled(){return!!this._get("filterBySelectionEnabled")}set filterBySelectionEnabled(e){const{objectIds:t}=this,i=t.length;e?(i&&(t.removeAll(),this._logWarning("Selection filter has been applied with an objectID filter. Object ID filter has been removed.")),this.filterGeometry&&this._logWarning("Selection filter has been applied with a geometry filter. Results may appear inconsistent"),this._syncObjectIdsWithStore(this.highlightIds.toArray())):i||this._syncObjectIdsWithStore(null),this._set("filterBySelectionEnabled",e)}get groupColumns(){return super.groupColumns}get hiddenFields(){return this._get("hiddenFields")??new o}set hiddenFields(e){this._set("hiddenFields",n(e,this._get("hiddenFields"),o))}get highlightIds(){return super.highlightIds}set highlightIds(e){super.highlightIds=e}get initialSize(){return this.store.initialSize}set initialSize(e){this.store.initialSize=e}get isEditing(){return super.isEditing}get isQuerying(){return super.isQuerying}get isSyncing(){return super.isSyncing}get isQueryingOrSyncing(){return this.isQuerying||this.isSyncing||this.relatedTables.some(e=>!!e.isQueryingOrSyncing)}get isSyncingAttachments(){return this.store.isSyncingAttachmentEdits||this.relatedTables.some(e=>!!e.isSyncingAttachments)}get layer(){return this._get("layer")}set layer(e){this._highlights.removeAll(),this.drainRelatedTables(),this._set("layer",e)}get layerFieldConfigurations(){const e=this.layer;return ie(e)?e.fieldConfigurations:void 0}get layerView(){return this.store.layerView}get objectIds(){return super.objectIds}set objectIds(e){super.objectIds=e}get outFields(){return this.store.outFields}set outFields(e){this.store.outFields=e}get pageCount(){return super.pageCount}get pageIndex(){return super.pageIndex}set pageIndex(e){super.pageIndex=e}get pageSize(){return super.pageSize}set pageSize(e){super.pageSize=e}get relatedRecordsEnabled(){return this.store.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.store.relatedRecordsEnabled=e}get relatedTable(){return this.relatedTables.at(-1)}get relationship(){const e=this.relationshipConfig?.relationshipId;return null==e?null:this.relationships?.find(({id:t})=>t===e)}get relationshipColumns(){return this.allColumns.filter(e=>Q(e))}get relationshipConfig(){return this.store.relationshipConfig}set relationshipConfig(e){this.highlightIds.removeAll(),this.objectIds.removeAll(),this.filterBySelectionEnabled=!1,this.store.relationshipConfig=e}get relationshipInfos(){const{layer:e,layers:t,relationships:i,tableController:s}=this,l=this.store.relationshipInfos;if(l.length||!se(e)||!i?.length)return l;const o=[],n=s?.layers||t||[];return i.forEach(t=>{const i=le(e,n,t);i&&(i.load(),o.push({layer:e,relatedLayer:i,relationshipId:t.id}))}),o}get relationships(){return this.store.relationships}get returnGeometryEnabled(){return this.store.returnGeometry}set returnGeometryEnabled(e){this.store.returnGeometry=e}get returnMEnabled(){return this.store.returnM}set returnMEnabled(e){this.store.returnM=e}get returnZEnabled(){return this.store.returnZ}set returnZEnabled(e){this.store.returnZ=e}get rowHighlightIds(){return super.rowHighlightIds}set rowHighlightIds(e){super.rowHighlightIds=e}get showAllRelatedTables(){return this._get("showAllRelatedTables")}set showAllRelatedTables(e){const{relatedTable:t}=this;this._set("showAllRelatedTables",e),t&&(e?this._showAllRelatedTables(t):this._hideAllRelatedTables(t))}get showPrompt(){return e=>{this.prompt?.cancel?.(),this.prompt=e}}set showPrompt(e){this._overrideIfSome("showPrompt",e)}get size(){return super.size}get state(){return super.state}get supportsAttachments(){return this.store.supportsAttachments}get supportsAddAttachments(){const{store:{supportsAddAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get supportsDeleteAttachments(){return this.supportsUpdateAttachments}get supportsResizeAttachments(){return this.store.supportsResizeAttachments}get supportsUpdateAttachments(){const{store:{supportsUpdateAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get timeExtent(){return this.store.timeExtent}set timeExtent(e){this.store.timeExtent=e}get timeZone(){return this._get("timeZone")}set timeZone(e){this.allColumns.forEach(t=>t.tableTimeZone=e),this._set("timeZone",e)}get view(){return this.store.view}set view(e){this.store.view=e,this.fieldColumns.forEach(t=>t.view=e),this.refreshCellContent()}get visibleColumns(){return super.visibleColumns}async addAttachment(e,t){const{attachmentsViewOptions:i,store:s}=this,l=i.objectId===e;await s.addAttachment(e,t).catch(e=>{l&&e&&"object"==typeof e&&"error"in e&&e.error instanceof a&&(this._logWarning(`Unable to add attachment. ${e.error.name} ${e.error.message}`),i.error=e.error)}),l&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}async deleteAttachments(e,t){const{attachmentsViewOptions:i,store:s}=this,l=i.objectId===e;await s.deleteAttachments(e,t).catch(e=>{l&&e&&"object"==typeof e&&"error"in e&&e.error instanceof a&&(this._logWarning(`Unable to delete attachment(s). ${e.error.name} ${e.error.message}`),i.error=e.error)}),l&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}collapseRelatedTable(e,t){const{relatedLayer:i,objectId:s,relationshipId:l}=t,{objectIdField:n}=i,r=oe(i,l),a=i.displayField||r?.keyField||n;e.set({highlightIds:new o([s]),multipleSelectionEnabled:!1,tableTemplateOverride:this._getTableTemplateForRelatedTableView(e,a,l)});const h=e.hiddenFields;h.includes(ne.action)||h.add(ne.action),h.includes(ne.attachments)||h.add(ne.attachments),e.scrollLeft()}async deleteSelection(){const e=this.highlightIds.toArray();if(!e?.length)return;const{deleteFeatureResults:t}=await this.store.deleteRowsByObjectId(e),i=t.filter(e=>!e.error).map(e=>e.objectId);i.length&&(this.highlightIds.removeMany(i),await this.refresh())}async downloadAttachmentById(e,t){const i=(await this.store.getAttachmentsByObjectId(e,!0)).find(e=>e.id===t);await K(i)}drainRelatedTables(){this.relatedTables.drain(e=>e.destroy()),this.set({multipleSelectionEnabled:!0,relationshipColumnConfigs:null,showAllRelatedTables:!1,tableTemplateOverride:null}),this.hiddenFields.removeMany([ne.action,ne.attachments])}drainRelatedTablesAboveIndex(e){const{relatedTables:t}=this,i=t.slice(e+1);t.removeMany(i).forEach(e=>e.destroy());const s=t.at(-1);s&&(s.attachmentsViewOptions.objectId=null,this.allRelatedTablesVisible?this._showAllRelatedTables(s):this._hideAllRelatedTables(s))}async exportSelectionToCSV(e){const{highlightIds:t,layer:i,outFields:s}=this;i&&t.length?await J({layer:i,objectIds:t.toArray(),outFields:s,includeGeometry:e}):this._logWarning("Export failed.")}filterBySelection(){this.filterBySelectionEnabled?this._logWarning("Property 'filterBySelectionEnabled' is already 'true'. This method has no effect."):(r(d.getLogger(this),"`FeatureTable.filterBySelection` is deprecated in favor of 'filterBySelectionEnabled' and 'objectIds'",{replacement:"FeatureTable.filterBySelectionEnabled or FeatureTable.objectIds",version:"4.30",warnOnce:!0}),this.objectIds.addMany(this.highlightIds.toArray()))}getObjectIdIndex(e){return this.store.getItemIndexByObjectId(e)}getValue(e,t){const i=this.store.getItemByObjectId(e);return i?.feature?.attributes[t]}getVirtualPageIndex(){return this.grid?.getVirtualPageIndex()??0}goToPage(e){if(null==e||!Number.isInteger(e))return void this._logWarning("Invalid 'page' parameter provided to 'goToPage()'. Current page will remain the same.");const{pageCount:t}=this;(e>=t||-1===e)&&(e=t-1),e<-1&&(e=0),e!==this.pageIndex&&(this.pageIndex=e),this.paginationEnabled||this.scrollToIndex(e*this.pageSize)}hideAttachmentsView(){this.attachmentsViewOptions.objectId=null,this.set({relationshipColumnConfigs:null,multipleSelectionEnabled:!0,tableTemplateOverride:null}),this.hiddenFields.remove(ne.action)}nextPage(){const e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e+1)}previousPage(){const e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e-1)}async refresh(){await Promise.all([...this.relatedTables.map(e=>e.refresh()),p(this._refreshDebounced())])}refreshCellContent(){this.grid?.requestContentUpdate()}refreshPageCache(){this.grid?.refreshPageCache()}async reset(){this.goToPage(0),await(this.grid?.reset())}scrollLeft(){this.grid?.scrollLeft(0)}scrollToBottom(){this.grid?.scrollToBottom()}scrollToIndex(e){this.grid?.scrollToIndex(e)}scrollToRow(e){const t=this.store.getItemIndexByObjectId(e);t>-1?this.grid?.scrollToIndex(t):this._logWarning("Row not found. Associated data may not be loaded yet.")}scrollToTop(){this.grid?.scrollToTop()}async saveAttachmentsViewForm(){const{attachmentId:e,form:t,objectId:i}=this.attachmentsViewOptions;null!=i&&t&&(null!=e?await this.updateAttachment(i,e,t):await this.addAttachment(i,t))}async showAttachmentsView({objectId:e}){const{attachmentsViewOptions:t,hiddenFields:i,layer:s}=this;if(!this.attachmentsEnabled||!s)return void this._logWarning("The 'attachmentsEnabled' property is currently false.");await s.load();const l=this._getDefaultLayerDisplayField(s),n=await this.store.getAttachmentsByObjectId(e,!0),r=this.store.getItemIndexByObjectId(e);t.set({attachmentInfos:n,mode:n.length?"list":"file",objectId:e}),this.set({highlightIds:new o([e]),multipleSelectionEnabled:!1,relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForAttachmentsView(l)}),i.includes(ne.action)||i.add(ne.action),null!=r&&this.scrollToIndex(r)}syncAttributeTableTemplate(){this._syncAttributeTableTemplate(!0)}clearSelectionFilter(){r(d.getLogger(this),"`FeatureTable.clearSelectionFilter` is deprecated in favor of 'filterBySelectionEnabled' and 'objectIds'",{replacement:"FeatureTable.filterBySelectionEnabled or FeatureTable.objectIds",version:"4.30",warnOnce:!0}),this.objectIds.removeAll()}async updateAttachment(e,t,i){const{attachmentsViewOptions:s,store:l}=this,o=s.objectId===e;await l.updateAttachment(e,t,i).catch(e=>{o&&e&&"object"==typeof e&&"error"in e&&e.error instanceof a&&(this._logWarning(`Unable to update attachment. ${e.error.name} ${e.error.message}`),s.error=e.error)}),o&&!s.error&&(s.onEditComplete(),s.attachmentInfos=await l.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}async zoomToSelection(){const{layer:e,view:t}=this,i=this.highlightIds.toArray();if(!e||!t||!i.length)return;const s=e.createQuery();s.objectIds=i,s.returnGeometry=!0;const l=await e.queryFeatures(s);try{await pe(t,l.features)}catch(o){"AbortError"!==o.name&&console.error(o)}}_syncAttributeTableTemplate(e=!1){const{_effectiveAttributeTableTemplate:t,layer:i,tableTemplateOverride:s,syncTemplateOnChangesEnabled:l}=this;if(!i||!t||!l&&!e||s||this.tableParent||this.relatedTable||null!==this.attachmentsViewOptions.objectId)return;const{activeSortOrders:o,allColumns:n,columns:r}=this,a=[],h=ce(r.toArray());o.forEach(({fieldName:e,direction:t})=>{e&&t&&a.push(new x({field:e,order:t}))}),n.forEach(({fieldName:e,direction:t})=>{t&&!a.some(t=>t.field===e)&&a.push(new x({field:e,order:t}))}),t.elements=h,t.orderByFields=a}async _refresh(){await this.store.refresh();const e=this.highlightIds.toArray();if(e.length){(await this.store.verifyFeaturesByObjectId(e)).forEach((t,i)=>{t||this.highlightIds.remove(e[i])})}this.refreshPageCache();const t=this.attachmentsViewOptions;null!=t?.objectId&&(t.attachmentInfos=await this.store.getAttachmentsByObjectId(t.objectId,!0))}async _onLayerLoad(){const{layer:e,pageSize:t}=this;if(!e)return;e.parent&&S(e.parent)&&await e.parent.loadAll();const i=e.capabilities.query?.maxRecordCount,s=i&&i<t,l=s?i:t;s&&(this._logWarning("The value for 'pageSize' has been adjusted due to the provided layer's max record count."),this.pageSize=l),this.grid?.set("pageSize",l),this.store.load(),this._generateColumns()}_onLayerRefresh(e){this.autoRefreshEnabled&&e.dataChanged&&this.refresh()}_generateColumns(){this._drainColumns();const{_effectiveTableTemplate:e,_effectiveAttributeTableTemplate:t}=this,i=e?.columnTemplates,s=this._generateColumnsFromColumnTemplates(i)??this._generateColumnsFromAttributeTableTemplate(t)??this._generateDefaultFieldColumns();s.length&&(this.attachmentsEnabled&&!s.some(e=>$(e))&&s.push(this._generateDefaultAttachmentsColumn()),this.relatedRecordsEnabled&&this.relationshipInfos.length&&!s.some(e=>Q(e))&&s.push(...this._generateDefaultRelationshipColumns()),this.actionColumnConfig&&s.push(this._generateActionColumn()),s.sort((e,t)=>e.frozen&&t.frozen||e.frozenToEnd&&t.frozenToEnd?0:e.frozen||t.frozenToEnd?-1:0),this.columns.addMany(s))}_generateColumnsFromAttributeTableTemplate(e){const{layer:t}=this;if(!e||!t)return null;const{elements:i,orderByFields:s}=e,o=j(t),n=[];n.push(...this._generateColumnsFromAttributeTableElements(i,s));const r=o.map(e=>{if(!e.fieldName||re(e.fieldName,n))return null;const{fieldName:i}=e,l=ae(t,i);return l?this._generateDefaultFieldColumn(l,{hidden:!0,orderByFields:s}):(this._logTemplateWarning("A valid 'field' could not be found for the provided template."),null)}).filter(l);return n.push(...r),this.attachmentsEnabled&&he(t)&&!n.some(e=>$(e))&&n.push(this._generateDefaultAttachmentsColumn({hidden:!0})),this.relatedRecordsEnabled&&se(t)&&t.relationships?.forEach(({id:e},t)=>{const i=this.relationshipInfos.find(t=>t.relationshipId===e);i&&!n.some(t=>Q(t)&&t.relationshipId===e)&&n.push(this._generateDefaultRelationshipColumn({hidden:!0,info:i,index:t}))}),n.length?n:null}_generateColumnsFromAttributeTableElements(e,t){const{layer:i}=this;return i?e?.map((e,i)=>{switch(e.type){case"field":return this._createFieldColumnFromElement({element:e,orderByFields:t});case"group":return this._createGroupColumnFromElement({element:e,orderByFields:t});case"attachment":return this._createAttachmentColumnFromElement({element:e,index:i});case"relationship":return this._createRelationshipColumnFromElement({element:e,index:i})}}).filter(e=>!!e)??[]:[]}_createFieldColumnFromElement(e){const{layer:t}=this;if(!t)return null;const{element:i,orderByFields:s}=e,{fieldName:l}=i;if(null==l)return this._logTemplateWarning("A valid 'fieldName' must be provided."),null;const o=ae(t,l);if(!o)return this._logTemplateWarning("A valid 'field' could not be found for the provided template."),null;const{description:n,label:r}=i,a=s?.findIndex(({field:e})=>e&&e===l)??-1,h=a>-1?s?.at(a)?.order:void 0,d=a>-1?a:void 0,{editingEnabled:m,grid:c,messages:p,messagesCommon:u,messagesURIUtils:g,store:b,timeZone:f,view:y}=this;return new L({description:n,direction:h,field:o,fieldName:l,grid:c,initialSortPriority:d,label:r,layer:t,messages:p,messagesCommon:u,messagesURIUtils:g,store:b,tableEditingEnabled:m,tableTimeZone:f,view:y,onShowPromptCallback:this._onShowPromptCallback})}_createGroupColumnFromElement(e){const{element:t,orderByFields:i}=e,{description:s,label:l}=t;if(!l)return this._logTemplateWarning("Group columns require a label."),null;if(!t.elements.length)return this._logTemplateWarning("Group columns require child columns."),null;const{grid:o,messages:n,messagesCommon:r,messagesURIUtils:a,store:h,timeZone:d}=this;return new N({columns:this._generateColumnsFromAttributeTableElements(t.elements,i),description:s,grid:o,label:l,messages:n,messagesCommon:r,messagesURIUtils:a,store:h,tableTimeZone:d})}_createAttachmentColumnFromElement(e){if(!this.attachmentsEnabled)return void this._logTemplateWarning("The 'attachmentsEnabled' property is currently false.");const{element:t,index:i}=e,{description:s,label:l}=t,{grid:o,layer:n,messages:r,messagesCommon:a,messagesURIUtils:h,store:d,timeZone:m}=this;return new H({description:s,fieldName:`${ne.attachments}-${i}`,grid:o,label:l,layer:n,messages:r,messagesCommon:a,messagesURIUtils:h,store:d,tableTimeZone:m,onShowAttachments:e=>this._onShowAttachments(e)})}_createRelationshipColumnFromElement(e){if(!this.relatedRecordsEnabled)return void this._logTemplateWarning("Relationship columns require related records to be enabled on the table.");const{element:t,index:i}=e,{description:s,label:l,relationshipId:o}=t,n=this.relationshipInfos.find(e=>e.relationshipId===o);if(!n)return this._logTemplateWarning("Unable to find valid related layer target based on the provided relationship id."),null;const{grid:r,messages:a,messagesCommon:h,messagesURIUtils:d,store:m,timeZone:c}=this;return new B({description:s,fieldName:`${ne.relationship}-${o}-${i}`,grid:r,label:l,messages:a,messagesCommon:h,messagesURIUtils:d,relationshipId:o,store:m,tableTimeZone:c,layer:n.relatedLayer,relatedLayer:n.layer,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateColumnsFromColumnTemplates(e){const{editingEnabled:t,grid:i,layer:s,messages:l,messagesCommon:o,messagesURIUtils:n,store:r,timeZone:a,view:h}=this;if(!e?.length||!s)return null;const d=[];return e.forEach((e,m)=>{const{autoWidth:c,description:p,direction:u,flexGrow:g,fieldName:b,formatFunction:f,frozen:y,frozenToEnd:T,icon:w,iconText:_,initialSortPriority:C,invalid:I,label:v,labelTooltipText:E,menuConfig:A,resizable:F,sortable:S,textAlign:j,textWrap:R,timeZone:x,type:U,width:O}=e;if(!U)return void this._logTemplateWarning("Property 'type' is missing from the provided template.");if(y&&T)return void this._logTemplateWarning("Properties 'frozen' and 'frozenToEnd' cannot both be true for the same column.");const V=!1===e.visible;if("group"===U){if(!e.columnTemplates?.length)return void this._logTemplateWarning("Group columns must contain column templates.");if(!e.label)return void this._logTemplateWarning("Group columns require a label.");const t=this._generateColumnsFromColumnTemplates(e.columnTemplates),s=V||this._isFieldHidden(e.label);d.push(new N({autoWidth:c,columns:t,description:p,flexGrow:g,frozen:y,frozenToEnd:T,grid:i,hidden:s,icon:w,iconText:_,invalid:I,label:v,labelTooltipText:E,menuConfig:A,messages:l,messagesCommon:o,messagesURIUtils:n,resizable:F,tableTimeZone:a,textAlign:j,textWrap:R,timeZone:x,width:O}))}else if("attachment"===U){if(!this.attachmentsEnabled)return void this._logTemplateWarning("Attachment columns require attachments to be enabled on the table.");d.push(this._generateAttachmentsColumnFromTemplate(e,m))}else if("relationship"===U){if(!this.relatedRecordsEnabled)return void this._logTemplateWarning("Relationship columns require related records to be enabled on the table.");const{relationshipId:t}=e;if(null==t)return void this._logTemplateWarning("Property 'relationshipId' is missing from the provided template.");const i=this.relationshipInfos.find(e=>e.relationshipId===t);if(!i)return void this._logTemplateWarning("Unable to find valid related layer target based on the provided relationship id.");d.push(this._generateRelationshipColumnFromTemplate(i,e,m))}else if(!b)return void this._logTemplateWarning("Value for 'fieldName' property was missing from the provided template.");const z=V||this._isFieldHidden(b);if("column"===U)d.push(new Z({autoWidth:c,description:p,direction:u,fieldName:b,flexGrow:g,formatFunction:f,frozen:y,frozenToEnd:T,grid:i,hidden:z,icon:w,iconText:_,initialSortPriority:C,invalid:I,label:v,labelTooltipText:E,menuConfig:A,messages:l,messagesCommon:o,messagesURIUtils:n,resizable:F,sortable:S,tableTimeZone:a,textAlign:j,textWrap:R,timeZone:x,width:O}));else if("field"===U){const m=ae(s,e.fieldName);if(!m)return void this._logTemplateWarning("A valid 'field' could not be found for the provided template.");const{editable:b,required:U}=e;d.push(new L({autoWidth:c,description:p,direction:u,editable:b,field:m,fieldName:m.name,flexGrow:g,formatFunction:f,frozen:y,frozenToEnd:T,grid:i,hidden:z,icon:w,iconText:_,initialSortPriority:C,invalid:I,label:v,labelTooltipText:E,layer:s,messages:l,messagesCommon:o,messagesURIUtils:n,menuConfig:A,required:U,resizable:F,sortable:S,store:r,tableEditingEnabled:t,tableTimeZone:a,template:e,textAlign:j,textWrap:R,timeZone:x,width:O,view:h,onShowPromptCallback:this._onShowPromptCallback}))}}),d.length?d:null}_generateDefaultFieldColumns(){return this.layer?.fields?.map(e=>this._generateDefaultFieldColumn(e)).filter(l)??[]}_generateDefaultFieldColumn(e,t){const{editingEnabled:i,grid:s,layer:l,messages:o,messagesCommon:n,messagesURIUtils:r,store:a,timeZone:h,view:d}=this,m=t?.orderByFields;if(!e.visible||"geometry"===e.type)return null;const c=e.name,p=m?.findIndex(({field:e})=>e&&e===c)??-1,u=p>-1?m?.at(p)?.order:void 0,g=p>-1?p:void 0;return new L({direction:u,field:e,fieldName:c,grid:s,hidden:t?.hidden||this._isFieldHidden(c),initialSortPriority:g,layer:l,messages:o,messagesCommon:n,messagesURIUtils:r,store:a,tableEditingEnabled:i,tableTimeZone:h,view:d,onShowPromptCallback:this._onShowPromptCallback})}_generateAttachmentsColumnFromTemplate(e,t){const{grid:i,layer:s,messages:l,messagesCommon:o,messagesURIUtils:n,store:r,timeZone:a}=this,{attachmentsViewEnabled:h,autoWidth:d,description:m,flexGrow:c,fieldName:p,formatFunction:u,frozen:g,frozenToEnd:b,icon:f,iconText:y,invalid:T,label:w,labelTooltipText:_,menuConfig:C,resizable:I,textAlign:v,textWrap:E,thumbnailAppearance:A,thumbnailCount:F,thumbnailIconScale:S,thumbnailsEnabled:j,timeZone:R,width:x}=e;return new H({attachmentsViewEnabled:h,autoWidth:d,description:m,fieldName:`${ne.attachments}-${t}`,flexGrow:c,formatFunction:u,frozen:g,frozenToEnd:b,grid:i,hidden:!1===e.visible||this._isFieldHidden(w)||this._isFieldHidden(p),icon:f,iconText:y,invalid:T,label:w,labelTooltipText:_,layer:s,menuConfig:C,messages:l,messagesCommon:o,messagesURIUtils:n,resizable:I,store:r,tableTimeZone:a,textAlign:v,textWrap:E,thumbnailAppearance:A,thumbnailCount:F,thumbnailIconScale:S,thumbnailsEnabled:j,timeZone:R,width:x,onShowAttachments:e=>this._onShowAttachments(e)})}_generateDefaultAttachmentsColumn(e){const{grid:t,layer:i,messages:s,messagesCommon:l,messagesURIUtils:o,store:n,timeZone:r}=this,a=ne.attachments;return new H({fieldName:a,grid:t,hidden:e?.hidden||this._isFieldHidden(a),layer:i,messages:s,messagesCommon:l,messagesURIUtils:o,store:n,tableTimeZone:r,onShowAttachments:e=>this._onShowAttachments(e)})}_generateRelationshipColumnFromTemplate(e,t,i){const{grid:s,messages:l,messagesCommon:o,messagesURIUtils:n,store:r,timeZone:a}=this,{autoWidth:h,collapsed:d,description:m,flexGrow:c,fieldName:p,formatFunction:u,frozen:g,frozenToEnd:b,icon:f,iconText:y,invalid:T,label:w,labelTooltipText:_,menuConfig:C,relationshipId:I,resizable:v,textAlign:E,textWrap:A,timeZone:F,width:S}=t;return new B({autoWidth:h,collapsed:d,description:m,fieldName:`${ne.relationship}-${I}-${i}`,flexGrow:c,formatFunction:u,frozen:g,frozenToEnd:b,grid:s,hidden:!1===t.visible||this._isFieldHidden(w)||this._isFieldHidden(p),icon:f,iconText:y,invalid:T,label:w,labelTooltipText:_,menuConfig:C,messages:l,messagesCommon:o,messagesURIUtils:n,relationshipId:I,resizable:v,store:r,tableTimeZone:a,textAlign:E,textWrap:A,timeZone:F,width:S,layer:e.relatedLayer,relatedLayer:e.layer,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateDefaultRelationshipColumns(){const{relationshipInfos:e,relationshipColumnConfigs:t}=this,i=[];return e?.length?(t?t.forEach((t,s)=>{const{relationshipId:l}=t,o=e.find(e=>e.relationshipId===l);o&&i.push(this._generateDefaultRelationshipColumn({config:t,index:s,info:o}))}):e.forEach((e,t)=>i.push(this._generateDefaultRelationshipColumn({index:t,info:e}))),i):i}_generateDefaultRelationshipColumn(e){const{config:t,hidden:i,index:s,info:l}=e,{grid:o,messages:n,messagesCommon:r,messagesURIUtils:a}=this,{relationshipId:h}=l;return new B({...t,fieldName:`${ne.relationship}-${h}-${s}`,grid:o,hidden:i,messages:n,messagesCommon:r,messagesURIUtils:a,layer:l.relatedLayer,relatedLayer:l.layer,relationshipId:h,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateActionColumn(){return new P({hidden:this._isFieldHidden(ne.action),...this.actionColumnConfig})}_isFieldHidden(e){const t=e?.toLowerCase();return(this.hiddenFields??this._defaultHiddenFields).some(e=>e.toLowerCase()===t)}_addTableHighlight(e){if(!this.highlightEnabled)return;const{_highlightableLayerView:t,layer:i}=this;if(t&&i){const s=this.store.getItemByObjectId(e),l=s?.feature??e;this._highlights.add(t.highlight(l,{name:O}),de(i,e))}}_removeTableHighlight(e){const{layer:t}=this;t&&this._highlights.remove(de(t,e))}async _syncTemporaryHighlight(e,t){if(!this.highlightEnabled)return this._currentTemporaryHighlight?.handle.remove(),void(this._currentTemporaryHighlight=null);if(await u(25),g(t),!this._currentTemporaryHighlight&&!e)return;const{id:i}=this._currentTemporaryHighlight??{};if(i===e)return;this._currentTemporaryHighlight?.handle?.remove(),this._currentTemporaryHighlight=null;const{_highlightableLayerView:s,layer:l,highlightEnabled:o}=this;e&&s&&l&&o&&(this._currentTemporaryHighlight={id:e,handle:s.highlight(e,{name:V})})}_syncSelection(){this._highlights.removeAll(),this._tableHighlightsReady?this.highlightIds.forEach(e=>this._addTableHighlight(e)):this._viewSelectionReady&&(this.highlightIds.items=this._viewSelection)}_appendToViewSelection(e){const{_selectableLayer:t}=this;t&&this._selectionManager?.appendToSelection(t,e)}_removeFromViewSelection(e){const{_selectableLayer:t}=this;t&&this._selectionManager?.removeFromSelection(t,e)}async _onHighlightIdsChange(e){const{added:t,removed:i}=e,{attachmentsViewOptions:s}=this;if(this._tableHighlightsReady?(i.forEach(e=>this._removeTableHighlight(e)),t.forEach(e=>this._addTableHighlight(e))):this._viewSelectionReady&&(this._removeFromViewSelection(i),this._appendToViewSelection(t)),this.filterBySelectionEnabled&&this._syncObjectIdsWithStore(this.highlightIds.toArray()),null!=s.objectId){const e=this.highlightIds.at(0);if(null!=e){const t=await this.store.getAttachmentsByObjectId(e,!0);s.set({attachmentInfos:t,objectId:e,mode:t.length?"list":"file"})}}}_onShowRelatedTable(e){const{highlightIds:t}=this,{objectId:i}=e;t.removeAll(),t.add(i),this.showRelatedTableCallback?this.showRelatedTableCallback(e):this.emit("show-related-table",e)}_onObjectIdsChange(){const e=this.objectIds.toArray();e.length&&this.filterBySelectionEnabled&&(this.filterBySelectionEnabled=!1,this._logWarning("Object ID filter was applied while a selection filter was applied. Selection filter has been removed.")),this._syncObjectIdsWithStore(e)}_syncObjectIdsWithStore(e){this.store.objectIds=e,this.refreshPageCache()}_drainColumns(){this.columns.drain(e=>!e.destroyed&&e.destroy())}_showAllRelatedTables(e){const t=e.layer;if(!t)return;const i=this._getDefaultLayerDisplayField(t);e.set({relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForShowAllTablesView(e,i)});const s=e.hiddenFields;s.includes(ne.action)||s.add(ne.action),s.includes(ne.attachments)||s.add(ne.attachments)}_hideAllRelatedTables(e){const{layer:t,relationship:i}=e;if(t&&null!=i?.id)if(null!=e.attachmentsViewOptions.objectId){const i=this._getDefaultLayerDisplayField(t);e.set({multipleSelectionEnabled:!1,relationshipColumnConfigs:[],showAllRelatedTables:!1,tableTemplateOverride:this._getTableTemplateForAttachmentsView(i)})}else e.set({multipleSelectionEnabled:!0,relationshipColumnConfigs:me(t,i.id),showAllRelatedTables:!1,tableTemplateOverride:null}),e.hiddenFields.removeMany([ne.action,ne.attachments])}_getTableTemplateForRelatedTableView(e,t,i){return new te({columnTemplates:[new Y({fieldName:t,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map(([s,l])=>({selected:s===t,label:l||s,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForRelatedTableView(e,s,i)}}))},resizable:!1}),new ee({autoWidth:!1,collapsed:!0,flexGrow:0,label:"",resizable:!1,relationshipId:i,width:ge})]})}_getTableTemplateForShowAllTablesView(e,t){const i=[new Y({fieldName:t,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map(([i,s])=>({selected:i===t,label:s||i,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForShowAllTablesView(e,i)}}))},resizable:!1})];return null!=e.attachmentsViewOptions.objectId&&i.push(new D({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:ge})),new te({columnTemplates:i})}async _onShowPromptCallback(e){const{column:t,objectId:i,oldValue:s,value:l}=e,{_subtypes:o,layer:n}=this;if(!n||!o.length)return void t.cancel();const r=o.find(e=>e.code===l);if(!r)return void t.cancel();const a=b(),h=this._createSubtypeEditPrompt(s,r,a),d=!!n.parent;try{this.showPrompt(h);const e=await a.promise,s=[{fieldName:t.fieldName,value:l}];switch(e){case"update-fields":for(const[e,t]of Object.entries(r.defaultValues))null!=t&&s.push({fieldName:e,value:t});await t.updateItems({objectId:i,updates:s}),d&&this.refresh();break;case"keep-existing":await t.updateItems({objectId:i,updates:s}),d&&this.refresh();break;case"undo":t.cancel()}}finally{this.clearPrompt()}}_createSubtypeEditPrompt(e,t,s){const{_subtypes:l,messages:o,messagesCommon:n}=this,r=l.find(t=>t.code===e)?.name??`${e}`;let a="update-fields";const h=[{label:o.subtypes.useDefaultValuesOption,value:"update-fields"},{label:o.subtypes.keepCurrentValuesOption,value:"keep-existing"}];return{context:"info",title:o.subtypes.changeWarningTitle,message:i(o.subtypes.changeWarning,{originalType:r,newType:t.name}),radios:h,defaultRadioSelection:"update-fields",onRadioSelection:e=>{a=e},actions:{primary:{label:n.apply,action:()=>s.resolve(a),type:"positive"},secondary:{label:n.cancel,type:"neutral",action:()=>s.resolve("undo")}},cancel:()=>s.reject()}}_onShowAttachments({objectId:e}){this.attachmentsViewOptions.objectId=e}_getTableTemplateForAttachmentsView(e){return new te({columnTemplates:[new Y({fieldName:e,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(this).map(([t,i])=>({selected:t===e,label:i||t,clickFunction:()=>{this.tableTemplateOverride=this._getTableTemplateForAttachmentsView(t)}}))},resizable:!1}),new D({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:ge})]})}_extractFieldColumnInfosFromTableTemplate(e){const t=e??this,{layer:i,tableTemplate:s}=t;return s?s.columnTemplates.filter(({type:e})=>"field"===e||"column"===e).map(({fieldName:e,label:t})=>{if(null!=t&&""!==t)return[e,t];const s=i?.fieldsIndex.get(e);return[e,s&&I(s,i)]}):i?.fields.map(e=>[e.name,I(e,i)])??[]}_getDefaultLayerDisplayField(e){const{displayField:t,objectIdField:i}=e;return t&&""!==t.trim()?t:i||(e.fields.length?e.fields[0].name:"")}_getIndexOfFirstFrozenToEndColumn(){const e=this.columns.findIndex(e=>e.frozenToEnd);return e>-1?e:void 0}_logWarning(e,t){t?d.getLogger(this).warnOnce(e):d.getLogger(this).warn(e)}_logTemplateWarning(e){this._logWarning(`${e} Skipped generating a column using the provided template.`,!0)}_onCellInteraction(e){null!=e&&null!=this.attachmentsViewOptions.objectId&&this.highlightIds.add(e)}};e([_()],be.prototype,"_defaultHiddenFields",null),e([_()],be.prototype,"_effectiveTableTemplate",null),e([_()],be.prototype,"_effectiveAttributeTableTemplate",null),e([_()],be.prototype,"_highlights",void 0),e([_()],be.prototype,"_highlightableLayerView",null),e([_()],be.prototype,"_selectionManager",null),e([_()],be.prototype,"_selectableLayer",null),e([_()],be.prototype,"_subtypes",null),e([_()],be.prototype,"_tableHighlightsReady",null),e([_()],be.prototype,"_viewSelection",null),e([_()],be.prototype,"_viewSelectionReady",null),e([_()],be.prototype,"activeFilters",null),e([_({readOnly:!0})],be.prototype,"activeSortOrders",null),e([_()],be.prototype,"allRelatedTablesVisible",null),e([_()],be.prototype,"attachmentsColumns",null),e([_()],be.prototype,"attachmentsEnabled",null),e([_()],be.prototype,"attachmentsViewOptions",void 0),e([_({type:R})],be.prototype,"attributeTableTemplate",void 0),e([_()],be.prototype,"autoRefreshEnabled",void 0),e([_()],be.prototype,"clearPrompt",null),e([_({readOnly:!0})],be.prototype,"columns",void 0),e([_()],be.prototype,"dataProvider",void 0),e([_()],be.prototype,"definitionExpression",null),e([_()],be.prototype,"fieldColumns",null),e([_({types:v})],be.prototype,"filterGeometry",null),e([_()],be.prototype,"filterBySelectionEnabled",null),e([_({readOnly:!0})],be.prototype,"grid",void 0),e([_()],be.prototype,"hiddenFields",null),e([_()],be.prototype,"highlightEnabled",void 0),e([_()],be.prototype,"initialSize",null),e([_()],be.prototype,"isQueryingOrSyncing",null),e([_()],be.prototype,"isSyncingAttachments",null),e([_()],be.prototype,"layer",null),e([_()],be.prototype,"layers",void 0),e([_()],be.prototype,"layerFieldConfigurations",null),e([_()],be.prototype,"layerView",null),e([_()],be.prototype,"menuConfig",void 0),e([_()],be.prototype,"messages",void 0),e([_(),ue("esri/t9n/common")],be.prototype,"messagesCommon",void 0),e([_(),ue("esri/core/t9n/Units")],be.prototype,"messagesUnits",void 0),e([_(),ue("esri/widgets/support/t9n/uriUtils")],be.prototype,"messagesURIUtils",void 0),e([_()],be.prototype,"outFields",null),e([_()],be.prototype,"prompt",void 0),e([_()],be.prototype,"relatedRecordsEnabled",null),e([_()],be.prototype,"relatedTable",null),e([_()],be.prototype,"relatedTables",void 0),e([_()],be.prototype,"relationship",null),e([_()],be.prototype,"relationshipColumnConfigs",void 0),e([_()],be.prototype,"relationshipColumns",null),e([_()],be.prototype,"relationshipConfig",null),e([_()],be.prototype,"relationshipInfos",null),e([_()],be.prototype,"relationships",null),e([_()],be.prototype,"returnGeometryEnabled",null),e([_()],be.prototype,"returnMEnabled",null),e([_()],be.prototype,"returnZEnabled",null),e([_()],be.prototype,"selectionSource",void 0),e([_()],be.prototype,"showAllRelatedTables",null),e([_()],be.prototype,"showPrompt",null),e([_()],be.prototype,"showRelatedTableCallback",void 0),e([_({readOnly:!0,type:X})],be.prototype,"store",void 0),e([_()],be.prototype,"supportsAttachments",null),e([_()],be.prototype,"supportsAddAttachments",null),e([_()],be.prototype,"supportsDeleteAttachments",null),e([_()],be.prototype,"supportsResizeAttachments",null),e([_()],be.prototype,"supportsUpdateAttachments",null),e([_()],be.prototype,"syncTemplateOnChangesEnabled",void 0),e([_()],be.prototype,"tableController",void 0),e([_()],be.prototype,"tableParent",void 0),e([_({type:te})],be.prototype,"tableTemplate",void 0),e([_()],be.prototype,"tableTemplateOverride",void 0),e([_({type:U})],be.prototype,"timeExtent",null),e([_()],be.prototype,"timeZone",null),e([_()],be.prototype,"view",null),be=e([C("esri.widgets.FeatureTable.FeatureTableViewModel")],be);const fe=be;export{fe as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import{onLocaleChange as t,substitute as i,fetchMessageBundle as s}from"../../intl.js";import{isSome as l}from"../../core/arrayUtils.js";import o from"../../core/Collection.js";import{referenceSetter as r}from"../../core/collectionUtils.js";import{deprecatedFunction as n}from"../../core/deprecate.js";import a from"../../core/Error.js";import h from"../../core/Handles.js";import d from"../../core/Logger.js";import{abortMaybe as m}from"../../core/maybe.js";import{debounce as c,ignoreAbortErrors as p,after as u,throwIfAborted as g,createResolver as b}from"../../core/promiseUtils.js";import{watch as f,on as y,initial as T}from"../../core/reactiveUtils.js";import{throttle as w}from"../../core/throttle.js";import{property as _,subclass as C}from"../../core/accessorSupport/decorators.js";import{getEffectiveFieldAlias as I}from"../../editing/fieldUtils.js";import{geometryTypes as v}from"../../geometry/support/typeUtils.js";import{getLowerCaseDefaultHiddenFields as E}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as A,getSubtypesFromLayer as F,isSubtypeGroupLayer as S}from"../../layers/support/layerUtils.js";import{createFieldInfos as j}from"../../support/popupUtils.js";import R from"../../tables/AttributeTableTemplate.js";import x from"../../tables/support/FieldOrder.js";import U from"../../time/TimeExtent.js";import{defaultHighlightName as O,temporaryHighlightName as V}from"../../views/support/HighlightDefaults.js";import{highlightsSupported as z}from"../../views/support/layerViewUtils.js";import{isISelectableLayer as W}from"../../views/support/selectionUtils.js";import P from"./ActionColumn.js";import H from"./AttachmentsColumn.js";import L from"./FieldColumn.js";import B from"./RelationshipColumn.js";import G from"./Grid/Column.js";import k from"./Grid/Grid.js";import N from"./Grid/GridViewModel.js";import D from"./Grid/GroupColumn.js";import M from"./support/AttachmentsColumnTemplate.js";import $ from"./support/AttachmentsViewOptions.js";import{isAttachmentsColumn as Z,isFieldColumn as q,isRelationshipColumn as Q}from"./support/columnUtils.js";import{downloadAttachmentInfo as K,exportToCSV as J}from"./support/exportUtils.js";import X from"./support/FeatureStore.js";import Y from"./support/FieldColumnTemplate.js";import ee from"./support/RelationshipColumnTemplate.js";import te from"./support/TableTemplate.js";import{isIFeatureTableSupportedLayerWithFieldConfigurations as ie,isIFeatureTableSupportedLayerWithRelationships as se,findRelatedLayerInSources as le,findRelationship as oe,uniqueColumnNames as re,hasColumnForField as ne,findField as ae,isIFeatureTableSupportedLayerWithAttachments as he,getTableHighlightKey as de,getRelationshipIdsToShow as me}from"./support/tableUtils.js";import{createAttributeTableElements as ce}from"./support/templateUtils.js";import{goTo as pe}from"../support/goToUtils.js";import{messageBundle as ue}from"../support/widget.js";const ge="80px";let be=class extends N{constructor(e){super(e),this._currentTemporaryHighlight=null,this._highlights=new h,this._refreshDebounced=c(()=>this._refresh()),this._syncTemplateThrottled=w(()=>this._syncAttributeTableTemplate()),this._temporaryHighlightAbortController=null,this.attachmentsViewOptions=new $,this.attributeTableTemplate=null,this.autoRefreshEnabled=!0,this.columns=new o,this.dataProvider=async(e,t)=>{const{layer:i,store:s}=this;if(!t)return;if(!i||!s)return void(t&&t([]));await i.load();const{objectIds:l}=this;if(this.filterBySelectionEnabled&&!this.highlightIds.length||1===l.length&&-1===l.items[0])return void t([]);"loaded"!==s.state&&"loading"!==s.state&&await s.load();const o=this.paginationEnabled?this.pageIndex:e.page,r=await s.fetchItems({...e,page:o});t&&t(r)},this.grid=null,this.highlightEnabled=!0,this.layers=null,this.maxSize=null,this.menuConfig=null,this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this.messagesURIUtils=null,this.prompt=null,this.relatedTables=new o,this.relationshipColumnConfigs=null,this.selectionSource="table",this.showRelatedTableCallback=null,this.store=null,this.syncTemplateOnChangesEnabled=!0,this.tableController=null,this.tableParent=null,this.tableTemplate=null,this.tableTemplateOverride=null,this._onLayerRefresh=this._onLayerRefresh.bind(this),this._onShowPromptCallback=this._onShowPromptCallback.bind(this),this._set("store",new X),this._set("grid",new k({viewModel:this}))}initialize(){const e=async()=>{this.messages=await s("esri/widgets/FeatureTable/t9n/FeatureTable"),this.messagesCommon=await s("esri/t9n/common"),this.messagesUnits=await s("esri/core/t9n/Units"),this.messagesURIUtils=await s("esri/widgets/support/t9n/uriUtils")};e(),this.addHandles([t(()=>{e(),this._generateColumns()}),f(()=>[this.messages,this.messagesCommon,this.messagesURIUtils],()=>{const e=this.messages;this.grid&&(this.grid.messages=e),this.allColumns.forEach(t=>{t.messages=e,t.messagesCommon=this.messagesCommon,t.messagesURIUtils=this.messagesURIUtils}),this.refreshCellContent()},T),y(()=>this.highlightIds,"change",e=>this._onHighlightIdsChange(e),{onListenerAdd:()=>this._syncSelection(),onListenerRemove:()=>this._highlights.removeAll()}),f(()=>this.grid?.temporaryHighlightId,e=>{this._temporaryHighlightAbortController?.abort(),this._temporaryHighlightAbortController=new AbortController,p(this._syncTemporaryHighlight(e,this._temporaryHighlightAbortController.signal))}),f(()=>this.attachmentsEnabled,()=>this.layer?.loaded&&this._generateColumns()),f(()=>this._viewSelection,()=>{this._viewSelectionReady&&(this.highlightIds.items=this._viewSelection)}),f(()=>[this._tableHighlightsReady,this._viewSelectionReady],()=>this._syncSelection()),f(()=>this.layer,async(e,t)=>{const i=this.grid;i&&(i.clearSort(),e&&t&&await this.reset()),this.goToPage(0),this._drainColumns(),this.store.layer=e,e&&(e.loaded?this._onLayerLoad():e.load().catch(()=>{})),t&&null!=this.attachmentsViewOptions.objectId&&(this.attachmentsViewOptions.objectId=null)}),f(()=>this.layer?.loaded,e=>e&&this._onLayerLoad()),f(()=>this.store.state,e=>{"loaded"===e&&(this.scrollToTop(),this.refreshCellContent())}),f(()=>this._effectiveTableTemplate,()=>{this.scrollLeft(),this.layer?.loaded&&this._generateColumns()}),f(()=>this.editingEnabled,()=>this.refreshCellContent()),f(()=>this.timeZone??this.view?.timeZone,()=>this.refreshCellContent()),f(()=>this.store.effectiveWhere,()=>"loaded"===this.store.state&&this.reset()),f(()=>this.layer?.timeExtent,(e,t)=>(e||t)&&!this.timeExtent&&"loaded"===this.store.state&&this.reset()),y(()=>this.layer,"refresh",e=>this._onLayerRefresh(e)),y(()=>this.grid,["cell-click","cell-dblclick","cell-pointerover","cell-pointerout","cell-keydown","column-reorder"],({index:e,item:t,native:i,path:s,type:l})=>{const o=t?.feature,r=o?.getObjectId(),n="cell-keydown"===l&&i&&i instanceof KeyboardEvent&&"Enter"===i.key;this.emit(l,{feature:o,index:e,native:i,type:l,fieldName:s??void 0,objectId:r}),(n||"cell-click"===l)&&this._onCellInteraction(r)}),f(()=>this.actionColumnConfig,e=>{const{actionColumn:t,columns:i}=this;t?e?t.set(e):i.remove(t):e&&i.length&&i.add(this._generateActionColumn(),!1!==e.frozenToEnd?void 0:this._getIndexOfFirstFrozenToEndColumn())}),f(()=>this.relatedRecordsEnabled,()=>this.layer?.loaded&&this._generateColumns()),y(()=>this.objectIds,"change",()=>this._onObjectIdsChange(),{onListenerAdd:()=>this._onObjectIdsChange()}),f(()=>[this.paginationEnabled,this.pageIndex],()=>this.refreshPageCache()),f(()=>this.activeSortOrders,e=>{this.store.sortOrders=e,this._syncTemplateThrottled()}),f(()=>this.allVisibleColumns,()=>this._syncTemplateThrottled()),f(()=>this.pageCount,()=>{this.pageIndex>=this.pageCount&&this.goToPage(0)}),f(()=>this.state,e=>{"disabled"===e&&this.relatedTables.length&&this.drainRelatedTables()}),y(()=>this.tableParent?.highlightIds,"change",({added:e})=>{const{relationshipConfig:t}=this,i=e[0];if(null==i||!t)return;const{relatedLayer:s,relationshipId:l}=t;this.relationshipConfig={objectId:i,relatedLayer:s,relationshipId:l}}),y(()=>this.tableParent,"cell-click",e=>{const{tableParent:t}=this,{objectId:i}=e;t&&null!=i&&t.highlightIds.add(i)}),f(()=>this.attachmentsViewOptions.objectId,(e,t)=>{null!=e?null==t&&this.showAttachmentsView({objectId:e}):this.hideAttachmentsView()}),f(()=>this.layerFieldConfigurations,()=>this.refreshCellContent())])}destroy(){this._drainColumns(),this._highlights.removeAll(),this._highlights.destroy(),this._currentTemporaryHighlight?.handle.remove(),this._temporaryHighlightAbortController=m(this._temporaryHighlightAbortController),this.grid?.destroy(),this.columns.destroyed||this.columns.destroy(),this.layer=null,this.view=null}get _defaultHiddenFields(){return E(this.layer)}get _effectiveTableTemplate(){return this.tableTemplateOverride||this.tableTemplate}get _effectiveAttributeTableTemplate(){return this.attributeTableTemplate||this.layer?.attributeTableTemplate}get _highlightableLayerView(){const e=this.layerView;return z(e)?e:null}get _selectionManager(){const{view:e}=this;return!e||e.destroyed?null:e.selectionManager?.sources?.length?e.selectionManager:null}get _selectableLayer(){const{layer:e}=this;if(W(e)||A(e)){const t=e;return this._selectionManager?.sources?.includes(t)?t:null}return null}get _subtypes(){return F(this.layer)}get _tableHighlightsReady(){return!("table"!==this.selectionSource||!this.highlightEnabled||!this._highlightableLayerView)}get _viewSelection(){const{_selectableLayer:e}=this;return e?this._selectionManager?.getSelection(e)??[]:[]}get _viewSelectionReady(){return!(!this.layer||"view"!==this.selectionSource||!this._selectionManager)}get actionColumn(){return super.actionColumn}get activeFilters(){const{filterGeometry:e,objectIds:t,filterBySelectionEnabled:i,highlightIds:s}=this,l=new o;return e&&l.push({type:"geometry",geometry:e}),i?l.push({type:"selection",objectIds:s.toArray()}):t.length&&l.push({type:"objectId",objectIds:t.toArray()}),l}get activeSortOrders(){return this.grid?.sortOrders?this.grid.sortOrders.map(({path:e,direction:t})=>({fieldName:e,direction:t})).filter(e=>e.fieldName&&e.direction):[]}get allColumns(){return super.allColumns}get allRelatedTablesVisible(){return!!(this.relatedRecordsEnabled&&this.relatedTables.length&&this.showAllRelatedTables)}get allVisibleColumns(){return super.allVisibleColumns}get attachmentsColumns(){return this.allColumns.filter(e=>Z(e))}get attachmentsEnabled(){return this.store.attachmentsEnabled}set attachmentsEnabled(e){this.store.attachmentsEnabled=e}get clearPrompt(){return()=>this.prompt=null}set clearPrompt(e){this._overrideIfSome("clearPrompt",e)}get definitionExpression(){return this.store.where}set definitionExpression(e){this.store.where=e}get editingEnabled(){return super.editingEnabled}set editingEnabled(e){super.editingEnabled=e}get effectiveSize(){return super.effectiveSize}get fieldColumns(){return this.allColumns.filter(e=>q(e))}get filterGeometry(){return this.store.filterGeometry}set filterGeometry(e){this.store.filterGeometry=e}get filterBySelectionEnabled(){return!!this._get("filterBySelectionEnabled")}set filterBySelectionEnabled(e){const{objectIds:t}=this,i=t.length;e?(i&&(t.removeAll(),this._logWarning("Selection filter has been applied with an objectID filter. Object ID filter has been removed.")),this.filterGeometry&&this._logWarning("Selection filter has been applied with a geometry filter. Results may appear inconsistent"),this._syncObjectIdsWithStore(this.highlightIds.toArray())):i||this._syncObjectIdsWithStore(null),this._set("filterBySelectionEnabled",e)}get groupColumns(){return super.groupColumns}get hiddenFields(){return this._get("hiddenFields")??new o}set hiddenFields(e){this._set("hiddenFields",r(e,this._get("hiddenFields"),o))}get highlightIds(){return super.highlightIds}set highlightIds(e){super.highlightIds=e}get initialSize(){return this.store.initialSize}set initialSize(e){this.store.initialSize=e}get isEditing(){return super.isEditing}get isQuerying(){return super.isQuerying}get isSyncing(){return super.isSyncing}get isQueryingOrSyncing(){return this.isQuerying||this.isSyncing||this.relatedTables.some(e=>!!e.isQueryingOrSyncing)}get isSyncingAttachments(){return this.store.isSyncingAttachmentEdits||this.relatedTables.some(e=>!!e.isSyncingAttachments)}get layer(){return this._get("layer")}set layer(e){this._highlights.removeAll(),this.drainRelatedTables(),this._set("layer",e)}get layerFieldConfigurations(){const e=this.layer;return ie(e)?e.fieldConfigurations:void 0}get layerView(){return this.store.layerView}get objectIds(){return super.objectIds}set objectIds(e){super.objectIds=e}get outFields(){return this.store.outFields}set outFields(e){this.store.outFields=e}get pageCount(){return super.pageCount}get pageIndex(){return super.pageIndex}set pageIndex(e){super.pageIndex=e}get pageSize(){return super.pageSize}set pageSize(e){super.pageSize=e}get relatedRecordsEnabled(){return this.store.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.store.relatedRecordsEnabled=e}get relatedTable(){return this.relatedTables.at(-1)}get relationship(){const e=this.relationshipConfig?.relationshipId;return null==e?null:this.relationships?.find(({id:t})=>t===e)}get relationshipColumns(){return this.allColumns.filter(e=>Q(e))}get relationshipConfig(){return this.store.relationshipConfig}set relationshipConfig(e){this.highlightIds.removeAll(),this.objectIds.removeAll(),this.filterBySelectionEnabled=!1,this.store.relationshipConfig=e}get relationshipInfos(){const{layer:e,layers:t,relationships:i,tableController:s}=this,l=this.store.relationshipInfos;if(l.length||!se(e)||!i?.length)return l;const o=[],r=s?.layers||t||[];return i.forEach(t=>{const i=le(e,r,t);i&&(i.load(),o.push({layer:e,relatedLayer:i,relationshipId:t.id}))}),o}get relationships(){return this.store.relationships}get returnGeometryEnabled(){return this.store.returnGeometry}set returnGeometryEnabled(e){this.store.returnGeometry=e}get returnMEnabled(){return this.store.returnM}set returnMEnabled(e){this.store.returnM=e}get returnZEnabled(){return this.store.returnZ}set returnZEnabled(e){this.store.returnZ=e}get rowHighlightIds(){return super.rowHighlightIds}set rowHighlightIds(e){super.rowHighlightIds=e}get showAllRelatedTables(){return this._get("showAllRelatedTables")}set showAllRelatedTables(e){const{relatedTable:t}=this;this._set("showAllRelatedTables",e),t&&(e?this._showAllRelatedTables(t):this._hideAllRelatedTables(t))}get showPrompt(){return e=>{this.prompt?.cancel?.(),this.prompt=e}}set showPrompt(e){this._overrideIfSome("showPrompt",e)}get size(){return super.size}get state(){return super.state}get supportsAttachments(){return this.store.supportsAttachments}get supportsAddAttachments(){const{store:{supportsAddAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get supportsDeleteAttachments(){return this.supportsUpdateAttachments}get supportsResizeAttachments(){return this.store.supportsResizeAttachments}get supportsUpdateAttachments(){const{store:{supportsUpdateAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get timeExtent(){return this.store.timeExtent}set timeExtent(e){this.store.timeExtent=e}get timeZone(){return this.store.timeZone}set timeZone(e){this.store.timeZone=e}get view(){return this.store.view}set view(e){this.store.view=e,this.fieldColumns.forEach(t=>t.view=e),this.refreshCellContent()}get visibleColumns(){return super.visibleColumns}async addAttachment(e,t){const{attachmentsViewOptions:i,store:s}=this,l=i.objectId===e;await s.addAttachment(e,t).catch(e=>{l&&e&&"object"==typeof e&&"error"in e&&e.error instanceof a&&(this._logWarning(`Unable to add attachment. ${e.error.name} ${e.error.message}`),i.error=e.error)}),l&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}async deleteAttachments(e,t){const{attachmentsViewOptions:i,store:s}=this,l=i.objectId===e;await s.deleteAttachments(e,t).catch(e=>{l&&e&&"object"==typeof e&&"error"in e&&e.error instanceof a&&(this._logWarning(`Unable to delete attachment(s). ${e.error.name} ${e.error.message}`),i.error=e.error)}),l&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}collapseRelatedTable(e,t){const{relatedLayer:i,objectId:s,relationshipId:l}=t,{objectIdField:r}=i,n=oe(i,l),a=i.displayField||n?.keyField||r;e.set({highlightIds:new o([s]),multipleSelectionEnabled:!1,tableTemplateOverride:this._getTableTemplateForRelatedTableView(e,a,l)});const h=e.hiddenFields;h.includes(re.action)||h.add(re.action),h.includes(re.attachments)||h.add(re.attachments),e.scrollLeft()}async deleteSelection(){const e=this.highlightIds.toArray();if(!e?.length)return;const{deleteFeatureResults:t}=await this.store.deleteRowsByObjectId(e),i=t.filter(e=>!e.error).map(e=>e.objectId);i.length&&(this.highlightIds.removeMany(i),await this.refresh())}async downloadAttachmentById(e,t){const i=(await this.store.getAttachmentsByObjectId(e,!0)).find(e=>e.id===t);await K(i)}drainRelatedTables(){this.relatedTables.drain(e=>e.destroy()),this.set({multipleSelectionEnabled:!0,relationshipColumnConfigs:null,showAllRelatedTables:!1,tableTemplateOverride:null}),this.hiddenFields.removeMany([re.action,re.attachments])}drainRelatedTablesAboveIndex(e){const{relatedTables:t}=this,i=t.slice(e+1);t.removeMany(i).forEach(e=>e.destroy());const s=t.at(-1);s&&(s.attachmentsViewOptions.objectId=null,this.allRelatedTablesVisible?this._showAllRelatedTables(s):this._hideAllRelatedTables(s))}async exportSelectionToCSV(e){const{highlightIds:t,layer:i,outFields:s}=this;i&&t.length?await J({layer:i,objectIds:t.toArray(),outFields:s,includeGeometry:e}):this._logWarning("Export failed.")}filterBySelection(){this.filterBySelectionEnabled?this._logWarning("Property 'filterBySelectionEnabled' is already 'true'. This method has no effect."):(n(d.getLogger(this),"`FeatureTable.filterBySelection` is deprecated in favor of 'filterBySelectionEnabled' and 'objectIds'",{replacement:"FeatureTable.filterBySelectionEnabled or FeatureTable.objectIds",version:"4.30",warnOnce:!0}),this.objectIds.addMany(this.highlightIds.toArray()))}getObjectIdIndex(e){return this.store.getItemIndexByObjectId(e)}getValue(e,t){const i=this.store.getItemByObjectId(e);return i?.feature?.attributes[t]}getVirtualPageIndex(){return this.grid?.getVirtualPageIndex()??0}goToPage(e){if(null==e||!Number.isInteger(e))return void this._logWarning("Invalid 'page' parameter provided to 'goToPage()'. Current page will remain the same.");const{pageCount:t}=this;(e>=t||-1===e)&&(e=t-1),e<-1&&(e=0),e!==this.pageIndex&&(this.pageIndex=e),this.paginationEnabled||this.scrollToIndex(e*this.pageSize)}hideAttachmentsView(){this.attachmentsViewOptions.objectId=null,this.set({relationshipColumnConfigs:null,multipleSelectionEnabled:!0,tableTemplateOverride:null}),this.hiddenFields.remove(re.action)}nextPage(){const e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e+1)}previousPage(){const e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e-1)}async refresh(){await Promise.all([...this.relatedTables.map(e=>e.refresh()),p(this._refreshDebounced())])}refreshCellContent(){this.grid?.requestContentUpdate()}refreshPageCache(){this.grid?.refreshPageCache()}async reset(){this.goToPage(0),await(this.grid?.reset())}scrollLeft(){this.grid?.scrollLeft(0)}scrollToBottom(){this.grid?.scrollToBottom()}scrollToIndex(e){this.grid?.scrollToIndex(e)}scrollToRow(e){const t=this.store.getItemIndexByObjectId(e);t>-1?this.grid?.scrollToIndex(t):this._logWarning("Row not found. Associated data may not be loaded yet.")}scrollToTop(){this.grid?.scrollToTop()}async saveAttachmentsViewForm(){const{attachmentId:e,form:t,objectId:i}=this.attachmentsViewOptions;null!=i&&t&&(null!=e?await this.updateAttachment(i,e,t):await this.addAttachment(i,t))}async showAttachmentsView({objectId:e}){const{attachmentsViewOptions:t,hiddenFields:i,layer:s}=this;if(!this.attachmentsEnabled||!s)return void this._logWarning("The 'attachmentsEnabled' property is currently false.");await s.load();const l=this._getDefaultLayerDisplayField(s),r=await this.store.getAttachmentsByObjectId(e,!0),n=this.store.getItemIndexByObjectId(e);t.set({attachmentInfos:r,mode:r.length?"list":"file",objectId:e}),this.set({highlightIds:new o([e]),multipleSelectionEnabled:!1,relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForAttachmentsView(l)}),i.includes(re.action)||i.add(re.action),null!=n&&this.scrollToIndex(n)}syncAttributeTableTemplate(){this._syncAttributeTableTemplate(!0)}clearSelectionFilter(){n(d.getLogger(this),"`FeatureTable.clearSelectionFilter` is deprecated in favor of 'filterBySelectionEnabled' and 'objectIds'",{replacement:"FeatureTable.filterBySelectionEnabled or FeatureTable.objectIds",version:"4.30",warnOnce:!0}),this.objectIds.removeAll()}async updateAttachment(e,t,i){const{attachmentsViewOptions:s,store:l}=this,o=s.objectId===e;await l.updateAttachment(e,t,i).catch(e=>{o&&e&&"object"==typeof e&&"error"in e&&e.error instanceof a&&(this._logWarning(`Unable to update attachment. ${e.error.name} ${e.error.message}`),s.error=e.error)}),o&&!s.error&&(s.onEditComplete(),s.attachmentInfos=await l.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}async zoomToSelection(){const{layer:e,view:t}=this,i=this.highlightIds.toArray();if(!e||!t||!i.length)return;const s=e.createQuery();s.objectIds=i,s.returnGeometry=!0;const l=await e.queryFeatures(s);try{await pe(t,l.features)}catch(o){"AbortError"!==o.name&&console.error(o)}}_syncAttributeTableTemplate(e=!1){const{_effectiveAttributeTableTemplate:t,layer:i,tableTemplateOverride:s,syncTemplateOnChangesEnabled:l}=this;if(!i||!t||!l&&!e||s||this.tableParent||this.relatedTable||null!==this.attachmentsViewOptions.objectId)return;const{activeSortOrders:o,allColumns:r,columns:n}=this,a=[],h=ce(n.toArray());o.forEach(({fieldName:e,direction:t})=>{e&&t&&a.push(new x({field:e,order:t}))}),r.forEach(({fieldName:e,direction:t})=>{t&&!a.some(t=>t.field===e)&&a.push(new x({field:e,order:t}))}),t.elements=h,t.orderByFields=a}async _refresh(){await this.store.refresh();const e=this.highlightIds.toArray();if(e.length){(await this.store.verifyFeaturesByObjectId(e)).forEach((t,i)=>{t||this.highlightIds.remove(e[i])})}this.refreshPageCache();const t=this.attachmentsViewOptions;null!=t?.objectId&&(t.attachmentInfos=await this.store.getAttachmentsByObjectId(t.objectId,!0))}async _onLayerLoad(){const{layer:e,pageSize:t}=this;if(!e)return;e.parent&&S(e.parent)&&await e.parent.loadAll();const i=e.capabilities.query?.maxRecordCount,s=i&&i<t,l=s?i:t;s&&(this._logWarning("The value for 'pageSize' has been adjusted due to the provided layer's max record count."),this.pageSize=l),this.grid?.set("pageSize",l),this.store.load(),this._generateColumns()}_onLayerRefresh(e){this.autoRefreshEnabled&&e.dataChanged&&this.refresh()}_generateColumns(){this._drainColumns();const{_effectiveTableTemplate:e,_effectiveAttributeTableTemplate:t}=this,i=e?.columnTemplates,s=this._generateColumnsFromColumnTemplates(i)??this._generateColumnsFromAttributeTableTemplate(t)??this._generateDefaultFieldColumns();s.length&&(this.attachmentsEnabled&&!s.some(e=>Z(e))&&s.push(this._generateDefaultAttachmentsColumn()),this.relatedRecordsEnabled&&this.relationshipInfos.length&&!s.some(e=>Q(e))&&s.push(...this._generateDefaultRelationshipColumns()),this.actionColumnConfig&&s.push(this._generateActionColumn()),s.sort((e,t)=>e.frozen&&t.frozen||e.frozenToEnd&&t.frozenToEnd?0:e.frozen||t.frozenToEnd?-1:0),this.columns.addMany(s))}_generateColumnsFromAttributeTableTemplate(e){const{layer:t}=this;if(!e||!t)return null;const{elements:i,orderByFields:s}=e,o=j(t),r=[];r.push(...this._generateColumnsFromAttributeTableElements(i,s));const n=o.map(e=>{if(!e.fieldName||ne(e.fieldName,r))return null;const{fieldName:i}=e,l=ae(t,i);return l?this._generateDefaultFieldColumn(l,{hidden:!0,orderByFields:s}):(this._logTemplateWarning("A valid 'field' could not be found for the provided template."),null)}).filter(l);return r.push(...n),this.attachmentsEnabled&&he(t)&&!r.some(e=>Z(e))&&r.push(this._generateDefaultAttachmentsColumn({hidden:!0})),this.relatedRecordsEnabled&&se(t)&&t.relationships?.forEach(({id:e},t)=>{const i=this.relationshipInfos.find(t=>t.relationshipId===e);i&&!r.some(t=>Q(t)&&t.relationshipId===e)&&r.push(this._generateDefaultRelationshipColumn({hidden:!0,info:i,index:t}))}),r.length?r:null}_generateColumnsFromAttributeTableElements(e,t){const{layer:i}=this;return i?e?.map((e,i)=>{switch(e.type){case"field":return this._createFieldColumnFromElement({element:e,orderByFields:t});case"group":return this._createGroupColumnFromElement({element:e,orderByFields:t});case"attachment":return this._createAttachmentColumnFromElement({element:e,index:i});case"relationship":return this._createRelationshipColumnFromElement({element:e,index:i})}}).filter(e=>!!e)??[]:[]}_createFieldColumnFromElement(e){const{layer:t}=this;if(!t)return null;const{element:i,orderByFields:s}=e,{fieldName:l}=i;if(null==l)return this._logTemplateWarning("A valid 'fieldName' must be provided."),null;const o=ae(t,l);if(!o)return this._logTemplateWarning("A valid 'field' could not be found for the provided template."),null;const{description:r,label:n}=i,a=s?.findIndex(({field:e})=>e&&e===l)??-1,h=a>-1?s?.at(a)?.order:void 0,d=a>-1?a:void 0,{grid:m,messages:c,messagesCommon:p,messagesURIUtils:u,store:g,view:b}=this;return new L({description:r,direction:h,field:o,fieldName:l,grid:m,initialSortPriority:d,label:n,layer:t,messages:c,messagesCommon:p,messagesURIUtils:u,store:g,view:b,onShowPromptCallback:this._onShowPromptCallback})}_createGroupColumnFromElement(e){const{element:t,orderByFields:i}=e,{description:s,label:l}=t;if(!l)return this._logTemplateWarning("Group columns require a label."),null;if(!t.elements.length)return this._logTemplateWarning("Group columns require child columns."),null;const{grid:o,messages:r,messagesCommon:n,messagesURIUtils:a,store:h}=this;return new D({columns:this._generateColumnsFromAttributeTableElements(t.elements,i),description:s,grid:o,label:l,messages:r,messagesCommon:n,messagesURIUtils:a,store:h})}_createAttachmentColumnFromElement(e){if(!this.attachmentsEnabled)return void this._logTemplateWarning("The 'attachmentsEnabled' property is currently false.");const{element:t,index:i}=e,{description:s,label:l}=t,{grid:o,layer:r,messages:n,messagesCommon:a,messagesURIUtils:h,store:d}=this;return new H({description:s,fieldName:`${re.attachments}-${i}`,grid:o,label:l,layer:r,messages:n,messagesCommon:a,messagesURIUtils:h,store:d,onShowAttachments:e=>this._onShowAttachments(e)})}_createRelationshipColumnFromElement(e){if(!this.relatedRecordsEnabled)return void this._logTemplateWarning("Relationship columns require related records to be enabled on the table.");const{element:t,index:i}=e,{description:s,label:l,relationshipId:o}=t,r=this.relationshipInfos.find(e=>e.relationshipId===o);if(!r)return this._logTemplateWarning("Unable to find valid related layer target based on the provided relationship id."),null;const{grid:n,messages:a,messagesCommon:h,messagesURIUtils:d,store:m}=this;return new B({description:s,fieldName:`${re.relationship}-${o}-${i}`,grid:n,label:l,messages:a,messagesCommon:h,messagesURIUtils:d,relationshipId:o,store:m,layer:r.relatedLayer,relatedLayer:r.layer,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateColumnsFromColumnTemplates(e){const{grid:t,layer:i,messages:s,messagesCommon:l,messagesURIUtils:o,store:r,view:n}=this;if(!e?.length||!i)return null;const a=[];return e.forEach((e,h)=>{const{autoWidth:d,description:m,direction:c,flexGrow:p,fieldName:u,formatFunction:g,frozen:b,frozenToEnd:f,icon:y,iconText:T,initialSortPriority:w,invalid:_,label:C,labelTooltipText:I,menuConfig:v,resizable:E,sortable:A,textAlign:F,textWrap:S,timeZone:j,type:R,width:x}=e;if(!R)return void this._logTemplateWarning("Property 'type' is missing from the provided template.");if(b&&f)return void this._logTemplateWarning("Properties 'frozen' and 'frozenToEnd' cannot both be true for the same column.");const U=!1===e.visible;if("group"===R){if(!e.columnTemplates?.length)return void this._logTemplateWarning("Group columns must contain column templates.");if(!e.label)return void this._logTemplateWarning("Group columns require a label.");const i=this._generateColumnsFromColumnTemplates(e.columnTemplates),r=U||this._isFieldHidden(e.label);a.push(new D({autoWidth:d,columns:i,description:m,flexGrow:p,frozen:b,frozenToEnd:f,grid:t,hidden:r,icon:y,iconText:T,invalid:_,label:C,labelTooltipText:I,menuConfig:v,messages:s,messagesCommon:l,messagesURIUtils:o,resizable:E,textAlign:F,textWrap:S,timeZone:j,width:x}))}else if("attachment"===R){if(!this.attachmentsEnabled)return void this._logTemplateWarning("Attachment columns require attachments to be enabled on the table.");a.push(this._generateAttachmentsColumnFromTemplate(e,h))}else if("relationship"===R){if(!this.relatedRecordsEnabled)return void this._logTemplateWarning("Relationship columns require related records to be enabled on the table.");const{relationshipId:t}=e;if(null==t)return void this._logTemplateWarning("Property 'relationshipId' is missing from the provided template.");const i=this.relationshipInfos.find(e=>e.relationshipId===t);if(!i)return void this._logTemplateWarning("Unable to find valid related layer target based on the provided relationship id.");a.push(this._generateRelationshipColumnFromTemplate(i,e,h))}else if(!u)return void this._logTemplateWarning("Value for 'fieldName' property was missing from the provided template.");const O=U||this._isFieldHidden(u);if("column"===R)a.push(new G({autoWidth:d,description:m,direction:c,fieldName:u,flexGrow:p,formatFunction:g,frozen:b,frozenToEnd:f,grid:t,hidden:O,icon:y,iconText:T,initialSortPriority:w,invalid:_,label:C,labelTooltipText:I,menuConfig:v,messages:s,messagesCommon:l,messagesURIUtils:o,resizable:E,sortable:A,textAlign:F,textWrap:S,timeZone:j,width:x}));else if("field"===R){const h=ae(i,e.fieldName);if(!h)return void this._logTemplateWarning("A valid 'field' could not be found for the provided template.");const{editable:u,required:R}=e;a.push(new L({autoWidth:d,description:m,direction:c,editable:u,field:h,fieldName:h.name,flexGrow:p,formatFunction:g,frozen:b,frozenToEnd:f,grid:t,hidden:O,icon:y,iconText:T,initialSortPriority:w,invalid:_,label:C,labelTooltipText:I,layer:i,messages:s,messagesCommon:l,messagesURIUtils:o,menuConfig:v,required:R,resizable:E,sortable:A,store:r,template:e,textAlign:F,textWrap:S,timeZone:j,width:x,view:n,onShowPromptCallback:this._onShowPromptCallback}))}}),a.length?a:null}_generateDefaultFieldColumns(){return this.layer?.fields?.map(e=>this._generateDefaultFieldColumn(e)).filter(l)??[]}_generateDefaultFieldColumn(e,t){const{grid:i,layer:s,messages:l,messagesCommon:o,messagesURIUtils:r,store:n,view:a}=this,h=t?.orderByFields;if(!e.visible||"geometry"===e.type)return null;const d=e.name,m=h?.findIndex(({field:e})=>e&&e===d)??-1,c=m>-1?h?.at(m)?.order:void 0,p=m>-1?m:void 0;return new L({direction:c,field:e,fieldName:d,grid:i,hidden:t?.hidden||this._isFieldHidden(d),initialSortPriority:p,layer:s,messages:l,messagesCommon:o,messagesURIUtils:r,store:n,view:a,onShowPromptCallback:this._onShowPromptCallback})}_generateAttachmentsColumnFromTemplate(e,t){const{grid:i,layer:s,messages:l,messagesCommon:o,messagesURIUtils:r,store:n}=this,{attachmentsViewEnabled:a,autoWidth:h,description:d,flexGrow:m,fieldName:c,formatFunction:p,frozen:u,frozenToEnd:g,icon:b,iconText:f,invalid:y,label:T,labelTooltipText:w,menuConfig:_,resizable:C,textAlign:I,textWrap:v,thumbnailAppearance:E,thumbnailCount:A,thumbnailIconScale:F,thumbnailsEnabled:S,timeZone:j,width:R}=e;return new H({attachmentsViewEnabled:a,autoWidth:h,description:d,fieldName:`${re.attachments}-${t}`,flexGrow:m,formatFunction:p,frozen:u,frozenToEnd:g,grid:i,hidden:!1===e.visible||this._isFieldHidden(T)||this._isFieldHidden(c),icon:b,iconText:f,invalid:y,label:T,labelTooltipText:w,layer:s,menuConfig:_,messages:l,messagesCommon:o,messagesURIUtils:r,resizable:C,store:n,textAlign:I,textWrap:v,thumbnailAppearance:E,thumbnailCount:A,thumbnailIconScale:F,thumbnailsEnabled:S,timeZone:j,width:R,onShowAttachments:e=>this._onShowAttachments(e)})}_generateDefaultAttachmentsColumn(e){const{grid:t,layer:i,messages:s,messagesCommon:l,messagesURIUtils:o,store:r}=this,n=re.attachments;return new H({fieldName:n,grid:t,hidden:e?.hidden||this._isFieldHidden(n),layer:i,messages:s,messagesCommon:l,messagesURIUtils:o,store:r,onShowAttachments:e=>this._onShowAttachments(e)})}_generateRelationshipColumnFromTemplate(e,t,i){const{grid:s,messages:l,messagesCommon:o,messagesURIUtils:r,store:n}=this,{autoWidth:a,collapsed:h,description:d,flexGrow:m,fieldName:c,formatFunction:p,frozen:u,frozenToEnd:g,icon:b,iconText:f,invalid:y,label:T,labelTooltipText:w,menuConfig:_,relationshipId:C,resizable:I,textAlign:v,textWrap:E,timeZone:A,width:F}=t;return new B({autoWidth:a,collapsed:h,description:d,fieldName:`${re.relationship}-${C}-${i}`,flexGrow:m,formatFunction:p,frozen:u,frozenToEnd:g,grid:s,hidden:!1===t.visible||this._isFieldHidden(T)||this._isFieldHidden(c),icon:b,iconText:f,invalid:y,label:T,labelTooltipText:w,menuConfig:_,messages:l,messagesCommon:o,messagesURIUtils:r,relationshipId:C,resizable:I,store:n,textAlign:v,textWrap:E,timeZone:A,width:F,layer:e.relatedLayer,relatedLayer:e.layer,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateDefaultRelationshipColumns(){const{relationshipInfos:e,relationshipColumnConfigs:t}=this,i=[];return e?.length?(t?t.forEach((t,s)=>{const{relationshipId:l}=t,o=e.find(e=>e.relationshipId===l);o&&i.push(this._generateDefaultRelationshipColumn({config:t,index:s,info:o}))}):e.forEach((e,t)=>i.push(this._generateDefaultRelationshipColumn({index:t,info:e}))),i):i}_generateDefaultRelationshipColumn(e){const{config:t,hidden:i,index:s,info:l}=e,{grid:o,messages:r,messagesCommon:n,messagesURIUtils:a}=this,{relationshipId:h}=l;return new B({...t,fieldName:`${re.relationship}-${h}-${s}`,grid:o,hidden:i,messages:r,messagesCommon:n,messagesURIUtils:a,layer:l.relatedLayer,relatedLayer:l.layer,relationshipId:h,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateActionColumn(){return new P({hidden:this._isFieldHidden(re.action),...this.actionColumnConfig})}_isFieldHidden(e){const t=e?.toLowerCase();return(this.hiddenFields??this._defaultHiddenFields).some(e=>e.toLowerCase()===t)}_addTableHighlight(e){if(!this.highlightEnabled)return;const{_highlightableLayerView:t,layer:i}=this;if(t&&i){const s=this.store.getItemByObjectId(e),l=s?.feature??e;this._highlights.add(t.highlight(l,{name:O}),de(i,e))}}_removeTableHighlight(e){const{layer:t}=this;t&&this._highlights.remove(de(t,e))}async _syncTemporaryHighlight(e,t){if(!this.highlightEnabled)return this._currentTemporaryHighlight?.handle.remove(),void(this._currentTemporaryHighlight=null);if(await u(25),g(t),!this._currentTemporaryHighlight&&!e)return;const{id:i}=this._currentTemporaryHighlight??{};if(i===e)return;this._currentTemporaryHighlight?.handle?.remove(),this._currentTemporaryHighlight=null;const{_highlightableLayerView:s,layer:l,highlightEnabled:o}=this;e&&s&&l&&o&&(this._currentTemporaryHighlight={id:e,handle:s.highlight(e,{name:V})})}_syncSelection(){this._highlights.removeAll(),this._tableHighlightsReady?this.highlightIds.forEach(e=>this._addTableHighlight(e)):this._viewSelectionReady&&(this.highlightIds.items=this._viewSelection)}_appendToViewSelection(e){const{_selectableLayer:t}=this;t&&this._selectionManager?.appendToSelection(t,e)}_removeFromViewSelection(e){const{_selectableLayer:t}=this;t&&this._selectionManager?.removeFromSelection(t,e)}async _onHighlightIdsChange(e){const{added:t,removed:i}=e,{attachmentsViewOptions:s}=this;if(this._tableHighlightsReady?(i.forEach(e=>this._removeTableHighlight(e)),t.forEach(e=>this._addTableHighlight(e))):this._viewSelectionReady&&(this._removeFromViewSelection(i),this._appendToViewSelection(t)),this.filterBySelectionEnabled&&this._syncObjectIdsWithStore(this.highlightIds.toArray()),null!=s.objectId){const e=this.highlightIds.at(0);if(null!=e){const t=await this.store.getAttachmentsByObjectId(e,!0);s.set({attachmentInfos:t,objectId:e,mode:t.length?"list":"file"})}}}_onShowRelatedTable(e){const{highlightIds:t}=this,{objectId:i}=e;t.removeAll(),t.add(i),this.showRelatedTableCallback?this.showRelatedTableCallback(e):this.emit("show-related-table",e)}_onObjectIdsChange(){const e=this.objectIds.toArray();e.length&&this.filterBySelectionEnabled&&(this.filterBySelectionEnabled=!1,this._logWarning("Object ID filter was applied while a selection filter was applied. Selection filter has been removed.")),this._syncObjectIdsWithStore(e)}_syncObjectIdsWithStore(e){this.store.objectIds=e,this.refreshPageCache()}_drainColumns(){this.columns.drain(e=>!e.destroyed&&e.destroy())}_showAllRelatedTables(e){const t=e.layer;if(!t)return;const i=this._getDefaultLayerDisplayField(t);e.set({relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForShowAllTablesView(e,i)});const s=e.hiddenFields;s.includes(re.action)||s.add(re.action),s.includes(re.attachments)||s.add(re.attachments)}_hideAllRelatedTables(e){const{layer:t,relationship:i}=e;if(t&&null!=i?.id)if(null!=e.attachmentsViewOptions.objectId){const i=this._getDefaultLayerDisplayField(t);e.set({multipleSelectionEnabled:!1,relationshipColumnConfigs:[],showAllRelatedTables:!1,tableTemplateOverride:this._getTableTemplateForAttachmentsView(i)})}else e.set({multipleSelectionEnabled:!0,relationshipColumnConfigs:me(t,i.id),showAllRelatedTables:!1,tableTemplateOverride:null}),e.hiddenFields.removeMany([re.action,re.attachments])}_getTableTemplateForRelatedTableView(e,t,i){return new te({columnTemplates:[new Y({fieldName:t,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map(([s,l])=>({selected:s===t,label:l||s,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForRelatedTableView(e,s,i)}}))},resizable:!1}),new ee({autoWidth:!1,collapsed:!0,flexGrow:0,label:"",resizable:!1,relationshipId:i,width:ge})]})}_getTableTemplateForShowAllTablesView(e,t){const i=[new Y({fieldName:t,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map(([i,s])=>({selected:i===t,label:s||i,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForShowAllTablesView(e,i)}}))},resizable:!1})];return null!=e.attachmentsViewOptions.objectId&&i.push(new M({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:ge})),new te({columnTemplates:i})}async _onShowPromptCallback(e){const{column:t,objectId:i,oldValue:s,value:l}=e,{_subtypes:o,layer:r}=this;if(!r||!o.length)return void t.cancel();const n=o.find(e=>e.code===l);if(!n)return void t.cancel();const a=b(),h=this._createSubtypeEditPrompt(s,n,a),d=!!r.parent;try{this.showPrompt(h);const e=await a.promise,s=[{fieldName:t.fieldName,value:l}];switch(e){case"update-fields":for(const[e,t]of Object.entries(n.defaultValues))null!=t&&s.push({fieldName:e,value:t});await t.updateItems({objectId:i,updates:s}),d&&this.refresh();break;case"keep-existing":await t.updateItems({objectId:i,updates:s}),d&&this.refresh();break;case"undo":t.cancel()}}finally{this.clearPrompt()}}_createSubtypeEditPrompt(e,t,s){const{_subtypes:l,messages:o,messagesCommon:r}=this,n=l.find(t=>t.code===e)?.name??`${e}`;let a="update-fields";const h=[{label:o.subtypes.useDefaultValuesOption,value:"update-fields"},{label:o.subtypes.keepCurrentValuesOption,value:"keep-existing"}];return{context:"info",title:o.subtypes.changeWarningTitle,message:i(o.subtypes.changeWarning,{originalType:n,newType:t.name}),radios:h,defaultRadioSelection:"update-fields",onRadioSelection:e=>{a=e},actions:{primary:{label:r.apply,action:()=>s.resolve(a),type:"positive"},secondary:{label:r.cancel,type:"neutral",action:()=>s.resolve("undo")}},cancel:()=>s.reject()}}_onShowAttachments({objectId:e}){this.attachmentsViewOptions.objectId=e}_getTableTemplateForAttachmentsView(e){return new te({columnTemplates:[new Y({fieldName:e,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(this).map(([t,i])=>({selected:t===e,label:i||t,clickFunction:()=>{this.tableTemplateOverride=this._getTableTemplateForAttachmentsView(t)}}))},resizable:!1}),new M({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:ge})]})}_extractFieldColumnInfosFromTableTemplate(e){const t=e??this,{layer:i,tableTemplate:s}=t;return s?s.columnTemplates.filter(({type:e})=>"field"===e||"column"===e).map(({fieldName:e,label:t})=>{if(null!=t&&""!==t)return[e,t];const s=i?.fieldsIndex.get(e);return[e,s&&I(s,i)]}):i?.fields.map(e=>[e.name,I(e,i)])??[]}_getDefaultLayerDisplayField(e){const{displayField:t,objectIdField:i}=e;return t&&""!==t.trim()?t:i||(e.fields.length?e.fields[0].name:"")}_getIndexOfFirstFrozenToEndColumn(){const e=this.columns.findIndex(e=>e.frozenToEnd);return e>-1?e:void 0}_logWarning(e,t){t?d.getLogger(this).warnOnce(e):d.getLogger(this).warn(e)}_logTemplateWarning(e){this._logWarning(`${e} Skipped generating a column using the provided template.`,!0)}_onCellInteraction(e){null!=e&&null!=this.attachmentsViewOptions.objectId&&this.highlightIds.add(e)}};e([_()],be.prototype,"_defaultHiddenFields",null),e([_()],be.prototype,"_effectiveTableTemplate",null),e([_()],be.prototype,"_effectiveAttributeTableTemplate",null),e([_()],be.prototype,"_highlights",void 0),e([_()],be.prototype,"_highlightableLayerView",null),e([_()],be.prototype,"_selectionManager",null),e([_()],be.prototype,"_selectableLayer",null),e([_()],be.prototype,"_subtypes",null),e([_()],be.prototype,"_tableHighlightsReady",null),e([_()],be.prototype,"_viewSelection",null),e([_()],be.prototype,"_viewSelectionReady",null),e([_()],be.prototype,"activeFilters",null),e([_({readOnly:!0})],be.prototype,"activeSortOrders",null),e([_()],be.prototype,"allRelatedTablesVisible",null),e([_()],be.prototype,"attachmentsColumns",null),e([_()],be.prototype,"attachmentsEnabled",null),e([_()],be.prototype,"attachmentsViewOptions",void 0),e([_({type:R})],be.prototype,"attributeTableTemplate",void 0),e([_()],be.prototype,"autoRefreshEnabled",void 0),e([_()],be.prototype,"clearPrompt",null),e([_({readOnly:!0})],be.prototype,"columns",void 0),e([_()],be.prototype,"dataProvider",void 0),e([_()],be.prototype,"definitionExpression",null),e([_()],be.prototype,"fieldColumns",null),e([_({types:v})],be.prototype,"filterGeometry",null),e([_()],be.prototype,"filterBySelectionEnabled",null),e([_({readOnly:!0})],be.prototype,"grid",void 0),e([_()],be.prototype,"hiddenFields",null),e([_()],be.prototype,"highlightEnabled",void 0),e([_()],be.prototype,"initialSize",null),e([_()],be.prototype,"isQueryingOrSyncing",null),e([_()],be.prototype,"isSyncingAttachments",null),e([_()],be.prototype,"layer",null),e([_()],be.prototype,"layers",void 0),e([_()],be.prototype,"layerFieldConfigurations",null),e([_()],be.prototype,"layerView",null),e([_()],be.prototype,"menuConfig",void 0),e([_()],be.prototype,"messages",void 0),e([_(),ue("esri/t9n/common")],be.prototype,"messagesCommon",void 0),e([_(),ue("esri/core/t9n/Units")],be.prototype,"messagesUnits",void 0),e([_(),ue("esri/widgets/support/t9n/uriUtils")],be.prototype,"messagesURIUtils",void 0),e([_()],be.prototype,"outFields",null),e([_()],be.prototype,"prompt",void 0),e([_()],be.prototype,"relatedRecordsEnabled",null),e([_()],be.prototype,"relatedTable",null),e([_()],be.prototype,"relatedTables",void 0),e([_()],be.prototype,"relationship",null),e([_()],be.prototype,"relationshipColumnConfigs",void 0),e([_()],be.prototype,"relationshipColumns",null),e([_()],be.prototype,"relationshipConfig",null),e([_()],be.prototype,"relationshipInfos",null),e([_()],be.prototype,"relationships",null),e([_()],be.prototype,"returnGeometryEnabled",null),e([_()],be.prototype,"returnMEnabled",null),e([_()],be.prototype,"returnZEnabled",null),e([_()],be.prototype,"selectionSource",void 0),e([_()],be.prototype,"showAllRelatedTables",null),e([_()],be.prototype,"showPrompt",null),e([_()],be.prototype,"showRelatedTableCallback",void 0),e([_({readOnly:!0,type:X})],be.prototype,"store",void 0),e([_()],be.prototype,"supportsAttachments",null),e([_()],be.prototype,"supportsAddAttachments",null),e([_()],be.prototype,"supportsDeleteAttachments",null),e([_()],be.prototype,"supportsResizeAttachments",null),e([_()],be.prototype,"supportsUpdateAttachments",null),e([_()],be.prototype,"syncTemplateOnChangesEnabled",void 0),e([_()],be.prototype,"tableController",void 0),e([_()],be.prototype,"tableParent",void 0),e([_({type:te})],be.prototype,"tableTemplate",void 0),e([_()],be.prototype,"tableTemplateOverride",void 0),e([_({type:U})],be.prototype,"timeExtent",null),e([_()],be.prototype,"timeZone",null),e([_()],be.prototype,"view",null),be=e([C("esri.widgets.FeatureTable.FeatureTableViewModel")],be);const fe=be;export{fe as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{watch as i,when as n,initial as o}from"../../../core/reactiveUtils.js";import{renderingSanitizer as s,stripHTMLSanitizer as l}from"../../../core/sanitizerUtils.js";import{property as r,subclass as a}from"../../../core/accessorSupport/decorators.js";import{css as c}from"./ColumnCSS.js";import{isEmptyStringOrWhitespace as d}from"../support/tableUtils.js";import{autoLink as p}from"../../support/uriUtils.js";import{setFocus as u}from"../../support/widgetUtils.js";const m=/<br\s*\/*>/gi;let h=class extends t{constructor(e){super(e),this._menuIsOpen=!1,this.autoWidth=!1,this.cellValueFormatFunction=({root:e,rowData:t,value:i})=>{const{formatFunction:n}=this,o=this.sanitizeContent(i);if(n&&t){const{index:i,item:{attachments:s,feature:l,relatedRecords:r}}=t;return n({attachments:s,column:this,feature:l,index:i,relatedRecords:r,value:o,virtualIndex:this.getVirtualRowIndex(e),field:void 0})}return o},this.description=null,this.direction=null,this.fieldName=null,this.flexGrow=1,this.footerRenderFunction=null,this.formatFunction=null,this.frozen=!1,this.frozenToEnd=!1,this.grid=null,this.headerRenderFunction=e=>{const{root:t}=e,i=this.createHeaderContent();this.removeCellContent(t),t.appendChild(i)},this.hidden=!1,this.icon=null,this.iconText=null,this.initialSortPriority=null,this.label=null,this.labelTooltipText=null,this.menuConfig=null,this.messages=null,this.messagesCommon=null,this.messagesURIUtils=null,this.renderFunction=({root:e,rowData:t})=>{const i=this.getCellValue(t),n=this.cellValueFormatFunction({root:e,rowData:t,value:i});let o=null;if(o=n instanceof HTMLElement?n:p(this.messagesURIUtils,n),this.removeCellContent(e),o instanceof HTMLElement)e.removeAttribute("title"),e.appendChild(o);else if(null!=o){const t=o.toString();e.innerHTML=t,e.title=t}},this.resizable=!0,this.sortable=!1,this.store=null,this.tableTimeZone=null,this.textAlign="start",this.textWrap=!1,this.timeZone=null,this.visibleElements=null,this.width=200}initialize(){const{fieldName:e}=this;this._set("sortElement",this.createSortElement()),this.sortElement.setAttribute("path",e),this.addHandles([i(()=>this.direction,e=>{const{sortElement:t}=this;this.effectiveSortable&&t&&(e?this.sortElement.direction!==e&&t.setAttribute("direction",e):t.removeAttribute("direction"))}),n(()=>this.grid?.isReady&&this.sortElement,()=>{const{direction:e,grid:t,hidden:i,sortElement:n}=this;i&&e&&n&&t&&!t.hasSorter(n)&&t.addSorter(n)},o),i(()=>[this.timeZone,this.icon,this.iconText,this.labelTooltipText],()=>this.grid?.requestContentUpdate()),i(()=>this.hidden,()=>this.closeMenu()),i(()=>this.fieldName,e=>{const{sortElement:t}=this;t&&t.path!==e&&t.setAttribute("path",e)}),i(()=>[this.effectiveLabel,this.labelTooltipText],([e,t])=>{const{sortElement:i}=this;i&&(i.setAttribute("title",t||e),i.textContent=e)})])}get _headerRequiresTextContainer(){return!(!this.effectiveSortable&&""===this.effectiveLabel&&null==this.effectiveDescription)}get customMenuItems(){return this.menuConfig?.items?.map(({disabled:e,hidden:t,icon:i,iconClass:n,label:o,selected:s,clickFunction:l})=>this.createCalciteDropdownItem({disabled:e,hidden:t,iconClass:n,iconStart:i,selected:s,textContent:o,onclick:e=>l(e)}))??[]}get defaultMenuItems(){if(!this.effectiveSortable)return[];const e=this.messages,t=[],i=this.visibleElements?.columnMenuItems;if(!1!==i?.sortAscending){const i=this.createCalciteDropdownItem({iconStart:"sort-ascending-arrow",textContent:e?.sortAsc,onclick:()=>this.direction="asc"});t.push(i)}if(!1!==i?.sortDescending){const i=this.createCalciteDropdownItem({iconStart:"sort-descending-arrow",textContent:e?.sortDesc,onclick:()=>this.direction="desc"});t.push(i)}return t}get effectiveDescription(){const{description:e}=this;return d(e)?null:this.sanitizeLabel(e)}get effectiveLabel(){return this.sanitizeLabel(this.label||this.fieldName)}get effectiveSortable(){return this.sortable}get iconNode(){const{icon:e,iconText:t}=this,i=t?this.sanitizeLabel(t):void 0;return e?this.createCalciteIcon({icon:e,textLabel:i}):null}set invalid(e){this._set("invalid",e),this.grid?.generateCellPartNames()}get invalid(){return this._get("invalid")??!1}get menu(){const{customMenuItems:e,defaultMenuItems:t,menuConfig:i}=this,n=!!i?.open,o=this.createCalciteAction({icon:i?.icon??"ellipsis",text:this.messages?.menu??"",slot:"trigger"}),s=document.createElement("calcite-dropdown");if(s.maxItems=i?.maxItems??4,s.placement="top-end",s.scale=i?.scale??"m",n&&(s.open=n,this._menuIsOpen=!0),s.appendChild(o),s.addEventListener("calciteDropdownOpen",()=>this._menuIsOpen=!0),s.addEventListener("calciteDropdownClose",()=>this._menuIsOpen=!1),s.onkeydown=this._stopPropagationOnSelect,s.addEventListener("mousewheel",e=>{e.stopPropagation()}),t.length){const e=s.appendChild(document.createElement("calcite-dropdown-group"));e.selectionMode="none",e.append(...t)}if(e.length){const t=s.appendChild(document.createElement("calcite-dropdown-group"));t.selectionMode=i?.selectionMode??"none",t.append(...e)}return s}get menuItems(){return[...this.defaultMenuItems,...this.customMenuItems]}get menuIsOpen(){return this._menuIsOpen}get menuIsVisible(){return!(!1===this.visibleElements?.columnMenus||!this.menuItems.length)}closeMenu(){this.menu.open=!1}createSortElement(){const{effectiveLabel:e,direction:t,fieldName:i,initialSortPriority:n}=this,o=document.createElement("vaadin-grid-sorter");return o.classList.add(c.sorter),o.setAttribute("path",i),o.setAttribute("title",this.labelTooltipText||e),o.textContent=e,t&&o.setAttribute("direction",t),null!=n&&(o._initialOrder=n),o.addEventListener("direction-changed",()=>{this.direction!==o.direction&&this._set("direction",o.direction)}),o}createCalciteAction(e){const t=document.createElement("calcite-action"),{alignment:i,appearance:n,className:o,disabled:s,icon:l,label:r,scale:a,slot:c,text:d,textEnabled:p,onclick:u}=e;return t.alignment=i??"center",t.appearance=n??"transparent",t.className=o??"",t.disabled=!!s,t.icon=l??"",t.label=r??"",t.scale=a??"s",t.slot=c??"",t.text=t.title=d??"",t.textEnabled=!!p,t.onclick=u??null,t}createCalciteButton(e){const t=document.createElement("calcite-button"),{alignment:i,appearance:n,className:o,disabled:s,iconEnd:l,iconFlipRtl:r,kind:a,loading:c,onclick:d,scale:p,textContent:u,title:m,width:h}=e;return t.alignment=i??"center",t.className=o??"",t.scale=p??"s",t.appearance=n??"transparent",t.disabled=!!s,t.iconEnd=l??"",r&&(t.iconFlipRtl=r),t.kind=a??"brand",t.loading=!!c,t.textContent=u??"",m&&(t.title=m),t.width=h??"auto",t.onclick=d??null,t}createCalciteDropdownItem(e){const t=document.createElement("calcite-dropdown-item"),{disabled:i,hidden:n,iconClass:o,iconStart:s,textContent:l,onclick:r,selected:a}=e,d=l??"";if(o&&!s){const e=document.createElement("span"),i=document.createElement("span");i.classList.add(c.headerMenuIcon,o),e.textContent=e.title=d,e.insertBefore(i,e.firstChild),t.appendChild(e)}else t.iconStart=s??"",t.textContent=t.title=d;return t.disabled=!!i,t.hidden="function"==typeof n?n():!!n,t.selected=!!a,r&&(t.addEventListener("calciteDropdownItemSelect",r),t.onkeydown=this._stopPropagationOnSelect),t}createCalciteIcon(e){const{effectiveLabel:t}=this,{icon:i,scale:n,textLabel:o}=e,s=document.createElement("calcite-icon"),l=o??t;return s.icon=i,s.scale=n??"s",s.textLabel=l,s.title=l,s}createHeaderContent(){const{effectiveDescription:e,effectiveLabel:t,iconNode:i}=this,n=document.createElement("div");if(n.classList.add(c.headerContent),i&&n.appendChild(i),!this._headerRequiresTextContainer)return n;const o=n.appendChild(document.createElement("div"));return this.effectiveSortable?o.appendChild(this.sortElement):""!==t&&o.appendChild(this._createHeaderTextElement({label:t,cssClass:c.headerLabel,title:this.labelTooltipText})),null!=e&&!1!==this.visibleElements?.columnDescriptions&&o.appendChild(this._createHeaderTextElement({label:e,cssClass:c.headerDescription})),this.menuIsVisible&&n.appendChild(this.menu),n}getCellValue(e){return e?.item.feature.attributes?.[this.fieldName]}getVirtualRowIndex(e){const t=this.grid?.getRowContainingNode(e);return t?.parentElement?[...t.parentElement.children].indexOf(t):-1}removeCellContent(e){if(e&&e.firstChild)try{for(;e?.firstChild;)e?.removeChild(e.firstChild)}catch(t){}}openMenu(){this.menuIsVisible&&(this.menu.open=!0,u(this.menuItems[0]))}sanitizeContent(e){return s.sanitize(e)}sanitizeLabel(e){return null==e||""===e?"":l.sanitize(e.toString()).replaceAll(m," ")}sort(){this.effectiveSortable&&this.sortElement?.click()}_stopPropagationOnSelect(e){"Enter"!==e.key&&" "!==e.key||e.stopPropagation()}_createHeaderTextElement({cssClass:e,label:t,title:i}){const n=document.createElement("span");n.classList.add(e);const o=n.appendChild(document.createElement("span"));return o.textContent=t,o.setAttribute("title",i||t),n}};e([r()],h.prototype,"_headerRequiresTextContainer",null),e([r()],h.prototype,"_menuIsOpen",void 0),e([r()],h.prototype,"autoWidth",void 0),e([r()],h.prototype,"cellValueFormatFunction",void 0),e([r()],h.prototype,"customMenuItems",null),e([r()],h.prototype,"defaultMenuItems",null),e([r()],h.prototype,"description",void 0),e([r()],h.prototype,"direction",void 0),e([r()],h.prototype,"effectiveDescription",null),e([r()],h.prototype,"effectiveLabel",null),e([r()],h.prototype,"effectiveSortable",null),e([r({constructOnly:!0})],h.prototype,"fieldName",void 0),e([r()],h.prototype,"flexGrow",void 0),e([r()],h.prototype,"footerRenderFunction",void 0),e([r()],h.prototype,"formatFunction",void 0),e([r()],h.prototype,"frozen",void 0),e([r()],h.prototype,"frozenToEnd",void 0),e([r()],h.prototype,"grid",void 0),e([r()],h.prototype,"iconNode",null),e([r()],h.prototype,"invalid",null),e([r()],h.prototype,"headerRenderFunction",void 0),e([r()],h.prototype,"hidden",void 0),e([r()],h.prototype,"icon",void 0),e([r()],h.prototype,"iconText",void 0),e([r({constructOnly:!0})],h.prototype,"initialSortPriority",void 0),e([r()],h.prototype,"label",void 0),e([r()],h.prototype,"labelTooltipText",void 0),e([r()],h.prototype,"menu",null),e([r()],h.prototype,"menuItems",null),e([r()],h.prototype,"menuConfig",void 0),e([r()],h.prototype,"menuIsOpen",null),e([r()],h.prototype,"menuIsVisible",null),e([r()],h.prototype,"messages",void 0),e([r()],h.prototype,"messagesCommon",void 0),e([r()],h.prototype,"messagesURIUtils",void 0),e([r()],h.prototype,"renderFunction",void 0),e([r()],h.prototype,"resizable",void 0),e([r()],h.prototype,"sortable",void 0),e([r({readOnly:!0})],h.prototype,"sortElement",void 0),e([r()],h.prototype,"store",void 0),e([r()],h.prototype,"tableTimeZone",void 0),e([r()],h.prototype,"textAlign",void 0),e([r()],h.prototype,"textWrap",void 0),e([r()],h.prototype,"timeZone",void 0),e([r()],h.prototype,"visibleElements",void 0),e([r()],h.prototype,"width",void 0),h=e([a("esri.widgets.FeatureTable.Grid.Column")],h);const f=h;export{f as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{watch as i,when as n,initial as o}from"../../../core/reactiveUtils.js";import{renderingSanitizer as s,stripHTMLSanitizer as l}from"../../../core/sanitizerUtils.js";import{property as r,subclass as a}from"../../../core/accessorSupport/decorators.js";import{css as c}from"./ColumnCSS.js";import{isEmptyStringOrWhitespace as d}from"../support/tableUtils.js";import{autoLink as p}from"../../support/uriUtils.js";import{setFocus as u}from"../../support/widgetUtils.js";const m=/<br\s*\/*>/gi;let h=class extends t{constructor(e){super(e),this._menuIsOpen=!1,this.autoWidth=!1,this.cellValueFormatFunction=({root:e,rowData:t,value:i})=>{const{formatFunction:n}=this,o=this.sanitizeContent(i);if(n&&t){const{index:i,item:{attachments:s,feature:l,relatedRecords:r}}=t;return n({attachments:s,column:this,feature:l,index:i,relatedRecords:r,value:o,virtualIndex:this.getVirtualRowIndex(e),field:void 0})}return o},this.description=null,this.direction=null,this.fieldName=null,this.flexGrow=1,this.footerRenderFunction=null,this.formatFunction=null,this.frozen=!1,this.frozenToEnd=!1,this.grid=null,this.headerRenderFunction=e=>{const{root:t}=e,i=this.createHeaderContent();this.removeCellContent(t),t.appendChild(i)},this.hidden=!1,this.icon=null,this.iconText=null,this.initialSortPriority=null,this.label=null,this.labelTooltipText=null,this.menuConfig=null,this.messages=null,this.messagesCommon=null,this.messagesURIUtils=null,this.renderFunction=({root:e,rowData:t})=>{const i=this.getCellValue(t),n=this.cellValueFormatFunction({root:e,rowData:t,value:i});let o=null;if(o=n instanceof HTMLElement?n:p(this.messagesURIUtils,n),this.removeCellContent(e),o instanceof HTMLElement)e.removeAttribute("title"),e.appendChild(o);else if(null!=o){const t=o.toString();e.innerHTML=t,e.title=t}},this.resizable=!0,this.sortable=!1,this.store=null,this.textAlign="start",this.textWrap=!1,this.timeZone=null,this.visibleElements=null,this.width=200}initialize(){const{fieldName:e}=this;this._set("sortElement",this.createSortElement()),this.sortElement.setAttribute("path",e),this.addHandles([i(()=>this.direction,e=>{const{sortElement:t}=this;this.effectiveSortable&&t&&(e?this.sortElement.direction!==e&&t.setAttribute("direction",e):t.removeAttribute("direction"))}),n(()=>this.grid?.isReady&&this.sortElement,()=>{const{direction:e,grid:t,hidden:i,sortElement:n}=this;i&&e&&n&&t&&!t.hasSorter(n)&&t.addSorter(n)},o),i(()=>[this.timeZone,this.icon,this.iconText,this.labelTooltipText],()=>this.grid?.requestContentUpdate()),i(()=>this.hidden,()=>this.closeMenu()),i(()=>this.fieldName,e=>{const{sortElement:t}=this;t&&t.path!==e&&t.setAttribute("path",e)}),i(()=>[this.effectiveLabel,this.labelTooltipText],([e,t])=>{const{sortElement:i}=this;i&&(i.setAttribute("title",t||e),i.textContent=e)})])}get _headerRequiresTextContainer(){return!(!this.effectiveSortable&&""===this.effectiveLabel&&null==this.effectiveDescription)}get customMenuItems(){return this.menuConfig?.items?.map(({disabled:e,hidden:t,icon:i,iconClass:n,label:o,selected:s,clickFunction:l})=>this.createCalciteDropdownItem({disabled:e,hidden:t,iconClass:n,iconStart:i,selected:s,textContent:o,onclick:e=>l(e)}))??[]}get defaultMenuItems(){if(!this.effectiveSortable)return[];const e=this.messages,t=[],i=this.visibleElements?.columnMenuItems;if(!1!==i?.sortAscending){const i=this.createCalciteDropdownItem({iconStart:"sort-ascending-arrow",textContent:e?.sortAsc,onclick:()=>this.direction="asc"});t.push(i)}if(!1!==i?.sortDescending){const i=this.createCalciteDropdownItem({iconStart:"sort-descending-arrow",textContent:e?.sortDesc,onclick:()=>this.direction="desc"});t.push(i)}return t}get effectiveDescription(){const{description:e}=this;return d(e)?null:this.sanitizeLabel(e)}get effectiveLabel(){return this.sanitizeLabel(this.label||this.fieldName)}get effectiveSortable(){return this.sortable}get iconNode(){const{icon:e,iconText:t}=this,i=t?this.sanitizeLabel(t):void 0;return e?this.createCalciteIcon({icon:e,textLabel:i}):null}set invalid(e){this._set("invalid",e),this.grid?.generateCellPartNames()}get invalid(){return this._get("invalid")??!1}get menu(){const{customMenuItems:e,defaultMenuItems:t,menuConfig:i}=this,n=!!i?.open,o=this.createCalciteAction({icon:i?.icon??"ellipsis",text:this.messages?.menu??"",slot:"trigger"}),s=document.createElement("calcite-dropdown");if(s.maxItems=i?.maxItems??4,s.placement="top-end",s.scale=i?.scale??"m",n&&(s.open=n,this._menuIsOpen=!0),s.appendChild(o),s.addEventListener("calciteDropdownOpen",()=>this._menuIsOpen=!0),s.addEventListener("calciteDropdownClose",()=>this._menuIsOpen=!1),s.onkeydown=this._stopPropagationOnSelect,s.addEventListener("mousewheel",e=>{e.stopPropagation()}),t.length){const e=s.appendChild(document.createElement("calcite-dropdown-group"));e.selectionMode="none",e.append(...t)}if(e.length){const t=s.appendChild(document.createElement("calcite-dropdown-group"));t.selectionMode=i?.selectionMode??"none",t.append(...e)}return s}get menuItems(){return[...this.defaultMenuItems,...this.customMenuItems]}get menuIsOpen(){return this._menuIsOpen}get menuIsVisible(){return!(!1===this.visibleElements?.columnMenus||!this.menuItems.length)}get tableTimeZone(){return this.store.timeZone}closeMenu(){this.menu.open=!1}createSortElement(){const{effectiveLabel:e,direction:t,fieldName:i,initialSortPriority:n}=this,o=document.createElement("vaadin-grid-sorter");return o.classList.add(c.sorter),o.setAttribute("path",i),o.setAttribute("title",this.labelTooltipText||e),o.textContent=e,t&&o.setAttribute("direction",t),null!=n&&(o._initialOrder=n),o.addEventListener("direction-changed",()=>{this.direction!==o.direction&&this._set("direction",o.direction)}),o}createCalciteAction(e){const t=document.createElement("calcite-action"),{alignment:i,appearance:n,className:o,disabled:s,icon:l,label:r,scale:a,slot:c,text:d,textEnabled:p,onclick:u}=e;return t.alignment=i??"center",t.appearance=n??"transparent",t.className=o??"",t.disabled=!!s,t.icon=l??"",t.label=r??"",t.scale=a??"s",t.slot=c??"",t.text=t.title=d??"",t.textEnabled=!!p,t.onclick=u??null,t}createCalciteButton(e){const t=document.createElement("calcite-button"),{alignment:i,appearance:n,className:o,disabled:s,iconEnd:l,iconFlipRtl:r,kind:a,loading:c,onclick:d,scale:p,textContent:u,title:m,width:h}=e;return t.alignment=i??"center",t.className=o??"",t.scale=p??"s",t.appearance=n??"transparent",t.disabled=!!s,t.iconEnd=l??"",r&&(t.iconFlipRtl=r),t.kind=a??"brand",t.loading=!!c,t.textContent=u??"",m&&(t.title=m),t.width=h??"auto",t.onclick=d??null,t}createCalciteDropdownItem(e){const t=document.createElement("calcite-dropdown-item"),{disabled:i,hidden:n,iconClass:o,iconStart:s,textContent:l,onclick:r,selected:a}=e,d=l??"";if(o&&!s){const e=document.createElement("span"),i=document.createElement("span");i.classList.add(c.headerMenuIcon,o),e.textContent=e.title=d,e.insertBefore(i,e.firstChild),t.appendChild(e)}else t.iconStart=s??"",t.textContent=t.title=d;return t.disabled=!!i,t.hidden="function"==typeof n?n():!!n,t.selected=!!a,r&&(t.addEventListener("calciteDropdownItemSelect",r),t.onkeydown=this._stopPropagationOnSelect),t}createCalciteIcon(e){const{effectiveLabel:t}=this,{icon:i,scale:n,textLabel:o}=e,s=document.createElement("calcite-icon"),l=o??t;return s.icon=i,s.scale=n??"s",s.textLabel=l,s.title=l,s}createHeaderContent(){const{effectiveDescription:e,effectiveLabel:t,iconNode:i}=this,n=document.createElement("div");if(n.classList.add(c.headerContent),i&&n.appendChild(i),!this._headerRequiresTextContainer)return n;const o=n.appendChild(document.createElement("div"));return this.effectiveSortable?o.appendChild(this.sortElement):""!==t&&o.appendChild(this._createHeaderTextElement({label:t,cssClass:c.headerLabel,title:this.labelTooltipText})),null!=e&&!1!==this.visibleElements?.columnDescriptions&&o.appendChild(this._createHeaderTextElement({label:e,cssClass:c.headerDescription})),this.menuIsVisible&&n.appendChild(this.menu),n}getCellValue(e){return e?.item.feature.attributes?.[this.fieldName]}getVirtualRowIndex(e){const t=this.grid?.getRowContainingNode(e);return t?.parentElement?[...t.parentElement.children].indexOf(t):-1}removeCellContent(e){if(e&&e.firstChild)try{for(;e?.firstChild;)e?.removeChild(e.firstChild)}catch(t){}}openMenu(){this.menuIsVisible&&(this.menu.open=!0,u(this.menuItems[0]))}sanitizeContent(e){return s.sanitize(e)}sanitizeLabel(e){return null==e||""===e?"":l.sanitize(e.toString()).replaceAll(m," ")}sort(){this.effectiveSortable&&this.sortElement?.click()}_stopPropagationOnSelect(e){"Enter"!==e.key&&" "!==e.key||e.stopPropagation()}_createHeaderTextElement({cssClass:e,label:t,title:i}){const n=document.createElement("span");n.classList.add(e);const o=n.appendChild(document.createElement("span"));return o.textContent=t,o.setAttribute("title",i||t),n}};e([r()],h.prototype,"_headerRequiresTextContainer",null),e([r()],h.prototype,"_menuIsOpen",void 0),e([r()],h.prototype,"autoWidth",void 0),e([r()],h.prototype,"cellValueFormatFunction",void 0),e([r()],h.prototype,"customMenuItems",null),e([r()],h.prototype,"defaultMenuItems",null),e([r()],h.prototype,"description",void 0),e([r()],h.prototype,"direction",void 0),e([r()],h.prototype,"effectiveDescription",null),e([r()],h.prototype,"effectiveLabel",null),e([r()],h.prototype,"effectiveSortable",null),e([r({constructOnly:!0})],h.prototype,"fieldName",void 0),e([r()],h.prototype,"flexGrow",void 0),e([r()],h.prototype,"footerRenderFunction",void 0),e([r()],h.prototype,"formatFunction",void 0),e([r()],h.prototype,"frozen",void 0),e([r()],h.prototype,"frozenToEnd",void 0),e([r()],h.prototype,"grid",void 0),e([r()],h.prototype,"iconNode",null),e([r()],h.prototype,"invalid",null),e([r()],h.prototype,"headerRenderFunction",void 0),e([r()],h.prototype,"hidden",void 0),e([r()],h.prototype,"icon",void 0),e([r()],h.prototype,"iconText",void 0),e([r({constructOnly:!0})],h.prototype,"initialSortPriority",void 0),e([r()],h.prototype,"label",void 0),e([r()],h.prototype,"labelTooltipText",void 0),e([r()],h.prototype,"menu",null),e([r()],h.prototype,"menuItems",null),e([r()],h.prototype,"menuConfig",void 0),e([r()],h.prototype,"menuIsOpen",null),e([r()],h.prototype,"menuIsVisible",null),e([r()],h.prototype,"messages",void 0),e([r()],h.prototype,"messagesCommon",void 0),e([r()],h.prototype,"messagesURIUtils",void 0),e([r()],h.prototype,"renderFunction",void 0),e([r()],h.prototype,"resizable",void 0),e([r()],h.prototype,"sortable",void 0),e([r({readOnly:!0})],h.prototype,"sortElement",void 0),e([r()],h.prototype,"store",void 0),e([r()],h.prototype,"tableTimeZone",null),e([r()],h.prototype,"textAlign",void 0),e([r()],h.prototype,"textWrap",void 0),e([r()],h.prototype,"timeZone",void 0),e([r()],h.prototype,"visibleElements",void 0),e([r()],h.prototype,"width",void 0),h=e([a("esri.widgets.FeatureTable.Grid.Column")],h);const f=h;export{f as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{on as e,sync as n}from"../../../core/reactiveUtils.js";import{property as i,subclass as o}from"../../../core/accessorSupport/decorators.js";import l from"./Column.js";import{autoLink as r}from"../../support/uriUtils.js";const a={showInput:"Enter",cancelEdit:"Escape"},s=Symbol();let c=class extends l{constructor(t){super(t),this.editInfo=null,this.cellValueValidatorFunction=({oldValue:t,value:e})=>t!==e,this.editable=!0,this.headerRenderFunction=t=>{const{root:e}=t,n=this.createHeaderContent();this.tableEditingEnabled&&!this.effectiveEditable&&n.prepend(this._lockIconNode),this.removeCellContent(e),e.appendChild(n)},this.inputRenderFunction=({root:t,column:e,rowData:n})=>{if(this.editInfo||!this.effectiveEditable||!n)return;const i=this.getCellValue(n),o=this.createInputElement({value:i});this._set("editInfo",{column:e,inputs:[o],root:t,rowData:n,oldValue:i});const l=document.createElement("div");l.appendChild(o),this.removeCellContent(t),t.appendChild(l),o.focus(),o instanceof HTMLInputElement&&o.select()},this.loadingMessage="",this.inputType="text",this.maxLength=null,this.onShowPromptCallback=()=>{},this.parseInputValueFunction=({inputs:t})=>t?.length||1!==t.length||Array.isArray(t[0].value)?null:t[0].value,this.renderFunction=t=>{const{root:e,rowData:n}=t,{editInfo:i}=this;if(i)return;const o=this.getCellValue(n),l=this.cellValueFormatFunction({root:e,rowData:n,value:o});let s=null;e.onclick=()=>e.focus(),e.ondblclick=()=>this.inputRenderFunction(t),e.ontouchend=()=>this.inputRenderFunction(t);const c=this.grid?.getSlotElementByName(e.slot),u=c?.parentElement;u&&!u.onkeydown&&(u.onkeydown=e=>{e.key!==a.showInput||this.editInfo||this.inputRenderFunction(t),e.key===a.cancelEdit&&this.editInfo&&this.cancel()}),null!=o&&null!=l?e.title=l.toString():e.title&&e.removeAttribute("title"),s=l instanceof HTMLElement?l:r(this.messagesURIUtils,l),this.removeCellContent(e),s instanceof HTMLElement?e.appendChild(s):null!=s&&(e.innerHTML=s.toString())},this.required=!1
|
|
5
|
+
import{__decorate as t}from"tslib";import{on as e,sync as n}from"../../../core/reactiveUtils.js";import{property as i,subclass as o}from"../../../core/accessorSupport/decorators.js";import l from"./Column.js";import{autoLink as r}from"../../support/uriUtils.js";const a={showInput:"Enter",cancelEdit:"Escape"},s=Symbol();let c=class extends l{constructor(t){super(t),this.editInfo=null,this.cellValueValidatorFunction=({oldValue:t,value:e})=>t!==e,this.editable=!0,this.headerRenderFunction=t=>{const{root:e}=t,n=this.createHeaderContent();this.tableEditingEnabled&&!this.effectiveEditable&&n.prepend(this._lockIconNode),this.removeCellContent(e),e.appendChild(n)},this.inputRenderFunction=({root:t,column:e,rowData:n})=>{if(this.editInfo||!this.effectiveEditable||!n)return;const i=this.getCellValue(n),o=this.createInputElement({value:i});this._set("editInfo",{column:e,inputs:[o],root:t,rowData:n,oldValue:i});const l=document.createElement("div");l.appendChild(o),this.removeCellContent(t),t.appendChild(l),o.focus(),o instanceof HTMLInputElement&&o.select()},this.loadingMessage="",this.inputType="text",this.maxLength=null,this.onShowPromptCallback=()=>{},this.parseInputValueFunction=({inputs:t})=>t?.length||1!==t.length||Array.isArray(t[0].value)?null:t[0].value,this.renderFunction=t=>{const{root:e,rowData:n}=t,{editInfo:i}=this;if(i)return;const o=this.getCellValue(n),l=this.cellValueFormatFunction({root:e,rowData:n,value:o});let s=null;e.onclick=()=>e.focus(),e.ondblclick=()=>this.inputRenderFunction(t),e.ontouchend=()=>this.inputRenderFunction(t);const c=this.grid?.getSlotElementByName(e.slot),u=c?.parentElement;u&&!u.onkeydown&&(u.onkeydown=e=>{e.key!==a.showInput||this.editInfo||this.inputRenderFunction(t),e.key===a.cancelEdit&&this.editInfo&&this.cancel()}),null!=o&&null!=l?e.title=l.toString():e.title&&e.removeAttribute("title"),s=l instanceof HTMLElement?l:r(this.messagesURIUtils,l),this.removeCellContent(e),s instanceof HTMLElement?e.appendChild(s):null!=s&&(e.innerHTML=s.toString())},this.required=!1}get _lockIconNode(){return this.createCalciteIcon({icon:"lock",textLabel:this.messages?.editingPreventedColumn})}get effectiveEditable(){return this.tableEditingEnabled&&this.editable}get effectiveRequired(){return this.required}get editing(){return!!this.editInfo}get shouldShowPrompt(){return!1}get tableEditingEnabled(){return this.store.editingEnabled}cancel(){this.onEditComplete()}createCalciteOption(t,e,n=!1){const i=document.createElement("calcite-option");return i.label=t,i.value=`${e}`,i.selected=n,i}createCalciteSelect(t,e){const{effectiveRequired:n,messages:i}=this;let o=!1;const l=e.map(({name:e,value:n})=>{const i=n===t;return i&&(o=!0),this.createCalciteOption(e,n,i)});if(null!=t&&""!==t&&!o){const e=t.toString(),n=this.createCalciteOption(e,e);l.unshift(n)}n||l.unshift(this.createCalciteOption(`<${i?.noValue}>`,""));const r=document.createElement("calcite-select");return l.forEach(t=>r.appendChild(t)),r}createInputElement({value:t}){const{effectiveRequired:i,maxLength:o}=this,l=document.createElement("calcite-input");return null!=o&&(l.maxLength=o),l.required=i,l.value=null!=t?t.toString():"",this.addHandles([e(()=>l,"calciteInputChange",()=>this.onInputBlur(),n),e(()=>l,"keydown",t=>{t.key===a.cancelEdit&&this.onInputBlur(!0)},n),e(()=>l,"blur",()=>this.onInputBlur(),n)],s),l}createDateComponent(){const t=document.createElement("calcite-input-date-picker");return t.focusTrapDisabled=!0,t.overlayPositioning="fixed",t}createTimeComponent(){const t=document.createElement("calcite-input-time-picker");return t.overlayPositioning="fixed",t.placement="auto-start",t.step=1,t}createTimeZoneComponent(){const t=document.createElement("calcite-input-time-zone");return t.maxItems=4,t.overlayPositioning="fixed",t}onEditComplete(){this._set("editInfo",null),this.grid?.generateCellPartNames(),this.grid?.requestContentUpdate()}onInputBlur(t=!1){this.removeHandles(s),t?this.cancel():this.submit()}async submit(){const{editInfo:t}=this;if(!t)return void this.cancel();const{inputs:e,rowData:n,oldValue:i}=t,o=this.parseInputValueFunction({inputs:e});if(!this.cellValueValidatorFunction({value:o,oldValue:i}))return void this.cancel();const{root:l}=t,r=n.item.objectId,{fieldName:a}=this;l.textContent=this.loadingMessage,this.shouldShowPrompt?this.onShowPromptCallback({column:this,objectId:r,oldValue:i,value:o}):await this.updateItems({objectId:r,updates:[{fieldName:a,value:o}]})}async updateItems(t){try{await this.store.updateItem(t),this.onEditComplete()}catch{this.cancel()}}};t([i()],c.prototype,"_lockIconNode",null),t([i({readOnly:!0})],c.prototype,"editInfo",void 0),t([i()],c.prototype,"cellValueValidatorFunction",void 0),t([i()],c.prototype,"editable",void 0),t([i()],c.prototype,"effectiveEditable",null),t([i()],c.prototype,"effectiveRequired",null),t([i()],c.prototype,"editing",null),t([i()],c.prototype,"headerRenderFunction",void 0),t([i()],c.prototype,"inputRenderFunction",void 0),t([i({constructOnly:!0})],c.prototype,"loadingMessage",void 0),t([i()],c.prototype,"inputType",void 0),t([i()],c.prototype,"maxLength",void 0),t([i()],c.prototype,"onShowPromptCallback",void 0),t([i()],c.prototype,"parseInputValueFunction",void 0),t([i()],c.prototype,"renderFunction",void 0),t([i()],c.prototype,"required",void 0),t([i()],c.prototype,"shouldShowPrompt",null),t([i()],c.prototype,"tableEditingEnabled",null),c=t([o("esri.widgets.FeatureTable.Grid.EditorColumn")],c);const u=c;export{u as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import"@vaadin/grid/vaadin-grid.js";import"@vaadin/grid/vaadin-grid-column-group.js";import"@vaadin/grid/vaadin-grid-selection-column.js";import"@vaadin/grid/vaadin-grid-sorter.js";import{isSome as t}from"../../../core/arrayUtils.js";import{on as i}from"../../../core/events.js";import{assertIsSome as r}from"../../../core/maybe.js";import{on as n,watch as o}from"../../../core/reactiveUtils.js";import{renderingSanitizer as l}from"../../../core/sanitizerUtils.js";import{property as s,subclass as d}from"../../../core/accessorSupport/decorators.js";import a from"../../Widget.js";import h from"./GridViewModel.js";import{globalCss as u}from"../../support/globalCss.js";import{messageBundle as g,tsx as m}from"../../support/widget.js";const c="esri-grid",p="compact column-borders",_={base:c,content:`${c}__content`,grid:`${c}__grid`,noDataMessage:`${c}__no-data-message`},f={sort:["Enter"," "]};let v=class extends a{constructor(e,t){super(e,t),this._columnElements=[],this._grid=null,this._temporaryHighlightId=null,this.itemIdPath="objectId",this.messages=null,this.selectionColumnEnabled=!0,this.viewModel=new h,this._onSelectedItemsChange=this._onSelectedItemsChange.bind(this)}initialize(){this.addHandles([this.columns.on("before-changes",()=>this.renderNow()),this.columns.on("change",()=>this.onColumnChange()),n(()=>this.highlightIds,"before-add",({target:e})=>{!this.multipleSelectionEnabled&&e.length&&e.removeAll()}),this.rowHighlightIds.on("change",()=>this.generateCellPartNames()),o(()=>this.effectiveSize,()=>this._updateGridSize()),o(()=>this.isEditing,()=>{this.generateCellPartNames(),this.requestContentUpdate()}),o(()=>this.store?.state,(e,t)=>{"ready"!==e||"loaded"!==t&&"error"!==t||this.refreshPageCache()}),n(()=>this._table,"scroll",()=>this.viewModel.closeColumnMenus()),i(window,"resize",()=>this._updateColumnBorderStyles()),n(()=>this._table,"scrollend",()=>{this.paginationEnabled||(this.pageIndex=this.getVirtualPageIndex()),this._updateColumnBorderStyles()}),o(()=>this.multipleSelectionEnabled,e=>{!e&&this.highlightIds.length>1&&this.highlightIds.removeAll()})])}destroy(){this.resetColumns(),this.columns.destroyed||this.columns.destroy()}resetColumns(){this.columns.drain(e=>!e.destroyed&&e.destroy())}get _columnRendering(){return this.columnPerformanceModeEnabled?"lazy":"eager"}get _selectedItems(){const{highlightIds:e,store:t}=this;return e.toArray().map(e=>t?.getItemByObjectId(e)??{objectId:e})}get _gridIsDisabled(){return 0===this.viewModel.allVisibleColumns.length||this.hasInvalidColumnConfiguration}get _noDataMessage(){return l.sanitize(this.noDataMessage)}get _table(){return this._grid?.$?.table}get cellPartNameGenerator(){return this.viewModel.cellPartNameGenerator}set cellPartNameGenerator(e){this.viewModel.cellPartNameGenerator=e}get columns(){return this.viewModel.columns}set columns(e){this.viewModel.columns=e}get columnPerformanceModeEnabled(){return this.viewModel.columnPerformanceModeEnabled}set columnPerformanceModeEnabled(e){this.viewModel.columnPerformanceModeEnabled=e}get columnReorderingEnabled(){return this.viewModel.columnReorderingEnabled}set columnReorderingEnabled(e){this.viewModel.columnReorderingEnabled=e}get dataProvider(){return this.viewModel.dataProvider}set dataProvider(e){this.viewModel.dataProvider=e}get editingEnabled(){return this.viewModel.editingEnabled}set editingEnabled(e){this.viewModel.editingEnabled=e}get effectiveSize(){return this.viewModel.effectiveSize}get groupColumns(){return this.viewModel.groupColumns}get hasInvalidColumnConfiguration(){return this.viewModel.hasInvalidColumnConfiguration}get highlightIds(){return this.viewModel.highlightIds}set highlightIds(e){this.viewModel.highlightIds=e}get temporaryHighlightId(){return this._temporaryHighlightId}get isEditing(){return this.viewModel.isEditing}get isReady(){return!!this._grid}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get multipleSelectionEnabled(){return this.viewModel.multipleSelectionEnabled}set multipleSelectionEnabled(e){this.viewModel.multipleSelectionEnabled=e}get multiSortEnabled(){return this.viewModel.multiSortEnabled}set multiSortEnabled(e){this.viewModel.multiSortEnabled=e}get noDataMessage(){return this.viewModel.noDataMessage}set noDataMessage(e){this.viewModel.noDataMessage=e}get pageIndex(){return this.viewModel.pageIndex}set pageIndex(e){this.viewModel.pageIndex=e}get multipleSortPriority(){return this.viewModel.multipleSortPriority}set multipleSortPriority(e){this.viewModel.multipleSortPriority=e}get pageSize(){return this.viewModel.pageSize}set pageSize(e){this.viewModel.pageSize=e}get paginationEnabled(){return this.viewModel.paginationEnabled}set paginationEnabled(e){this.viewModel.paginationEnabled=e}get rowDetailsRenderer(){return this.viewModel.rowDetailsRenderer}set rowDetailsRenderer(e){this.viewModel.rowDetailsRenderer=e}get rowHighlightIds(){return this.viewModel.rowHighlightIds}set rowHighlightIds(e){this.viewModel.rowHighlightIds=e}get size(){return this.viewModel.size}get sortOrders(){return this._grid?._sorters?this._grid._sorters.filter(e=>!!e&&e.path).map(({direction:e,path:t})=>({direction:e,path:t})):[]}get store(){return this.viewModel.store}set store(e){this.viewModel.store=e}get state(){return this.viewModel.state}addSorter(e){this._grid?.__updateSorter(e,!1,!1),this.notifyChange("sortOrders")}getColumnProps(e,t){const{id:i}=this,{autoWidth:r,direction:n,fieldName:o,flexGrow:l,frozen:s,frozenToEnd:d,hidden:a,label:h,resizable:u,textAlign:g,width:m}=e,c=`${i}_${o}_${t}`,{renderFunction:p,footerRenderFunction:_,headerRenderFunction:f}=e,v=_?(e,t)=>_({root:e,column:t}):void 0,y=f?(e,t)=>f({root:e,column:t}):void 0,C=p?(e,t,i)=>p({root:e,column:t,rowData:i}):void 0;let w="";return e.direction&&(w+=" direction"),e.invalid&&(w+=" invalid"),{footerRenderer:v,headerRenderer:y,renderer:C,autoWidth:r,direction:n,flexGrow:l,frozen:s,frozenToEnd:d,headerPartName:w,key:c,resizable:u,bind:this,"data-fieldName":o,header:h,hidden:this.hasInvalidColumnConfiguration||a,path:o,"text-align":g,width:"number"==typeof m?`${m}px`:m,afterCreate:this._afterColumnCreate,afterRemoved:this._afterColumnRemoved}}clearSelection(){this._clearSelection(),this.scheduleRender()}clearSort(){let e=!1;if(this._grid){if(this._grid._sorters?.length&&(this._grid._sorters.forEach(e=>{e._order=null,e.direction=null}),e=!0),this.columns.length){this.columns.some(e=>!!e.direction)&&(this.columns.forEach(e=>e.direction=null),e=!0)}e&&(this.notifyChange("sortOrders"),this.scheduleRender())}}findColumn(e){return this.viewModel.findColumn(e)}generateCellPartNames(){this._grid?.generateCellPartNames()}getFirstVisibleRowIndex(){return this._grid?._firstVisibleIndex||0}getVirtualPageIndex(){return Math.floor(this.getFirstVisibleRowIndex()/this.pageSize)}getLastVisibleRowIndex(){return this._grid?._lastVisibleIndex||0}getVisibleItemsCount(){return this._grid?._visibleItemsCount||0}getRowContainingNode(e){try{return this._grid?._getRowContainingNode(e)}catch{return null}}getSlotElementByName(e){return this._grid?.shadowRoot?.querySelector(`slot[name='${e}']`)??null}hasSorter(e){return this._grid?._sorters?.includes(e)||!1}hideColumn(e){this.viewModel.hideColumn(e)}recalculateColumnWidths(){this._grid?.recalculateColumnWidths()}async reset(){this._clearSelection(),this.store?.reset(),this.scrollToTop()}refreshPageCache(){this._grid?.clearCache(),this._temporaryHighlightId=null}requestContentUpdate(){this._grid?.requestContentUpdate(),this._temporaryHighlightId=null}selectRows(e){const{itemIdPath:t}=this,i=e?.filter(e=>!this.highlightIds.includes(e[t])),r=i.map(e=>e[t]);r.length&&(this.multipleSelectionEnabled||(this.highlightIds.removeAll(),r.splice(1)),this.highlightIds.addMany(r))}deselectRows(e){const{itemIdPath:t}=this,i=e?.map(e=>e[t])||[];i.length&&this.highlightIds.removeMany(i)}showColumn(e){this.viewModel.showColumn(e)}sort({path:e,direction:t}){this.viewModel.sortColumn(e,t),this.notifyChange("sortOrders")}scrollToIndex(e){0!==this.size&&(this._grid?.isConnected&&this._grid?.scrollToIndex(e),this._temporaryHighlightId=null)}scrollToTop(){this.scrollToIndex(0)}scrollToBottom(){this.scrollToIndex(1/0)}scrollLeft(e){const{_table:t}=this;t&&(t.scrollLeft=e)}toggleColumnVisibility(e){this.viewModel.toggleColumnVisibility(e)}onColumnChange(){this._columnElements.forEach(e=>this._applyRenderersToColumnElement(e)),this.requestContentUpdate()}render(){return m("div",{bind:this,class:this.classes(_.base,u.widget)},m("div",{bind:this,class:_.content},this._renderGrid()))}_renderGrid(){return m("vaadin-grid",{afterCreate:this._afterGridCreate,afterUpdate:this._afterGridUpdate,bind:this,cellPartNameGenerator:this.cellPartNameGenerator,class:_.grid,columnRendering:this._columnRendering,columnReorderingAllowed:this.columnReorderingEnabled,dataProvider:this.dataProvider,disabled:this._gridIsDisabled,id:`${this.id}_grid`,itemIdPath:this.itemIdPath,multiSort:this.multiSortEnabled,multiSortPriority:this.multipleSortPriority,pageSize:this.pageSize,ref:"grid",rowDetailsRenderer:this.rowDetailsRenderer,selectedItems:this._selectedItems,size:this.effectiveSize},this._renderAllColumns(),this._renderEmptyState())}_renderAllColumns(){return"disabled"!==this.state&&this.columns.length?[this._renderSelectionColumn(),this._renderColumns()]:null}_renderSelectionColumn(){return m("vaadin-grid-selection-column",{_selectAllHidden:!0,autoWidth:!1,bind:this,dragSelect:!0,frozen:!0,hidden:this.hasInvalidColumnConfiguration||!this.selectionColumnEnabled,selectAll:!1,sortable:!1,textAlign:"center"})}_renderColumns(){return Array.from(this.columns,(e,t)=>"columns"in e?this._renderGroupColumn(e,t):m("vaadin-grid-column",{...this.getColumnProps(e,t)})).filter(t)}_renderGroupColumn(e,t){const i=this.getColumnProps(e,t);if(i.hidden||!e.columns)return null;const r=e.columns.filter(({hidden:e})=>!e);return r.length?m("vaadin-grid-column-group",{...i},r.map(e=>m("vaadin-grid-column",{...this.getColumnProps(e,t)}))):null}_renderEmptyState(){const e=this.viewModel;if("loaded"===e.state&&!e.isQueryingOrSyncing)return m("div",{class:_.noDataMessage,slot:"empty-state"},this._noDataMessage??this.messages.noDataFound)}_afterGridCreate(e){const t=this._grid=e;t.setAttribute("theme",p),customElements.whenDefined("vaadin-grid").then(()=>{this._appendStyles(),this._addGridEventListeners()}),t.__updateSorter=(e,i,r)=>{const n=t._sorters,o=!n.includes(e),{multiSort:l,multiSortOnShiftClick:s,multiSortPriority:d}=t,a=n.filter(t=>t!==e),h=l&&(!s||!r)||s&&i;e._order=null,e.direction?h?null!=e._initialOrder?(o?n[e._initialOrder]=e:n.splice(e._initialOrder,0,e),e._initialOrder=null):"append"===d&&o?t._sorters=[...a,e]:"prepend"===d&&(t._sorters=[e,...a]):(e.direction||s)&&(t._sorters=e.direction?[e]:[],a.forEach(e=>{e._order=null,e.direction=null})):o||(t._sorters=[...a])},t.__removeSorters=e=>{if(0===e.length)return;const i=new Set(e.filter(e=>!e.direction));t._sorters=t._sorters.filter(e=>!i.has(e)),t.__applySorters()}}_appendStyles(){const e=this._grid?.shadowRoot,t=document.createElement("style");e&&(t.textContent='\n #items [part~="row"][editing],\n #items [part~="row"][editing][selected] {\n z-index: 2;\n }\n\n #items [part~="editing"],\n #items [part~="editing"][selected] {\n z-index: 3;\n }\n\n [frozen], [frozen-to-end] {\n z-index: 4;\n }\n\n [last-frozen] {\n overflow: visible;\n }\n\n [part~=\'cell\'] ::slotted(vaadin-grid-cell-content) {\n align-items: center;\n box-sizing: border-box !important;\n height: 100%;\n line-height: 2em;\n min-height: 40px;\n }\n\n #items [part~="text-wrap"] {\n text-wrap: wrap;\n }\n ',e.appendChild(t))}_afterGridUpdate(e){this._grid||(this._grid=e)}_afterColumnCreate(e){this._columnElements.push(e)}_afterColumnRemoved(e){const t=this._columnElements.indexOf(e,0);t>-1&&this._columnElements.splice(t,1)}_updateGridSize(){this._grid&&(this._grid.size=this.effectiveSize,this.scheduleRender())}_addGridEventListeners(){const e=this._grid;r(e),this.addHandles([i(e,["click","dblclick","keydown","pointerover","pointerout"],e=>this._onGridInteraction(e)),i(e,["pointerover","pointerout","cell-focus"],e=>this._onTransientGridInteraction(e)),i(e,"selected-items-changed",this._onSelectedItemsChange),i(e,"sorter-changed",()=>{this.notifyChange("sortOrders"),this._updateColumnBorderStyles()}),i(e,"column-resize",e=>{const t=e.detail.resizedColumn,i=t.getAttribute("data-fieldName"),r=this.findColumn(i);r?.set({width:t.width}),this._updateColumnBorderStyles()}),i(e,"column-reorder",()=>this._onColumnOrderChange())])}_onGridInteraction(e){const t=this._grid;if(r(t),("pointerover"===e.type||"pointerout"===e.type)&&e.relatedTarget!==t){const{target:t,relatedTarget:i}=e;if(!this._isGridCellContentNode(t)||!this._isGridCellContentNode(i))return}let i=null;try{i=t.getEventContext(e)}catch(a){}if(!i)return;const{column:n,index:o,item:l,section:s}=i;if(!s)return;if("header"===s&&"keydown"===e.type&&n?.path){const t=e.key;f.sort.includes(t)&&this.findColumn(n.path)?.sort()}const d=`cell-${e.type}`;this.emit(d,{type:d,context:i,index:o,item:l,native:e,path:n?.path??void 0})}_onTransientGridInteraction(e){if("pointerout"===e.type)return void(this._temporaryHighlightId=null);const t=this._grid;if(t)try{const{item:i}=t.getEventContext(e);this._temporaryHighlightId=i?.objectId}catch{this._temporaryHighlightId=null}}_isGridCellContentNode(e){return!!(e&&e instanceof HTMLElement&&"vaadin-grid-cell-content"===e.localName)}_onColumnOrderChange(){const e=this._grid;r(e);const t=e._getColumnsInOrder(0),i=[],n=(this.viewModel.groupColumns.length?e._getColumnsInOrder(1):t).map(e=>e.getAttribute("data-fieldName"));t?.forEach(e=>{const t=e.getAttribute("data-fieldName");if(null!=t){const e=this.findColumn(t);i.push(t),e&&"columns"in e&&e.columns?.length&&e.columns.sort((e,t)=>n.indexOf(e.fieldName)>n.indexOf(t.fieldName)?1:-1)}}),this.columns.sort((e,t)=>i.indexOf(e.fieldName)>i.indexOf(t.fieldName)?1:-1),this.notifyChange("sortOrders"),this.emit("column-reorder",{type:"column-reorder"})}_clearSelection(){this.highlightIds.removeAll(),this._temporaryHighlightId=null}_onSelectedItemsChange(e){const{highlightIds:t,itemIdPath:i}=this,r=e.detail.value.map(e=>e[i]),n=r.filter(e=>!t.includes(e));if(!this.multipleSelectionEnabled&&n.length&&t.length)t.removeAll(),t.add(n[0]);else{const e=t.filter(e=>!r.includes(e));t.removeMany(e),t.addMany(n)}}_applyRenderersToColumnElement(e){const t=e?.path,i=null!=t?this.findColumn(t):void 0;if(i)try{const{renderFunction:t,footerRenderFunction:r,headerRenderFunction:n}=i;t&&"renderer"in e&&(e.renderer=(e,i,r)=>t({root:e,column:i,rowData:r})),r&&(e.footerRenderer=(e,t)=>r({root:e,column:t})),n&&(e.headerRenderer=(e,t)=>n({root:e,column:t}))}catch(r){}}_updateColumnBorderStyles(){try{this._grid?._updateFirstAndLastColumn()}catch(e){}}};e([s()],v.prototype,"_columnElements",void 0),e([s()],v.prototype,"_columnRendering",null),e([s()],v.prototype,"_selectedItems",null),e([s()],v.prototype,"_grid",void 0),e([s()],v.prototype,"_gridIsDisabled",null),e([s()],v.prototype,"_noDataMessage",null),e([s()],v.prototype,"_table",null),e([s()],v.prototype,"_temporaryHighlightId",void 0),e([s()],v.prototype,"cellPartNameGenerator",null),e([s()],v.prototype,"columns",null),e([s()],v.prototype,"columnPerformanceModeEnabled",null),e([s()],v.prototype,"columnReorderingEnabled",null),e([s()],v.prototype,"dataProvider",null),e([s()],v.prototype,"editingEnabled",null),e([s()],v.prototype,"effectiveSize",null),e([s()],v.prototype,"groupColumns",null),e([s()],v.prototype,"hasInvalidColumnConfiguration",null),e([s()],v.prototype,"highlightIds",null),e([s()],v.prototype,"temporaryHighlightId",null),e([s()],v.prototype,"isEditing",null),e([s()],v.prototype,"isReady",null),e([s()],v.prototype,"itemIdPath",void 0),e([s()],v.prototype,"label",null),e([s(),g("esri/widgets/FeatureTable/t9n/FeatureTable")],v.prototype,"messages",void 0),e([s()],v.prototype,"multipleSelectionEnabled",null),e([s()],v.prototype,"multiSortEnabled",null),e([s()],v.prototype,"noDataMessage",null),e([s()],v.prototype,"pageIndex",null),e([s()],v.prototype,"multipleSortPriority",null),e([s()],v.prototype,"pageSize",null),e([s()],v.prototype,"paginationEnabled",null),e([s()],v.prototype,"rowDetailsRenderer",null),e([s()],v.prototype,"rowHighlightIds",null),e([s()],v.prototype,"selectionColumnEnabled",void 0),e([s()],v.prototype,"size",null),e([s({readOnly:!0})],v.prototype,"sortOrders",null),e([s()],v.prototype,"store",null),e([s()],v.prototype,"state",null),e([s()],v.prototype,"viewModel",void 0),v=e([d("esri.widgets.FeatureTable.Grid.Grid")],v);const y=v;export{y as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import"@vaadin/grid/vaadin-grid.js";import"@vaadin/grid/vaadin-grid-column-group.js";import"@vaadin/grid/vaadin-grid-selection-column.js";import"@vaadin/grid/vaadin-grid-sorter.js";import{isSome as t}from"../../../core/arrayUtils.js";import{on as i}from"../../../core/events.js";import{assertIsSome as r}from"../../../core/maybe.js";import{on as n,watch as o}from"../../../core/reactiveUtils.js";import{renderingSanitizer as l}from"../../../core/sanitizerUtils.js";import{property as s,subclass as d}from"../../../core/accessorSupport/decorators.js";import a from"../../Widget.js";import h from"./GridViewModel.js";import{globalCss as u}from"../../support/globalCss.js";import{messageBundle as g,tsx as m}from"../../support/widget.js";const c="esri-grid",p="compact column-borders",_={base:c,content:`${c}__content`,grid:`${c}__grid`,noDataMessage:`${c}__no-data-message`},f={sort:["Enter"," "]};let v=class extends a{constructor(e,t){super(e,t),this._columnElements=[],this._grid=null,this._temporaryHighlightId=null,this.itemIdPath="objectId",this.messages=null,this.selectionColumnEnabled=!0,this.viewModel=new h,this._onSelectedItemsChange=this._onSelectedItemsChange.bind(this)}initialize(){this.addHandles([this.columns.on("before-changes",()=>this.renderNow()),this.columns.on("change",()=>this.onColumnChange()),n(()=>this.highlightIds,"before-add",({target:e})=>{!this.multipleSelectionEnabled&&e.length&&e.removeAll()}),this.rowHighlightIds.on("change",()=>this.generateCellPartNames()),o(()=>this.effectiveSize,()=>this._updateGridSize()),o(()=>this.isEditing,()=>{this.generateCellPartNames(),this.requestContentUpdate()}),o(()=>this.store?.state,(e,t)=>{"ready"!==e||"loaded"!==t&&"error"!==t||this.refreshPageCache()}),n(()=>this._table,"scroll",()=>this.viewModel.closeColumnMenus()),i(window,"resize",()=>this._updateColumnBorderStyles()),n(()=>this._table,"scrollend",()=>{this.paginationEnabled||(this.pageIndex=this.getVirtualPageIndex()),this._updateColumnBorderStyles()}),o(()=>this.multipleSelectionEnabled,e=>{!e&&this.highlightIds.length>1&&this.highlightIds.removeAll()})])}destroy(){this.resetColumns(),this.columns.destroyed||this.columns.destroy()}resetColumns(){this.columns.drain(e=>!e.destroyed&&e.destroy())}get _columnRendering(){return this.columnPerformanceModeEnabled?"lazy":"eager"}get _selectedItems(){const{highlightIds:e,store:t}=this;return e.toArray().map(e=>t?.getItemByObjectId(e)??{objectId:e})}get _gridIsDisabled(){return 0===this.viewModel.allVisibleColumns.length||this.hasInvalidColumnConfiguration}get _noDataMessage(){return l.sanitize(this.noDataMessage)}get _table(){return this._grid?.$?.table}get cellPartNameGenerator(){return this.viewModel.cellPartNameGenerator}set cellPartNameGenerator(e){this.viewModel.cellPartNameGenerator=e}get columns(){return this.viewModel.columns}set columns(e){this.viewModel.columns=e}get columnPerformanceModeEnabled(){return this.viewModel.columnPerformanceModeEnabled}set columnPerformanceModeEnabled(e){this.viewModel.columnPerformanceModeEnabled=e}get columnReorderingEnabled(){return this.viewModel.columnReorderingEnabled}set columnReorderingEnabled(e){this.viewModel.columnReorderingEnabled=e}get dataProvider(){return this.viewModel.dataProvider}set dataProvider(e){this.viewModel.dataProvider=e}get editingEnabled(){return this.viewModel.editingEnabled}set editingEnabled(e){this.viewModel.editingEnabled=e}get effectiveSize(){return this.viewModel.effectiveSize}get groupColumns(){return this.viewModel.groupColumns}get hasInvalidColumnConfiguration(){return this.viewModel.hasInvalidColumnConfiguration}get highlightIds(){return this.viewModel.highlightIds}set highlightIds(e){this.viewModel.highlightIds=e}get temporaryHighlightId(){return this._temporaryHighlightId}get isEditing(){return this.viewModel.isEditing}get isReady(){return!!this._grid}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get multipleSelectionEnabled(){return this.viewModel.multipleSelectionEnabled}set multipleSelectionEnabled(e){this.viewModel.multipleSelectionEnabled=e}get multiSortEnabled(){return this.viewModel.multiSortEnabled}set multiSortEnabled(e){this.viewModel.multiSortEnabled=e}get noDataMessage(){return this.viewModel.noDataMessage}set noDataMessage(e){this.viewModel.noDataMessage=e}get pageIndex(){return this.viewModel.pageIndex}set pageIndex(e){this.viewModel.pageIndex=e}get multipleSortPriority(){return this.viewModel.multipleSortPriority}set multipleSortPriority(e){this.viewModel.multipleSortPriority=e}get pageSize(){return this.viewModel.pageSize}set pageSize(e){this.viewModel.pageSize=e}get paginationEnabled(){return this.viewModel.paginationEnabled}set paginationEnabled(e){this.viewModel.paginationEnabled=e}get rowDetailsRenderer(){return this.viewModel.rowDetailsRenderer}set rowDetailsRenderer(e){this.viewModel.rowDetailsRenderer=e}get rowHighlightIds(){return this.viewModel.rowHighlightIds}set rowHighlightIds(e){this.viewModel.rowHighlightIds=e}get size(){return this.viewModel.size}get sortOrders(){return this._grid?._sorters?this._grid._sorters.filter(e=>!!e&&e.path).map(({direction:e,path:t})=>({direction:e,path:t})):[]}get store(){return this.viewModel.store}get state(){return this.viewModel.state}addSorter(e){this._grid?.__updateSorter(e,!1,!1),this.notifyChange("sortOrders")}getColumnProps(e,t){const{id:i}=this,{autoWidth:r,direction:n,fieldName:o,flexGrow:l,frozen:s,frozenToEnd:d,hidden:a,label:h,resizable:u,textAlign:g,width:m}=e,c=`${i}_${o}_${t}`,{renderFunction:p,footerRenderFunction:_,headerRenderFunction:f}=e,v=_?(e,t)=>_({root:e,column:t}):void 0,y=f?(e,t)=>f({root:e,column:t}):void 0,C=p?(e,t,i)=>p({root:e,column:t,rowData:i}):void 0;let w="";return e.direction&&(w+=" direction"),e.invalid&&(w+=" invalid"),{footerRenderer:v,headerRenderer:y,renderer:C,autoWidth:r,direction:n,flexGrow:l,frozen:s,frozenToEnd:d,headerPartName:w,key:c,resizable:u,bind:this,"data-fieldName":o,header:h,hidden:this.hasInvalidColumnConfiguration||a,path:o,"text-align":g,width:"number"==typeof m?`${m}px`:m,afterCreate:this._afterColumnCreate,afterRemoved:this._afterColumnRemoved}}clearSelection(){this._clearSelection(),this.scheduleRender()}clearSort(){let e=!1;if(this._grid){if(this._grid._sorters?.length&&(this._grid._sorters.forEach(e=>{e._order=null,e.direction=null}),e=!0),this.columns.length){this.columns.some(e=>!!e.direction)&&(this.columns.forEach(e=>e.direction=null),e=!0)}e&&(this.notifyChange("sortOrders"),this.scheduleRender())}}findColumn(e){return this.viewModel.findColumn(e)}generateCellPartNames(){this._grid?.generateCellPartNames()}getFirstVisibleRowIndex(){return this._grid?._firstVisibleIndex||0}getVirtualPageIndex(){return Math.floor(this.getFirstVisibleRowIndex()/this.pageSize)}getLastVisibleRowIndex(){return this._grid?._lastVisibleIndex||0}getVisibleItemsCount(){return this._grid?._visibleItemsCount||0}getRowContainingNode(e){try{return this._grid?._getRowContainingNode(e)}catch{return null}}getSlotElementByName(e){return this._grid?.shadowRoot?.querySelector(`slot[name='${e}']`)??null}hasSorter(e){return this._grid?._sorters?.includes(e)||!1}hideColumn(e){this.viewModel.hideColumn(e)}recalculateColumnWidths(){this._grid?.recalculateColumnWidths()}async reset(){this._clearSelection(),this.store?.reset(),this.scrollToTop()}refreshPageCache(){this._grid?.clearCache(),this._temporaryHighlightId=null}requestContentUpdate(){this._grid?.requestContentUpdate(),this._temporaryHighlightId=null}selectRows(e){const{itemIdPath:t}=this,i=e?.filter(e=>!this.highlightIds.includes(e[t])),r=i.map(e=>e[t]);r.length&&(this.multipleSelectionEnabled||(this.highlightIds.removeAll(),r.splice(1)),this.highlightIds.addMany(r))}deselectRows(e){const{itemIdPath:t}=this,i=e?.map(e=>e[t])||[];i.length&&this.highlightIds.removeMany(i)}showColumn(e){this.viewModel.showColumn(e)}sort({path:e,direction:t}){this.viewModel.sortColumn(e,t),this.notifyChange("sortOrders")}scrollToIndex(e){0!==this.size&&(this._grid?.isConnected&&this._grid?.scrollToIndex(e),this._temporaryHighlightId=null)}scrollToTop(){this.scrollToIndex(0)}scrollToBottom(){this.scrollToIndex(1/0)}scrollLeft(e){const{_table:t}=this;t&&(t.scrollLeft=e)}toggleColumnVisibility(e){this.viewModel.toggleColumnVisibility(e)}onColumnChange(){this._columnElements.forEach(e=>this._applyRenderersToColumnElement(e)),this.requestContentUpdate()}render(){return m("div",{bind:this,class:this.classes(_.base,u.widget)},m("div",{bind:this,class:_.content},this._renderGrid()))}_renderGrid(){return m("vaadin-grid",{afterCreate:this._afterGridCreate,afterUpdate:this._afterGridUpdate,bind:this,cellPartNameGenerator:this.cellPartNameGenerator,class:_.grid,columnRendering:this._columnRendering,columnReorderingAllowed:this.columnReorderingEnabled,dataProvider:this.dataProvider,disabled:this._gridIsDisabled,id:`${this.id}_grid`,itemIdPath:this.itemIdPath,multiSort:this.multiSortEnabled,multiSortPriority:this.multipleSortPriority,pageSize:this.pageSize,ref:"grid",rowDetailsRenderer:this.rowDetailsRenderer,selectedItems:this._selectedItems,size:this.effectiveSize},this._renderAllColumns(),this._renderEmptyState())}_renderAllColumns(){return"disabled"!==this.state&&this.columns.length?[this._renderSelectionColumn(),this._renderColumns()]:null}_renderSelectionColumn(){return m("vaadin-grid-selection-column",{_selectAllHidden:!0,autoWidth:!1,bind:this,dragSelect:!0,frozen:!0,hidden:this.hasInvalidColumnConfiguration||!this.selectionColumnEnabled,selectAll:!1,sortable:!1,textAlign:"center"})}_renderColumns(){return Array.from(this.columns,(e,t)=>"columns"in e?this._renderGroupColumn(e,t):m("vaadin-grid-column",{...this.getColumnProps(e,t)})).filter(t)}_renderGroupColumn(e,t){const i=this.getColumnProps(e,t);if(i.hidden||!e.columns)return null;const r=e.columns.filter(({hidden:e})=>!e);return r.length?m("vaadin-grid-column-group",{...i},r.map(e=>m("vaadin-grid-column",{...this.getColumnProps(e,t)}))):null}_renderEmptyState(){const e=this.viewModel;if("loaded"===e.state&&!e.isQueryingOrSyncing)return m("div",{class:_.noDataMessage,slot:"empty-state"},this._noDataMessage??this.messages.noDataFound)}_afterGridCreate(e){const t=this._grid=e;t.setAttribute("theme",p),customElements.whenDefined("vaadin-grid").then(()=>{this._appendStyles(),this._addGridEventListeners()}),t.__updateSorter=(e,i,r)=>{const n=t._sorters,o=!n.includes(e),{multiSort:l,multiSortOnShiftClick:s,multiSortPriority:d}=t,a=n.filter(t=>t!==e),h=l&&(!s||!r)||s&&i;e._order=null,e.direction?h?null!=e._initialOrder?(o?n[e._initialOrder]=e:n.splice(e._initialOrder,0,e),e._initialOrder=null):"append"===d&&o?t._sorters=[...a,e]:"prepend"===d&&(t._sorters=[e,...a]):(e.direction||s)&&(t._sorters=e.direction?[e]:[],a.forEach(e=>{e._order=null,e.direction=null})):o||(t._sorters=[...a])},t.__removeSorters=e=>{if(0===e.length)return;const i=new Set(e.filter(e=>!e.direction));t._sorters=t._sorters.filter(e=>!i.has(e)),t.__applySorters()}}_appendStyles(){const e=this._grid?.shadowRoot,t=document.createElement("style");e&&(t.textContent='\n #items [part~="row"][editing],\n #items [part~="row"][editing][selected] {\n z-index: 2;\n }\n\n #items [part~="editing"],\n #items [part~="editing"][selected] {\n z-index: 3;\n }\n\n [frozen], [frozen-to-end] {\n z-index: 4;\n }\n\n [last-frozen] {\n overflow: visible;\n }\n\n [part~=\'cell\'] ::slotted(vaadin-grid-cell-content) {\n align-items: center;\n box-sizing: border-box !important;\n height: 100%;\n line-height: 2em;\n min-height: 40px;\n }\n\n #items [part~="text-wrap"] {\n text-wrap: wrap;\n }\n ',e.appendChild(t))}_afterGridUpdate(e){this._grid||(this._grid=e)}_afterColumnCreate(e){this._columnElements.push(e)}_afterColumnRemoved(e){const t=this._columnElements.indexOf(e,0);t>-1&&this._columnElements.splice(t,1)}_updateGridSize(){this._grid&&(this._grid.size=this.effectiveSize,this.scheduleRender())}_addGridEventListeners(){const e=this._grid;r(e),this.addHandles([i(e,["click","dblclick","keydown","pointerover","pointerout"],e=>this._onGridInteraction(e)),i(e,["pointerover","pointerout","cell-focus"],e=>this._onTransientGridInteraction(e)),i(e,"selected-items-changed",this._onSelectedItemsChange),i(e,"sorter-changed",()=>{this.notifyChange("sortOrders"),this._updateColumnBorderStyles()}),i(e,"column-resize",e=>{const t=e.detail.resizedColumn,i=t.getAttribute("data-fieldName"),r=this.findColumn(i);r?.set({width:t.width}),this._updateColumnBorderStyles()}),i(e,"column-reorder",()=>this._onColumnOrderChange())])}_onGridInteraction(e){const t=this._grid;if(r(t),("pointerover"===e.type||"pointerout"===e.type)&&e.relatedTarget!==t){const{target:t,relatedTarget:i}=e;if(!this._isGridCellContentNode(t)||!this._isGridCellContentNode(i))return}let i=null;try{i=t.getEventContext(e)}catch(a){}if(!i)return;const{column:n,index:o,item:l,section:s}=i;if(!s)return;if("header"===s&&"keydown"===e.type&&n?.path){const t=e.key;f.sort.includes(t)&&this.findColumn(n.path)?.sort()}const d=`cell-${e.type}`;this.emit(d,{type:d,context:i,index:o,item:l,native:e,path:n?.path??void 0})}_onTransientGridInteraction(e){if("pointerout"===e.type)return void(this._temporaryHighlightId=null);const t=this._grid;if(t)try{const{item:i}=t.getEventContext(e);this._temporaryHighlightId=i?.objectId}catch{this._temporaryHighlightId=null}}_isGridCellContentNode(e){return!!(e&&e instanceof HTMLElement&&"vaadin-grid-cell-content"===e.localName)}_onColumnOrderChange(){const e=this._grid;r(e);const t=e._getColumnsInOrder(0),i=[],n=(this.viewModel.groupColumns.length?e._getColumnsInOrder(1):t).map(e=>e.getAttribute("data-fieldName"));t?.forEach(e=>{const t=e.getAttribute("data-fieldName");if(null!=t){const e=this.findColumn(t);i.push(t),e&&"columns"in e&&e.columns?.length&&e.columns.sort((e,t)=>n.indexOf(e.fieldName)>n.indexOf(t.fieldName)?1:-1)}}),this.columns.sort((e,t)=>i.indexOf(e.fieldName)>i.indexOf(t.fieldName)?1:-1),this.notifyChange("sortOrders"),this.emit("column-reorder",{type:"column-reorder"})}_clearSelection(){this.highlightIds.removeAll(),this._temporaryHighlightId=null}_onSelectedItemsChange(e){const{highlightIds:t,itemIdPath:i}=this,r=e.detail.value.map(e=>e[i]),n=r.filter(e=>!t.includes(e));if(!this.multipleSelectionEnabled&&n.length&&t.length)t.removeAll(),t.add(n[0]);else{const e=t.filter(e=>!r.includes(e));t.removeMany(e),t.addMany(n)}}_applyRenderersToColumnElement(e){const t=e?.path,i=null!=t?this.findColumn(t):void 0;if(i)try{const{renderFunction:t,footerRenderFunction:r,headerRenderFunction:n}=i;t&&"renderer"in e&&(e.renderer=(e,i,r)=>t({root:e,column:i,rowData:r})),r&&(e.footerRenderer=(e,t)=>r({root:e,column:t})),n&&(e.headerRenderer=(e,t)=>n({root:e,column:t}))}catch(r){}}_updateColumnBorderStyles(){try{this._grid?._updateFirstAndLastColumn()}catch(e){}}};e([s()],v.prototype,"_columnElements",void 0),e([s()],v.prototype,"_columnRendering",null),e([s()],v.prototype,"_selectedItems",null),e([s()],v.prototype,"_grid",void 0),e([s()],v.prototype,"_gridIsDisabled",null),e([s()],v.prototype,"_noDataMessage",null),e([s()],v.prototype,"_table",null),e([s()],v.prototype,"_temporaryHighlightId",void 0),e([s()],v.prototype,"cellPartNameGenerator",null),e([s()],v.prototype,"columns",null),e([s()],v.prototype,"columnPerformanceModeEnabled",null),e([s()],v.prototype,"columnReorderingEnabled",null),e([s()],v.prototype,"dataProvider",null),e([s()],v.prototype,"editingEnabled",null),e([s()],v.prototype,"effectiveSize",null),e([s()],v.prototype,"groupColumns",null),e([s()],v.prototype,"hasInvalidColumnConfiguration",null),e([s()],v.prototype,"highlightIds",null),e([s()],v.prototype,"temporaryHighlightId",null),e([s()],v.prototype,"isEditing",null),e([s()],v.prototype,"isReady",null),e([s()],v.prototype,"itemIdPath",void 0),e([s()],v.prototype,"label",null),e([s(),g("esri/widgets/FeatureTable/t9n/FeatureTable")],v.prototype,"messages",void 0),e([s()],v.prototype,"multipleSelectionEnabled",null),e([s()],v.prototype,"multiSortEnabled",null),e([s()],v.prototype,"noDataMessage",null),e([s()],v.prototype,"pageIndex",null),e([s()],v.prototype,"multipleSortPriority",null),e([s()],v.prototype,"pageSize",null),e([s()],v.prototype,"paginationEnabled",null),e([s()],v.prototype,"rowDetailsRenderer",null),e([s()],v.prototype,"rowHighlightIds",null),e([s()],v.prototype,"selectionColumnEnabled",void 0),e([s()],v.prototype,"size",null),e([s({readOnly:!0})],v.prototype,"sortOrders",null),e([s()],v.prototype,"store",null),e([s()],v.prototype,"state",null),e([s()],v.prototype,"viewModel",void 0),v=e([d("esri.widgets.FeatureTable.Grid.Grid")],v);const y=v;export{y as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import e from"../../../core/Collection.js";import{referenceSetter as i}from"../../../core/collectionUtils.js";import{EventedAccessor as
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../../../core/Collection.js";import{referenceSetter as i}from"../../../core/collectionUtils.js";import{EventedAccessor as n}from"../../../core/Evented.js";import{property as o,subclass as l}from"../../../core/accessorSupport/decorators.js";import{isGroupColumn as r}from"../support/columnUtils.js";import{uniqueColumnNames as s,isPageIndexValid as u}from"../support/tableUtils.js";let d=class extends n{constructor(t){super(t),this.actionColumnConfig=null,this.cellPartNameGenerator=(t,e)=>{let i="";e?.item&&this.rowHighlightIds.includes(e.item.objectId)&&(i+=" highlight");const n=this.findColumn(t?.path);return n?(n.invalid&&(i+=" invalid"),n.textWrap&&(i+=" text-wrap"),"editInfo"in n&&n.editInfo&&n.editInfo.rowData?.index===e.index&&(i+=" editing"),i):i},this.columnPerformanceModeEnabled=!0,this.columnReorderingEnabled=!0,this.columns=new e,this.dataProvider=async(t,e)=>{const{store:i}=this;if(!e)return;e(await i.fetchItems(t))},this.maxSize=null,this.multipleSelectionEnabled=!0,this.multiSortEnabled=!1,this.multipleSortPriority="prepend",this.noDataMessage=null,this.paginationEnabled=!1,this.rowDetailsRenderer=null,this.store=null}get actionColumn(){return this.allColumns.find(t=>t.fieldName===s.action)}get allColumns(){return this.columns.toArray().flatMap(t=>[t,...r(t)&&t.columns?.length?t.columns:[]])}get allVisibleColumns(){return this.allColumns.filter(t=>!t.hidden)}get columnMenuIsOpen(){return this.allColumns.some(t=>t.menuIsOpen)}get editingEnabled(){return this.store.editingEnabled}set editingEnabled(t){this.store.editingEnabled=t}get editableColumns(){return this.allColumns.filter(t=>"editable"in t)}get effectiveSize(){const{filterBySelectionEnabled:t,highlightIds:e,objectIds:i,pageSize:n,size:o}=this;if(0===o)return 0;if(this.paginationEnabled){const l=this.pageCount===this.pageIndex+1&&o%n||n;return t?Math.min(e.length,l):i.length?Math.min(i.length,l):l}return t?e.length:i.length?i.length:o}get filterBySelectionEnabled(){return!!this._get("filterBySelectionEnabled")}set filterBySelectionEnabled(t){this._set("filterBySelectionEnabled",t)}get groupColumns(){return this.columns.toArray().filter(t=>r(t))}get hasInvalidColumnConfiguration(){return this.visibleColumns.every(t=>t.frozen||t.frozenToEnd)}get highlightIds(){return this._get("highlightIds")||new e}set highlightIds(t){let n=Array.isArray(t)?new e(t):t;this.multipleSelectionEnabled||(n=n.slice(0,1)),this._set("highlightIds",i(n,this._get("highlightIds"),e))}get isEditing(){return this.editableColumns.some(t=>t.editInfo)}get isQuerying(){return this.store.isQuerying}get isQueryingOrSyncing(){return this.isQuerying||this.isSyncing}get isSyncing(){return this.store.isSyncing}get objectIds(){return this._get("objectIds")??new e}set objectIds(t){this._set("objectIds",i(t,this._get("objectIds"),e))}get pageCount(){const{pageSize:t,size:e}=this;return 0===e||0===t?1:Math.ceil(e/t)}get pageIndex(){return this._get("pageIndex")||0}set pageIndex(t){const{pageCount:e}=this;u(t,e)&&this._set("pageIndex",t)}get pageSize(){return this.store.pageSize}set pageSize(t){this.store.pageSize=t}get rowHighlightIds(){return this._get("rowHighlightIds")||new e}set rowHighlightIds(t){this._set("rowHighlightIds",i(t,this._get("rowHighlightIds"),e))}get size(){const t=this.store?.count??0,{maxSize:e}=this;return null!=t&&null!=e?Math.min(e,t):t}get state(){return this.store.state}get visibleColumns(){return this.columns.toArray().filter(t=>!t.hidden)}closeColumnMenus(){this.allColumns.forEach(t=>t.closeMenu())}sortColumn(t,e){if(!t)return;const i=this.findColumn(t);i&&(i.direction=e)}hideColumn(t){const e=this.findColumn(t);!1===e?.hidden&&(e.hidden=!0)}showColumn(t){const e=this.findColumn(t);e?.hidden&&(e.hidden=!1)}showAllColumns(){this.allColumns.forEach(t=>{t.hidden&&(t.hidden=!1)})}findColumn(t){return this.allColumns.find(e=>e.fieldName===t)}refresh(){this.store.reset(),this.store.load()}toggleColumnVisibility(t){const e=this.findColumn(t);e&&(e.hidden=!e.hidden)}};t([o()],d.prototype,"actionColumn",null),t([o()],d.prototype,"actionColumnConfig",void 0),t([o()],d.prototype,"allColumns",null),t([o()],d.prototype,"allVisibleColumns",null),t([o()],d.prototype,"cellPartNameGenerator",void 0),t([o()],d.prototype,"columnMenuIsOpen",null),t([o()],d.prototype,"columnPerformanceModeEnabled",void 0),t([o()],d.prototype,"columnReorderingEnabled",void 0),t([o()],d.prototype,"columns",void 0),t([o()],d.prototype,"dataProvider",void 0),t([o()],d.prototype,"editingEnabled",null),t([o()],d.prototype,"editableColumns",null),t([o()],d.prototype,"effectiveSize",null),t([o()],d.prototype,"filterBySelectionEnabled",null),t([o()],d.prototype,"groupColumns",null),t([o()],d.prototype,"hasInvalidColumnConfiguration",null),t([o()],d.prototype,"highlightIds",null),t([o()],d.prototype,"isEditing",null),t([o()],d.prototype,"isQuerying",null),t([o()],d.prototype,"isQueryingOrSyncing",null),t([o()],d.prototype,"isSyncing",null),t([o()],d.prototype,"maxSize",void 0),t([o()],d.prototype,"multipleSelectionEnabled",void 0),t([o()],d.prototype,"multiSortEnabled",void 0),t([o()],d.prototype,"multipleSortPriority",void 0),t([o()],d.prototype,"noDataMessage",void 0),t([o()],d.prototype,"objectIds",null),t([o()],d.prototype,"pageCount",null),t([o()],d.prototype,"pageIndex",null),t([o()],d.prototype,"pageSize",null),t([o()],d.prototype,"paginationEnabled",void 0),t([o()],d.prototype,"rowHighlightIds",null),t([o()],d.prototype,"rowDetailsRenderer",void 0),t([o({readOnly:!0})],d.prototype,"size",null),t([o()],d.prototype,"store",void 0),t([o({readOnly:!0})],d.prototype,"state",null),t([o()],d.prototype,"visibleColumns",null),d=t([l("esri.widgets.FeatureTable.Grid.GridViewModel")],d);const h=d;export{h as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import r from"../../../core/Accessor.js";import{equals as s,isSome as i}from"../../../core/arrayUtils.js";import a from"../../../core/Collection.js";import o from"../../../core/Error.js";import{clone as n}from"../../../core/lang.js";import u from"../../../core/Logger.js";import p from"../../../core/ReactiveMap.js";import{watch as l,when as h}from"../../../core/reactiveUtils.js";import{property as d,subclass as c}from"../../../core/accessorSupport/decorators.js";import{geometryTypes as y}from"../../../geometry/support/typeUtils.js";import{isSubtypeGroupLayer as m,isSubtypeSublayer as _}from"../../../layers/support/layerUtils.js";import f from"../../../rest/support/AttachmentQuery.js";import g from"../../../rest/support/RelationshipQuery.js";import b from"../../../time/TimeExtent.js";import{isIFeatureTableSupportedLayerWithAttachments as v,isIFeatureTableSupportedLayerWithAttachmentsEditing as O,isIFeatureTableSupportedLayerWithEditing as I,isIFeatureTableSupportedLayerWithRelationships as A,findRelatedLayer as j}from"./tableUtils.js";let C=class extends r{constructor(e){super(e),this._attachmentsOperationQueue=new a,this._defaultOutFields=["*"],this._editOperationQueue=new a,this._loaded=!1,this._loadError=!1,this._loading=!1,this._objectIdCache=new a,this._queryOperationQueue=new a,this.attachmentsEnabled=!1,this.count=0,this.failures=new a,this.filterGeometry=null,this.initialSize=null,this.layer=null,this.objectIds=null,this.outFields=null,this.pageCache=new p,this.pageSize=50,this.relationshipConfig=null,this.relatedRecordsEnabled=!1,this.returnGeometry=!1,this.returnZ=!1,this.returnM=!1,this.sortOrders=[],this.timeExtent=null,this.view=null,this.where=null}initialize(){this.addHandles([l(()=>[this.filterGeometry,this.layer,this.objectIds,this.outFields,this.pageSize,this.relationshipConfig,this.returnGeometry,this.returnM,this.returnZ,this.timeExtent,this.where],()=>this._reset()),l(()=>this.orderByFields,()=>this._clearCaches(),{equals:s}),h(()=>this.attachmentsEnabled,()=>this._reset()),h(()=>this.relatedRecordsEnabled,()=>this._reset())])}destroy(){this.layer=null,this.itemCache?.destroy(),this.failures?.destroy()}get _capabilities(){const{layer:e}=this;return e?.effectiveCapabilities??e?.capabilities}get _effectiveReturnZ(){return this.returnZ&&this.supportsZ}get _effectiveReturnM(){return this.returnM&&this.supportsM}get _layerWithAttachments(){const{layer:e}=this;return e&&this._capabilities&&this.attachmentsEnabled&&this.supportsAttachments&&v(e)?e:null}get _layerWithAttachmentsEditing(){const{_layerWithAttachments:e}=this;return e&&O(e)&&this.supportsEditing?e:null}get _layerWithEditing(){const e=this.layer;return I(e)&&this.supportsEditing?e:null}get _layerWithRelationships(){const e=this.layer;return A(e)&&this.supportsQueryRelated?e:null}get _relatedLayer(){return this.relationshipConfig?.relatedLayer}get _relatedLayerCapabilities(){const{_relatedLayer:e}=this;return e?.effectiveCapabilities??e?.capabilities}get _relatedLayerSupportsCacheHint(){return!!this._relatedLayerCapabilities?.queryRelated?.supportsCacheHint}get _relatedLayerSupportsQuery(){return!!this._relatedLayerCapabilities?.operations.supportsQuery}get _relatedLayerSupportsQueryRelated(){const{_relatedLayerCapabilities:e}=this;return!!e?.queryRelated?.supportsCount&&!!e?.queryRelated?.supportsPagination}get _sortedFieldNames(){return this.sortOrders.map(({fieldName:e})=>e)}get _subtypeCode(){return this.layer?.subtypeCode??null}get _subtypeField(){const{layer:e}=this;return m(e?.parent)?e.subtypeField:null}get _canUseRelatedLayer(){return!(!this._relatedLayerSupportsQuery||!this._relatedLayerSupportsQueryRelated)}get canAddRelatedFeature(){const{state:e,relationship:t,supportsAdd:r,supportsEditing:s}=this;if("loaded"!==e||!t||!r||!s)return!1;const{count:i}=this,{cardinality:a,role:o}=t,n=i>0;return("one-to-one"!==a||!n)&&("one-to-many"!==a||"origin"!==o||!n)}get effectiveOutFields(){const{layer:e,outFields:t}=this;if(!e||!t?.length)return this._defaultOutFields;const r=[];t.forEach(t=>{const s=e.fieldsIndex.normalizeFieldName(t);s&&r.push(s)});const{objectIdField:s}=e,i=e.fieldsIndex.normalizeFieldName(s)??s;return i&&!r.includes(i)&&r.unshift(i),r}get effectiveTimeExtent(){const{layer:e,timeExtent:t}=this;return t||e&&"timeExtent"in e&&e.timeExtent||null}get effectiveWhere(){const{layer:e,where:t}=this;return null!=t&&""!==t?t:_(e)&&e.parent?.definitionExpression?e.parent.definitionExpression:e?.definitionExpression||"1=1"}get isQuerying(){return this._queryOperationQueue.length>0}get isSyncing(){return this.isSyncingFeatureEdits||this.isSyncingAttachmentEdits}get isSyncingAttachmentEdits(){return this._attachmentsOperationQueue.length>0}get isSyncingFeatureEdits(){return this._editOperationQueue.length>0}get itemCache(){return new a({items:[...this.pageCache.values()].flat()})}get layerView(){const{layer:e,view:t}=this;if(!e||!t)return null;const r="sublayer"===e.type||_(e)?e.parent:e;return t.allLayerViews.find(e=>e.layer===r)}get orderByFields(){const{_sortedFieldNames:e,layer:t,sortOrders:r}=this,s=r.filter(({fieldName:t,direction:r},s)=>e.indexOf(t)===s&&null!=r).map(({fieldName:e,direction:t})=>`${e} ${t?.toUpperCase()}`);if(t&&!s.length&&!t.objectIdField&&t.fields?.length){const e=t.fields.find(e=>e.name);if(e){const r=t.fieldsIndex.normalizeFieldName(e.name);r&&s.push(`${r} ASC`)}}return s}get relationship(){const{relationshipConfig:e}=this;return null==e?.relationshipId?null:this.relationships?.find(t=>t.id===e.relationshipId)}get relationshipIds(){return this.relationships?.map(e=>e.id)??[]}get relationshipInfos(){const{_layerWithRelationships:e,relatedRecordsEnabled:t,relationships:r,view:s}=this,i=[];return t&&e?.loaded&&s?.map&&r?.length?(r.forEach(t=>{const r=j(e,s,t);r&&(r.load(),i.push({layer:e,relatedLayer:r,relationshipId:t.id}))}),i):i}get relationships(){return this._layerWithRelationships?.relationships}get state(){const{layer:e,_loaded:t,_loadError:r,_loading:s}=this;return!e||e.destroyed?"disabled":r||e.loadError?"error":"loaded"===e.loadStatus&&t?"loaded":s?"loading":"ready"}get supportsAdd(){return!!this._capabilities?.operations.supportsAdd}get supportsAddAttachments(){return!(!this._layerWithAttachmentsEditing||!this.supportsAdd&&!this.supportsUpdate)}get supportsAttachments(){const{_capabilities:e}=this;return!(!e?.data?.supportsAttachment||!e?.operations.supportsQueryAttachments)}get supportsCacheHint(){return!!this._capabilities?.query?.supportsCacheHint}get supportsCacheHintQueryRelated(){return!!this._capabilities?.queryRelated?.supportsCacheHint}get supportsDelete(){return!!this._capabilities?.operations.supportsDelete}get supportsEditing(){return!!this._capabilities?.operations.supportsEditing}get supportsM(){return!!this.layer?.hasM&&!!this._capabilities?.data?.supportsM}get supportsOrderBy(){return!!this._capabilities?.query?.supportsOrderBy}get supportsPagination(){return!!this._capabilities?.query?.supportsPagination}get supportsQuery(){return!!this._capabilities?.operations.supportsQuery}get supportsQueryRelated(){const{_capabilities:e}=this;return!!e?.queryRelated?.supportsCount&&!!e?.queryRelated?.supportsPagination}get supportsResizeAttachments(){const{_capabilities:e}=this;return!(!this.supportsAttachments||!e?.attachment?.supportsResize)}get supportsUpdate(){return!!this._capabilities?.operations.supportsUpdate}get supportsUpdateAttachments(){return!(!this._layerWithAttachmentsEditing||!this.supportsAdd&&!this.supportsUpdate)}get supportsZ(){return!!this.layer?.hasZ&&!!this._capabilities?.data?.supportsZ}async addAttachment(e,t){const{_layerWithAttachmentsEditing:r}=this;if(!r||!this.supportsAddAttachments)return{};const s=await this._queueAttachmentsOperation(e,()=>r.addAttachment(this._createBaseGraphic(r,e),t));return this._ensureArrayContent(s)}async deleteAttachments(e,t){const{_layerWithAttachmentsEditing:r}=this;if(!r||!this.supportsUpdateAttachments||!t.length)return[];const s=await this._queueAttachmentsOperation(e,()=>r.deleteAttachments(this._createBaseGraphic(r,e),t));return this._ensureArray(s)}async deleteRowsByObjectId(e){const{_layerWithEditing:t}=this;if(!this.supportsDelete||!t)throw new o("store:delete-error","Delete is not supported.");const r=e.map(e=>this.getItemByObjectId(e)?.feature).filter(i);return this._queueEditOperation(()=>t.applyEdits({deleteFeatures:r}))}async fetchItems(e){const{page:t}=e,{pageSize:r}=this,s=t*r,i=s+r,{layer:a,state:o}=this;return a&&"loaded"===o?this._query({layer:a,start:s,num:i,page:t,pageSize:r}):[]}async getAttachmentsByObjectId(e,t){const r=this.getItemByObjectId(e)?.attachments??[];if(!r.length&&t){return(await this._queryAttachments([e]))[e]??[]}return r}getItemByObjectId(e){for(const t of this.pageCache.values())for(const r of t)if(r.objectId===e)return r}getItemIndexByObjectId(e){const{pageCache:t,pageSize:r}=this,s=t.entries();let i=-1;for(const[a,o]of s)if(o.some((t,s)=>{const o=t.objectId===e;return o&&(i=a*r+s),o}),i>-1)break;return i}async load(){const{layer:e}=this;if(!this._loading&&!this._loaded&&e){this._reset(),this._loading=!0;try{await e.load(),e.parent&&m(e.parent)&&await e.parent.loadAll(),await e.when();const t=this.initialSize;this.initialSize=null,await this.refresh(t),this._loaded=!0,this._loading=!1}catch(t){throw this._reset(),this._loadError=!0,this._logError("store:load-error","An error occurred."),t}}}async query(e){const{state:t}=this;return this.supportsQuery&&"loaded"===t?this._query(e):[]}async refresh(e){this._clearCaches(),await this._syncCount(e),await this._syncObjectIdCache()}reset(){this._reset()}async updateAttachment(e,t,r){const{_layerWithAttachmentsEditing:s}=this;if(!s||!this.supportsUpdateAttachments)return{};const i=await this._queueAttachmentsOperation(e,()=>s.updateAttachment(this._createBaseGraphic(s,e),t,r));return this._ensureArrayContent(i)}async updateItem(e){const{_sortedFieldNames:t}=this,r=e.updates.map(({fieldName:e})=>e),s=await this._update(e);return!s.updateFeatureResults.find(e=>e.error)&&r.some(e=>t.includes(e))&&this._clearCaches(),s}async verifyFeaturesByObjectId(e){const{layer:t,state:r}=this;if(!t||"loaded"!==r)return[];const{objectIdField:s}=t,i=await this._verifyFeaturesByObjectId(e);return e.map(e=>i.some(t=>{const r=t.getObjectId()??t.attributes[s];return e===r}))}_clearCaches(){this.pageCache.clear(),this._objectIdCache.removeAll()}_createBaseGraphic(e,r){const s=new t({attributes:{[e.objectIdField]:r}});return this._subtypeField&&null!=this._subtypeCode&&(s.attributes[this._subtypeField]=this._subtypeCode),s}_ensureArray(e){return Array.isArray(e)?e:[e]}_ensureArrayContent(e){return Array.isArray(e)?e[0]:e}_getObjectIdsForPage(e,t){const r=this._objectIdCache.toArray();return r.length>=e+t?r.slice(e,e+t):r.slice(e)}_logError(e,t){u.getLogger(this).error(e,t)}_reset(){this._clearCaches(),this.failures.removeAll(),this._attachmentsOperationQueue.removeAll(),this._editOperationQueue.removeAll(),this._queryOperationQueue.removeAll(),this._loading=!1,this._loaded=!1,this._loadError=!1,this._set("count",0)}async _syncCount(e){null==e?await this._queryCount().then(e=>this._set("count",e)):this._set("count",e)}async _syncObjectIdCache(){if(this.supportsPagination)return;const e=await this._queryObjectIds();this._objectIdCache.removeAll(),this._objectIdCache.addMany(e)}async _verifyFeaturesByObjectId(e){const{layer:t}=this;if(!t||!this.supportsQuery)throw new o("store:query-error","Layer does not support query operation.");const{effectiveTimeExtent:r,effectiveWhere:s,orderByFields:i,supportsCacheHint:a,supportsOrderBy:n}=this,u=t.createQuery();u.where=s,u.timeExtent=r,u.returnGeometry=!1,u.objectIds=e.length?e:void 0,u.outFields=[t.objectIdField],n&&(u.orderByFields=i),a&&(u.cacheHint=!0);return(await t.queryFeatures(u)).features}async _update(e){const{objectId:r,updates:s}=e,{_layerWithEditing:i}=this;if(!this.supportsUpdate||!i)throw new o("store:update-error","Update is not supported.");const a=this.getItemByObjectId(r)?.feature;if(!a)throw new o("store:update-error","Feature with provided 'objectId' not found.");const u=n(a.attributes);s.forEach(({fieldName:e,value:t})=>u[e]=t);const p=new t({attributes:u});p.sourceLayer=a.sourceLayer;const l=i.applyEdits({updateFeatures:[p]}).then(e=>{const{updateFeatureResults:t}=e,r=t.find(e=>!!e.error);if(r)throw r.error;return t.length&&(a.attributes=u),e});return this._queueEditOperation(()=>l)}_prepareFeatureData(e){const{attachments:t,features:r,layer:s,relatedRecords:i}=e,a=s.objectIdField;return r.map(e=>{const r=e.getObjectId()??e.attributes[a],o=[];return e.layer||e.sourceLayer||(e.layer=s,e.sourceLayer=s),i.forEach((e,t)=>{o.push({relationshipId:t,count:e[r]??0})}),{objectId:r,feature:e,attachments:t[r]??null,relatedRecords:o}})}async _query(e){const{page:t,refresh:r}=e;!0===r&&await this.refresh();const s=this.pageCache.get(t);if(s)return s;const i=await this._queryPage(e);return this.pageCache.set(t,i),i}_queryAttachments(e){const{_layerWithAttachments:t,effectiveWhere:r}=this;return t?e.some(e=>"number"!=typeof e)?Promise.reject(new o("invalid-object-id","Only numeric object ids are valid to query attachments")):t.queryAttachments(new f({objectIds:e,where:r,returnMetadata:!0})):Promise.resolve({})}async _queryCount(){const{_relatedLayerSupportsCacheHint:e,layer:t,relationshipConfig:r,supportsCacheHint:s}=this;if(!t)return 0;if(r&&this._canUseRelatedLayer){const{objectId:t,relatedLayer:s,relationshipId:i}=r;return(await s.queryRelatedFeaturesCount(new g({cacheHint:e,relationshipId:i,objectIds:[t]})))[t]??0}const{effectiveTimeExtent:i,effectiveWhere:a,filterGeometry:o,objectIds:n}=this,u=t.createQuery();return u.geometry=o,u.returnGeometry=!1,u.where=a,u.timeExtent=i,u.objectIds=n?.length?n:void 0,s&&(u.cacheHint=!0),t.queryFeatureCount(u)}async _queryFeatures(e){const{relationshipConfig:t}=this;if(t&&this._canUseRelatedLayer)return this._queryRelatedFeatures(e,t);const{_effectiveReturnM:r,_effectiveReturnZ:s,effectiveOutFields:i,effectiveTimeExtent:a,effectiveWhere:o,filterGeometry:n,objectIds:u,orderByFields:p,pageSize:l,returnGeometry:h,supportsCacheHint:d,supportsOrderBy:c,supportsPagination:y}=this,{layer:m,start:_}=e,f=u?.length,g=m.createQuery();g.returnGeometry=h,g.outFields=i,g.returnM=r,g.returnZ=s,y?(g.start=_,g.num=l,g.where=o,g.timeExtent=a,g.objectIds=f?u:void 0):g.objectIds=f?u:this._getObjectIdsForPage(_,l??0),c&&(g.orderByFields=p),n&&(g.geometry=n),d&&(g.cacheHint=!0);return(await m.queryFeatures(g)).features}_queryObjectIds(){const{effectiveTimeExtent:e,effectiveWhere:t,filterGeometry:r,layer:s,objectIds:i,orderByFields:a,supportsCacheHint:o,supportsOrderBy:n}=this;if(!s)return Promise.resolve([]);const u=s.createQuery();return u.geometry=r,u.outFields=[s.objectIdField],u.returnGeometry=!1,u.where=t,u.timeExtent=e,u.objectIds=i?.length?i:void 0,n&&(u.orderByFields=a),o&&(u.cacheHint=!0),s.queryObjectIds(u)}async _queryPage(e){const{layer:t}=e;return this._queueQueryOperation(async()=>{const r=await this._queryFeatures(e),s=r.map(e=>e.getObjectId()??e.attributes[t.objectIdField]),i=await this._queryAttachments(s),a=await this._queryRelatedCounts(s);return this._prepareFeatureData({layer:t,features:r,attachments:i,relatedRecords:a})||[]})}async _queryRelatedCounts(e){const{_layerWithRelationships:t,relationshipIds:r,supportsCacheHintQueryRelated:s}=this,i=new Map;return t&&e?.length&&r.length?(await Promise.allSettled(r.map(async r=>{const a=await t.queryRelatedFeaturesCount(new g({cacheHint:s,relationshipId:r,objectIds:e}));i.set(r,a)})),i):i}async _queryRelatedFeatures(e,t){const{_defaultOutFields:r,_effectiveReturnM:s,_effectiveReturnZ:i,orderByFields:a,pageSize:o,returnGeometry:n,supportsCacheHint:u}=this,{layer:p,start:l}=e,{objectId:h,relatedLayer:d,relationshipId:c}=t,y=p.createQuery(),m=new g({cacheHint:u,num:o,objectIds:[h],orderByFields:a,outFields:r,relationshipId:c,returnGeometry:n,returnM:s,returnZ:i,start:l,where:y.where??void 0}),_=await d.queryRelatedFeatures(m);return _[h]?.features||[]}_queueAttachmentsOperation(e,t){return this._attachmentsOperationQueue.push(t),t().then(async r=>{this._attachmentsOperationQueue.remove(t);const s=this._ensureArray(r),i=s.some(e=>e.error),a=this.getItemByObjectId(e);if(a&&(!i||s.length>1)){const t=await this._queryAttachments([e]);a.attachments=t[e]}return r}).catch(async r=>{this._logError("store:attachment-error","An error occurred.");const s={error:r,retry:()=>{this.failures.remove(s),this._queueAttachmentsOperation(e,t)},cancel:()=>this.failures.remove(s)};throw this.failures.add(s),this._attachmentsOperationQueue.remove(t),r})}_queueEditOperation(e){return this._editOperationQueue.push(e),e().then(t=>(this._editOperationQueue.remove(e),t)).catch(t=>{this._logError("store:edit-error","An error occurred.");const r={error:t,retry:()=>{this.failures.remove(r),this._queueEditOperation(e)},cancel:()=>this.failures.remove(r)};throw this.failures.add(r),this._editOperationQueue.remove(e),t})}_queueQueryOperation(e){return this._queryOperationQueue.push(e),e().then(t=>this._queryOperationQueue.includes(e)?t:[]).catch(t=>{this._logError("store:query-error","An error occurred.");const r={error:t,retry:()=>{this.failures.remove(r),this._queueQueryOperation(e)},cancel:()=>this.failures.remove(r)};return this.failures.add(r),[]}).then(t=>(this._queryOperationQueue.remove(e),t))}};e([d()],C.prototype,"_attachmentsOperationQueue",void 0),e([d({readOnly:!0})],C.prototype,"_capabilities",null),e([d()],C.prototype,"_defaultOutFields",void 0),e([d()],C.prototype,"_editOperationQueue",void 0),e([d()],C.prototype,"_effectiveReturnZ",null),e([d()],C.prototype,"_effectiveReturnM",null),e([d({readOnly:!0})],C.prototype,"_layerWithAttachments",null),e([d({readOnly:!0})],C.prototype,"_layerWithAttachmentsEditing",null),e([d({readOnly:!0})],C.prototype,"_layerWithEditing",null),e([d({readOnly:!0})],C.prototype,"_layerWithRelationships",null),e([d()],C.prototype,"_loaded",void 0),e([d()],C.prototype,"_loadError",void 0),e([d()],C.prototype,"_loading",void 0),e([d()],C.prototype,"_objectIdCache",void 0),e([d()],C.prototype,"_queryOperationQueue",void 0),e([d({readOnly:!0})],C.prototype,"_relatedLayer",null),e([d({readOnly:!0})],C.prototype,"_relatedLayerCapabilities",null),e([d({readOnly:!0})],C.prototype,"_relatedLayerSupportsCacheHint",null),e([d()],C.prototype,"_relatedLayerSupportsQuery",null),e([d()],C.prototype,"_relatedLayerSupportsQueryRelated",null),e([d()],C.prototype,"_sortedFieldNames",null),e([d()],C.prototype,"_subtypeCode",null),e([d()],C.prototype,"_subtypeField",null),e([d()],C.prototype,"_canUseRelatedLayer",null),e([d()],C.prototype,"attachmentsEnabled",void 0),e([d()],C.prototype,"canAddRelatedFeature",null),e([d({readOnly:!0})],C.prototype,"count",void 0),e([d()],C.prototype,"effectiveOutFields",null),e([d()],C.prototype,"effectiveTimeExtent",null),e([d()],C.prototype,"effectiveWhere",null),e([d({readOnly:!0})],C.prototype,"failures",void 0),e([d({types:y})],C.prototype,"filterGeometry",void 0),e([d()],C.prototype,"initialSize",void 0),e([d({readOnly:!0})],C.prototype,"isQuerying",null),e([d({readOnly:!0})],C.prototype,"isSyncing",null),e([d({readOnly:!0})],C.prototype,"isSyncingAttachmentEdits",null),e([d({readOnly:!0})],C.prototype,"isSyncingFeatureEdits",null),e([d({readOnly:!0})],C.prototype,"itemCache",null),e([d()],C.prototype,"layer",void 0),e([d()],C.prototype,"layerView",null),e([d()],C.prototype,"objectIds",void 0),e([d()],C.prototype,"orderByFields",null),e([d()],C.prototype,"outFields",void 0),e([d({readOnly:!0})],C.prototype,"pageCache",void 0),e([d()],C.prototype,"pageSize",void 0),e([d()],C.prototype,"relationship",null),e([d()],C.prototype,"relationshipConfig",void 0),e([d()],C.prototype,"relationshipIds",null),e([d()],C.prototype,"relationshipInfos",null),e([d()],C.prototype,"relationships",null),e([d()],C.prototype,"relatedRecordsEnabled",void 0),e([d()],C.prototype,"returnGeometry",void 0),e([d()],C.prototype,"returnZ",void 0),e([d()],C.prototype,"returnM",void 0),e([d()],C.prototype,"sortOrders",void 0),e([d({readOnly:!0})],C.prototype,"state",null),e([d()],C.prototype,"supportsAdd",null),e([d()],C.prototype,"supportsAddAttachments",null),e([d()],C.prototype,"supportsAttachments",null),e([d()],C.prototype,"supportsCacheHint",null),e([d()],C.prototype,"supportsCacheHintQueryRelated",null),e([d()],C.prototype,"supportsDelete",null),e([d()],C.prototype,"supportsEditing",null),e([d()],C.prototype,"supportsM",null),e([d()],C.prototype,"supportsOrderBy",null),e([d()],C.prototype,"supportsPagination",null),e([d()],C.prototype,"supportsQuery",null),e([d()],C.prototype,"supportsQueryRelated",null),e([d()],C.prototype,"supportsResizeAttachments",null),e([d()],C.prototype,"supportsUpdate",null),e([d()],C.prototype,"supportsUpdateAttachments",null),e([d()],C.prototype,"supportsZ",null),e([d({type:b})],C.prototype,"timeExtent",void 0),e([d()],C.prototype,"view",void 0),e([d()],C.prototype,"where",void 0),C=e([c("esri.widgets.FeatureTable.support.FeatureStore")],C);const w=C;export{w as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import r from"../../../core/Accessor.js";import{equals as s,isSome as i}from"../../../core/arrayUtils.js";import a from"../../../core/Collection.js";import o from"../../../core/Error.js";import{clone as n}from"../../../core/lang.js";import u from"../../../core/Logger.js";import p from"../../../core/ReactiveMap.js";import{watch as l,when as h}from"../../../core/reactiveUtils.js";import{property as d,subclass as c}from"../../../core/accessorSupport/decorators.js";import{geometryTypes as y}from"../../../geometry/support/typeUtils.js";import{isSubtypeGroupLayer as m,isSubtypeSublayer as _}from"../../../layers/support/layerUtils.js";import f from"../../../rest/support/AttachmentQuery.js";import g from"../../../rest/support/RelationshipQuery.js";import b from"../../../time/TimeExtent.js";import{isIFeatureTableSupportedLayerWithAttachments as v,isIFeatureTableSupportedLayerWithAttachmentsEditing as O,isIFeatureTableSupportedLayerWithEditing as I,isIFeatureTableSupportedLayerWithRelationships as A,findRelatedLayer as j}from"./tableUtils.js";let C=class extends r{constructor(e){super(e),this._attachmentsOperationQueue=new a,this._defaultOutFields=["*"],this._editOperationQueue=new a,this._loaded=!1,this._loadError=!1,this._loading=!1,this._objectIdCache=new a,this._queryOperationQueue=new a,this.attachmentsEnabled=!1,this.count=0,this.editingEnabled=!1,this.failures=new a,this.filterGeometry=null,this.initialSize=null,this.layer=null,this.objectIds=null,this.outFields=null,this.pageCache=new p,this.pageSize=50,this.relationshipConfig=null,this.relatedRecordsEnabled=!1,this.returnGeometry=!1,this.returnZ=!1,this.returnM=!1,this.sortOrders=[],this.timeExtent=null,this.timeZone=null,this.view=null,this.where=null}initialize(){this.addHandles([l(()=>[this.filterGeometry,this.layer,this.objectIds,this.outFields,this.pageSize,this.relationshipConfig,this.returnGeometry,this.returnM,this.returnZ,this.timeExtent,this.where],()=>this._reset()),l(()=>this.orderByFields,()=>this._clearCaches(),{equals:s}),h(()=>this.attachmentsEnabled,()=>this._reset()),h(()=>this.relatedRecordsEnabled,()=>this._reset())])}destroy(){this.layer=null,this.itemCache?.destroy(),this.failures?.destroy()}get _capabilities(){const{layer:e}=this;return e?.effectiveCapabilities??e?.capabilities}get _effectiveReturnZ(){return this.returnZ&&this.supportsZ}get _effectiveReturnM(){return this.returnM&&this.supportsM}get _layerWithAttachments(){const{layer:e}=this;return e&&this._capabilities&&this.attachmentsEnabled&&this.supportsAttachments&&v(e)?e:null}get _layerWithAttachmentsEditing(){const{_layerWithAttachments:e}=this;return e&&O(e)&&this.supportsEditing?e:null}get _layerWithEditing(){const e=this.layer;return I(e)&&this.supportsEditing?e:null}get _layerWithRelationships(){const e=this.layer;return A(e)&&this.supportsQueryRelated?e:null}get _relatedLayer(){return this.relationshipConfig?.relatedLayer}get _relatedLayerCapabilities(){const{_relatedLayer:e}=this;return e?.effectiveCapabilities??e?.capabilities}get _relatedLayerSupportsCacheHint(){return!!this._relatedLayerCapabilities?.queryRelated?.supportsCacheHint}get _relatedLayerSupportsQuery(){return!!this._relatedLayerCapabilities?.operations.supportsQuery}get _relatedLayerSupportsQueryRelated(){const{_relatedLayerCapabilities:e}=this;return!!e?.queryRelated?.supportsCount&&!!e?.queryRelated?.supportsPagination}get _sortedFieldNames(){return this.sortOrders.map(({fieldName:e})=>e)}get _subtypeCode(){return this.layer?.subtypeCode??null}get _subtypeField(){const{layer:e}=this;return m(e?.parent)?e.subtypeField:null}get _canUseRelatedLayer(){return!(!this._relatedLayerSupportsQuery||!this._relatedLayerSupportsQueryRelated)}get canAddRelatedFeature(){const{state:e,relationship:t,supportsAdd:r,supportsEditing:s}=this;if("loaded"!==e||!t||!r||!s)return!1;const{count:i}=this,{cardinality:a,role:o}=t,n=i>0;return("one-to-one"!==a||!n)&&("one-to-many"!==a||"origin"!==o||!n)}get effectiveOutFields(){const{layer:e,outFields:t}=this;if(!e||!t?.length)return this._defaultOutFields;const r=[];t.forEach(t=>{const s=e.fieldsIndex.normalizeFieldName(t);s&&r.push(s)});const{objectIdField:s}=e,i=e.fieldsIndex.normalizeFieldName(s)??s;return i&&!r.includes(i)&&r.unshift(i),r}get effectiveTimeExtent(){const{layer:e,timeExtent:t}=this;return t||e&&"timeExtent"in e&&e.timeExtent||null}get effectiveWhere(){const{layer:e,where:t}=this;return null!=t&&""!==t?t:_(e)&&e.parent?.definitionExpression?e.parent.definitionExpression:e?.definitionExpression||"1=1"}get isQuerying(){return this._queryOperationQueue.length>0}get isSyncing(){return this.isSyncingFeatureEdits||this.isSyncingAttachmentEdits}get isSyncingAttachmentEdits(){return this._attachmentsOperationQueue.length>0}get isSyncingFeatureEdits(){return this._editOperationQueue.length>0}get itemCache(){return new a({items:[...this.pageCache.values()].flat()})}get layerView(){const{layer:e,view:t}=this;if(!e||!t)return null;const r="sublayer"===e.type||_(e)?e.parent:e;return t.allLayerViews.find(e=>e.layer===r)}get orderByFields(){const{_sortedFieldNames:e,layer:t,sortOrders:r}=this,s=r.filter(({fieldName:t,direction:r},s)=>e.indexOf(t)===s&&null!=r).map(({fieldName:e,direction:t})=>`${e} ${t?.toUpperCase()}`);if(t&&!s.length&&!t.objectIdField&&t.fields?.length){const e=t.fields.find(e=>e.name);if(e){const r=t.fieldsIndex.normalizeFieldName(e.name);r&&s.push(`${r} ASC`)}}return s}get relationship(){const{relationshipConfig:e}=this;return null==e?.relationshipId?null:this.relationships?.find(t=>t.id===e.relationshipId)}get relationshipIds(){return this.relationships?.map(e=>e.id)??[]}get relationshipInfos(){const{_layerWithRelationships:e,relatedRecordsEnabled:t,relationships:r,view:s}=this,i=[];return t&&e?.loaded&&s?.map&&r?.length?(r.forEach(t=>{const r=j(e,s,t);r&&(r.load(),i.push({layer:e,relatedLayer:r,relationshipId:t.id}))}),i):i}get relationships(){return this._layerWithRelationships?.relationships}get state(){const{layer:e,_loaded:t,_loadError:r,_loading:s}=this;return!e||e.destroyed?"disabled":r||e.loadError?"error":"loaded"===e.loadStatus&&t?"loaded":s?"loading":"ready"}get supportsAdd(){return!!this._capabilities?.operations.supportsAdd}get supportsAddAttachments(){return!(!this._layerWithAttachmentsEditing||!this.supportsAdd&&!this.supportsUpdate)}get supportsAttachments(){const{_capabilities:e}=this;return!(!e?.data?.supportsAttachment||!e?.operations.supportsQueryAttachments)}get supportsCacheHint(){return!!this._capabilities?.query?.supportsCacheHint}get supportsCacheHintQueryRelated(){return!!this._capabilities?.queryRelated?.supportsCacheHint}get supportsDelete(){return!!this._capabilities?.operations.supportsDelete}get supportsEditing(){return!!this._capabilities?.operations.supportsEditing}get supportsM(){return!!this.layer?.hasM&&!!this._capabilities?.data?.supportsM}get supportsOrderBy(){return!!this._capabilities?.query?.supportsOrderBy}get supportsPagination(){return!!this._capabilities?.query?.supportsPagination}get supportsQuery(){return!!this._capabilities?.operations.supportsQuery}get supportsQueryRelated(){const{_capabilities:e}=this;return!!e?.queryRelated?.supportsCount&&!!e?.queryRelated?.supportsPagination}get supportsResizeAttachments(){const{_capabilities:e}=this;return!(!this.supportsAttachments||!e?.attachment?.supportsResize)}get supportsUpdate(){return!!this._capabilities?.operations.supportsUpdate}get supportsUpdateAttachments(){return!(!this._layerWithAttachmentsEditing||!this.supportsAdd&&!this.supportsUpdate)}get supportsZ(){return!!this.layer?.hasZ&&!!this._capabilities?.data?.supportsZ}async addAttachment(e,t){const{_layerWithAttachmentsEditing:r}=this;if(!r||!this.supportsAddAttachments)return{};const s=await this._queueAttachmentsOperation(e,()=>r.addAttachment(this._createBaseGraphic(r,e),t));return this._ensureArrayContent(s)}async deleteAttachments(e,t){const{_layerWithAttachmentsEditing:r}=this;if(!r||!this.supportsUpdateAttachments||!t.length)return[];const s=await this._queueAttachmentsOperation(e,()=>r.deleteAttachments(this._createBaseGraphic(r,e),t));return this._ensureArray(s)}async deleteRowsByObjectId(e){const{_layerWithEditing:t}=this;if(!this.supportsDelete||!t)throw new o("store:delete-error","Delete is not supported.");const r=e.map(e=>this.getItemByObjectId(e)?.feature).filter(i);return this._queueEditOperation(()=>t.applyEdits({deleteFeatures:r}))}async fetchItems(e){const{page:t}=e,{pageSize:r}=this,s=t*r,i=s+r,{layer:a,state:o}=this;return a&&"loaded"===o?this._query({layer:a,start:s,num:i,page:t,pageSize:r}):[]}async getAttachmentsByObjectId(e,t){const r=this.getItemByObjectId(e)?.attachments??[];if(!r.length&&t){return(await this._queryAttachments([e]))[e]??[]}return r}getItemByObjectId(e){for(const t of this.pageCache.values())for(const r of t)if(r.objectId===e)return r}getItemIndexByObjectId(e){const{pageCache:t,pageSize:r}=this,s=t.entries();let i=-1;for(const[a,o]of s)if(o.some((t,s)=>{const o=t.objectId===e;return o&&(i=a*r+s),o}),i>-1)break;return i}async load(){const{layer:e}=this;if(!this._loading&&!this._loaded&&e){this._reset(),this._loading=!0;try{await e.load(),e.parent&&m(e.parent)&&await e.parent.loadAll(),await e.when();const t=this.initialSize;this.initialSize=null,await this.refresh(t),this._loaded=!0,this._loading=!1}catch(t){throw this._reset(),this._loadError=!0,this._logError("store:load-error","An error occurred."),t}}}async query(e){const{state:t}=this;return this.supportsQuery&&"loaded"===t?this._query(e):[]}async refresh(e){this._clearCaches(),await this._syncCount(e),await this._syncObjectIdCache()}reset(){this._reset()}async updateAttachment(e,t,r){const{_layerWithAttachmentsEditing:s}=this;if(!s||!this.supportsUpdateAttachments)return{};const i=await this._queueAttachmentsOperation(e,()=>s.updateAttachment(this._createBaseGraphic(s,e),t,r));return this._ensureArrayContent(i)}async updateItem(e){const{_sortedFieldNames:t}=this,r=e.updates.map(({fieldName:e})=>e),s=await this._update(e);return!s.updateFeatureResults.find(e=>e.error)&&r.some(e=>t.includes(e))&&this._clearCaches(),s}async verifyFeaturesByObjectId(e){const{layer:t,state:r}=this;if(!t||"loaded"!==r)return[];const{objectIdField:s}=t,i=await this._verifyFeaturesByObjectId(e);return e.map(e=>i.some(t=>{const r=t.getObjectId()??t.attributes[s];return e===r}))}_clearCaches(){this.pageCache.clear(),this._objectIdCache.removeAll()}_createBaseGraphic(e,r){const s=new t({attributes:{[e.objectIdField]:r}});return this._subtypeField&&null!=this._subtypeCode&&(s.attributes[this._subtypeField]=this._subtypeCode),s}_ensureArray(e){return Array.isArray(e)?e:[e]}_ensureArrayContent(e){return Array.isArray(e)?e[0]:e}_getObjectIdsForPage(e,t){const r=this._objectIdCache.toArray();return r.length>=e+t?r.slice(e,e+t):r.slice(e)}_logError(e,t){u.getLogger(this).error(e,t)}_reset(){this._clearCaches(),this.failures.removeAll(),this._attachmentsOperationQueue.removeAll(),this._editOperationQueue.removeAll(),this._queryOperationQueue.removeAll(),this._loading=!1,this._loaded=!1,this._loadError=!1,this._set("count",0)}async _syncCount(e){null==e?await this._queryCount().then(e=>this._set("count",e)):this._set("count",e)}async _syncObjectIdCache(){if(this.supportsPagination)return;const e=await this._queryObjectIds();this._objectIdCache.removeAll(),this._objectIdCache.addMany(e)}async _verifyFeaturesByObjectId(e){const{layer:t}=this;if(!t||!this.supportsQuery)throw new o("store:query-error","Layer does not support query operation.");const{effectiveTimeExtent:r,effectiveWhere:s,orderByFields:i,supportsCacheHint:a,supportsOrderBy:n}=this,u=t.createQuery();u.where=s,u.timeExtent=r,u.returnGeometry=!1,u.objectIds=e.length?e:void 0,u.outFields=[t.objectIdField],n&&(u.orderByFields=i),a&&(u.cacheHint=!0);return(await t.queryFeatures(u)).features}async _update(e){const{objectId:r,updates:s}=e,{_layerWithEditing:i}=this;if(!this.supportsUpdate||!i)throw new o("store:update-error","Update is not supported.");const a=this.getItemByObjectId(r)?.feature;if(!a)throw new o("store:update-error","Feature with provided 'objectId' not found.");const u=n(a.attributes);s.forEach(({fieldName:e,value:t})=>u[e]=t);const p=new t({attributes:u});p.sourceLayer=a.sourceLayer;const l=i.applyEdits({updateFeatures:[p]}).then(e=>{const{updateFeatureResults:t}=e,r=t.find(e=>!!e.error);if(r)throw r.error;return t.length&&(a.attributes=u),e});return this._queueEditOperation(()=>l)}_prepareFeatureData(e){const{attachments:t,features:r,layer:s,relatedRecords:i}=e,a=s.objectIdField;return r.map(e=>{const r=e.getObjectId()??e.attributes[a],o=[];return e.layer||e.sourceLayer||(e.layer=s,e.sourceLayer=s),i.forEach((e,t)=>{o.push({relationshipId:t,count:e[r]??0})}),{objectId:r,feature:e,attachments:t[r]??null,relatedRecords:o}})}async _query(e){const{page:t,refresh:r}=e;!0===r&&await this.refresh();const s=this.pageCache.get(t);if(s)return s;const i=await this._queryPage(e);return this.pageCache.set(t,i),i}_queryAttachments(e){const{_layerWithAttachments:t,effectiveWhere:r}=this;return t?e.some(e=>"number"!=typeof e)?Promise.reject(new o("invalid-object-id","Only numeric object ids are valid to query attachments")):t.queryAttachments(new f({objectIds:e,where:r,returnMetadata:!0})):Promise.resolve({})}async _queryCount(){const{_relatedLayerSupportsCacheHint:e,layer:t,relationshipConfig:r,supportsCacheHint:s}=this;if(!t)return 0;if(r&&this._canUseRelatedLayer){const{objectId:t,relatedLayer:s,relationshipId:i}=r;return(await s.queryRelatedFeaturesCount(new g({cacheHint:e,relationshipId:i,objectIds:[t]})))[t]??0}const{effectiveTimeExtent:i,effectiveWhere:a,filterGeometry:o,objectIds:n}=this,u=t.createQuery();return u.geometry=o,u.returnGeometry=!1,u.where=a,u.timeExtent=i,u.objectIds=n?.length?n:void 0,s&&(u.cacheHint=!0),t.queryFeatureCount(u)}async _queryFeatures(e){const{relationshipConfig:t}=this;if(t&&this._canUseRelatedLayer)return this._queryRelatedFeatures(e,t);const{_effectiveReturnM:r,_effectiveReturnZ:s,effectiveOutFields:i,effectiveTimeExtent:a,effectiveWhere:o,filterGeometry:n,objectIds:u,orderByFields:p,pageSize:l,returnGeometry:h,supportsCacheHint:d,supportsOrderBy:c,supportsPagination:y}=this,{layer:m,start:_}=e,f=u?.length,g=m.createQuery();g.returnGeometry=h,g.outFields=i,g.returnM=r,g.returnZ=s,y?(g.start=_,g.num=l,g.where=o,g.timeExtent=a,g.objectIds=f?u:void 0):g.objectIds=f?u:this._getObjectIdsForPage(_,l??0),c&&(g.orderByFields=p),n&&(g.geometry=n),d&&(g.cacheHint=!0);return(await m.queryFeatures(g)).features}_queryObjectIds(){const{effectiveTimeExtent:e,effectiveWhere:t,filterGeometry:r,layer:s,objectIds:i,orderByFields:a,supportsCacheHint:o,supportsOrderBy:n}=this;if(!s)return Promise.resolve([]);const u=s.createQuery();return u.geometry=r,u.outFields=[s.objectIdField],u.returnGeometry=!1,u.where=t,u.timeExtent=e,u.objectIds=i?.length?i:void 0,n&&(u.orderByFields=a),o&&(u.cacheHint=!0),s.queryObjectIds(u)}async _queryPage(e){const{layer:t}=e;return this._queueQueryOperation(async()=>{const r=await this._queryFeatures(e),s=r.map(e=>e.getObjectId()??e.attributes[t.objectIdField]),i=await this._queryAttachments(s),a=await this._queryRelatedCounts(s);return this._prepareFeatureData({layer:t,features:r,attachments:i,relatedRecords:a})||[]})}async _queryRelatedCounts(e){const{_layerWithRelationships:t,relationshipIds:r,supportsCacheHintQueryRelated:s}=this,i=new Map;return t&&e?.length&&r.length?(await Promise.allSettled(r.map(async r=>{const a=await t.queryRelatedFeaturesCount(new g({cacheHint:s,relationshipId:r,objectIds:e}));i.set(r,a)})),i):i}async _queryRelatedFeatures(e,t){const{_defaultOutFields:r,_effectiveReturnM:s,_effectiveReturnZ:i,orderByFields:a,pageSize:o,returnGeometry:n,supportsCacheHint:u}=this,{layer:p,start:l}=e,{objectId:h,relatedLayer:d,relationshipId:c}=t,y=p.createQuery(),m=new g({cacheHint:u,num:o,objectIds:[h],orderByFields:a,outFields:r,relationshipId:c,returnGeometry:n,returnM:s,returnZ:i,start:l,where:y.where??void 0}),_=await d.queryRelatedFeatures(m);return _[h]?.features||[]}_queueAttachmentsOperation(e,t){return this._attachmentsOperationQueue.push(t),t().then(async r=>{this._attachmentsOperationQueue.remove(t);const s=this._ensureArray(r),i=s.some(e=>e.error),a=this.getItemByObjectId(e);if(a&&(!i||s.length>1)){const t=await this._queryAttachments([e]);a.attachments=t[e]}return r}).catch(async r=>{this._logError("store:attachment-error","An error occurred.");const s={error:r,retry:()=>{this.failures.remove(s),this._queueAttachmentsOperation(e,t)},cancel:()=>this.failures.remove(s)};throw this.failures.add(s),this._attachmentsOperationQueue.remove(t),r})}_queueEditOperation(e){return this._editOperationQueue.push(e),e().then(t=>(this._editOperationQueue.remove(e),t)).catch(t=>{this._logError("store:edit-error","An error occurred.");const r={error:t,retry:()=>{this.failures.remove(r),this._queueEditOperation(e)},cancel:()=>this.failures.remove(r)};throw this.failures.add(r),this._editOperationQueue.remove(e),t})}_queueQueryOperation(e){return this._queryOperationQueue.push(e),e().then(t=>this._queryOperationQueue.includes(e)?t:[]).catch(t=>{this._logError("store:query-error","An error occurred.");const r={error:t,retry:()=>{this.failures.remove(r),this._queueQueryOperation(e)},cancel:()=>this.failures.remove(r)};return this.failures.add(r),[]}).then(t=>(this._queryOperationQueue.remove(e),t))}};e([d()],C.prototype,"_attachmentsOperationQueue",void 0),e([d({readOnly:!0})],C.prototype,"_capabilities",null),e([d()],C.prototype,"_defaultOutFields",void 0),e([d()],C.prototype,"_editOperationQueue",void 0),e([d()],C.prototype,"_effectiveReturnZ",null),e([d()],C.prototype,"_effectiveReturnM",null),e([d({readOnly:!0})],C.prototype,"_layerWithAttachments",null),e([d({readOnly:!0})],C.prototype,"_layerWithAttachmentsEditing",null),e([d({readOnly:!0})],C.prototype,"_layerWithEditing",null),e([d({readOnly:!0})],C.prototype,"_layerWithRelationships",null),e([d()],C.prototype,"_loaded",void 0),e([d()],C.prototype,"_loadError",void 0),e([d()],C.prototype,"_loading",void 0),e([d()],C.prototype,"_objectIdCache",void 0),e([d()],C.prototype,"_queryOperationQueue",void 0),e([d({readOnly:!0})],C.prototype,"_relatedLayer",null),e([d({readOnly:!0})],C.prototype,"_relatedLayerCapabilities",null),e([d({readOnly:!0})],C.prototype,"_relatedLayerSupportsCacheHint",null),e([d()],C.prototype,"_relatedLayerSupportsQuery",null),e([d()],C.prototype,"_relatedLayerSupportsQueryRelated",null),e([d()],C.prototype,"_sortedFieldNames",null),e([d()],C.prototype,"_subtypeCode",null),e([d()],C.prototype,"_subtypeField",null),e([d()],C.prototype,"_canUseRelatedLayer",null),e([d()],C.prototype,"attachmentsEnabled",void 0),e([d()],C.prototype,"canAddRelatedFeature",null),e([d({readOnly:!0})],C.prototype,"count",void 0),e([d()],C.prototype,"editingEnabled",void 0),e([d()],C.prototype,"effectiveOutFields",null),e([d()],C.prototype,"effectiveTimeExtent",null),e([d()],C.prototype,"effectiveWhere",null),e([d({readOnly:!0})],C.prototype,"failures",void 0),e([d({types:y})],C.prototype,"filterGeometry",void 0),e([d()],C.prototype,"initialSize",void 0),e([d({readOnly:!0})],C.prototype,"isQuerying",null),e([d({readOnly:!0})],C.prototype,"isSyncing",null),e([d({readOnly:!0})],C.prototype,"isSyncingAttachmentEdits",null),e([d({readOnly:!0})],C.prototype,"isSyncingFeatureEdits",null),e([d({readOnly:!0})],C.prototype,"itemCache",null),e([d()],C.prototype,"layer",void 0),e([d()],C.prototype,"layerView",null),e([d()],C.prototype,"objectIds",void 0),e([d()],C.prototype,"orderByFields",null),e([d()],C.prototype,"outFields",void 0),e([d({readOnly:!0})],C.prototype,"pageCache",void 0),e([d()],C.prototype,"pageSize",void 0),e([d()],C.prototype,"relationship",null),e([d()],C.prototype,"relationshipConfig",void 0),e([d()],C.prototype,"relationshipIds",null),e([d()],C.prototype,"relationshipInfos",null),e([d()],C.prototype,"relationships",null),e([d()],C.prototype,"relatedRecordsEnabled",void 0),e([d()],C.prototype,"returnGeometry",void 0),e([d()],C.prototype,"returnZ",void 0),e([d()],C.prototype,"returnM",void 0),e([d()],C.prototype,"sortOrders",void 0),e([d({readOnly:!0})],C.prototype,"state",null),e([d()],C.prototype,"supportsAdd",null),e([d()],C.prototype,"supportsAddAttachments",null),e([d()],C.prototype,"supportsAttachments",null),e([d()],C.prototype,"supportsCacheHint",null),e([d()],C.prototype,"supportsCacheHintQueryRelated",null),e([d()],C.prototype,"supportsDelete",null),e([d()],C.prototype,"supportsEditing",null),e([d()],C.prototype,"supportsM",null),e([d()],C.prototype,"supportsOrderBy",null),e([d()],C.prototype,"supportsPagination",null),e([d()],C.prototype,"supportsQuery",null),e([d()],C.prototype,"supportsQueryRelated",null),e([d()],C.prototype,"supportsResizeAttachments",null),e([d()],C.prototype,"supportsUpdate",null),e([d()],C.prototype,"supportsUpdateAttachments",null),e([d()],C.prototype,"supportsZ",null),e([d({type:b})],C.prototype,"timeExtent",void 0),e([d()],C.prototype,"timeZone",void 0),e([d()],C.prototype,"view",void 0),e([d()],C.prototype,"where",void 0),C=e([c("esri.widgets.FeatureTable.support.FeatureStore")],C);const w=C;export{w as default};
|