@arcgis/core 5.1.0-next.92 → 5.1.0-next.94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analysis/ShadowCast/DiscreteOptions.d.ts +12 -6
- package/analysis/ShadowCast/MinDurationOptions.d.ts +17 -9
- package/analysis/ShadowCast/TotalDurationOptions.d.ts +10 -6
- package/analysis/ShadowCastAnalysis.d.ts +23 -17
- package/analysis/Viewshed.js +1 -1
- package/arcade/arcadeAsyncRuntime.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/arcadeRuntime.js +1 -1
- package/arcade/compilerUtils.js +1 -1
- package/arcade/debug.d.ts +10 -1
- package/arcade.js +1 -1
- package/assets/components/assets/combobox/t9n/messages.fr.json +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/01af2a0611386df64cb1.js +636 -0
- package/assets/esri/core/workers/chunks/031ea31bbdb7f1be791e.js +1 -0
- package/assets/esri/core/workers/chunks/{9c09097e390985bbac58.js → 075a1e91a075efe59cd3.js} +1 -1
- package/assets/esri/core/workers/chunks/0981fe06796060e50d40.js +1 -0
- package/assets/esri/core/workers/chunks/0ab1384282afc8731857.js +1 -0
- package/assets/esri/core/workers/chunks/1523883460874c352e36.js +1 -0
- package/assets/esri/core/workers/chunks/{de3e5d82502ee15b7eae.js → 15a070d4ac2087b79e8b.js} +1 -1
- package/assets/esri/core/workers/chunks/198864c107fa2b24518c.js +1 -0
- package/assets/esri/core/workers/chunks/1f141a007b1ef9b069c6.js +1 -0
- package/assets/esri/core/workers/chunks/268f203d2492a03165ac.js +1 -0
- package/assets/esri/core/workers/chunks/{f52443cd203e687551da.js → 2fda38219d778f0447b5.js} +1 -1
- package/assets/esri/core/workers/chunks/2ffffc1931b2e27c6617.js +1 -0
- package/assets/esri/core/workers/chunks/{394812e19b6915d560b0.js → 3a691f848152e3818a48.js} +1 -1
- package/assets/esri/core/workers/chunks/{ceff78c9e31e3572a082.js → 3a6b8879702fb247328b.js} +1 -1
- package/assets/esri/core/workers/chunks/{41cbde4738ae4adf973d.js → 4142d5232c99d8aa943d.js} +5 -5
- package/assets/esri/core/workers/chunks/4378e544687fec4b06fb.js +1 -0
- package/assets/esri/core/workers/chunks/{4b9b9e6136c11d5d7901.js → 460e693ad19fa77ffdc2.js} +1 -1
- package/assets/esri/core/workers/chunks/4df19e670b6ed76c1dea.js +2 -0
- package/assets/esri/core/workers/chunks/{a169d9fe66b5865911d9.js → 503439246250d9e1cbd5.js} +1 -1
- package/assets/esri/core/workers/chunks/{1e3fe89970c57a883fe5.js → 53ff47c06ccfc0be885c.js} +1 -1
- package/assets/esri/core/workers/chunks/561d45dc9421f80feca5.js +1 -0
- package/assets/esri/core/workers/chunks/598271956c46e21e5c09.js +1 -0
- package/assets/esri/core/workers/chunks/{d82da31dc702b8fd6a07.js → 59a64d72eed8c40c63cf.js} +1 -1
- package/assets/esri/core/workers/chunks/5a8fd2fd8a24f9290b7f.js +1 -0
- package/assets/esri/core/workers/chunks/64cf18ba2869171a5a7a.js +1 -0
- package/assets/esri/core/workers/chunks/{fade7b878a9498382bb2.js → 700f7aa9cf7b13acaf5d.js} +1 -1
- package/assets/esri/core/workers/chunks/{4c97cc922eece3a91b6b.js → 7531bbcb6613c87a344e.js} +1 -1
- package/assets/esri/core/workers/chunks/{6f67c9f68101a084b683.js → 765bc49e58e9d0caa496.js} +6 -6
- package/assets/esri/core/workers/chunks/8042e001545e2782499c.js +1 -0
- package/assets/esri/core/workers/chunks/{bb8d596f15fd3a0d783a.js → 82215d7a64b8be02eff1.js} +1 -1
- package/assets/esri/core/workers/chunks/{d3d9d40556c847bba1a7.js → 87f7a674957f734b1b42.js} +1 -1
- package/assets/esri/core/workers/chunks/{5409369d0d637cb30257.js → 8875e53097b25655ef67.js} +1 -1
- package/assets/esri/core/workers/chunks/8e1140725a72038627c2.js +1 -0
- package/assets/esri/core/workers/chunks/8e374ce47256a567ae11.js +1 -0
- package/assets/esri/core/workers/chunks/{127cd8fee3717a473fc5.js → 928dac64e6ba401d391a.js} +1 -1
- package/assets/esri/core/workers/chunks/{d7e7f3efd1d28617b808.js → 92e7067960549733f8e6.js} +1 -1
- package/assets/esri/core/workers/chunks/{0a6df243b18acae471be.js → 992525afdf11b2fb16d4.js} +1 -1
- package/assets/esri/core/workers/chunks/{f1673e723b336204ad77.js → 9b23d999db902d25ba58.js} +1 -1
- package/assets/esri/core/workers/chunks/{f2c11f54255fd506655e.js → 9b869a8bda9384f25464.js} +1 -1
- package/assets/esri/core/workers/chunks/a76e14fe5e8b2f7ef9de.js +2 -0
- package/assets/esri/core/workers/chunks/{46b16501db6681dc467b.js → af074b5b4e1d6baf5219.js} +1 -1
- package/assets/esri/core/workers/chunks/{75c09a2fa4c34b4844c5.js → be0eab592db0e651b023.js} +6 -6
- package/assets/esri/core/workers/chunks/{2dcfc4d7e76c922bcbf9.js → c7b9df9a204f6206364a.js} +1 -1
- package/assets/esri/core/workers/chunks/{969f58a2de4ebe63619d.js → c88fd4f69cb2b53b48ec.js} +1 -1
- package/assets/esri/core/workers/chunks/{ee057c85cdf6beb5b012.js → d1ba118ddd0390c07f35.js} +2 -2
- package/assets/esri/core/workers/chunks/d6f03f628ebfc28fdd23.js +2 -0
- package/assets/esri/core/workers/chunks/{577cbc131b21c351fae5.js → d87e504082e293640ece.js} +2 -2
- package/assets/esri/core/workers/chunks/{54c035cdc171998d0776.js → de99500b0fcedf2c8a5c.js} +1 -1
- package/assets/esri/core/workers/chunks/e54ad3683ad992682deb.js +1 -0
- package/assets/esri/core/workers/chunks/e6f1ed5e56f1d9862821.js +1 -0
- package/assets/esri/core/workers/chunks/e7e7c7cbfd8542bd7a46.js +1 -0
- package/assets/esri/core/workers/chunks/{27f67a3828b78d4c1413.js → e81afc8a058a8ecc9b24.js} +1 -1
- package/assets/esri/core/workers/chunks/{aefeb5a17bb481c95da3.js → eeb847bfea558566adf6.js} +1 -1
- package/assets/esri/core/workers/chunks/{90a8dfb03a437fe8a6e7.js → f04b49d80f422708d98c.js} +1 -1
- package/assets/esri/core/workers/chunks/{d11de13537b623739e14.js → f14e3693cd644265f909.js} +1 -1
- package/assets/esri/core/workers/chunks/f2beb4267b8d4cddfa3e.js +1 -0
- package/assets/esri/core/workers/chunks/{2fd4220131bfc3f5e2dd.js → f635a8e3b0bfeda99ed5.js} +1 -1
- package/assets/esri/core/workers/chunks/{aa6808146c76b2d49b64.js → f68c12e0c1eda7f73a17.js} +1 -1
- package/assets/esri/core/workers/chunks/f69c44479ee3fd8c831d.js +1 -0
- package/assets/esri/core/workers/chunks/fa3138dd8139008b430d.js +1 -0
- package/assets/esri/core/workers/chunks/fa4265db06e2721754a0.js +1 -0
- package/assets/esri/core/workers/chunks/{adfa5c136c72c1e65770.js → fb75d4bce1e86eed017a.js} +28 -22
- package/chunks/GlobalIllumination.glsl.js +24 -18
- package/chunks/GlowBlur.glsl.js +11 -11
- package/chunks/GlowComposition.glsl.js +4 -4
- package/chunks/RibbonLine.glsl.js +91 -51
- package/chunks/ShadowCastVisualize.glsl.js +18 -15
- package/config.js +1 -1
- package/geometry/support/geometryUtils.js +1 -1
- package/kernel.js +1 -1
- package/layers/FeatureLayer.d.ts +27 -1
- package/layers/FeatureLayer.js +1 -1
- package/layers/graphics/sources/MemorySource.js +1 -1
- package/layers/mixins/PortalLayer.js +1 -1
- package/layers/raster/datasets/ImageAuxRaster.js +1 -1
- package/layers/raster/datasets/InMemoryRaster.js +1 -1
- package/layers/raster/formats/ImageCanvasDecoder.js +1 -1
- package/layers/raster/formats/RasterCodec.js +1 -1
- package/layers/support/RasterJobHandler.js +1 -1
- package/networks/support/UNTraceConfiguration.d.ts +19 -2
- package/networks/support/UNTraceConfiguration.js +1 -1
- package/networks/support/jsonTypes.d.ts +9 -1
- package/package.json +4 -4
- package/popup/Feature.d.ts +4 -4
- package/popup/Feature.js +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/portal/support/layersLoader.js +1 -1
- package/rest/knowledgeGraph/GraphApplyEditsResult.d.ts +13 -1
- package/rest/knowledgeGraph/GraphApplyEditsResult.js +1 -1
- package/rest/knowledgeGraph/GraphDeleteNamedTypeResult.d.ts +9 -1
- package/rest/knowledgeGraph/GraphDeleteNamedTypeResult.js +1 -1
- package/rest/knowledgeGraph/wasmInterface/wasmToDataModelChangeResponseFactories.js +1 -1
- package/rest/knowledgeGraph/wasmInterface/wasmToUpdateResponseFactories.js +1 -1
- package/rest/networks/support/NetworkElement.d.ts +13 -1
- package/rest/networks/support/NetworkElement.js +1 -1
- package/rest/versionManagement/gdbVersion/support/ConflictsParameters.js +1 -1
- package/rest/versionManagement/gdbVersion/support/DifferencesParameters.js +1 -1
- package/rest/versionManagement/gdbVersion/support/DifferencesResult.d.ts +25 -0
- package/rest/versionManagement/gdbVersion/support/InspectConflictsParameters.js +1 -1
- package/rest/versionManagement/gdbVersion/support/ReconcileParameters.d.ts +3 -5
- package/rest/versionManagement/gdbVersion/support/ReconcileParameters.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/types.d.ts +27 -0
- package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
- package/views/2d/engine/webgl/GlyphSDFCreator.js +1 -1
- package/views/2d/engine/webgl/definitions.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/graph/GlslGraphWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/graph/ShaderGraphContext.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/graph/glsl.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.d.ts +6 -5
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/support/QualityProfile.js +1 -1
- package/views/3d/support/QualitySettings.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +11 -12
- package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +5 -5
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/LocalAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/MarsAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/CloudsComposition.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/CloudsRenderer.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/NoiseTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowBlur.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlightBuffer.js +1 -1
- package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
- package/views/3d/webgl-engine/effects/precipitation/Precipitation.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillVisualizationRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/oitResolution.glsl.js +1 -1
- package/views/SceneView.d.ts +3 -3
- package/views/layers/FeatureLikeLayerView.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Column.d.ts +2 -17
- package/widgets/FeatureTable/Grid/Column.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/GroupColumn.d.ts +1 -7
- package/widgets/FeatureTable/Grid/GroupColumn.js +1 -1
- package/widgets/FeatureTable/support/ColumnTemplateBase.d.ts +1 -9
- package/widgets/FeatureTable/support/ColumnTemplateBase.js +1 -1
- package/widgets/FeatureTable/support/types.d.ts +0 -8
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Search/support/layerSearchUtils.js +1 -1
- package/widgets/Search/support/locatorUtils.js +1 -1
- package/assets/esri/core/workers/chunks/00e9e25269d5776f8645.js +0 -1
- package/assets/esri/core/workers/chunks/014a5fad55f97b9b5166.js +0 -1
- package/assets/esri/core/workers/chunks/06003996a378c45bc605.js +0 -1
- package/assets/esri/core/workers/chunks/0840e7dd62643c56ae9e.js +0 -1
- package/assets/esri/core/workers/chunks/0cc4b3100a7a453bd058.js +0 -1
- package/assets/esri/core/workers/chunks/1e4e7111d43f01c149b3.js +0 -1
- package/assets/esri/core/workers/chunks/3d9032217347dadcbe41.js +0 -1
- package/assets/esri/core/workers/chunks/4b79ebfb3328f9483147.js +0 -1
- package/assets/esri/core/workers/chunks/4dbbf59c79d9e72f20ee.js +0 -1
- package/assets/esri/core/workers/chunks/4e206957b28253ddc1a3.js +0 -1
- package/assets/esri/core/workers/chunks/53ef72edc3ed80bf558c.js +0 -1
- package/assets/esri/core/workers/chunks/6dac8dfcd63fc757ae2d.js +0 -1
- package/assets/esri/core/workers/chunks/73af4c947e8151d411c1.js +0 -2
- package/assets/esri/core/workers/chunks/752f4e0e2961fc315dca.js +0 -1
- package/assets/esri/core/workers/chunks/7ba67f1d7831a5576a5a.js +0 -1
- package/assets/esri/core/workers/chunks/a508104179e08f0f268c.js +0 -2
- package/assets/esri/core/workers/chunks/a6b75576d598ec161cc4.js +0 -1
- package/assets/esri/core/workers/chunks/b4bac22467e96be7a974.js +0 -1
- package/assets/esri/core/workers/chunks/bb5f909a2f26fc6a21b0.js +0 -2
- package/assets/esri/core/workers/chunks/bea2fd831d7a864e5995.js +0 -596
- package/assets/esri/core/workers/chunks/c8ef80a7c46d7d2c5172.js +0 -1
- package/assets/esri/core/workers/chunks/dd5b362bded458afa2d6.js +0 -1
- package/assets/esri/core/workers/chunks/dde94664110ff231a52d.js +0 -1
- package/assets/esri/core/workers/chunks/f1e5626a0cc1631a1efb.js +0 -1
- package/assets/esri/core/workers/chunks/f36345ebb9851ab92453.js +0 -1
- package/assets/esri/core/workers/chunks/f7531aa69a87814c60d1.js +0 -1
- package/assets/esri/core/workers/chunks/f971dcfd04af1fd652b4.js +0 -1
- package/assets/esri/themes/base/fonts/cdn.scss +0 -3
- /package/assets/esri/core/workers/chunks/{bb5f909a2f26fc6a21b0.js.LICENSE.txt → 4df19e670b6ed76c1dea.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{a508104179e08f0f268c.js.LICENSE.txt → a76e14fe5e8b2f7ef9de.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{73af4c947e8151d411c1.js.LICENSE.txt → d1ba118ddd0390c07f35.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{ee057c85cdf6beb5b012.js.LICENSE.txt → d6f03f628ebfc28fdd23.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{577cbc131b21c351fae5.js.LICENSE.txt → d87e504082e293640ece.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import s from"../../../../core/Collection.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../../core/maybe.js";import{watch as r,initial as
|
|
2
|
+
import{__decorate as e}from"tslib";import s from"../../../../core/Collection.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../../core/maybe.js";import{watch as r,initial as a,when as o,sync as n}from"../../../../core/reactiveUtils.js";import{property as h,subclass as d}from"../../../../core/accessorSupport/decorators.js";import{translate as c,fromTranslation as p,scale as l,mul as w}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{sub as f,distance as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as v,fromValues as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Sphere as _}from"../../../../geometry/support/sphere.js";import{InternalRenderCategory as V}from"../../webgl.js";import b from"../../webgl/RenderNode.js";import{ViewshedShadowMap as M}from"./ViewshedShadowMap.js";import{V as S}from"../../../../chunks/Viewshed.glsl.js";import{ViewshedTechnique as y}from"../shaders/ViewshedTechnique.js";import{ColorAttachment0 as j}from"../../../webgl/enums.js";let x=class extends b{get shadowMap(){return this._shadowMap}get hasViewsheds(){return this._viewsheds.length>0}get _contentPixelRatio(){return this.view.state.contentPixelRatio}get _viewshedsInView(){return this._viewsheds.items.filter(e=>P(this.view,e))}constructor(e){super(e),this.isDecoration=!1,this._passParameters=new S,this._viewsheds=new s,this._shadowMap=null,this.consumes={required:[V.VIEWSHED,"normals"]},this.produces=V.VIEWSHED}initialize(){this._shadowMap=new M(this.fboCache),this.addHandles([r(()=>this.view.resolutionScale,e=>{const s=this._shadowMap;s&&(s.settings.textureSizeQuality=e)},a),o(()=>!this.hasViewsheds,()=>this._shadowMap?.dispose()),r(()=>this._viewshedsInView.map(e=>[e.elevationAlignedObserverRenderSpace,e.heading,e.tilt,e.farDistance,e.horizontalFieldOfView,e.verticalFieldOfView]),()=>this.requestRender(1),n)])}destroy(){this._shadowMap=i(this._shadowMap)}precompile(){if(this.hasViewsheds)for(const e of this._viewshedsInView)if(this._shadowMap?.isActive(e))return void this.view.stage.renderer.precompileViewshedShadowMap()}render(e){const s=this.bindParameters,t=this.renderingContext,i=e.find(({name:e})=>e===V.VIEWSHED);if(!this.hasViewsheds||this.isDecoration&&!s.decorations)return i;const r=this.techniques.getCompiled(y);if(!r)return this.requestRender(1),i;const a=this.view.stage.renderer.isFeatureEnabled(6);this._passParameters.shadowMap=this._shadowMap??this._passParameters.shadowMap,this._passParameters.normals=e.find(({name:e})=>"normals"===e)?.getTexture();const o=i.obtainDepthTexture();for(const n of this._viewshedsInView){if(!this._renderShadowCubeMap(s,n,a)||!this._shadowMap?.ready)continue;const e=this._setupViewshedParameters(n,s.camera);t.bindFramebuffer(i.fbo),t.bindTechnique(r,s,e),t.setDrawBuffers([j]),t.screen.draw()}return this.shadowMap?.dispose(),i.attachDepth(o),o?.release(),i}updateViewsheds(e){const s=this._viewsheds,{removes:t,adds:i}=e;if(t&&(Array.isArray(t)?s.removeMany(t):s.remove(t)),i)if(Array.isArray(i)){const e=i.filter(e=>!s.includes(e));s.addMany(e)}else s.includes(i)||s.add(i)}_renderShadowCubeMap(e,s,t){const i=this._shadowMap;if(!i)return!1;const r=this.view.basemapTerrain.hasStencilEnabledExtents,a=i.start(e.camera,s,t,this._contentPixelRatio,r);return a&&i.faces.forEach(e=>this.view.stage.renderer.renderViewshedShadowMap(e)),i.finish(),a}_setupViewshedParameters(e,s){const i=this._shadowMap;if(!i)return this._passParameters;const r=this._passParameters,a=e.effectiveObserverRenderSpace;r.localOrigin=a,r.observerOffset=f(D,e.elevationAlignedObserverRenderSpace,e.effectiveObserverRenderSpace),r.fovs=[t(e.horizontalFieldOfView),t(e.verticalFieldOfView)],r.headingAndTilt=[t(e.heading),t(e.tiltParallelToSurface)],r.upVector=e.tiltedUpVector;const o=A(e.elevationAlignedTargetRenderSpace,a);r.targetVector=o;const n=new Array,h=new Array;for(let t=0;t<i.numActiveFaces;t++)c(E,i.viewshedViewMatrices[t],a),n.push(...E),R(i.viewshedProjectionMatrices[t],E,I),h.push(...I);return r.viewMatrices=n,r.projectionMatrices=h,r.volumeOffset=this.selectedViewshed?.()===e.viewshed?O(e,this.view,s.eye):0,r}get test(){return{viewsheds:this._viewsheds,shadowMap:this._shadowMap,viewshedsInView:this._viewshedsInView}}};function A(e,s){const t=v();return f(t,e,s)}function R(e,s,t){const i=g(.5,.5,.5);return p(t,i),l(t,t,i),w(t,t,e),w(t,t,s),t}function P(e,s){const t=new _(s.elevationAlignedObserverRenderSpace,s.farDistanceRenderSpace);return!!e.ready&&e.frustum.intersectsSphere(t)}function O(e,s,t){if(null==e)return 0;const{elevationAlignedObserverRenderSpace:i,elevationAlignedTargetRenderSpace:r}=e,a=u(t,i)>u(t,r)?e.observer:e.target;return s.pixelSizeAt(a)}e([h()],x.prototype,"selectedViewshed",void 0),e([h()],x.prototype,"isDecoration",void 0),e([h()],x.prototype,"shadowMap",null),e([h()],x.prototype,"hasViewsheds",null),e([h()],x.prototype,"_contentPixelRatio",null),e([h()],x.prototype,"_viewshedsInView",null),e([h()],x.prototype,"consumes",void 0),e([h()],x.prototype,"produces",void 0),x=e([d("esri.views.3d.webgl-engine.lib.Viewshed")],x);const D=v(),E=m(),I=m();export{x as Viewshed,O as computeOffsetScale};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as r,Seconds as s}from"../../../../core/time.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as n,subtract as o,dot as l,scale as p,add as h,copy as c,length as m,distance as u,lerp as f,transformMat4 as d,normalize as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as S}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ONES as _,create as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as P}from"../../../../geometry/support/float16.js";import{create as w,fromPoints as y,distance2 as j,closestLineSegmentPoint as z,projectPointFraction as E}from"../../../../geometry/support/lineSegment.js";import{create as A,fromPoints as x,signedDistance as T,getNormal as C}from"../../../../geometry/support/plane.js";import{isHighlightOrOLID as O,isColor as M,isDepth as L,isColorHighlightOLIDOrDepth as R,is2DGeometryOutput as V}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as F}from"../effects/geometry/olidUtils.js";import N from"../lib/GLMaterial.js";import{Material as U}from"../lib/Material.js";import{ScreenSizePerspectiveEvaluator as k}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as W}from"../lib/Util.js";import{isImagePattern as B}from"./lineStippleUtils.js";import{VisualVariablePassParameters as I}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as D}from"./internal/bufferWriterUtils.js";import{r as J}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as Y}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as q}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as X}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as G}from"../../../../webscene/support/AlphaCutoff.js";class H extends U{constructor(e,t){super(e,Q),this.produces=new Map([[2,e=>O(e)||M(e)&&8===this.parameters.renderOccluded],[3,e=>L(e)],[10,e=>R(e)&&8===this.parameters.renderOccluded],[11,e=>R(e)&&8===this.parameters.renderOccluded],[4,e=>M(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,e=>M(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,e=>V(e)]]),this._configuration=new X(t)}updateConfiguration(e){super.updateConfiguration(e);const t=18===e.slot,i=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==e.output,r=i&&t&&this.parameters.isImagePattern();this._configuration.draped=t,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=i,this._configuration.stippleOffColorEnabled=i&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=i&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&te(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.hasEmissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!r,this._configuration.worldSizedImagePattern=r}get visible(){return this.parameters.color[3]>=G||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>G}get hasEmissions(){return this.parameters.emissiveStrength>0?8!==this.parameters.renderOccluded?2:1:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectDraped({attributes:e,screenToWorldRatio:i},r,s,a,n){if(!r.options.selectionMode)return;const o=e.get("size");let l=this.parameters.width;if(this.parameters.vvSize){const i=e.get("sizeFeatureAttribute").data[0];Number.isNaN(i)?l*=this.parameters.vvSize.fallback[0]:l*=t(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(l*=o.data[0]);const p=s[0],h=s[1],c=(l/2+4)*i;let m=Number.MAX_VALUE,u=0;const f=e.get("position").data,d=ee(this.parameters,e)?f.length-2:f.length-5;for(let g=0;g<d;g+=3){const e=f[g],i=f[g+1],r=(g+3)%f.length,s=p-e,a=h-i,n=f[r]-e,o=f[r+1]-i,l=t((n*s+o*a)/(n*n+o*o),0,1),c=n*l-s,d=o*l-a,b=c*c+d*d;b<m&&(m=b,u=g/3)}m<c*c&&a(n.distance,n.normal,u)}intersect(i,r,s,f,d,g){const{options:b,camera:S,rayBegin:_,rayEnd:v}=s;if(!b.selectionMode||!i.visible||!S)return;if(!W(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const P=i.attributes,w=P.get("position").data;let E=this.parameters.width;if(this.parameters.vvSize){const e=P.get("sizeFeatureAttribute").data[0];Number.isNaN(e)||(E*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else P.has("size")&&(E*=P.get("size").data[0]);const A=he;a(A,s.point);const O=E*S.pixelRatio,M=4*S.pixelRatio,L=O/2+M;n(Pe[0],A[0]-L,A[1]+L,0),n(Pe[1],A[0]+L,A[1]+L,0),n(Pe[2],A[0]+L,A[1]-L,0),n(Pe[3],A[0]-L,A[1]-L,0);for(let e=0;e<4;e++)if(!S.unprojectFromRenderScreen(Pe[e],we[e]))return;x(S.eye,we[0],we[1],ye),x(S.eye,we[1],we[2],je),x(S.eye,we[2],we[3],ze),x(S.eye,we[3],we[0],Ee);let R=Number.MAX_VALUE,V=0;const F=ee(this.parameters,P)?w.length-2:w.length-5;for(let e=0;e<F;e+=3){re[0]=w[e]+r[12],re[1]=w[e+1]+r[13],re[2]=w[e+2]+r[14];const t=(e+3)%w.length;if(se[0]=w[t]+r[12],se[1]=w[t+1]+r[13],se[2]=w[t+2]+r[14],T(ye,re)<0&&T(ye,se)<0||T(je,re)<0&&T(je,se)<0||T(ze,re)<0&&T(ze,se)<0||T(Ee,re)<0&&T(Ee,se)<0)continue;const i=S.projectToRenderScreen(re,ce),s=S.projectToRenderScreen(se,me);if(null==i||null==s)continue;if(i[2]<0&&s[2]>0){o(le,re,se);const e=S.frustum,t=-T(e[4],re)/l(le,C(e[4]));if(p(le,le,t),h(re,re,le),!S.projectToRenderScreen(re,i))continue}else if(i[2]>0&&s[2]<0){o(le,se,re);const e=S.frustum,t=-T(e[4],se)/l(le,C(e[4]));if(p(le,le,t),h(se,se,le),!S.projectToRenderScreen(se,s))continue}else if(i[2]<0&&s[2]<0)continue;i[2]=0,s[2]=0;const a=y(i,s,de),n=j(a,A);if(!(n>=R)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(a,re,se,A,S,E,M);if(n>=e*e)continue}R=n,c(ue,re),c(fe,se),V=e/3}}if(R<L*L){let e=Number.MAX_VALUE;if(z(y(ue,fe,de),y(_,v,ge),pe)){o(pe,pe,_);const t=m(pe);p(pe,pe,1/t),e=t/u(_,v)}g(e,pe,V)}}createBufferWriter(){return new Z(Y(this.parameters),this.parameters)}createGLMaterial(e){return new K(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:r(e.time)},!1),0!==e.dt)}computeScreenSizePerspectiveWidth(e,t,i,r,s,a,n){const o=E(e,r);f(ae,t,i,o),d(ne,ae,s.viewMatrix);const l=m(ne),p=this.computeCameraAbsCosAngle(ae,s,this._configuration.spherical);ie.update(p,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize);return ie.apply(a)*s.pixelRatio/2+n}computeCameraAbsCosAngle(e,t,i){return i?g(pe,e):n(pe,0,0,1),o(oe,e,t.eye),g(oe,oe),Math.abs(l(pe,oe))}}class K extends N{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(q,e)}}class Q extends I{constructor(){super(...arguments),this._width=0,this.color=_,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=s(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=s(0),this.endTime=s(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return B(this.stipplePattern)&&null!=this.stippleTexture}}class Z{constructor(e,t){this.layout=e,this._parameters=t;const i=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=i;break;case"round":this.numJoinSubdivisions=J+i}}_isClosed(e){return ee(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCount(e){const t=2,i=e.get("position").indices.length/2+1,r=this._isClosed(e);let s=r?2:2*t;return s+=((r?i:i-1)-(r?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,i,r,s,a){const{buffer:o,offset:l}=s,p=this.layout,h=i.get("position"),m=h.indices,f=h.data.length/3,g=i.get("distanceToStart")?.data;m&&m.length!==2*(f-1)&&console.warn("RibbonLineMaterial does not support indices");const b=p.fields.has("sizeFeatureAttribute");let _=1,v=null;if(b){const e=i.get("sizeFeatureAttribute");1===e.data.length?_=e.data[0]:v=e.data}else _=i.get("size")?.data[0]??1;let w=[1,1,1,1],y=0,j=null;const z=p.fields.has("colorFeatureAttribute");if(z){const e=i.get("colorFeatureAttribute");1===e.data.length?y=e.data[0]:j=e.data}else w=i.get("color")?.data??w;const E=i.get("timeStamps")?.data,A=E&&p.fields.has("timeStamps"),x=p.fields.has("opacityFeatureAttribute");let T=0,C=null;if(x){const e=i.get("opacityFeatureAttribute");1===e.data.length?T=e.data[0]:C=e.data}const O=new Float32Array(o.buffer),M=P(o.buffer),L=new Uint8Array(o.buffer),R=p.stride/4;let V=l*R;const N=V;let U=0;const k=g?(e,t,i)=>U=g[i]:(e,t,i)=>U+=u(e,t),W=O.BYTES_PER_ELEMENT/M.BYTES_PER_ELEMENT,B=4/W,I=F(),J=(e,t,i,s,a,n,o,l)=>{O[V++]=t[0],O[V++]=t[1],O[V++]=t[2],D(e,t,M,V*W),V+=B,D(i,t,M,V*W),V+=B,O[V++]=l;let p=V*W;if(M[p++]=a,M[p++]=n,V=Math.ceil(p/W),z)O[V]=j?.[o]??y;else{const e=Math.min(4*o,w.length-4),t=4*V;L[t]=255*w[e],L[t+1]=255*w[e+1],L[t+2]=255*w[e+2],L[t+3]=255*w[e+3]}if(V++,O[V++]=v?.[o]??_,x&&(O[V++]=C?.[o]??T),I){let e=4*V;r?(L[e++]=r[0],L[e++]=r[1],L[e++]=r[2],L[e++]=r[3]):(L[e++]=0,L[e++]=0,L[e++]=0,L[e++]=0),V=Math.ceil(.25*e)}A&&(p=V*W,M[p++]=s[0],M[p++]=s[1],M[p++]=s[2],M[p++]=s[3],V=Math.ceil(p/W))};V+=R,n(Se,h.data[0],h.data[1],h.data[2]),A&&S(ve,E[0],E[1],E[2],E[3]),e&&d(Se,Se,e);const Y=this._isClosed(i);if(Y){const t=h.data.length-3;n(be,h.data[t],h.data[t+1],h.data[t+2]),e&&d(be,be,e)}else n(_e,h.data[3],h.data[4],h.data[5]),e&&d(_e,_e,e),J(Se,Se,_e,ve,1,-4,0,0),J(Se,Se,_e,ve,1,4,0,0),c(be,Se),c(Se,_e),A&&S(ve,E[4],E[5],E[6],E[7]);const q=Y?0:1,X=Y?f:f-1;for(let u=q;u<X;u++){const t=(u+1)%f*3;n(_e,h.data[t],h.data[t+1],h.data[t+2]),e&&d(_e,_e,e),k(be,Se,u),J(be,Se,_e,ve,0,-1,u,U),J(be,Se,_e,ve,0,1,u,U);const i=this.numJoinSubdivisions;for(let e=0;e<i;++e){const t=(e+1)/(i+1);J(be,Se,_e,ve,t,-1,u,U),J(be,Se,_e,ve,t,1,u,U)}if(J(be,Se,_e,ve,1,-2,u,U),J(be,Se,_e,ve,1,2,u,U),c(be,Se),c(Se,_e),A){const e=(u+1)%f*4;S(ve,E[e],E[e+1],E[e+2],E[e+3])}}Y?(n(_e,h.data[3],h.data[4],h.data[5]),e&&d(_e,_e,e),U=k(be,Se,X),J(be,Se,_e,ve,0,-1,q,U),J(be,Se,_e,ve,0,1,q,U)):(U=k(be,Se,X),J(be,Se,Se,ve,0,-5,X,U),J(be,Se,Se,ve,0,5,X,U)),$(O,N+R,O,N,R);V=$(O,V-R,O,V,R),this._parameters.wireframe&&this._addWireframeVertices(o,N,V,R)}_addWireframeVertices(e,t,i,r){const s=new Float32Array(e.buffer,i*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,i-t);let n=0;const o=e=>n=$(a,e,s,n,r);for(let l=0;l<a.length-1;l+=2*r)o(l),o(l+2*r),o(l+1*r),o(l+2*r),o(l+1*r),o(l+3*r)}}function $(e,t,i,r,s){for(let a=0;a<s;a++)i[r++]=e[t++];return r}function ee(e,t){if(!e.isClosed)return!1;return t.get("position").indices.length>2}function te(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}const ie=new k,re=b(),se=b(),ae=b(),ne=b(),oe=b(),le=b(),pe=b(),he=b(),ce=i(),me=i(),ue=b(),fe=b(),de=w(),ge=w(),be=b(),Se=b(),_e=b(),ve=v(),Pe=[i(),i(),i(),i()],we=[b(),b(),b(),b()],ye=A(),je=A(),ze=A(),Ee=A();export{Q as Parameters,H as RibbonLineMaterial};
|
|
2
|
+
import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as r,Seconds as s}from"../../../../core/time.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as n,subtract as o,dot as l,scale as p,add as h,copy as c,length as m,distance as u,lerp as f,transformMat4 as d,normalize as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as S}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ONES as _,create as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as P}from"../../../../geometry/support/float16.js";import{create as w,fromPoints as y,distance2 as j,closestLineSegmentPoint as z,projectPointFraction as E}from"../../../../geometry/support/lineSegment.js";import{create as A,fromPoints as x,signedDistance as T,getNormal as C}from"../../../../geometry/support/plane.js";import{isHighlightOrOLID as O,isColor as M,isDepth as L,isColorHighlightOLIDOrDepth as R,is2DGeometryOutput as V}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as F}from"../effects/geometry/olidUtils.js";import N from"../lib/GLMaterial.js";import{Material as U}from"../lib/Material.js";import{ScreenSizePerspectiveEvaluator as k}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as W}from"../lib/Util.js";import{isImagePattern as B}from"./lineStippleUtils.js";import{VisualVariablePassParameters as I}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as D}from"./internal/bufferWriterUtils.js";import{r as J}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as Y}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as q}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as X}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as G}from"../../../../webscene/support/AlphaCutoff.js";class H extends U{constructor(e,t){super(e,Q),this.produces=new Map([[2,e=>O(e)||M(e)&&8===this.parameters.renderOccluded],[3,e=>L(e)],[10,e=>R(e)&&8===this.parameters.renderOccluded],[11,e=>R(e)&&8===this.parameters.renderOccluded],[4,e=>M(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,e=>M(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,e=>V(e)]]),this._configuration=new X(t)}updateConfiguration(e){super.updateConfiguration(e);const t=18===e.slot,i=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==e.output,r=i&&t&&this.parameters.isImagePattern();this._configuration.draped=t,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=i,this._configuration.stippleOffColorEnabled=i&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=i&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=ie(this.parameters.join,i),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&te(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.hasEmissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!r,this._configuration.worldSizedImagePattern=r}get visible(){return this.parameters.color[3]>=G||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>G}get hasEmissions(){return this.parameters.emissiveStrength>0?8!==this.parameters.renderOccluded?2:1:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectDraped({attributes:e,screenToWorldRatio:i},r,s,a,n){if(!r.options.selectionMode)return;const o=e.get("size");let l=this.parameters.width;if(this.parameters.vvSize){const i=e.get("sizeFeatureAttribute").data[0];Number.isNaN(i)?l*=this.parameters.vvSize.fallback[0]:l*=t(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(l*=o.data[0]);const p=s[0],h=s[1],c=(l/2+4)*i;let m=Number.MAX_VALUE,u=0;const f=e.get("position").data,d=ee(this.parameters,e)?f.length-2:f.length-5;for(let g=0;g<d;g+=3){const e=f[g],i=f[g+1],r=(g+3)%f.length,s=p-e,a=h-i,n=f[r]-e,o=f[r+1]-i,l=t((n*s+o*a)/(n*n+o*o),0,1),c=n*l-s,d=o*l-a,b=c*c+d*d;b<m&&(m=b,u=g/3)}m<c*c&&a(n.distance,n.normal,u)}intersect(i,r,s,f,d,g){const{options:b,camera:S,rayBegin:_,rayEnd:v}=s;if(!b.selectionMode||!i.visible||!S)return;if(!W(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const P=i.attributes,w=P.get("position").data;let E=this.parameters.width;if(this.parameters.vvSize){const e=P.get("sizeFeatureAttribute").data[0];Number.isNaN(e)||(E*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else P.has("size")&&(E*=P.get("size").data[0]);const A=ce;a(A,s.point);const O=E*S.pixelRatio,M=4*S.pixelRatio,L=O/2+M;n(we[0],A[0]-L,A[1]+L,0),n(we[1],A[0]+L,A[1]+L,0),n(we[2],A[0]+L,A[1]-L,0),n(we[3],A[0]-L,A[1]-L,0);for(let e=0;e<4;e++)if(!S.unprojectFromRenderScreen(we[e],ye[e]))return;x(S.eye,ye[0],ye[1],je),x(S.eye,ye[1],ye[2],ze),x(S.eye,ye[2],ye[3],Ee),x(S.eye,ye[3],ye[0],Ae);let R=Number.MAX_VALUE,V=0;const F=ee(this.parameters,P)?w.length-2:w.length-5;for(let e=0;e<F;e+=3){se[0]=w[e]+r[12],se[1]=w[e+1]+r[13],se[2]=w[e+2]+r[14];const t=(e+3)%w.length;if(ae[0]=w[t]+r[12],ae[1]=w[t+1]+r[13],ae[2]=w[t+2]+r[14],T(je,se)<0&&T(je,ae)<0||T(ze,se)<0&&T(ze,ae)<0||T(Ee,se)<0&&T(Ee,ae)<0||T(Ae,se)<0&&T(Ae,ae)<0)continue;const i=S.projectToRenderScreen(se,me),s=S.projectToRenderScreen(ae,ue);if(null==i||null==s)continue;if(i[2]<0&&s[2]>0){o(pe,se,ae);const e=S.frustum,t=-T(e[4],se)/l(pe,C(e[4]));if(p(pe,pe,t),h(se,se,pe),!S.projectToRenderScreen(se,i))continue}else if(i[2]>0&&s[2]<0){o(pe,ae,se);const e=S.frustum,t=-T(e[4],ae)/l(pe,C(e[4]));if(p(pe,pe,t),h(ae,ae,pe),!S.projectToRenderScreen(ae,s))continue}else if(i[2]<0&&s[2]<0)continue;i[2]=0,s[2]=0;const a=y(i,s,ge),n=j(a,A);if(!(n>=R)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(a,se,ae,A,S,E,M);if(n>=e*e)continue}R=n,c(fe,se),c(de,ae),V=e/3}}if(R<L*L){let e=Number.MAX_VALUE;if(z(y(fe,de,ge),y(_,v,be),he)){o(he,he,_);const t=m(he);p(he,he,1/t),e=t/u(_,v)}g(e,he,V)}}createBufferWriter(){return new Z(Y(this.parameters),this.parameters)}createGLMaterial(e){return new K(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:r(e.time)},!1),0!==e.dt)}computeScreenSizePerspectiveWidth(e,t,i,r,s,a,n){const o=E(e,r);f(ne,t,i,o),d(oe,ne,s.viewMatrix);const l=m(oe),p=this.computeCameraAbsCosAngle(ne,s,this._configuration.spherical);re.update(p,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize);return re.apply(a)*s.pixelRatio/2+n}computeCameraAbsCosAngle(e,t,i){return i?g(he,e):n(he,0,0,1),o(le,e,t.eye),g(le,le),Math.abs(l(he,le))}}class K extends N{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(q,e)}}class Q extends I{constructor(){super(...arguments),this._width=0,this.color=_,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=s(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=s(0),this.endTime=s(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return B(this.stipplePattern)&&null!=this.stippleTexture}}class Z{constructor(e,t){this.layout=e,this._parameters=t,this.numJoinSubdivisions=ie(this._parameters.join,null!=this._parameters.stipplePattern)}_isClosed(e){return ee(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCount(e){const t=2,i=e.get("position").indices.length/2+1,r=this._isClosed(e);let s=r?2:2*t;return s+=((r?i:i-1)-(r?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,i,r,s,a){const{buffer:o,offset:l}=s,p=this.layout,h=i.get("position"),m=h.indices,f=h.data.length/3,g=i.get("distanceToStart")?.data;m&&m.length!==2*(f-1)&&console.warn("RibbonLineMaterial does not support indices");const b=p.fields.has("sizeFeatureAttribute");let _=1,v=null;if(b){const e=i.get("sizeFeatureAttribute");1===e.data.length?_=e.data[0]:v=e.data}else _=i.get("size")?.data[0]??1;let w=[1,1,1,1],y=0,j=null;const z=p.fields.has("colorFeatureAttribute");if(z){const e=i.get("colorFeatureAttribute");1===e.data.length?y=e.data[0]:j=e.data}else w=i.get("color")?.data??w;const E=i.get("timeStamps")?.data,A=E&&p.fields.has("timeStamps"),x=p.fields.has("opacityFeatureAttribute");let T=0,C=null;if(x){const e=i.get("opacityFeatureAttribute");1===e.data.length?T=e.data[0]:C=e.data}const O=new Float32Array(o.buffer),M=P(o.buffer),L=new Uint8Array(o.buffer),R=p.stride/4;let V=l*R;const N=V;let U=0;const k=g?(e,t,i)=>U=g[i]:(e,t,i)=>U+=u(e,t),W=O.BYTES_PER_ELEMENT/M.BYTES_PER_ELEMENT,B=4/W,I=F(),J=(e,t,i,s,a,n,o,l)=>{O[V++]=t[0],O[V++]=t[1],O[V++]=t[2],D(e,t,M,V*W),V+=B,D(i,t,M,V*W),V+=B,O[V++]=l;let p=V*W;if(M[p++]=a,M[p++]=n,V=Math.ceil(p/W),z)O[V]=j?.[o]??y;else{const e=Math.min(4*o,w.length-4),t=4*V;L[t]=255*w[e],L[t+1]=255*w[e+1],L[t+2]=255*w[e+2],L[t+3]=255*w[e+3]}if(V++,O[V++]=v?.[o]??_,x&&(O[V++]=C?.[o]??T),I){let e=4*V;r?(L[e++]=r[0],L[e++]=r[1],L[e++]=r[2],L[e++]=r[3]):(L[e++]=0,L[e++]=0,L[e++]=0,L[e++]=0),V=Math.ceil(.25*e)}A&&(p=V*W,M[p++]=s[0],M[p++]=s[1],M[p++]=s[2],M[p++]=s[3],V=Math.ceil(p/W))};V+=R,n(_e,h.data[0],h.data[1],h.data[2]),A&&S(Pe,E[0],E[1],E[2],E[3]),e&&d(_e,_e,e);const Y=this._isClosed(i);if(Y){const t=h.data.length-3;n(Se,h.data[t],h.data[t+1],h.data[t+2]),e&&d(Se,Se,e)}else n(ve,h.data[3],h.data[4],h.data[5]),e&&d(ve,ve,e),J(_e,_e,ve,Pe,1,-4,0,0),J(_e,_e,ve,Pe,1,4,0,0),c(Se,_e),c(_e,ve),A&&S(Pe,E[4],E[5],E[6],E[7]);const q=Y?0:1,X=Y?f:f-1;for(let u=q;u<X;u++){const t=(u+1)%f*3;n(ve,h.data[t],h.data[t+1],h.data[t+2]),e&&d(ve,ve,e),k(Se,_e,u),J(Se,_e,ve,Pe,0,-1,u,U),J(Se,_e,ve,Pe,0,1,u,U);const i=this.numJoinSubdivisions;for(let e=0;e<i;++e){const t=(e+1)/(i+1);J(Se,_e,ve,Pe,t,-1,u,U),J(Se,_e,ve,Pe,t,1,u,U)}if(J(Se,_e,ve,Pe,1,-2,u,U),J(Se,_e,ve,Pe,1,2,u,U),c(Se,_e),c(_e,ve),A){const e=(u+1)%f*4;S(Pe,E[e],E[e+1],E[e+2],E[e+3])}}Y?(n(ve,h.data[3],h.data[4],h.data[5]),e&&d(ve,ve,e),U=k(Se,_e,X),J(Se,_e,ve,Pe,0,-1,q,U),J(Se,_e,ve,Pe,0,1,q,U)):(U=k(Se,_e,X),J(Se,_e,_e,Pe,0,-5,X,U),J(Se,_e,_e,Pe,0,5,X,U)),$(O,N+R,O,N,R);V=$(O,V-R,O,V,R),this._parameters.wireframe&&this._addWireframeVertices(o,N,V,R)}_addWireframeVertices(e,t,i,r){const s=new Float32Array(e.buffer,i*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,i-t);let n=0;const o=e=>n=$(a,e,s,n,r);for(let l=0;l<a.length-1;l+=2*r)o(l),o(l+2*r),o(l+1*r),o(l+2*r),o(l+1*r),o(l+3*r)}}function $(e,t,i,r,s){for(let a=0;a<s;a++)i[r++]=e[t++];return r}function ee(e,t){if(!e.isClosed)return!1;return t.get("position").indices.length>2}function te(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}function ie(e,t){const i=t?1:0;switch(e){case"miter":case"bevel":return i;case"round":return J+i}}const re=new k,se=b(),ae=b(),ne=b(),oe=b(),le=b(),pe=b(),he=b(),ce=b(),me=i(),ue=i(),fe=b(),de=b(),ge=w(),be=w(),Se=b(),_e=b(),ve=b(),Pe=v(),we=[i(),i(),i(),i()],ye=[b(),b(),b(),b()],je=A(),ze=A(),Ee=A(),Ae=A();export{Q as Parameters,H as RibbonLineMaterial};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as o}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TriangleTechniqueConfiguration as e}from"../materials/TriangleTechniqueConfiguration.js";const i=16;class
|
|
2
|
+
import{__decorate as o}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TriangleTechniqueConfiguration as e}from"../materials/TriangleTechniqueConfiguration.js";const i=16,r=8;class s extends e{constructor(o){super(),this.spherical=o,this.capType=0,this.emissionSource=0,this.animation=2,this.polygonOffsetIndex=0,this.writeDepth=!1,this.draped=!1,this.stippleEnabled=!1,this.stippleOffColorEnabled=!1,this.stipplePreferContinuous=!0,this.numJoinSubdivisions=1,this.roundJoins=!1,this.applyMarkerOffset=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.hasVVOpacity=!1,this.falloffEnabled=!1,this.innerColorEnabled=!1,this.hasOccludees=!1,this.occluder=!1,this.wireframe=!1,this.discardInvisibleFragments=!1,this.hasScreenSizePerspective=!1,this.worldSizedImagePattern=!1,this.textureCoordinateType=0,this.hasVVInstancing=!1,this.hasSliceTranslatedView=!0,this.overlayEnabled=!1,this.snowCover=!1}get hasAnimation(){return 0!==this.animation}}o([t({count:3})],s.prototype,"capType",void 0),o([t({count:8})],s.prototype,"emissionSource",void 0),o([t({count:4})],s.prototype,"animation",void 0),o([t({count:i})],s.prototype,"polygonOffsetIndex",void 0),o([t()],s.prototype,"writeDepth",void 0),o([t()],s.prototype,"draped",void 0),o([t()],s.prototype,"stippleEnabled",void 0),o([t()],s.prototype,"stippleOffColorEnabled",void 0),o([t()],s.prototype,"stipplePreferContinuous",void 0),o([t({count:r})],s.prototype,"numJoinSubdivisions",void 0),o([t()],s.prototype,"roundJoins",void 0),o([t()],s.prototype,"applyMarkerOffset",void 0),o([t()],s.prototype,"hasVVSize",void 0),o([t()],s.prototype,"hasVVColor",void 0),o([t()],s.prototype,"hasVVOpacity",void 0),o([t()],s.prototype,"falloffEnabled",void 0),o([t()],s.prototype,"innerColorEnabled",void 0),o([t()],s.prototype,"hasOccludees",void 0),o([t()],s.prototype,"occluder",void 0),o([t()],s.prototype,"wireframe",void 0),o([t()],s.prototype,"discardInvisibleFragments",void 0),o([t()],s.prototype,"hasScreenSizePerspective",void 0),o([t()],s.prototype,"worldSizedImagePattern",void 0);export{r as NUM_JOIN_SUBDIVISION_COUNT,i as POLYGON_OFFSET_INDEX_COUNT,s as RibbonLineTechniqueConfiguration};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as o}from"tslib";import{parameter as
|
|
2
|
+
import{__decorate as o}from"tslib";import{parameter as t,ShaderTechniqueConfiguration as e}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";class i extends e{constructor(){super(...arguments),this.visualization=0,this.thresholdRendersSunlight=!1,this.useMask=!1}}o([t({count:4})],i.prototype,"visualization",void 0),o([t()],i.prototype,"thresholdRendersSunlight",void 0),o([t()],i.prototype,"useMask",void 0);export{i as ShadowCastVisualizeTechniqueConfiguration};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
function
|
|
2
|
+
const t=16,a=t;function n(n,l){l.useFloatBlend?(n.constants.add("floatBlendOutputScale","float",1),n.constants.add("floatBlendInputScale","float",1)):(n.constants.add("floatBlendOutputScale","float",1/t),n.constants.add("floatBlendInputScale","float",t)),n.constants.add("maxEmissiveStrength","float",a)}export{t as floatBlendReductionFactor,a as maxEmissiveStrength,n as oitResolution};
|
package/views/SceneView.d.ts
CHANGED
|
@@ -471,7 +471,7 @@ export interface SceneViewProperties extends ViewProperties, DOMContainerPropert
|
|
|
471
471
|
* Scroll Wheel or Middle-click+Drag | Zoom in or out at the cursor
|
|
472
472
|
* Shift + Scroll Wheel or Shift + Middle-click+Drag | Change the camera field of view (focal length)
|
|
473
473
|
* Right-click+Drag | 3D-rotate around the center of the view
|
|
474
|
-
* Arrow Keys | Nudge the view left, right, up, or down
|
|
474
|
+
* Arrow Keys | Nudge the view left, right, up, or down
|
|
475
475
|
* B + Left-click+Drag | 3D-rotate around the camera's position
|
|
476
476
|
* B + Right-click+Drag | Forced horizontal pan
|
|
477
477
|
* P | Move the camera to look perpendicular to the data displayed in the view
|
|
@@ -480,8 +480,8 @@ export interface SceneViewProperties extends ViewProperties, DOMContainerPropert
|
|
|
480
480
|
* A | Rotate camera counterclockwise
|
|
481
481
|
* S | Tilt camera down
|
|
482
482
|
* D | Rotate camera clockwise
|
|
483
|
-
* J | Move down, closer to the view
|
|
484
|
-
* U | Move up, higher from the view
|
|
483
|
+
* J | Move down, closer to the view
|
|
484
|
+
* U | Move up, higher from the view
|
|
485
485
|
* Drag with one finger | Pan
|
|
486
486
|
* Double-tap with one finger | Zoom in at the finger position
|
|
487
487
|
* Two finger pinch in/out | Zoom out/in
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import"../../core/has.js";import t from"../../core/Logger.js";import{throwIfAborted as i}from"../../core/promiseUtils.js";import{watch as r,syncAndInitial as s,on as l}from"../../core/reactiveUtils.js";import{sqlOr as a,sqlIn as n,sqlAnd as o}from"../../core/sql.js";import{property as u,subclass as d}from"../../core/accessorSupport/decorators.js";import{getPopupProvider as p}from"../../graphic/getPopupProvider.js";import{getFeatureIdInfoFieldNames as f}from"../../layers/graphics/data/FeatureIdInfo.js";import{systemIsSpatialFieldName as h}from"../../layers/knowledgeGraph/constants.js";import{getEffectiveDisplayFilter as y}from"../../layers/support/displayFilterUtils.js";import m from"../../layers/support/FeatureEffect.js";import c from"../../layers/support/FeatureFilter.js";import{getSignedInUser as F,layerRequiresGeometryZM as g}from"../../layers/support/featureLayerUtils.js";import{fetchFeaturePopupFeatures as I,loadFeaturePopupArcadeModules as b}from"../../layers/support/featurePopupQueryUtils.js";import{fixFields as v,unpackFieldNames as w,collectLabelingFields as x,collectElevationFields as E,collectFilterFields as R,collectFeatureReductionFields as q,collectOrderByInfos as _,collectFields as j,collectTrackInfoFields as O,collectDisplayFilterFields as C,collectField as k,featureHasFields as P}from"../../layers/support/fieldUtils.js";import{getFloorFilterClause as U}from"../../layers/support/floorFilterUtils.js";import{collectRelativeTimeFields as T}from"../../layers/support/relativeTimeQueryUtils.js";import{getUtilityNetworkFields as L}from"../../networks/support/networkFieldUtils.js";import Z from"../../rest/support/Query.js";import{createFeatureIdInfo as S}from"../2d/layers/features/layerAdapters/featureServiceUtils.js";import M from"./LayerView.js";import{getFetchPopupTemplate as D,getRequiredFields as N}from"./support/popupUtils.js";import{WhereClauseVisitor as Q}from"./support/WhereClauseVisitor.js";let G=class extends M{constructor(){super(...arguments),this._updatingRequiredPromise=null,this._defaultReturnZ=!1,this.hasZ=!1,this.hasM=!1,this.filter=null,this.layer=null,this.requiresCurrentUser=!1,this.requiredFields=[],this.view=null}initialize(){this.addHandles([r(()=>{const e=this.layer,t=this.view;return[e&&"elevationInfo"in e?e.elevationInfo?.featureExpressionInfo:null,e&&"displayField"in e?e.displayField:null,e&&"timeInfo"in e&&e.timeInfo,e&&"renderer"in e&&e.renderer,e&&"returnZ"in e&&e.returnZ,e&&"returnM"in e&&e.returnM,e&&"capabilities"in e&&e.capabilities,e&&"labelingInfo"in e&&e.labelingInfo,e&&"floorInfo"in e&&e.floorInfo,t?.requiredFieldsOptions?.featureTitleFields&&e&&"featureTitleFields"in e&&e.featureTitleFields,t?.requiredFieldsOptions?.utilityNetworkFields&&L(t,e),e&&"displayFilterInfo"in e&&e.displayFilterInfo,this.displayFilterEnabled,this.filter,this.featureEffect,this.timeExtent,"knowledge-graph-sublayer"===e?.type&&"link-chart"===e.parentCompositeLayer.type&&e.parentCompositeLayer.linkChart?.linkChartProperties.nonspatialDataDisplay?.mode]},()=>this._handleChange(),s),l(()=>this.view?.floors,"change",()=>this._handleChange()),l(()=>(this.layer&&"displayFilterInfo"in this.layer?this.layer.displayFilterInfo:null)?.filters,"change",()=>this._handleChange()),l(()=>this.layer&&"sublayers"in this.layer?this.layer.sublayers:null,"change",()=>this._handleChange())])}get availableFields(){if(!this.layer)return[];const{layer:e,layer:{fieldsIndex:t},requiredFields:i}=this;return"outFields"in e&&e.outFields?v(t,[...w(t,e.outFields),...i]):v(t,i)}get displayFilterEnabled(){return(this.view?.displayFilterEnabled??!0)&&(!("displayFilterEnabled"in this.layer)||(this.layer?.displayFilterEnabled??!0))}get effectiveDisplayFilter(){const e=this.layer;return"displayFilterInfo"in e&&this.displayFilterEnabled&&e.displayFilterInfo?y(e.displayFilterInfo,this.view):null}get effectiveDisplayFilterClause(){const e=this.effectiveDisplayFilter?.where??null;return e&&this.hasHighlight?a(e,n(this.layer.objectIdField,this.highlightIds)):e}get featureEffect(){return this.layer&&"featureEffect"in this.layer?this.layer.featureEffect:null}set featureEffect(e){this._override("featureEffect",e)}get highlightOptions(){}set highlightOptions(e){}get maximumNumberOfFeatures(){return 0}set maximumNumberOfFeatures(e){t.getLogger(this).error("#maximumNumberOfFeatures=","Setting maximum number of features is not supported")}get maximumNumberOfFeaturesExceeded(){return!1}get signedInUser(){return this.layer?.url?F(this.layer.url):Promise.resolve(null)}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference},t=null!=this.filter?this.filter.createQuery(e):new Z(e);return"floorInfo"in this.layer&&this.layer.floorInfo&&(t.where=o(t.where,U(this))),this.displayFilterEnabled&&(t.where=o(t.where,this.effectiveDisplayFilter?.where)),null!=this.timeExtent&&(t.timeExtent=null!=t.timeExtent?t.timeExtent.intersection(this.timeExtent):this.timeExtent.clone()),t}createAggregateQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return new Z(e)}async fetchPopupFeaturesFromGraphics(e,t){const i=[],r=new Set;for(const l of e){const e=p(l.origin),s=D(e,{...t,checkPopupEnabled:!0});s&&(i.push(l),r.add(s))}if(0===i.length||0===r.size)return[];const s=await this._createPopupQuery(r,t);return await I(this.layer,i,s,{hasRequiredFields:(e,t)=>this._popupFeatureHasRequiredFields(e,t),...t})}_handleChange(){const e=Promise.all([this._updateRequiredFields(),this._updateClientWhereClauseRequirements(),this._updateHasZM()]).then(()=>{});return this._updatingRequiredPromise=e,e.then(()=>{this._updatingRequiredPromise===e&&(this._updatingRequiredPromise=null)}),e}async _updateClientWhereClauseRequirements(){if(!this.layer||!this.view)return;const{layer:e}=this,i=new Q(e.fieldsIndex);if(i.visitFilter(this.filter),"featureReduction"in e&&i.visitFeatureReduction(e.featureReduction),"labelingInfo"in e&&i.visitLabelingInfo(e.labelsVisible,e.labelingInfo),"trackInfo"in e&&i.visitTrackInfo(e.trackInfo),"2d"===this.view.type&&(i.visitFilter(this.featureEffect?.filter),"featureReduction"in e&&i.visitFeatureReduction(e.featureReduction),"displayFilterInfo"in e&&i.visitDisplayFilter(this.displayFilterEnabled,e.displayFilterInfo)),"subtype-group"===e.type)for(const t of e.sublayers)i.visitLabelingInfo(t.labelsVisible,t.labelingInfo);"definitionExpression"in e&&"capabilities"in e&&e.capabilities?.query.relativeTimeBinWindow&&i.visitRelativeTimeQuery(e.definitionExpression);try{const e=await i.finish();this._set("requiresCurrentUser",e.requiresCurrentUser)}catch(r){t.getLogger(this).error(r)}}async _updateRequiredFields(){if(!this.layer||!this.view)return;const e="3d"===this.view.type,{layer:i,layer:{fieldsIndex:r}}=this,s="renderer"in i&&i.renderer,l="orderBy"in i&&i.orderBy,a="featureReduction"in i?i.featureReduction:null,n=new Set,o=[s?s.collectRequiredFields(n,r):null,x(n,i),e&&"elevationInfo"in i?E(n,i):null,null!=this.filter?R(n,i,this.filter):null,e||null==this.featureEffect?null:R(n,i,this.featureEffect.filter),!e&&a?q(n,i,a):null,!e&&l?_(n,i,l):null,"definitionExpression"in i&&"capabilities"in i&&i.capabilities?.query.relativeTimeBinWindow?T(n,i.fieldsIndex,i.definitionExpression):null];if("timeInfo"in i&&i.timeInfo&&this.timeExtent&&j(n,i.fieldsIndex,[i.timeInfo.startField,i.timeInfo.endField]),"timeInfo"in i&&i.timeInfo&&"trackInfo"in i&&i.trackInfo){const{trackInfo:e}=i;j(n,i.fieldsIndex,[i.timeInfo.trackIdField]),"feature"!==i.type&&"startTimeField"!==e.timeField||j(n,i.fieldsIndex,[i.timeInfo.startField]),"endTimeField"===e.timeField&&j(n,i.fieldsIndex,[i.timeInfo.endField]),await O(n,i)}if("floorInfo"in i&&i.floorInfo&&j(n,i.fieldsIndex,[i.floorInfo.floorField]),"featureTitleFields"in i&&this.view?.requiredFieldsOptions?.featureTitleFields&&i.featureTitleFields&&j(n,i.fieldsIndex,i.featureTitleFields),"feature"===i.type&&i.globalIdField&&this.view?.requiredFieldsOptions?.globalIdField&&j(n,i.fieldsIndex,[i.globalIdField]),"feature"!==i.type&&"subtype-group"!==i.type||!this.view?.requiredFieldsOptions?.utilityNetworkFields||j(n,i.fieldsIndex,L(this.view,i)),this.displayFilterEnabled&&"displayFilterInfo"in i&&o.push(C(n,i,i.displayFilterInfo)),"feature"===i.type&&e&&null!=i.infoFor3D&&(null==i.globalIdField&&t.getLogger(this).error("globalIdField missing on 3DObjectFeatureLayer"),j(n,i.fieldsIndex,[i.globalIdField])),"subtype-group"===i.type){k(n,r,i.subtypeField);const e=i.sublayers.map(e=>Promise.all([e.renderer?.collectRequiredFields(n,r),x(n,e)]));o.push(Promise.all(e))}if("catalog-footprint"===i.type&&i.parent){const e=i.parent;j(n,r,[e.itemNameField,e.itemSourceField,e.itemTypeField,e.maxScaleField,e.minScaleField])}"knowledge-graph-sublayer"===i.type&&"link-chart"===i.parentCompositeLayer.type&&k(n,r,h);const u=await Promise.allSettled(o);if(e)k(n,r,i.objectIdField);else for(const t of f(S(i)))k(n,r,t);e&&"displayField"in i&&i.displayField&&k(n,r,i.displayField);for(const p of u)"rejected"===p.status&&t.getLogger(this).error(p.reason);const d=Array.from(n).sort();this._set("requiredFields",d)}async _updateHasZM(){const{layer:e}=this;if(!e||!this.view)return;let t=!1,i=!1;if("capabilities"in e&&e.capabilities){const{data:r}=e.capabilities;t=r.supportsZ,i=r.supportsM}this._set("hasZ",t),this._set("hasM",i);const{returnZ:r,returnM:s}=await g(e);t&&=r??this._defaultReturnZ,i&&=s??!1,this.hasZ!==t&&this._set("hasZ",t),this.hasM!==i&&this._set("hasM",i)}_popupFeatureHasRequiredFields(e,t){return P(e,t)}async _createPopupQuery(e,t){const r=this.layer.createQuery(),s=new Set;let l="point"===this.layer.geometryType;for(const a of e){if(!l){const e=await b(a);i(t),l=(e&&e.arcadeUtils.hasGeometryOperations(a))??!1}const e=await N(this.layer,a);i(t);for(const t of e)s.add(t)}return r.where="1=1",r.returnGeometry=l,r.returnZ=l,r.returnM=l,r.outFields=Array.from(s),r.outSpatialReference=this.view.spatialReference,"floorInfo"in this.layer&&this.layer.floorInfo&&(r.where=o(r.where,U(this))),r}canResume(){return!!super.canResume()&&(null==this.timeExtent||!this.timeExtent.isEmpty)}getTest(){}get test(){}};e([u()],G.prototype,"_updatingRequiredPromise",void 0),e([u()],G.prototype,"_defaultReturnZ",void 0),e([u({readOnly:!0})],G.prototype,"availableFields",null),e([u({readOnly:!0})],G.prototype,"hasZ",void 0),e([u({readOnly:!0})],G.prototype,"hasM",void 0),e([u({readOnly:!0})],G.prototype,"displayFilterEnabled",null),e([u({readOnly:!0})],G.prototype,"effectiveDisplayFilter",null),e([u({readOnly:!0})],G.prototype,"effectiveDisplayFilterClause",null),e([u({type:m})],G.prototype,"featureEffect",null),e([u({type:c})],G.prototype,"filter",void 0),e([u()],G.prototype,"layer",void 0),e([u({type:Number})],G.prototype,"maximumNumberOfFeatures",null),e([u({readOnly:!0,type:Boolean})],G.prototype,"maximumNumberOfFeaturesExceeded",null),e([u()],G.prototype,"requiresCurrentUser",void 0),e([u({readOnly:!0})],G.prototype,"requiredFields",void 0),e([u({readOnly:!0})],G.prototype,"signedInUser",null),e([u()],G.prototype,"view",void 0),G=e([d("esri.views.layers.FeatureLikeLayerView")],G);export{G as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import"../../core/has.js";import t from"../../core/Logger.js";import{throwIfAborted as i}from"../../core/promiseUtils.js";import{watch as r,syncAndInitial as s,on as l,whenOnce as a}from"../../core/reactiveUtils.js";import{sqlOr as n,sqlIn as o,sqlAnd as u}from"../../core/sql.js";import{property as d,subclass as p}from"../../core/accessorSupport/decorators.js";import{getPopupProvider as f}from"../../graphic/getPopupProvider.js";import{getFeatureIdInfoFieldNames as h}from"../../layers/graphics/data/FeatureIdInfo.js";import{systemIsSpatialFieldName as y}from"../../layers/knowledgeGraph/constants.js";import{getEffectiveDisplayFilter as m}from"../../layers/support/displayFilterUtils.js";import c from"../../layers/support/FeatureEffect.js";import F from"../../layers/support/FeatureFilter.js";import{getSignedInUser as g,layerRequiresGeometryZM as I}from"../../layers/support/featureLayerUtils.js";import{fetchFeaturePopupFeatures as b,loadFeaturePopupArcadeModules as v}from"../../layers/support/featurePopupQueryUtils.js";import{fixFields as w,unpackFieldNames as x,collectLabelingFields as E,collectElevationFields as R,collectFilterFields as q,collectFeatureReductionFields as _,collectOrderByInfos as j,collectFields as O,collectTrackInfoFields as C,collectDisplayFilterFields as k,collectField as P,featureHasFields as U}from"../../layers/support/fieldUtils.js";import{getFloorFilterClause as T}from"../../layers/support/floorFilterUtils.js";import{collectRelativeTimeFields as L}from"../../layers/support/relativeTimeQueryUtils.js";import{getUtilityNetworkFields as Z}from"../../networks/support/networkFieldUtils.js";import S from"../../rest/support/Query.js";import{createFeatureIdInfo as M}from"../2d/layers/features/layerAdapters/featureServiceUtils.js";import D from"./LayerView.js";import{getFetchPopupTemplate as N,getRequiredFields as Q}from"./support/popupUtils.js";import{WhereClauseVisitor as G}from"./support/WhereClauseVisitor.js";let H=class extends D{constructor(){super(...arguments),this._updatingRequiredPromise=null,this._defaultReturnZ=!1,this.hasZ=!1,this.hasM=!1,this.filter=null,this.layer=null,this.requiresCurrentUser=!1,this.requiredFields=[],this.view=null}initialize(){this.addHandles([r(()=>{const e=this.layer,t=this.view;return[e&&"elevationInfo"in e?e.elevationInfo?.featureExpressionInfo:null,e&&"displayField"in e?e.displayField:null,e&&"timeInfo"in e&&e.timeInfo,e&&"renderer"in e&&e.renderer,e&&"returnZ"in e&&e.returnZ,e&&"returnM"in e&&e.returnM,e&&"capabilities"in e&&e.capabilities,e&&"labelingInfo"in e&&e.labelingInfo,e&&"floorInfo"in e&&e.floorInfo,t?.requiredFieldsOptions?.featureTitleFields&&e&&"featureTitleFields"in e&&e.featureTitleFields,t?.requiredFieldsOptions?.utilityNetworkFields&&Z(t,e),e&&"displayFilterInfo"in e&&e.displayFilterInfo,this.displayFilterEnabled,this.filter,this.featureEffect,this.timeExtent,"knowledge-graph-sublayer"===e?.type&&"link-chart"===e.parentCompositeLayer.type&&e.parentCompositeLayer.linkChart?.linkChartProperties.nonspatialDataDisplay?.mode]},()=>this._handleChange(),s),l(()=>this.view?.floors,"change",()=>this._handleChange()),l(()=>(this.layer&&"displayFilterInfo"in this.layer?this.layer.displayFilterInfo:null)?.filters,"change",()=>this._handleChange()),l(()=>this.layer&&"sublayers"in this.layer?this.layer.sublayers:null,"change",()=>this._handleChange())])}get availableFields(){if(!this.layer)return[];const{layer:e,layer:{fieldsIndex:t},requiredFields:i}=this;return"outFields"in e&&e.outFields?w(t,[...x(t,e.outFields),...i]):w(t,i)}get displayFilterEnabled(){return(this.view?.displayFilterEnabled??!0)&&(!("displayFilterEnabled"in this.layer)||(this.layer?.displayFilterEnabled??!0))}get effectiveDisplayFilter(){const e=this.layer;return"displayFilterInfo"in e&&this.displayFilterEnabled&&e.displayFilterInfo?m(e.displayFilterInfo,this.view):null}get effectiveDisplayFilterClause(){const e=this.effectiveDisplayFilter?.where??null;return e&&this.hasHighlight?n(e,o(this.layer.objectIdField,this.highlightIds)):e}get featureEffect(){return this.layer&&"featureEffect"in this.layer?this.layer.featureEffect:null}set featureEffect(e){this._override("featureEffect",e)}get highlightOptions(){}set highlightOptions(e){}get maximumNumberOfFeatures(){return 0}set maximumNumberOfFeatures(e){t.getLogger(this).error("#maximumNumberOfFeatures=","Setting maximum number of features is not supported")}get maximumNumberOfFeaturesExceeded(){return!1}get signedInUser(){return this.layer?.url?g(this.layer.url):Promise.resolve(null)}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference},t=null!=this.filter?this.filter.createQuery(e):new S(e);return"floorInfo"in this.layer&&this.layer.floorInfo&&(t.where=u(t.where,T(this))),this.displayFilterEnabled&&(t.where=u(t.where,this.effectiveDisplayFilter?.where)),null!=this.timeExtent&&(t.timeExtent=null!=t.timeExtent?t.timeExtent.intersection(this.timeExtent):this.timeExtent.clone()),t}createAggregateQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return new S(e)}async fetchPopupFeaturesFromGraphics(e,t){const i=[],r=new Set;for(const l of e){const e=f(l.origin),s=N(e,{...t,checkPopupEnabled:!0});s&&(i.push(l),r.add(s))}if(0===i.length||0===r.size)return[];const s=await this._createPopupQuery(r,t);return await b(this.layer,i,s,{hasRequiredFields:(e,t)=>this._popupFeatureHasRequiredFields(e,t),...t})}_handleChange(){const e=Promise.all([a(()=>!("reloading"in this.layer&&this.layer.reloading)),this._updateRequiredFields(),this._updateClientWhereClauseRequirements(),this._updateHasZM()]).then(()=>{});return this._updatingRequiredPromise=e,e.then(()=>{this._updatingRequiredPromise===e&&(this._updatingRequiredPromise=null)}),e}async _updateClientWhereClauseRequirements(){if(!this.layer||!this.view)return;const{layer:e}=this,i=new G(e.fieldsIndex);if(i.visitFilter(this.filter),"featureReduction"in e&&i.visitFeatureReduction(e.featureReduction),"labelingInfo"in e&&i.visitLabelingInfo(e.labelsVisible,e.labelingInfo),"trackInfo"in e&&i.visitTrackInfo(e.trackInfo),"2d"===this.view.type&&(i.visitFilter(this.featureEffect?.filter),"featureReduction"in e&&i.visitFeatureReduction(e.featureReduction),"displayFilterInfo"in e&&i.visitDisplayFilter(this.displayFilterEnabled,e.displayFilterInfo)),"subtype-group"===e.type)for(const t of e.sublayers)i.visitLabelingInfo(t.labelsVisible,t.labelingInfo);"definitionExpression"in e&&"capabilities"in e&&e.capabilities?.query.relativeTimeBinWindow&&i.visitRelativeTimeQuery(e.definitionExpression);try{const e=await i.finish();this._set("requiresCurrentUser",e.requiresCurrentUser)}catch(r){t.getLogger(this).error(r)}}async _updateRequiredFields(){if(!this.layer||!this.view)return;const e="3d"===this.view.type,{layer:i,layer:{fieldsIndex:r}}=this,s="renderer"in i&&i.renderer,l="orderBy"in i&&i.orderBy,a="featureReduction"in i?i.featureReduction:null,n=new Set,o=[s?s.collectRequiredFields(n,r):null,E(n,i),e&&"elevationInfo"in i?R(n,i):null,null!=this.filter?q(n,i,this.filter):null,e||null==this.featureEffect?null:q(n,i,this.featureEffect.filter),!e&&a?_(n,i,a):null,!e&&l?j(n,i,l):null,"definitionExpression"in i&&"capabilities"in i&&i.capabilities?.query.relativeTimeBinWindow?L(n,i.fieldsIndex,i.definitionExpression):null];if("timeInfo"in i&&i.timeInfo&&this.timeExtent&&O(n,i.fieldsIndex,[i.timeInfo.startField,i.timeInfo.endField]),"timeInfo"in i&&i.timeInfo&&"trackInfo"in i&&i.trackInfo){const{trackInfo:e}=i;O(n,i.fieldsIndex,[i.timeInfo.trackIdField]),"feature"!==i.type&&"startTimeField"!==e.timeField||O(n,i.fieldsIndex,[i.timeInfo.startField]),"endTimeField"===e.timeField&&O(n,i.fieldsIndex,[i.timeInfo.endField]),await C(n,i)}if("floorInfo"in i&&i.floorInfo&&O(n,i.fieldsIndex,[i.floorInfo.floorField]),"featureTitleFields"in i&&this.view?.requiredFieldsOptions?.featureTitleFields&&i.featureTitleFields&&O(n,i.fieldsIndex,i.featureTitleFields),"feature"===i.type&&i.globalIdField&&this.view?.requiredFieldsOptions?.globalIdField&&O(n,i.fieldsIndex,[i.globalIdField]),"feature"!==i.type&&"subtype-group"!==i.type||!this.view?.requiredFieldsOptions?.utilityNetworkFields||O(n,i.fieldsIndex,Z(this.view,i)),this.displayFilterEnabled&&"displayFilterInfo"in i&&o.push(k(n,i,i.displayFilterInfo)),"feature"===i.type&&e&&null!=i.infoFor3D&&(null==i.globalIdField&&t.getLogger(this).error("globalIdField missing on 3DObjectFeatureLayer"),O(n,i.fieldsIndex,[i.globalIdField])),"subtype-group"===i.type){P(n,r,i.subtypeField);const e=i.sublayers.map(e=>Promise.all([e.renderer?.collectRequiredFields(n,r),E(n,e)]));o.push(Promise.all(e))}if("catalog-footprint"===i.type&&i.parent){const e=i.parent;O(n,r,[e.itemNameField,e.itemSourceField,e.itemTypeField,e.maxScaleField,e.minScaleField])}"knowledge-graph-sublayer"===i.type&&"link-chart"===i.parentCompositeLayer.type&&P(n,r,y);const u=await Promise.allSettled(o);if(e)P(n,r,i.objectIdField);else for(const t of h(M(i)))P(n,r,t);e&&"displayField"in i&&i.displayField&&P(n,r,i.displayField);for(const p of u)"rejected"===p.status&&t.getLogger(this).error(p.reason);const d=Array.from(n).sort();this._set("requiredFields",d)}async _updateHasZM(){const{layer:e}=this;if(!e||!this.view)return;let t=!1,i=!1;if("capabilities"in e&&e.capabilities){const{data:r}=e.capabilities;t=r.supportsZ,i=r.supportsM}this._set("hasZ",t),this._set("hasM",i);const{returnZ:r,returnM:s}=await I(e);t&&=r??this._defaultReturnZ,i&&=s??!1,this.hasZ!==t&&this._set("hasZ",t),this.hasM!==i&&this._set("hasM",i)}_popupFeatureHasRequiredFields(e,t){return U(e,t)}async _createPopupQuery(e,t){const r=this.layer.createQuery(),s=new Set;let l="point"===this.layer.geometryType;for(const a of e){if(!l){const e=await v(a);i(t),l=(e&&e.arcadeUtils.hasGeometryOperations(a))??!1}const e=await Q(this.layer,a);i(t);for(const t of e)s.add(t)}return r.where="1=1",r.returnGeometry=l,r.returnZ=l,r.returnM=l,r.outFields=Array.from(s),r.outSpatialReference=this.view.spatialReference,"floorInfo"in this.layer&&this.layer.floorInfo&&(r.where=u(r.where,T(this))),r}canResume(){return!!super.canResume()&&(null==this.timeExtent||!this.timeExtent.isEmpty)}getTest(){}get test(){}};e([d()],H.prototype,"_updatingRequiredPromise",void 0),e([d()],H.prototype,"_defaultReturnZ",void 0),e([d({readOnly:!0})],H.prototype,"availableFields",null),e([d({readOnly:!0})],H.prototype,"hasZ",void 0),e([d({readOnly:!0})],H.prototype,"hasM",void 0),e([d({readOnly:!0})],H.prototype,"displayFilterEnabled",null),e([d({readOnly:!0})],H.prototype,"effectiveDisplayFilter",null),e([d({readOnly:!0})],H.prototype,"effectiveDisplayFilterClause",null),e([d({type:c})],H.prototype,"featureEffect",null),e([d({type:F})],H.prototype,"filter",void 0),e([d()],H.prototype,"layer",void 0),e([d({type:Number})],H.prototype,"maximumNumberOfFeatures",null),e([d({readOnly:!0,type:Boolean})],H.prototype,"maximumNumberOfFeaturesExceeded",null),e([d()],H.prototype,"requiresCurrentUser",void 0),e([d({readOnly:!0})],H.prototype,"requiredFields",void 0),e([d({readOnly:!0})],H.prototype,"signedInUser",null),e([d()],H.prototype,"view",void 0),H=e([p("esri.views.layers.FeatureLikeLayerView")],H);export{H as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{onLocaleChange as t,substitute as i,fetchMessageBundle as s}from"../../intl.js";import{isSome as n}from"../../core/arrayUtils.js";import l from"../../core/Collection.js";import{referenceSetter as r}from"../../core/collectionUtils.js";import o from"../../core/Error.js";import a from"../../core/Logger.js";import{abortMaybe as d}from"../../core/maybe.js";import{debounce as h,ignoreAbortErrors as m,after as c,throwIfAborted as p}from"../../core/promiseUtils.js";import{watch as u,initial as g,on as b,sync as f,syncAndInitial as y}from"../../core/reactiveUtils.js";import{throttle as T}from"../../core/throttle.js";import{property as w,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 _}from"../../layers/support/fieldUtils.js";import{getSubtypesFromLayer as E,isSubtypeGroupLayer as S}from"../../layers/support/layerUtils.js";import{createFieldInfos as A}from"../../support/popupUtils.js";import F from"../../tables/AttributeTableTemplate.js";import j from"../../tables/support/FieldOrder.js";import x from"../../time/TimeExtent.js";import R from"../../views/SelectionManager.js";import{temporaryHighlightName as O}from"../../views/support/HighlightDefaults.js";import{highlightsSupported as U}from"../../views/support/layerViewUtils.js";import{isSelectableLayerWithObjectIds as V,isSelectableLayer as P}from"../../views/support/selectionUtils.js";import z from"./ActionColumn.js";import W from"./AttachmentsColumn.js";import H from"./FieldColumn.js";import B from"./RelationshipColumn.js";import M from"./Grid/Column.js";import L from"./Grid/Grid.js";import G from"./Grid/GridViewModel.js";import k from"./Grid/GroupColumn.js";import N from"./support/AttachmentsColumnTemplate.js";import D from"./support/AttachmentsViewOptions.js";import{isAttachmentsColumn as $,isFieldColumn as Z,isRelationshipColumn as q}from"./support/columnUtils.js";import{downloadAttachmentInfo as Q,exportToCSV as K}from"./support/exportUtils.js";import J from"./support/FeatureStore.js";import X from"./support/FieldColumnTemplate.js";import Y from"./support/RelationshipColumnTemplate.js";import ee from"./support/TableTemplate.js";import{isIFeatureTableSupportedLayerWithFieldConfigurations as te,isIFeatureTableSupportedLayerWithRelationships as ie,findRelatedLayerInSources as se,findRelationship as ne,uniqueColumnNames as le,hasColumnForField as re,findField as oe,isIFeatureTableSupportedLayerWithAttachments as ae,getRelationshipIdsToShow as de}from"./support/tableUtils.js";import{createAttributeTableElements as he}from"./support/templateUtils.js";import{goTo as me}from"../support/goToUtils.js";import{messageBundle as ce}from"../support/widget.js";const pe="80px";let ue=class extends G{constructor(e){super(e),this._currentTemporaryHighlight=null,this._refreshDebounced=h(()=>this._refresh()),this._syncTemplateThrottled=T(()=>this._syncAttributeTableTemplate()),this._temporaryHighlightAbortController=null,this.attachmentsViewOptions=new D,this.attributeTableTemplate=null,this.autoRefreshEnabled=!0,this.columns=new l,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:n}=this;if(this.filterBySelectionEnabled&&!this.highlightIds.length||1===n.length&&-1===n.items[0])return void t([]);"loaded"!==s.state&&"loading"!==s.state&&await s.load();const l=this.paginationEnabled?this.pageIndex:e.page,r=await s.fetchItems({...e,page:l});t&&t(r)},this.defaultSelectionManager=new R,this.grid=null,this.highlightEnabled=!0,this.layers=null,this.menuConfig=null,this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this.messagesURIUtils=null,this.prompt=null,this.relatedTables=new l,this.relationshipColumnConfigs=null,this.selectionManager=null,this.showRelatedTableCallback=null,this.store=null,this.syncTemplateOnChangesEnabled=!0,this.syncViewSelection=!1,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 J),this._set("grid",new L({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()}),u(()=>[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()},g),u(()=>this.attachmentsEnabled,()=>this.layer?.loaded&&this._generateColumns()),u(()=>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(()=>{})),this.syncViewSelection&&this._syncSelection(),t&&null!=this.attachmentsViewOptions.objectId&&(this.attachmentsViewOptions.objectId=null)}),u(()=>this.layer?.loaded,e=>e&&this._onLayerLoad()),u(()=>this.store.state,e=>{"loaded"===e&&(this.scrollToTop(),this.refreshCellContent())}),u(()=>this._effectiveTableTemplate,()=>{this.scrollLeft(),this.layer?.loaded&&this._generateColumns()}),u(()=>this.editingEnabled,()=>this.refreshCellContent()),u(()=>this.timeZone??this.view?.timeZone,()=>this.refreshCellContent()),u(()=>this.store.effectiveWhere,()=>"loaded"===this.store.state&&this.reset()),u(()=>this.layer?.timeExtent,(e,t)=>(e||t)&&!this.timeExtent&&"loaded"===this.store.state&&this.reset()),b(()=>this.layer,"refresh",e=>this._onLayerRefresh(e)),b(()=>this.grid,["cell-click","cell-dblclick","cell-pointerover","cell-pointerout","cell-keydown","column-reorder"],({index:e,item:t,native:i,path:s,type:n})=>{const l=t?.feature,r=l?.getObjectId(),o="cell-keydown"===n&&i&&i instanceof KeyboardEvent&&"Enter"===i.key;this.emit(n,{feature:l,index:e,native:i,type:n,fieldName:s??void 0,objectId:r}),(o||"cell-click"===n)&&this._onCellInteraction(r)}),u(()=>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())}),u(()=>this.relatedRecordsEnabled,()=>this.layer?.loaded&&this._generateColumns()),b(()=>this.objectIds,"change",()=>this._onObjectIdsChange(),{onListenerAdd:()=>this._onObjectIdsChange()}),u(()=>[this.paginationEnabled,this.pageIndex],()=>this.refreshPageCache()),u(()=>this.activeSortOrders,e=>{this.store.sortOrders=e,this._syncTemplateThrottled()}),u(()=>this.allVisibleColumns,()=>this._syncTemplateThrottled()),u(()=>this.pageCount,()=>{this.pageIndex>=this.pageCount&&this.goToPage(0)}),u(()=>this.state,e=>{"disabled"===e&&this.relatedTables.length&&this.drainRelatedTables()}),b(()=>this.tableParent?.highlightIds,"change",({added:e})=>{const{relationshipConfig:t}=this,i=e[0];if(null==i||!t)return;const{relatedLayer:s,relationshipId:n}=t;this.relationshipConfig={objectId:i,relatedLayer:s,relationshipId:n}}),b(()=>this.tableParent,"cell-click",async e=>{const{objectId:t}=e;this.tableController&&this.hasPendingEdits?await this.tableController.discardPendingEdits(void 0,!0).then(e=>e&&this._syncTableParentSelection(t)):this._syncTableParentSelection(t)}),u(()=>this.attachmentsViewOptions.objectId,(e,t)=>{null!=e?null==t&&this.showAttachmentsView({objectId:e}):this.hideAttachmentsView()}),u(()=>[this.layerFieldConfigurations,this.pendingEditsCount],()=>this.refreshCellContent()),b(()=>this.highlightIds,"change",e=>this._onHighlightIdsChange(e),{onListenerAdd:()=>this._syncSelection(),onListenerRemove:()=>this.defaultSelectionManager.clear()}),u(()=>this.grid?.temporaryHighlightId,e=>{this._temporaryHighlightAbortController?.abort(),this._temporaryHighlightAbortController=new AbortController;const t=this._syncTemporaryHighlight(e,this._temporaryHighlightAbortController.signal);m(this.view?.addUpdatingPromise(t)??t)},f),u(()=>this.effectiveSelectionManager,()=>this._syncSelection(),y),b(()=>this.effectiveSelectionManager,"selection-change",()=>this._syncSelection(),y),u(()=>[this.layer,this.view],()=>this.syncSelectionSources(),y),u(()=>this.highlightEnabled,e=>this.defaultSelectionManager.highlightEnabled=e,g)])}destroy(){this._drainColumns(),this._currentTemporaryHighlight?.handle.remove(),this._temporaryHighlightAbortController=d(this._temporaryHighlightAbortController),this.defaultSelectionManager.destroy(),this.grid?.destroy(),this.columns.destroyed||this.columns.destroy(),this.layer=null,this.view=null}get _defaultHiddenFields(){return _(this.layer)}get _effectiveTableTemplate(){return this.tableTemplateOverride||this.tableTemplate}get _effectiveAttributeTableTemplate(){return this.attributeTableTemplate||this.layer?.attributeTableTemplate}get _highlightableLayerView(){const e=this.layerView;return U(e)?e:null}get _subtypes(){return E(this.layer)}get actionColumn(){return super.actionColumn}get activeFilters(){const{filterGeometry:e,objectIds:t,filterBySelectionEnabled:i,highlightIds:s}=this,n=new l;return e&&n.push({type:"geometry",geometry:e}),i?n.push({type:"selection",objectIds:s.toArray()}):t.length&&n.push({type:"objectId",objectIds:t.toArray()}),n}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 autoSaveEnabled(){return this.store.autoSaveEnabled}set autoSaveEnabled(e){this.store.autoSaveEnabled=e}get canAddRelatedFeature(){return this.store.canAddRelatedFeature}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 effectiveSelectionManager(){const{layer:e,view:t}=this;return e&&this.syncViewSelection&&V(e)&&t?.selectionManager?.sources.includes(e)?t.selectionManager:this.selectionManager??this.defaultSelectionManager}get effectiveMultipleSelectionEnabled(){return super.effectiveMultipleSelectionEnabled}get effectiveSize(){return super.effectiveSize}get fieldColumns(){return this.allColumns.filter(e=>Z(e))}get filterByViewExtent(){return this.store.filterByViewExtent}set filterByViewExtent(e){this.store.filterByViewExtent=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 hasContingentValues(){return this.relatedTableHasContingentValues||this.store.hasContingentValues}get hasInvalidPendingEdits(){return this.relatedTableHasInvalidPendingEdits||this.store.hasInvalidPendingEdits}get hasPendingEdits(){return this.relatedTableHasPendingEdits||this.store.hasPendingEdits}get hiddenFields(){return this._get("hiddenFields")??new l}set hiddenFields(e){this._set("hiddenFields",r(e,this._get("hiddenFields"),l))}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.drainRelatedTables(),this._set("layer",e)}get layerFieldConfigurations(){const e=this.layer;return te(e)?e.fieldConfigurations:void 0}get layerView(){return this.store.layerView}get maxSize(){return super.maxSize}set maxSize(e){super.maxSize=e}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 paginationEnabled(){return super.paginationEnabled}set paginationEnabled(e){super.paginationEnabled=e}get pendingEditsCount(){return this.store.pendingEditsCount}get relatedRecordsEnabled(){return this.store.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.store.relatedRecordsEnabled=e}get relatedTable(){return this.relatedTables.at(-1)}get relatedTableHasContingentValues(){return!!this.relatedTable?.hasContingentValues}get relatedTableHasInvalidPendingEdits(){return!!this.relatedTable?.hasInvalidPendingEdits}get relatedTableHasPendingEdits(){return!!this.relatedTable?.hasPendingEdits}get relationship(){return this.store.relationship}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,n=this.store.relationshipInfos;if(n.length||!ie(e)||!i?.length)return n;const l=[],r=s?.layers||t||[];return i.forEach(t=>{const i=se(e,r,t);i&&(i.load(),l.push({layer:e,relatedLayer:i,relationshipId:t.id}))}),l}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 selectionSource(){return"table"}set selectionSource(e){this.syncViewSelection="view"===e,this._overrideIfSome("selectionSource",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,n=i.objectId===e;await s.addAttachment(e,t).catch(e=>{n&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to add attachment. ${e.error.name} ${e.error.message}`),i.error=e.error)}),n&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}addPendingEdits(e){this.store.addPendingEdits(e)}collapseRelatedTable(e,t){const{relatedLayer:i,objectId:s,relationshipId:n}=t,{objectIdField:r}=i,o=ne(i,n),a=i.displayField||o?.keyField||r;e.set({highlightIds:new l([s]),multipleSelectionEnabledOverride:!1,tableTemplateOverride:this._getTableTemplateForRelatedTableView(e,a,n)});const d=e.hiddenFields;d.includes(le.action)||d.add(le.action),d.includes(le.attachments)||d.add(le.attachments),e.scrollLeft()}async deleteAttachments(e,t){const{attachmentsViewOptions:i,store:s}=this,n=i.objectId===e;await s.deleteAttachments(e,t).catch(e=>{n&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to delete attachment(s). ${e.error.name} ${e.error.message}`),i.error=e.error)}),n&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}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 discardPendingEdits(e){return this.relatedTable&&this.relatedTableHasPendingEdits?this.relatedTable.discardPendingEdits(e):(this.store.discardPendingEdits(e),!0)}async downloadAttachmentById(e,t){const i=(await this.store.getAttachmentsByObjectId(e,!0)).find(e=>e.id===t);await Q(i)}drainRelatedTables(){this.relatedTables.drain(e=>e.destroy()),this.set({multipleSelectionEnabledOverride:null,relationshipColumnConfigs:null,showAllRelatedTables:!1,tableTemplateOverride:null}),this.hiddenFields.removeMany([le.action,le.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 K({layer:i,objectIds:t.toArray(),outFields:s,includeGeometry:e}):this._logWarning("Export failed.")}getFeatureStoreItemByObjectId(e){return this.store.getItemByObjectId(e)}async getFeatureTitle(e,t){return this.store.getFeatureTitle(e,t)}getFeatureTitleSync(e){const t=this.layer;if(!t)return`${e}`;const i=`${t.objectIdField}: ${e}`;return null==e?i:this.store.featureTitleMap.get(e)??i}getObjectIdIndex(e){return this.store.getItemIndexByObjectId(e)}getValue(e,t){const i=this.getFeatureStoreItemByObjectId(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,multipleSelectionEnabledOverride:null,tableTemplateOverride:null}),this.hiddenFields.remove(le.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()),m(this._refreshDebounced())])}refreshCellContent(){this.grid?.requestContentUpdate()}refreshPageCache(){this.grid?.refreshPageCache()}async reset(){this.goToPage(0),await(this.grid?.reset())}async savePendingEdits(){!this.relatedTableHasPendingEdits||this.relatedTableHasInvalidPendingEdits?this.hasPendingEdits&&!this.relatedTable&&(await this.store.savePendingEdits(),await this.refresh()):await(this.relatedTable?.savePendingEdits())}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 n=this._getDefaultLayerDisplayField(s),r=await this.store.getAttachmentsByObjectId(e,!0),o=this.store.getItemIndexByObjectId(e);t.set({attachmentInfos:r,mode:r.length?"list":"file",objectId:e}),this.set({highlightIds:new l([e]),multipleSelectionEnabledOverride:!1,relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForAttachmentsView(n)}),i.includes(le.action)||i.add(le.action),null!=o&&this.scrollToIndex(o)}syncAttributeTableTemplate(){this._syncAttributeTableTemplate(!0)}syncSelectionSources(){const{defaultSelectionManager:e,layer:t,view:i}=this;e.view=i,e.sources.removeAll(),t&&P(t)&&(e.sources.items=[t])}async updateAttachment(e,t,i){const{attachmentsViewOptions:s,store:n}=this,l=s.objectId===e;await n.updateAttachment(e,t,i).catch(e=>{l&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to update attachment. ${e.error.name} ${e.error.message}`),s.error=e.error)}),l&&!s.error&&(s.onEditComplete(),s.attachmentInfos=await n.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 n=await e.queryFeatures(s);try{await me(t,n.features)}catch(l){"AbortError"!==l.name&&console.error(l)}}_syncAttributeTableTemplate(e=!1){const{_effectiveAttributeTableTemplate:t,layer:i,tableTemplateOverride:s,syncTemplateOnChangesEnabled:n}=this;if(!i||!t||!n&&!e||s||this.tableParent||this.relatedTable||null!==this.attachmentsViewOptions.objectId)return;const{activeSortOrders:l,allColumns:r,columns:o}=this,a=[],d=he(o.toArray());l.forEach(({fieldName:e,direction:t})=>{e&&t&&a.push(new j({field:e,order:t}))}),r.forEach(({fieldName:e,direction:t})=>{t&&!a.some(t=>t.field===e)&&a.push(new j({field:e,order:t}))}),t.elements=d,t.orderByFields=a}async _refresh(){await super.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,n=s?i:t;s&&(this._logWarning("The value for 'pageSize' has been adjusted due to the provided layer's max record count."),this.pageSize=n),this.grid?.set("pageSize",n),this.store.load(),this._generateColumns()}_onLayerRefresh(e){this.autoRefreshEnabled&&e.dataChanged&&this.refresh()}_generateColumns(){this._drainColumns();const{_effectiveTableTemplate:e,_effectiveAttributeTableTemplate:t,layer:i}=this,s=e?.columnTemplates;if(!i)return;const n=this._generateColumnsFromColumnTemplates(i,s)??this._generateColumnsFromAttributeTableTemplate(i,t)??this._generateDefaultFieldColumns(i);n.length&&(this.attachmentsEnabled&&!n.some(e=>$(e))&&n.push(this._generateDefaultAttachmentsColumn(i)),this.relatedRecordsEnabled&&this.relationshipInfos.length&&!n.some(e=>q(e))&&n.push(...this._generateDefaultRelationshipColumns()),this.actionColumnConfig&&n.push(this._generateActionColumn()),n.sort((e,t)=>e.frozen&&t.frozen||e.frozenToEnd&&t.frozenToEnd?0:e.frozen||t.frozenToEnd?-1:0),this.columns.addMany(n))}_generateColumnsFromAttributeTableTemplate(e,t){if(!t)return null;const{elements:i,orderByFields:s}=t,l=A(e),r=[];r.push(...this._generateColumnsFromAttributeTableElements(e,i,s));const o=l.map(t=>{if(!t.fieldName||re(t.fieldName,r))return null;const{fieldName:i}=t,n=oe(e,i);return n?this._generateDefaultFieldColumn(e,n,{hidden:!0,orderByFields:s}):(this._logTemplateWarning("A valid 'field' could not be found for the provided template."),null)}).filter(n);return r.push(...o),this.attachmentsEnabled&&ae(e)&&!r.some(e=>$(e))&&r.push(this._generateDefaultAttachmentsColumn(e,{hidden:!0})),this.relatedRecordsEnabled&&ie(e)&&e.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,i){return t?.map((t,s)=>{switch(t.type){case"field":return this._createFieldColumnFromElement({layer:e,element:t,orderByFields:i});case"group":return this._createGroupColumnFromElement({layer:e,element:t,orderByFields:i});case"attachment":return this._createAttachmentColumnFromElement({layer:e,element:t,index:s});case"relationship":return this._createRelationshipColumnFromElement({element:t,index:s})}}).filter(e=>!!e)??[]}_createFieldColumnFromElement(e){const{layer:t,element:i,orderByFields:s}=e,{fieldName:n}=i;if(null==n)return this._logTemplateWarning("A valid 'fieldName' must be provided."),null;const l=oe(t,n);if(!l)return this._logTemplateWarning("A valid 'field' could not be found for the provided template."),null;const{description:r,label:o}=i,a=s?.findIndex(({field:e})=>e&&e===n)??-1,d=a>-1?s?.at(a)?.order:void 0,h=a>-1?a:void 0,{grid:m,messages:c,messagesCommon:p,messagesURIUtils:u,store:g,view:b}=this;return new H({description:r,direction:d,field:l,fieldName:n,grid:m,initialSortPriority:h,label:o,layer:t,messages:c,messagesCommon:p,messagesURIUtils:u,store:g,view:b,onShowPromptCallback:this._onShowPromptCallback})}_createGroupColumnFromElement(e){const{layer:t,element:i,orderByFields:s}=e,{description:n,label:l}=i;if(!l)return this._logTemplateWarning("Group columns require a label."),null;if(!i.elements.length)return this._logTemplateWarning("Group columns require child columns."),null;const{grid:r,messages:o,messagesCommon:a,messagesURIUtils:d,store:h}=this;return new k({columns:this._generateColumnsFromAttributeTableElements(t,i.elements,s),description:n,grid:r,label:l,messages:o,messagesCommon:a,messagesURIUtils:d,store:h})}_createAttachmentColumnFromElement(e){if(!this.attachmentsEnabled)return void this._logTemplateWarning("The 'attachmentsEnabled' property is currently false.");const{layer:t,element:i,index:s}=e,{description:n,label:l}=i,{grid:r,messages:o,messagesCommon:a,messagesURIUtils:d,store:h}=this;return new W({description:n,fieldName:`${le.attachments}-${s}`,grid:r,label:l,layer:t,messages:o,messagesCommon:a,messagesURIUtils:d,store:h,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:n,relationshipId:l}=t,r=this.relationshipInfos.find(e=>e.relationshipId===l);if(!r)return this._logTemplateWarning("Unable to find valid related layer target based on the provided relationship id."),null;const{grid:o,messages:a,messagesCommon:d,messagesURIUtils:h,store:m}=this;return new B({description:s,fieldName:`${le.relationship}-${l}-${i}`,grid:o,label:n,messages:a,messagesCommon:d,messagesURIUtils:h,relationshipId:l,store:m,layer:r.relatedLayer,relatedLayer:r.layer,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateColumnsFromColumnTemplates(e,t){const{grid:i,messages:s,messagesCommon:n,messagesURIUtils:l,store:r,view:o}=this;if(!t?.length)return null;const a=[];return t.forEach((t,d)=>{const{autoWidth:h,description:m,direction:c,flexGrow:p,fieldName:u,forceVisible:g,formatFunction:b,frozen:f,frozenToEnd:y,icon:T,iconText:w,initialSortPriority:C,invalid:I,label:v,labelTooltipText:_,menuConfig:E,resizable:S,sortable:A,textAlign:F,textWrap:j,timeZone:x,type:R,width:O}=t;if(!R)return void this._logTemplateWarning("Property 'type' is missing from the provided template.");if(f&&y)return void this._logTemplateWarning("Properties 'frozen' and 'frozenToEnd' cannot both be true for the same column.");const U=!1===t.visible;if("group"===R){if(!t.columnTemplates?.length)return void this._logTemplateWarning("Group columns must contain column templates.");if(!t.label)return void this._logTemplateWarning("Group columns require a label.");const r=this._generateColumnsFromColumnTemplates(e,t.columnTemplates),o=U||this._isFieldHidden(t.label);a.push(new k({autoWidth:h,columns:r,description:m,flexGrow:p,forceVisible:g,frozen:f,frozenToEnd:y,grid:i,hidden:o,icon:T,iconText:w,invalid:I,label:v,labelTooltipText:_,menuConfig:E,messages:s,messagesCommon:n,messagesURIUtils:l,resizable:S,textAlign:F,textWrap:j,timeZone:x,width:O}))}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,t,d))}else if("relationship"===R){if(!this.relatedRecordsEnabled)return void this._logTemplateWarning("Relationship columns require related records to be enabled on the table.");const{relationshipId:e}=t;if(null==e)return void this._logTemplateWarning("Property 'relationshipId' is missing from the provided template.");const i=this.relationshipInfos.find(t=>t.relationshipId===e);if(!i)return void this._logTemplateWarning("Unable to find valid related layer target based on the provided relationship id.");a.push(this._generateRelationshipColumnFromTemplate(i,t,d))}else if(!u)return void this._logTemplateWarning("Value for 'fieldName' property was missing from the provided template.");const V=U||this._isFieldHidden(u);if("column"===R)a.push(new M({autoWidth:h,description:m,direction:c,fieldName:u,flexGrow:p,forceVisible:g,formatFunction:b,frozen:f,frozenToEnd:y,grid:i,hidden:V,icon:T,iconText:w,initialSortPriority:C,invalid:I,label:v,labelTooltipText:_,menuConfig:E,messages:s,messagesCommon:n,messagesURIUtils:l,resizable:S,sortable:A,store:r,textAlign:F,textWrap:j,timeZone:x,width:O}));else if("field"===R){const d=oe(e,t.fieldName);if(!d)return void this._logTemplateWarning("A valid 'field' could not be found for the provided template.");const{editable:u,required:R}=t;a.push(new H({autoWidth:h,description:m,direction:c,editable:u,field:d,fieldName:d.name,flexGrow:p,forceVisible:g,formatFunction:b,frozen:f,frozenToEnd:y,grid:i,hidden:V,icon:T,iconText:w,initialSortPriority:C,invalid:I,label:v,labelTooltipText:_,layer:e,messages:s,messagesCommon:n,messagesURIUtils:l,menuConfig:E,required:R,resizable:S,sortable:A,store:r,template:t,textAlign:F,textWrap:j,timeZone:x,width:O,view:o,onShowPromptCallback:this._onShowPromptCallback}))}}),a.length?a:null}_generateDefaultFieldColumns(e){return e.fields?.map(t=>this._generateDefaultFieldColumn(e,t)).filter(n)??[]}_generateDefaultFieldColumn(e,t,i){const{grid:s,messages:n,messagesCommon:l,messagesURIUtils:r,store:o,view:a}=this;if(!t.visible||"geometry"===t.type)return null;const d=i?.orderByFields,h=t.name,m=d?.findIndex(({field:e})=>e&&e===h)??-1,c=m>-1?d?.at(m)?.order:void 0,p=m>-1?m:void 0;return new H({direction:c,field:t,fieldName:h,grid:s,hidden:i?.hidden||this._isFieldHidden(h),initialSortPriority:p,layer:e,messages:n,messagesCommon:l,messagesURIUtils:r,store:o,view:a,onShowPromptCallback:this._onShowPromptCallback})}_generateAttachmentsColumnFromTemplate(e,t,i){const{grid:s,messages:n,messagesCommon:l,messagesURIUtils:r,store:o}=this,{attachmentsViewEnabled:a,autoWidth:d,description:h,flexGrow:m,fieldName:c,forceVisible:p,formatFunction:u,frozen:g,frozenToEnd:b,icon:f,iconText:y,invalid:T,label:w,labelTooltipText:C,menuConfig:I,resizable:v,textAlign:_,textWrap:E,thumbnailAppearance:S,thumbnailCount:A,thumbnailIconScale:F,thumbnailsEnabled:j,timeZone:x,width:R}=t;return new W({attachmentsViewEnabled:a,autoWidth:d,description:h,fieldName:`${le.attachments}-${i}`,flexGrow:m,forceVisible:p,formatFunction:u,frozen:g,frozenToEnd:b,grid:s,hidden:!1===t.visible||this._isFieldHidden(w)||this._isFieldHidden(c),icon:f,iconText:y,invalid:T,label:w,labelTooltipText:C,layer:e,menuConfig:I,messages:n,messagesCommon:l,messagesURIUtils:r,resizable:v,store:o,textAlign:_,textWrap:E,thumbnailAppearance:S,thumbnailCount:A,thumbnailIconScale:F,thumbnailsEnabled:j,timeZone:x,width:R,onShowAttachments:e=>this._onShowAttachments(e)})}_generateDefaultAttachmentsColumn(e,t){const{grid:i,messages:s,messagesCommon:n,messagesURIUtils:l,store:r}=this,o=le.attachments;return new W({fieldName:o,grid:i,hidden:t?.hidden||this._isFieldHidden(o),layer:e,messages:s,messagesCommon:n,messagesURIUtils:l,store:r,onShowAttachments:e=>this._onShowAttachments(e)})}_generateRelationshipColumnFromTemplate(e,t,i){const{grid:s,messages:n,messagesCommon:l,messagesURIUtils:r,store:o}=this,{autoWidth:a,collapsed:d,description:h,flexGrow:m,fieldName:c,formatFunction:p,frozen:u,frozenToEnd:g,icon:b,iconText:f,invalid:y,label:T,labelTooltipText:w,menuConfig:C,relationshipId:I,resizable:v,textAlign:_,textWrap:E,timeZone:S,width:A}=t;return new B({autoWidth:a,collapsed:d,description:h,fieldName:`${le.relationship}-${I}-${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:C,messages:n,messagesCommon:l,messagesURIUtils:r,relationshipId:I,resizable:v,store:o,textAlign:_,textWrap:E,timeZone:S,width:A,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:n}=t,l=e.find(e=>e.relationshipId===n);l&&i.push(this._generateDefaultRelationshipColumn({config:t,index:s,info:l}))}):e.forEach((e,t)=>i.push(this._generateDefaultRelationshipColumn({index:t,info:e}))),i):i}_generateDefaultRelationshipColumn(e){const{config:t,hidden:i,index:s,info:n}=e,{grid:l,messages:r,messagesCommon:o,messagesURIUtils:a,store:d}=this,{relationshipId:h}=n;return new B({...t,fieldName:`${le.relationship}-${h}-${s}`,grid:l,hidden:i,messages:r,messagesCommon:o,messagesURIUtils:a,layer:n.relatedLayer,relatedLayer:n.layer,relationshipId:h,store:d,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateActionColumn(){const{actionColumnConfig:e,store:t}=this,i=this._isFieldHidden(le.action)&&!0!==e?.forceVisible;return new z({hidden:i,store:t,...e})}_isFieldHidden(e){const t=e?.toLowerCase();return(this.hiddenFields??this._defaultHiddenFields).some(e=>e.toLowerCase()===t)}async _syncTemporaryHighlight(e,t){if(!this.highlightEnabled)return this._currentTemporaryHighlight?.handle.remove(),void(this._currentTemporaryHighlight=null);if(await c(25),p(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:n,highlightEnabled:l}=this;e&&s&&n&&l&&(this._currentTemporaryHighlight={id:e,handle:s.highlight(e,{name:O})})}_syncSelection(){const{layer:e}=this;V(e)?this.highlightIds.items=this.effectiveSelectionManager.getSelection(e)??[]:this.highlightIds.removeAll()}_addToSelection(e){const t=this.layer;V(t)&&this.effectiveSelectionManager.add(t,e)}_removeFromSelection(e){const t=this.layer;V(t)&&this.effectiveSelectionManager.remove(t,e)}async _onHighlightIdsChange(e){const{added:t,removed:i}=e,{attachmentsViewOptions:s}=this;if(this._removeFromSelection(i),this._addToSelection(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"}),this.getFeatureTitle(e)}}}_syncTableParentSelection(e){const{tableParent:t}=this;t&&null!=e&&t.highlightIds.add(e)}_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(le.action)||s.add(le.action),s.includes(le.attachments)||s.add(le.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({multipleSelectionEnabledOverride:!1,relationshipColumnConfigs:[],showAllRelatedTables:!1,tableTemplateOverride:this._getTableTemplateForAttachmentsView(i)})}else e.set({multipleSelectionEnabledOverride:null,relationshipColumnConfigs:de(t,i.id),showAllRelatedTables:!1,tableTemplateOverride:null}),e.hiddenFields.removeMany([le.action,le.attachments])}_getTableTemplateForRelatedTableView(e,t,i){return new ee({columnTemplates:[new X({fieldName:t,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map(([s,n])=>({selected:s===t,label:n||s,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForRelatedTableView(e,s,i)}}))},resizable:!1}),new Y({autoWidth:!1,collapsed:!0,flexGrow:0,label:"",resizable:!1,relationshipId:i,width:pe})]})}_getTableTemplateForShowAllTablesView(e,t){const i=[new X({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 N({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:pe})),new ee({columnTemplates:i})}async _onShowPromptCallback(e){const{column:t,objectId:i,oldValue:s,value:n}=e,{_subtypes:l,layer:r}=this;if(!r||!l.length)return void t.cancel();const o=l.find(e=>e.code===n);if(!o)return void t.cancel();const a=Promise.withResolvers(),d=this._createSubtypeEditPrompt(s,o,a),h=!!r.parent&&this.autoSaveEnabled;try{this.showPrompt(d);const e=await a.promise,s=[{fieldName:t.fieldName,value:n}];switch(e){case"update-fields":for(const[e,t]of Object.entries(o.defaultValues))null!=t&&s.push({fieldName:e,value:t});await t.updateItems({objectId:i,updates:s}),h&&this.refresh();break;case"keep-existing":await t.updateItems({objectId:i,updates:s}),h&&this.refresh();break;case"undo":t.cancel()}}finally{this.clearPrompt()}}_createSubtypeEditPrompt(e,t,s){const{_subtypes:n,messages:l,messagesCommon:r}=this,o=n.find(t=>t.code===e)?.name??`${e}`;let a="update-fields";const d=[{label:l.subtypes.useDefaultValuesOption,value:"update-fields"},{label:l.subtypes.keepCurrentValuesOption,value:"keep-existing"}];return{context:"info",title:l.subtypes.changeWarningTitle,message:i(l.subtypes.changeWarning,{originalType:o,newType:t.name}),radios:d,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.hasPendingEdits||(this.attachmentsViewOptions.objectId=e)}_getTableTemplateForAttachmentsView(e){return new ee({columnTemplates:[new X({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 N({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:pe})]})}_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?a.getLogger(this).warnOnce(e):a.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([w()],ue.prototype,"_defaultHiddenFields",null),e([w()],ue.prototype,"_effectiveTableTemplate",null),e([w()],ue.prototype,"_effectiveAttributeTableTemplate",null),e([w()],ue.prototype,"_highlightableLayerView",null),e([w()],ue.prototype,"_subtypes",null),e([w()],ue.prototype,"activeFilters",null),e([w({readOnly:!0})],ue.prototype,"activeSortOrders",null),e([w()],ue.prototype,"allRelatedTablesVisible",null),e([w()],ue.prototype,"attachmentsColumns",null),e([w()],ue.prototype,"attachmentsEnabled",null),e([w()],ue.prototype,"attachmentsViewOptions",void 0),e([w({type:F})],ue.prototype,"attributeTableTemplate",void 0),e([w()],ue.prototype,"autoRefreshEnabled",void 0),e([w()],ue.prototype,"autoSaveEnabled",null),e([w()],ue.prototype,"canAddRelatedFeature",null),e([w()],ue.prototype,"clearPrompt",null),e([w({readOnly:!0})],ue.prototype,"columns",void 0),e([w()],ue.prototype,"dataProvider",void 0),e([w()],ue.prototype,"defaultSelectionManager",void 0),e([w()],ue.prototype,"definitionExpression",null),e([w()],ue.prototype,"effectiveSelectionManager",null),e([w()],ue.prototype,"fieldColumns",null),e([w()],ue.prototype,"filterByViewExtent",null),e([w({types:v})],ue.prototype,"filterGeometry",null),e([w()],ue.prototype,"filterBySelectionEnabled",null),e([w({readOnly:!0})],ue.prototype,"grid",void 0),e([w()],ue.prototype,"hasContingentValues",null),e([w()],ue.prototype,"hasInvalidPendingEdits",null),e([w()],ue.prototype,"hasPendingEdits",null),e([w()],ue.prototype,"hiddenFields",null),e([w()],ue.prototype,"highlightEnabled",void 0),e([w()],ue.prototype,"initialSize",null),e([w()],ue.prototype,"isQueryingOrSyncing",null),e([w()],ue.prototype,"isSyncingAttachments",null),e([w()],ue.prototype,"layer",null),e([w()],ue.prototype,"layers",void 0),e([w()],ue.prototype,"layerFieldConfigurations",null),e([w()],ue.prototype,"layerView",null),e([w()],ue.prototype,"menuConfig",void 0),e([w()],ue.prototype,"messages",void 0),e([w(),ce("esri/t9n/common")],ue.prototype,"messagesCommon",void 0),e([w(),ce("esri/core/t9n/Units")],ue.prototype,"messagesUnits",void 0),e([w(),ce("esri/widgets/support/t9n/uriUtils")],ue.prototype,"messagesURIUtils",void 0),e([w()],ue.prototype,"outFields",null),e([w()],ue.prototype,"pendingEditsCount",null),e([w()],ue.prototype,"prompt",void 0),e([w()],ue.prototype,"relatedRecordsEnabled",null),e([w()],ue.prototype,"relatedTable",null),e([w()],ue.prototype,"relatedTableHasContingentValues",null),e([w()],ue.prototype,"relatedTables",void 0),e([w()],ue.prototype,"relationship",null),e([w()],ue.prototype,"relationshipColumnConfigs",void 0),e([w()],ue.prototype,"relationshipColumns",null),e([w()],ue.prototype,"relationshipConfig",null),e([w()],ue.prototype,"relationshipInfos",null),e([w()],ue.prototype,"relationships",null),e([w()],ue.prototype,"returnGeometryEnabled",null),e([w()],ue.prototype,"returnMEnabled",null),e([w()],ue.prototype,"returnZEnabled",null),e([w()],ue.prototype,"selectionManager",void 0),e([w()],ue.prototype,"selectionSource",null),e([w()],ue.prototype,"showAllRelatedTables",null),e([w()],ue.prototype,"showPrompt",null),e([w()],ue.prototype,"showRelatedTableCallback",void 0),e([w({readOnly:!0,type:J})],ue.prototype,"store",void 0),e([w()],ue.prototype,"supportsAttachments",null),e([w()],ue.prototype,"supportsAddAttachments",null),e([w()],ue.prototype,"supportsDeleteAttachments",null),e([w()],ue.prototype,"supportsResizeAttachments",null),e([w()],ue.prototype,"supportsUpdateAttachments",null),e([w()],ue.prototype,"syncTemplateOnChangesEnabled",void 0),e([w()],ue.prototype,"syncViewSelection",void 0),e([w()],ue.prototype,"tableController",void 0),e([w()],ue.prototype,"tableParent",void 0),e([w({type:ee})],ue.prototype,"tableTemplate",void 0),e([w()],ue.prototype,"tableTemplateOverride",void 0),e([w({type:x})],ue.prototype,"timeExtent",null),e([w()],ue.prototype,"timeZone",null),e([w()],ue.prototype,"view",null),ue=e([C("esri.widgets.FeatureTable.FeatureTableViewModel")],ue);const ge=ue;export{ge as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{onLocaleChange as t,substitute as i,fetchMessageBundle as s}from"../../intl.js";import{isSome as n}from"../../core/arrayUtils.js";import l from"../../core/Collection.js";import{referenceSetter as r}from"../../core/collectionUtils.js";import o from"../../core/Error.js";import a from"../../core/Logger.js";import{abortMaybe as d}from"../../core/maybe.js";import{debounce as h,ignoreAbortErrors as m,after as c,throwIfAborted as p}from"../../core/promiseUtils.js";import{watch as u,initial as g,on as b,sync as f,syncAndInitial as y}from"../../core/reactiveUtils.js";import{throttle as T}from"../../core/throttle.js";import{property as w,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 _}from"../../layers/support/fieldUtils.js";import{getSubtypesFromLayer as E,isSubtypeGroupLayer as S}from"../../layers/support/layerUtils.js";import{createFieldInfos as A}from"../../support/popupUtils.js";import F from"../../tables/AttributeTableTemplate.js";import j from"../../tables/support/FieldOrder.js";import x from"../../time/TimeExtent.js";import R from"../../views/SelectionManager.js";import{temporaryHighlightName as O}from"../../views/support/HighlightDefaults.js";import{highlightsSupported as U}from"../../views/support/layerViewUtils.js";import{isSelectableLayerWithObjectIds as P,isSelectableLayer as V}from"../../views/support/selectionUtils.js";import z from"./ActionColumn.js";import W from"./AttachmentsColumn.js";import H from"./FieldColumn.js";import B from"./RelationshipColumn.js";import M from"./Grid/Column.js";import L from"./Grid/Grid.js";import G from"./Grid/GridViewModel.js";import k from"./Grid/GroupColumn.js";import N from"./support/AttachmentsColumnTemplate.js";import D from"./support/AttachmentsViewOptions.js";import{isAttachmentsColumn as $,isFieldColumn as Z,isRelationshipColumn as q}from"./support/columnUtils.js";import{downloadAttachmentInfo as Q,exportToCSV as K}from"./support/exportUtils.js";import J from"./support/FeatureStore.js";import X from"./support/FieldColumnTemplate.js";import Y from"./support/RelationshipColumnTemplate.js";import ee from"./support/TableTemplate.js";import{isIFeatureTableSupportedLayerWithFieldConfigurations as te,isIFeatureTableSupportedLayerWithRelationships as ie,findRelatedLayerInSources as se,findRelationship as ne,uniqueColumnNames as le,hasColumnForField as re,findField as oe,isIFeatureTableSupportedLayerWithAttachments as ae,getRelationshipIdsToShow as de}from"./support/tableUtils.js";import{createAttributeTableElements as he}from"./support/templateUtils.js";import{goTo as me}from"../support/goToUtils.js";import{messageBundle as ce}from"../support/widget.js";const pe="80px";let ue=class extends G{constructor(e){super(e),this._currentTemporaryHighlight=null,this._refreshDebounced=h(()=>this._refresh()),this._syncTemplateThrottled=T(()=>this._syncAttributeTableTemplate()),this._temporaryHighlightAbortController=null,this.attachmentsViewOptions=new D,this.attributeTableTemplate=null,this.autoRefreshEnabled=!0,this.columns=new l,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:n}=this;if(this.filterBySelectionEnabled&&!this.highlightIds.length||1===n.length&&-1===n.items[0])return void t([]);"loaded"!==s.state&&"loading"!==s.state&&await s.load();const l=this.paginationEnabled?this.pageIndex:e.page,r=await s.fetchItems({...e,page:l});t&&t(r)},this.defaultSelectionManager=new R,this.grid=null,this.highlightEnabled=!0,this.layers=null,this.menuConfig=null,this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this.messagesURIUtils=null,this.prompt=null,this.relatedTables=new l,this.relationshipColumnConfigs=null,this.selectionManager=null,this.showRelatedTableCallback=null,this.store=null,this.syncTemplateOnChangesEnabled=!0,this.syncViewSelection=!1,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 J),this._set("grid",new L({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()}),u(()=>[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()},g),u(()=>this.attachmentsEnabled,()=>this.layer?.loaded&&this._generateColumns()),u(()=>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(()=>{})),this.syncViewSelection&&this._syncSelection(),t&&null!=this.attachmentsViewOptions.objectId&&(this.attachmentsViewOptions.objectId=null)}),u(()=>this.layer?.loaded,e=>e&&this._onLayerLoad()),u(()=>this.store.state,e=>{"loaded"===e&&(this.scrollToTop(),this.refreshCellContent())}),u(()=>this._effectiveTableTemplate,()=>{this.scrollLeft(),this.layer?.loaded&&this._generateColumns()}),u(()=>this.editingEnabled,()=>this.refreshCellContent()),u(()=>this.timeZone??this.view?.timeZone,()=>this.refreshCellContent()),u(()=>this.store.effectiveWhere,()=>"loaded"===this.store.state&&this.reset()),u(()=>this.layer?.timeExtent,(e,t)=>(e||t)&&!this.timeExtent&&"loaded"===this.store.state&&this.reset()),b(()=>this.layer,"refresh",e=>this._onLayerRefresh(e)),b(()=>this.grid,["cell-click","cell-dblclick","cell-pointerover","cell-pointerout","cell-keydown","column-reorder"],({index:e,item:t,native:i,path:s,type:n})=>{const l=t?.feature,r=l?.getObjectId(),o="cell-keydown"===n&&i&&i instanceof KeyboardEvent&&"Enter"===i.key;this.emit(n,{feature:l,index:e,native:i,type:n,fieldName:s??void 0,objectId:r}),(o||"cell-click"===n)&&this._onCellInteraction(r)}),u(()=>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())}),u(()=>this.relatedRecordsEnabled,()=>this.layer?.loaded&&this._generateColumns()),b(()=>this.objectIds,"change",()=>this._onObjectIdsChange(),{onListenerAdd:()=>this._onObjectIdsChange()}),u(()=>[this.paginationEnabled,this.pageIndex],()=>this.refreshPageCache()),u(()=>this.activeSortOrders,e=>{this.store.sortOrders=e,this._syncTemplateThrottled()}),u(()=>this.allVisibleColumns,()=>this._syncTemplateThrottled()),u(()=>this.pageCount,()=>{this.pageIndex>=this.pageCount&&this.goToPage(0)}),u(()=>this.state,e=>{"disabled"===e&&this.relatedTables.length&&this.drainRelatedTables()}),b(()=>this.tableParent?.highlightIds,"change",({added:e})=>{const{relationshipConfig:t}=this,i=e[0];if(null==i||!t)return;const{relatedLayer:s,relationshipId:n}=t;this.relationshipConfig={objectId:i,relatedLayer:s,relationshipId:n}}),b(()=>this.tableParent,"cell-click",async e=>{const{objectId:t}=e;this.tableController&&this.hasPendingEdits?await this.tableController.discardPendingEdits(void 0,!0).then(e=>e&&this._syncTableParentSelection(t)):this._syncTableParentSelection(t)}),u(()=>this.attachmentsViewOptions.objectId,(e,t)=>{null!=e?null==t&&this.showAttachmentsView({objectId:e}):this.hideAttachmentsView()}),u(()=>[this.layerFieldConfigurations,this.pendingEditsCount],()=>this.refreshCellContent()),b(()=>this.highlightIds,"change",e=>this._onHighlightIdsChange(e),{onListenerAdd:()=>this._syncSelection(),onListenerRemove:()=>this.defaultSelectionManager.clear()}),u(()=>this.grid?.temporaryHighlightId,e=>{this._temporaryHighlightAbortController?.abort(),this._temporaryHighlightAbortController=new AbortController;const t=this._syncTemporaryHighlight(e,this._temporaryHighlightAbortController.signal);m(this.view?.addUpdatingPromise(t)??t)},f),u(()=>this.effectiveSelectionManager,()=>this._syncSelection(),y),b(()=>this.effectiveSelectionManager,"selection-change",()=>this._syncSelection(),y),u(()=>[this.layer,this.view],()=>this.syncSelectionSources(),y),u(()=>this.highlightEnabled,e=>this.defaultSelectionManager.highlightEnabled=e,g)])}destroy(){this._drainColumns(),this._currentTemporaryHighlight?.handle.remove(),this._temporaryHighlightAbortController=d(this._temporaryHighlightAbortController),this.defaultSelectionManager.destroy(),this.grid?.destroy(),this.columns.destroyed||this.columns.destroy(),this.layer=null,this.view=null}get _defaultHiddenFields(){return _(this.layer)}get _effectiveTableTemplate(){return this.tableTemplateOverride||this.tableTemplate}get _effectiveAttributeTableTemplate(){return this.attributeTableTemplate||this.layer?.attributeTableTemplate}get _highlightableLayerView(){const e=this.layerView;return U(e)?e:null}get _subtypes(){return E(this.layer)}get actionColumn(){return super.actionColumn}get activeFilters(){const{filterGeometry:e,objectIds:t,filterBySelectionEnabled:i,highlightIds:s}=this,n=new l;return e&&n.push({type:"geometry",geometry:e}),i?n.push({type:"selection",objectIds:s.toArray()}):t.length&&n.push({type:"objectId",objectIds:t.toArray()}),n}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 autoSaveEnabled(){return this.store.autoSaveEnabled}set autoSaveEnabled(e){this.store.autoSaveEnabled=e}get canAddRelatedFeature(){return this.store.canAddRelatedFeature}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 effectiveSelectionManager(){const{layer:e,view:t}=this;return e&&this.syncViewSelection&&P(e)&&t?.selectionManager?.sources.includes(e)?t.selectionManager:this.selectionManager??this.defaultSelectionManager}get effectiveMultipleSelectionEnabled(){return super.effectiveMultipleSelectionEnabled}get effectiveSize(){return super.effectiveSize}get fieldColumns(){return this.allColumns.filter(e=>Z(e))}get filterByViewExtent(){return this.store.filterByViewExtent}set filterByViewExtent(e){this.store.filterByViewExtent=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 hasContingentValues(){return this.relatedTableHasContingentValues||this.store.hasContingentValues}get hasInvalidPendingEdits(){return this.relatedTableHasInvalidPendingEdits||this.store.hasInvalidPendingEdits}get hasPendingEdits(){return this.relatedTableHasPendingEdits||this.store.hasPendingEdits}get hiddenFields(){return this._get("hiddenFields")??new l}set hiddenFields(e){this._set("hiddenFields",r(e,this._get("hiddenFields"),l))}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.drainRelatedTables(),this._set("layer",e)}get layerFieldConfigurations(){const e=this.layer;return te(e)?e.fieldConfigurations:void 0}get layerView(){return this.store.layerView}get maxSize(){return super.maxSize}set maxSize(e){super.maxSize=e}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 paginationEnabled(){return super.paginationEnabled}set paginationEnabled(e){super.paginationEnabled=e}get pendingEditsCount(){return this.store.pendingEditsCount}get relatedRecordsEnabled(){return this.store.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.store.relatedRecordsEnabled=e}get relatedTable(){return this.relatedTables.at(-1)}get relatedTableHasContingentValues(){return!!this.relatedTable?.hasContingentValues}get relatedTableHasInvalidPendingEdits(){return!!this.relatedTable?.hasInvalidPendingEdits}get relatedTableHasPendingEdits(){return!!this.relatedTable?.hasPendingEdits}get relationship(){return this.store.relationship}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,n=this.store.relationshipInfos;if(n.length||!ie(e)||!i?.length)return n;const l=[],r=s?.layers||t||[];return i.forEach(t=>{const i=se(e,r,t);i&&(i.load(),l.push({layer:e,relatedLayer:i,relationshipId:t.id}))}),l}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 selectionSource(){return"table"}set selectionSource(e){this.syncViewSelection="view"===e,this._overrideIfSome("selectionSource",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,n=i.objectId===e;await s.addAttachment(e,t).catch(e=>{n&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to add attachment. ${e.error.name} ${e.error.message}`),i.error=e.error)}),n&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}addPendingEdits(e){this.store.addPendingEdits(e)}collapseRelatedTable(e,t){const{relatedLayer:i,objectId:s,relationshipId:n}=t,{objectIdField:r}=i,o=ne(i,n),a=i.displayField||o?.keyField||r;e.set({highlightIds:new l([s]),multipleSelectionEnabledOverride:!1,tableTemplateOverride:this._getTableTemplateForRelatedTableView(e,a,n)});const d=e.hiddenFields;d.includes(le.action)||d.add(le.action),d.includes(le.attachments)||d.add(le.attachments),e.scrollLeft()}async deleteAttachments(e,t){const{attachmentsViewOptions:i,store:s}=this,n=i.objectId===e;await s.deleteAttachments(e,t).catch(e=>{n&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to delete attachment(s). ${e.error.name} ${e.error.message}`),i.error=e.error)}),n&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}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 discardPendingEdits(e){return this.relatedTable&&this.relatedTableHasPendingEdits?this.relatedTable.discardPendingEdits(e):(this.store.discardPendingEdits(e),!0)}async downloadAttachmentById(e,t){const i=(await this.store.getAttachmentsByObjectId(e,!0)).find(e=>e.id===t);await Q(i)}drainRelatedTables(){this.relatedTables.drain(e=>e.destroy()),this.set({multipleSelectionEnabledOverride:null,relationshipColumnConfigs:null,showAllRelatedTables:!1,tableTemplateOverride:null}),this.hiddenFields.removeMany([le.action,le.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 K({layer:i,objectIds:t.toArray(),outFields:s,includeGeometry:e}):this._logWarning("Export failed.")}getFeatureStoreItemByObjectId(e){return this.store.getItemByObjectId(e)}async getFeatureTitle(e,t){return this.store.getFeatureTitle(e,t)}getFeatureTitleSync(e){const t=this.layer;if(!t)return`${e}`;const i=`${t.objectIdField}: ${e}`;return null==e?i:this.store.featureTitleMap.get(e)??i}getObjectIdIndex(e){return this.store.getItemIndexByObjectId(e)}getValue(e,t){const i=this.getFeatureStoreItemByObjectId(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,multipleSelectionEnabledOverride:null,tableTemplateOverride:null}),this.hiddenFields.remove(le.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()),m(this._refreshDebounced())])}refreshCellContent(){this.grid?.requestContentUpdate()}refreshPageCache(){this.grid?.refreshPageCache()}async reset(){this.goToPage(0),await(this.grid?.reset())}async savePendingEdits(){!this.relatedTableHasPendingEdits||this.relatedTableHasInvalidPendingEdits?this.hasPendingEdits&&!this.relatedTable&&(await this.store.savePendingEdits(),await this.refresh()):await(this.relatedTable?.savePendingEdits())}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 n=this._getDefaultLayerDisplayField(s),r=await this.store.getAttachmentsByObjectId(e,!0),o=this.store.getItemIndexByObjectId(e);t.set({attachmentInfos:r,mode:r.length?"list":"file",objectId:e}),this.set({highlightIds:new l([e]),multipleSelectionEnabledOverride:!1,relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForAttachmentsView(n)}),i.includes(le.action)||i.add(le.action),null!=o&&this.scrollToIndex(o)}syncAttributeTableTemplate(){this._syncAttributeTableTemplate(!0)}syncSelectionSources(){const{defaultSelectionManager:e,layer:t,view:i}=this;e.view=i,e.sources.removeAll(),t&&V(t)&&(e.sources.items=[t])}async updateAttachment(e,t,i){const{attachmentsViewOptions:s,store:n}=this,l=s.objectId===e;await n.updateAttachment(e,t,i).catch(e=>{l&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to update attachment. ${e.error.name} ${e.error.message}`),s.error=e.error)}),l&&!s.error&&(s.onEditComplete(),s.attachmentInfos=await n.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 n=await e.queryFeatures(s);try{await me(t,n.features)}catch(l){"AbortError"!==l.name&&console.error(l)}}_syncAttributeTableTemplate(e=!1){const{_effectiveAttributeTableTemplate:t,layer:i,tableTemplateOverride:s,syncTemplateOnChangesEnabled:n}=this;if(!i||!t||!n&&!e||s||this.tableParent||this.relatedTable||null!==this.attachmentsViewOptions.objectId)return;const{activeSortOrders:l,allColumns:r,columns:o}=this,a=[],d=he(o.toArray());l.forEach(({fieldName:e,direction:t})=>{e&&t&&a.push(new j({field:e,order:t}))}),r.forEach(({fieldName:e,direction:t})=>{t&&!a.some(t=>t.field===e)&&a.push(new j({field:e,order:t}))}),t.elements=d,t.orderByFields=a}async _refresh(){await super.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,n=s?i:t;s&&(this._logWarning("The value for 'pageSize' has been adjusted due to the provided layer's max record count."),this.pageSize=n),this.grid?.set("pageSize",n),this.store.load(),this._generateColumns()}_onLayerRefresh(e){this.autoRefreshEnabled&&e.dataChanged&&this.refresh()}_generateColumns(){this._drainColumns();const{_effectiveTableTemplate:e,_effectiveAttributeTableTemplate:t,layer:i}=this,s=e?.columnTemplates;if(!i)return;const n=this._generateColumnsFromColumnTemplates(i,s)??this._generateColumnsFromAttributeTableTemplate(i,t)??this._generateDefaultFieldColumns(i);n.length&&(this.attachmentsEnabled&&!n.some(e=>$(e))&&n.push(this._generateDefaultAttachmentsColumn(i)),this.relatedRecordsEnabled&&this.relationshipInfos.length&&!n.some(e=>q(e))&&n.push(...this._generateDefaultRelationshipColumns()),this.actionColumnConfig&&n.push(this._generateActionColumn()),n.sort((e,t)=>e.frozen&&t.frozen||e.frozenToEnd&&t.frozenToEnd?0:e.frozen||t.frozenToEnd?-1:0),this.columns.addMany(n))}_generateColumnsFromAttributeTableTemplate(e,t){if(!t)return null;const{elements:i,orderByFields:s}=t,l=A(e),r=[];r.push(...this._generateColumnsFromAttributeTableElements(e,i,s));const o=l.map(t=>{if(!t.fieldName||re(t.fieldName,r))return null;const{fieldName:i}=t,n=oe(e,i);return n?this._generateDefaultFieldColumn(e,n,{hidden:!0,orderByFields:s}):(this._logTemplateWarning("A valid 'field' could not be found for the provided template."),null)}).filter(n);return r.push(...o),this.attachmentsEnabled&&ae(e)&&!r.some(e=>$(e))&&r.push(this._generateDefaultAttachmentsColumn(e,{hidden:!0})),this.relatedRecordsEnabled&&ie(e)&&e.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,i){return t?.map((t,s)=>{switch(t.type){case"field":return this._createFieldColumnFromElement({layer:e,element:t,orderByFields:i});case"group":return this._createGroupColumnFromElement({layer:e,element:t,orderByFields:i});case"attachment":return this._createAttachmentColumnFromElement({layer:e,element:t,index:s});case"relationship":return this._createRelationshipColumnFromElement({element:t,index:s})}}).filter(e=>!!e)??[]}_createFieldColumnFromElement(e){const{layer:t,element:i,orderByFields:s}=e,{fieldName:n}=i;if(null==n)return this._logTemplateWarning("A valid 'fieldName' must be provided."),null;const l=oe(t,n);if(!l)return this._logTemplateWarning("A valid 'field' could not be found for the provided template."),null;const{description:r,label:o}=i,a=s?.findIndex(({field:e})=>e&&e===n)??-1,d=a>-1?s?.at(a)?.order:void 0,h=a>-1?a:void 0,{grid:m,messages:c,messagesCommon:p,messagesURIUtils:u,store:g,view:b}=this;return new H({description:r,direction:d,field:l,fieldName:n,grid:m,initialSortPriority:h,label:o,layer:t,messages:c,messagesCommon:p,messagesURIUtils:u,store:g,view:b,onShowPromptCallback:this._onShowPromptCallback})}_createGroupColumnFromElement(e){const{layer:t,element:i,orderByFields:s}=e,{description:n,label:l}=i;if(!l)return this._logTemplateWarning("Group columns require a label."),null;if(!i.elements.length)return this._logTemplateWarning("Group columns require child columns."),null;const{grid:r,messages:o,messagesCommon:a,messagesURIUtils:d,store:h}=this;return new k({columns:this._generateColumnsFromAttributeTableElements(t,i.elements,s),description:n,grid:r,label:l,messages:o,messagesCommon:a,messagesURIUtils:d,store:h})}_createAttachmentColumnFromElement(e){if(!this.attachmentsEnabled)return void this._logTemplateWarning("The 'attachmentsEnabled' property is currently false.");const{layer:t,element:i,index:s}=e,{description:n,label:l}=i,{grid:r,messages:o,messagesCommon:a,messagesURIUtils:d,store:h}=this;return new W({description:n,fieldName:`${le.attachments}-${s}`,grid:r,label:l,layer:t,messages:o,messagesCommon:a,messagesURIUtils:d,store:h,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:n,relationshipId:l}=t,r=this.relationshipInfos.find(e=>e.relationshipId===l);if(!r)return this._logTemplateWarning("Unable to find valid related layer target based on the provided relationship id."),null;const{grid:o,messages:a,messagesCommon:d,messagesURIUtils:h,store:m}=this;return new B({description:s,fieldName:`${le.relationship}-${l}-${i}`,grid:o,label:n,messages:a,messagesCommon:d,messagesURIUtils:h,relationshipId:l,store:m,layer:r.relatedLayer,relatedLayer:r.layer,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateColumnsFromColumnTemplates(e,t){const{grid:i,messages:s,messagesCommon:n,messagesURIUtils:l,store:r,view:o}=this;if(!t?.length)return null;const a=[];return t.forEach((t,d)=>{const{autoWidth:h,description:m,direction:c,flexGrow:p,fieldName:u,formatFunction:g,frozen:b,frozenToEnd:f,icon:y,iconText:T,initialSortPriority:w,invalid:C,label:I,labelTooltipText:v,menuConfig:_,resizable:E,sortable:S,textAlign:A,textWrap:F,timeZone:j,type:x,width:R}=t;if(!x)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 O=!1===t.visible;if("group"===x){if(!t.columnTemplates?.length)return void this._logTemplateWarning("Group columns must contain column templates.");if(!t.label)return void this._logTemplateWarning("Group columns require a label.");const r=this._generateColumnsFromColumnTemplates(e,t.columnTemplates),o=O||this._isFieldHidden(t.label);a.push(new k({autoWidth:h,columns:r,description:m,flexGrow:p,frozen:b,frozenToEnd:f,grid:i,hidden:o,icon:y,iconText:T,invalid:C,label:I,labelTooltipText:v,menuConfig:_,messages:s,messagesCommon:n,messagesURIUtils:l,resizable:E,textAlign:A,textWrap:F,timeZone:j,width:R}))}else if("attachment"===x){if(!this.attachmentsEnabled)return void this._logTemplateWarning("Attachment columns require attachments to be enabled on the table.");a.push(this._generateAttachmentsColumnFromTemplate(e,t,d))}else if("relationship"===x){if(!this.relatedRecordsEnabled)return void this._logTemplateWarning("Relationship columns require related records to be enabled on the table.");const{relationshipId:e}=t;if(null==e)return void this._logTemplateWarning("Property 'relationshipId' is missing from the provided template.");const i=this.relationshipInfos.find(t=>t.relationshipId===e);if(!i)return void this._logTemplateWarning("Unable to find valid related layer target based on the provided relationship id.");a.push(this._generateRelationshipColumnFromTemplate(i,t,d))}else if(!u)return void this._logTemplateWarning("Value for 'fieldName' property was missing from the provided template.");const U=O||this._isFieldHidden(u);if("column"===x)a.push(new M({autoWidth:h,description:m,direction:c,fieldName:u,flexGrow:p,formatFunction:g,frozen:b,frozenToEnd:f,grid:i,hidden:U,icon:y,iconText:T,initialSortPriority:w,invalid:C,label:I,labelTooltipText:v,menuConfig:_,messages:s,messagesCommon:n,messagesURIUtils:l,resizable:E,sortable:S,store:r,textAlign:A,textWrap:F,timeZone:j,width:R}));else if("field"===x){const d=oe(e,t.fieldName);if(!d)return void this._logTemplateWarning("A valid 'field' could not be found for the provided template.");const{editable:u,required:x}=t;a.push(new H({autoWidth:h,description:m,direction:c,editable:u,field:d,fieldName:d.name,flexGrow:p,formatFunction:g,frozen:b,frozenToEnd:f,grid:i,hidden:U,icon:y,iconText:T,initialSortPriority:w,invalid:C,label:I,labelTooltipText:v,layer:e,messages:s,messagesCommon:n,messagesURIUtils:l,menuConfig:_,required:x,resizable:E,sortable:S,store:r,template:t,textAlign:A,textWrap:F,timeZone:j,width:R,view:o,onShowPromptCallback:this._onShowPromptCallback}))}}),a.length?a:null}_generateDefaultFieldColumns(e){return e.fields?.map(t=>this._generateDefaultFieldColumn(e,t)).filter(n)??[]}_generateDefaultFieldColumn(e,t,i){const{grid:s,messages:n,messagesCommon:l,messagesURIUtils:r,store:o,view:a}=this;if(!t.visible||"geometry"===t.type)return null;const d=i?.orderByFields,h=t.name,m=d?.findIndex(({field:e})=>e&&e===h)??-1,c=m>-1?d?.at(m)?.order:void 0,p=m>-1?m:void 0;return new H({direction:c,field:t,fieldName:h,grid:s,hidden:i?.hidden||this._isFieldHidden(h),initialSortPriority:p,layer:e,messages:n,messagesCommon:l,messagesURIUtils:r,store:o,view:a,onShowPromptCallback:this._onShowPromptCallback})}_generateAttachmentsColumnFromTemplate(e,t,i){const{grid:s,messages:n,messagesCommon:l,messagesURIUtils:r,store:o}=this,{attachmentsViewEnabled:a,autoWidth:d,description:h,flexGrow:m,fieldName:c,formatFunction:p,frozen:u,frozenToEnd:g,icon:b,iconText:f,invalid:y,label:T,labelTooltipText:w,menuConfig:C,resizable:I,textAlign:v,textWrap:_,thumbnailAppearance:E,thumbnailCount:S,thumbnailIconScale:A,thumbnailsEnabled:F,timeZone:j,width:x}=t;return new W({attachmentsViewEnabled:a,autoWidth:d,description:h,fieldName:`${le.attachments}-${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,layer:e,menuConfig:C,messages:n,messagesCommon:l,messagesURIUtils:r,resizable:I,store:o,textAlign:v,textWrap:_,thumbnailAppearance:E,thumbnailCount:S,thumbnailIconScale:A,thumbnailsEnabled:F,timeZone:j,width:x,onShowAttachments:e=>this._onShowAttachments(e)})}_generateDefaultAttachmentsColumn(e,t){const{grid:i,messages:s,messagesCommon:n,messagesURIUtils:l,store:r}=this,o=le.attachments;return new W({fieldName:o,grid:i,hidden:t?.hidden||this._isFieldHidden(o),layer:e,messages:s,messagesCommon:n,messagesURIUtils:l,store:r,onShowAttachments:e=>this._onShowAttachments(e)})}_generateRelationshipColumnFromTemplate(e,t,i){const{grid:s,messages:n,messagesCommon:l,messagesURIUtils:r,store:o}=this,{autoWidth:a,collapsed:d,description:h,flexGrow:m,fieldName:c,formatFunction:p,frozen:u,frozenToEnd:g,icon:b,iconText:f,invalid:y,label:T,labelTooltipText:w,menuConfig:C,relationshipId:I,resizable:v,textAlign:_,textWrap:E,timeZone:S,width:A}=t;return new B({autoWidth:a,collapsed:d,description:h,fieldName:`${le.relationship}-${I}-${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:C,messages:n,messagesCommon:l,messagesURIUtils:r,relationshipId:I,resizable:v,store:o,textAlign:_,textWrap:E,timeZone:S,width:A,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:n}=t,l=e.find(e=>e.relationshipId===n);l&&i.push(this._generateDefaultRelationshipColumn({config:t,index:s,info:l}))}):e.forEach((e,t)=>i.push(this._generateDefaultRelationshipColumn({index:t,info:e}))),i):i}_generateDefaultRelationshipColumn(e){const{config:t,hidden:i,index:s,info:n}=e,{grid:l,messages:r,messagesCommon:o,messagesURIUtils:a,store:d}=this,{relationshipId:h}=n;return new B({...t,fieldName:`${le.relationship}-${h}-${s}`,grid:l,hidden:i,messages:r,messagesCommon:o,messagesURIUtils:a,layer:n.relatedLayer,relatedLayer:n.layer,relationshipId:h,store:d,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateActionColumn(){return new z({hidden:this._isFieldHidden(le.action),store:this.store,...this.actionColumnConfig})}_isFieldHidden(e){const t=e?.toLowerCase();return(this.hiddenFields??this._defaultHiddenFields).some(e=>e.toLowerCase()===t)}async _syncTemporaryHighlight(e,t){if(!this.highlightEnabled)return this._currentTemporaryHighlight?.handle.remove(),void(this._currentTemporaryHighlight=null);if(await c(25),p(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:n,highlightEnabled:l}=this;e&&s&&n&&l&&(this._currentTemporaryHighlight={id:e,handle:s.highlight(e,{name:O})})}_syncSelection(){const{layer:e}=this;P(e)?this.highlightIds.items=this.effectiveSelectionManager.getSelection(e)??[]:this.highlightIds.removeAll()}_addToSelection(e){const t=this.layer;P(t)&&this.effectiveSelectionManager.add(t,e)}_removeFromSelection(e){const t=this.layer;P(t)&&this.effectiveSelectionManager.remove(t,e)}async _onHighlightIdsChange(e){const{added:t,removed:i}=e,{attachmentsViewOptions:s}=this;if(this._removeFromSelection(i),this._addToSelection(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"}),this.getFeatureTitle(e)}}}_syncTableParentSelection(e){const{tableParent:t}=this;t&&null!=e&&t.highlightIds.add(e)}_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(le.action)||s.add(le.action),s.includes(le.attachments)||s.add(le.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({multipleSelectionEnabledOverride:!1,relationshipColumnConfigs:[],showAllRelatedTables:!1,tableTemplateOverride:this._getTableTemplateForAttachmentsView(i)})}else e.set({multipleSelectionEnabledOverride:null,relationshipColumnConfigs:de(t,i.id),showAllRelatedTables:!1,tableTemplateOverride:null}),e.hiddenFields.removeMany([le.action,le.attachments])}_getTableTemplateForRelatedTableView(e,t,i){return new ee({columnTemplates:[new X({fieldName:t,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map(([s,n])=>({selected:s===t,label:n||s,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForRelatedTableView(e,s,i)}}))},resizable:!1}),new Y({autoWidth:!1,collapsed:!0,flexGrow:0,label:"",resizable:!1,relationshipId:i,width:pe})]})}_getTableTemplateForShowAllTablesView(e,t){const i=[new X({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 N({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:pe})),new ee({columnTemplates:i})}async _onShowPromptCallback(e){const{column:t,objectId:i,oldValue:s,value:n}=e,{_subtypes:l,layer:r}=this;if(!r||!l.length)return void t.cancel();const o=l.find(e=>e.code===n);if(!o)return void t.cancel();const a=Promise.withResolvers(),d=this._createSubtypeEditPrompt(s,o,a),h=!!r.parent&&this.autoSaveEnabled;try{this.showPrompt(d);const e=await a.promise,s=[{fieldName:t.fieldName,value:n}];switch(e){case"update-fields":for(const[e,t]of Object.entries(o.defaultValues))null!=t&&s.push({fieldName:e,value:t});await t.updateItems({objectId:i,updates:s}),h&&this.refresh();break;case"keep-existing":await t.updateItems({objectId:i,updates:s}),h&&this.refresh();break;case"undo":t.cancel()}}finally{this.clearPrompt()}}_createSubtypeEditPrompt(e,t,s){const{_subtypes:n,messages:l,messagesCommon:r}=this,o=n.find(t=>t.code===e)?.name??`${e}`;let a="update-fields";const d=[{label:l.subtypes.useDefaultValuesOption,value:"update-fields"},{label:l.subtypes.keepCurrentValuesOption,value:"keep-existing"}];return{context:"info",title:l.subtypes.changeWarningTitle,message:i(l.subtypes.changeWarning,{originalType:o,newType:t.name}),radios:d,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.hasPendingEdits||(this.attachmentsViewOptions.objectId=e)}_getTableTemplateForAttachmentsView(e){return new ee({columnTemplates:[new X({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 N({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:pe})]})}_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?a.getLogger(this).warnOnce(e):a.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([w()],ue.prototype,"_defaultHiddenFields",null),e([w()],ue.prototype,"_effectiveTableTemplate",null),e([w()],ue.prototype,"_effectiveAttributeTableTemplate",null),e([w()],ue.prototype,"_highlightableLayerView",null),e([w()],ue.prototype,"_subtypes",null),e([w()],ue.prototype,"activeFilters",null),e([w({readOnly:!0})],ue.prototype,"activeSortOrders",null),e([w()],ue.prototype,"allRelatedTablesVisible",null),e([w()],ue.prototype,"attachmentsColumns",null),e([w()],ue.prototype,"attachmentsEnabled",null),e([w()],ue.prototype,"attachmentsViewOptions",void 0),e([w({type:F})],ue.prototype,"attributeTableTemplate",void 0),e([w()],ue.prototype,"autoRefreshEnabled",void 0),e([w()],ue.prototype,"autoSaveEnabled",null),e([w()],ue.prototype,"canAddRelatedFeature",null),e([w()],ue.prototype,"clearPrompt",null),e([w({readOnly:!0})],ue.prototype,"columns",void 0),e([w()],ue.prototype,"dataProvider",void 0),e([w()],ue.prototype,"defaultSelectionManager",void 0),e([w()],ue.prototype,"definitionExpression",null),e([w()],ue.prototype,"effectiveSelectionManager",null),e([w()],ue.prototype,"fieldColumns",null),e([w()],ue.prototype,"filterByViewExtent",null),e([w({types:v})],ue.prototype,"filterGeometry",null),e([w()],ue.prototype,"filterBySelectionEnabled",null),e([w({readOnly:!0})],ue.prototype,"grid",void 0),e([w()],ue.prototype,"hasContingentValues",null),e([w()],ue.prototype,"hasInvalidPendingEdits",null),e([w()],ue.prototype,"hasPendingEdits",null),e([w()],ue.prototype,"hiddenFields",null),e([w()],ue.prototype,"highlightEnabled",void 0),e([w()],ue.prototype,"initialSize",null),e([w()],ue.prototype,"isQueryingOrSyncing",null),e([w()],ue.prototype,"isSyncingAttachments",null),e([w()],ue.prototype,"layer",null),e([w()],ue.prototype,"layers",void 0),e([w()],ue.prototype,"layerFieldConfigurations",null),e([w()],ue.prototype,"layerView",null),e([w()],ue.prototype,"menuConfig",void 0),e([w()],ue.prototype,"messages",void 0),e([w(),ce("esri/t9n/common")],ue.prototype,"messagesCommon",void 0),e([w(),ce("esri/core/t9n/Units")],ue.prototype,"messagesUnits",void 0),e([w(),ce("esri/widgets/support/t9n/uriUtils")],ue.prototype,"messagesURIUtils",void 0),e([w()],ue.prototype,"outFields",null),e([w()],ue.prototype,"pendingEditsCount",null),e([w()],ue.prototype,"prompt",void 0),e([w()],ue.prototype,"relatedRecordsEnabled",null),e([w()],ue.prototype,"relatedTable",null),e([w()],ue.prototype,"relatedTableHasContingentValues",null),e([w()],ue.prototype,"relatedTables",void 0),e([w()],ue.prototype,"relationship",null),e([w()],ue.prototype,"relationshipColumnConfigs",void 0),e([w()],ue.prototype,"relationshipColumns",null),e([w()],ue.prototype,"relationshipConfig",null),e([w()],ue.prototype,"relationshipInfos",null),e([w()],ue.prototype,"relationships",null),e([w()],ue.prototype,"returnGeometryEnabled",null),e([w()],ue.prototype,"returnMEnabled",null),e([w()],ue.prototype,"returnZEnabled",null),e([w()],ue.prototype,"selectionManager",void 0),e([w()],ue.prototype,"selectionSource",null),e([w()],ue.prototype,"showAllRelatedTables",null),e([w()],ue.prototype,"showPrompt",null),e([w()],ue.prototype,"showRelatedTableCallback",void 0),e([w({readOnly:!0,type:J})],ue.prototype,"store",void 0),e([w()],ue.prototype,"supportsAttachments",null),e([w()],ue.prototype,"supportsAddAttachments",null),e([w()],ue.prototype,"supportsDeleteAttachments",null),e([w()],ue.prototype,"supportsResizeAttachments",null),e([w()],ue.prototype,"supportsUpdateAttachments",null),e([w()],ue.prototype,"syncTemplateOnChangesEnabled",void 0),e([w()],ue.prototype,"syncViewSelection",void 0),e([w()],ue.prototype,"tableController",void 0),e([w()],ue.prototype,"tableParent",void 0),e([w({type:ee})],ue.prototype,"tableTemplate",void 0),e([w()],ue.prototype,"tableTemplateOverride",void 0),e([w({type:x})],ue.prototype,"timeExtent",null),e([w()],ue.prototype,"timeZone",null),e([w()],ue.prototype,"view",null),ue=e([C("esri.widgets.FeatureTable.FeatureTableViewModel")],ue);const ge=ue;export{ge as default};
|
|
@@ -5,7 +5,7 @@ import type { TimeZone } from "../../../time/types.js";
|
|
|
5
5
|
import type { TextAlign, ColumnTableMenuConfig, Direction } from "./types.js";
|
|
6
6
|
import type { FormatFunction } from "../support/types.js";
|
|
7
7
|
|
|
8
|
-
export interface ColumnProperties extends Partial<Pick<Column, "autoWidth" | "description" | "direction" | "flexGrow" | "
|
|
8
|
+
export interface ColumnProperties extends Partial<Pick<Column, "autoWidth" | "description" | "direction" | "flexGrow" | "hidden" | "icon" | "iconText" | "label" | "labelTooltipText" | "sortable" | "textAlign" | "textWrap" | "timeZone" | "topLayerDisabled" | "visibleElements" | "width">> {
|
|
9
9
|
/** The unique field name as defined by the data source. */
|
|
10
10
|
fieldName?: string;
|
|
11
11
|
/** Indicates the initial sort priority of the column when first rendered. */
|
|
@@ -66,12 +66,6 @@ export default class Column extends Accessor {
|
|
|
66
66
|
* using [fieldName](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/Grid/Column/#fieldName) if a [label](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/Grid/Column/#label) is not defined on the column.
|
|
67
67
|
*/
|
|
68
68
|
get effectiveLabel(): string;
|
|
69
|
-
/**
|
|
70
|
-
* Indicates whether the column is visible, accounting for both 'forceVisible' and 'hidden' properties.
|
|
71
|
-
*
|
|
72
|
-
* @since 5.1
|
|
73
|
-
*/
|
|
74
|
-
get effectiveVisible(): boolean;
|
|
75
69
|
/** The unique field name as defined by the data source. */
|
|
76
70
|
get fieldName(): string;
|
|
77
71
|
/**
|
|
@@ -80,15 +74,6 @@ export default class Column extends Accessor {
|
|
|
80
74
|
* @default 1
|
|
81
75
|
*/
|
|
82
76
|
accessor flexGrow: number;
|
|
83
|
-
/**
|
|
84
|
-
* Indicates this column should always be visible in the default table view.
|
|
85
|
-
* The column may still be hidden in a nested table view. This property takes priority over
|
|
86
|
-
* the 'hidden' property.
|
|
87
|
-
*
|
|
88
|
-
* @default false
|
|
89
|
-
* @since 5.1
|
|
90
|
-
*/
|
|
91
|
-
accessor forceVisible: boolean;
|
|
92
77
|
/**
|
|
93
78
|
* Custom function for rendering cell content that is called when the column is rendered in the table. The function should return the formatted content to display within a table's cell. This can be a string, number, an HTML element, or equivalent node type (e.g. a [Calcite component](https://developers.arcgis.com/calcite-design-system/components/)). If the content is an HTML element, it is appended to the root element. If the content is a string or number, it is set as the `innerHTML` of the root element. If the content is `null`, the root element is cleared. If the content is `undefined`, the root element is not modified. This property is useful when you want to customize the cell content. For example, you can use this property to create a custom cell renderer that displays a progress bar in the cell. The progress bar can be used to show the progress of a task.
|
|
94
79
|
*
|
|
@@ -117,7 +102,7 @@ export default class Column extends Accessor {
|
|
|
117
102
|
*/
|
|
118
103
|
get frozenToEnd(): boolean;
|
|
119
104
|
/**
|
|
120
|
-
* Indicates whether the column is
|
|
105
|
+
* Indicates whether the column is visible.
|
|
121
106
|
*
|
|
122
107
|
* @default false
|
|
123
108
|
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
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 h=/<br\s*\/*>/gi;let m=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.forceVisible=!1,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.topLayerDisabled=!1,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{effectiveVisible:e,direction:t,grid:i,sortElement:n}=this;!e&&t&&n&&i&&!i.hasSorter(n)&&i.addSorter(n)},o),i(()=>[this.timeZone,this.icon,this.iconText,this.labelTooltipText],()=>this.grid?.requestContentUpdate()),i(()=>this.effectiveVisible,()=>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({iconFlipRtl:"start",iconStart:"sort-ascending-arrow",textContent:e?.sortAsc,onclick:()=>this.direction="asc"});t.push(i)}if(!1!==i?.sortDescending){const i=this.createCalciteDropdownItem({iconFlipRtl:"start",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 effectiveVisible(){return this.forceVisible||!this.hidden}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??"",scale:"m",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 tableHasInvalidPendingEdits(){return this.store.hasInvalidPendingEdits}get tableHasPendingEdits(){return this.store.hasPendingEdits}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,className:n,disabled:o,icon:s,label:l,scale:r,slot:a,text:c,textEnabled:d,onclick:p}=e;return t.alignment=i??"center",t.className=n??"",t.disabled=!!o,s&&(t.icon=s),t.label=l??"",t.scale=r??"s",t.slot=a??"",t.text=t.title=c??"",t.textEnabled=!!d,t.onclick=p??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:h,width:m}=e;return t.alignment=i??"center",t.className=o??"",t.scale=p??"s",t.appearance=n??"transparent",t.disabled=!!s,l&&(t.iconEnd=l),r&&(t.iconFlipRtl=r),t.kind=a??"brand",t.loading=!!c,t.textContent=u??"",h&&(t.title=h),t.width=m??"auto",t.onclick=d??null,t}createCalciteDropdownItem(e){const t=document.createElement("calcite-dropdown-item"),{disabled:i,hidden:n,iconClass:o,iconFlipRtl:s,iconStart:l,textContent:r,onclick:a,selected:d}=e,p=r??"";if(o&&!l){const e=document.createElement("span"),i=document.createElement("span");i.classList.add(c.headerMenuIcon,o),e.textContent=e.title=p,e.insertBefore(i,e.firstChild),t.appendChild(e)}else l&&(t.iconStart=l),t.textContent=t.title=p;return t.disabled=!!i,t.hidden="function"==typeof n?n():!!n,t.selected=!!d,s&&(t.iconFlipRtl=s),a&&(t.addEventListener("calciteDropdownItemSelect",a),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}itemHasInvalidPendingEdits(e,t){return this.store.itemHasInvalidPendingEdits(e,t)}itemHasPendingEdits(e,t){return this.store.itemHasPendingEdits(e,t)}openMenu(){this.menuIsVisible&&(this.menu.open=!0,u(this.menuItems[0]))}removeCellContent(e){if(e?.firstChild)try{for(;e?.firstChild;)e.removeChild(e.firstChild)}catch(t){}}sanitizeContent(e){return s.sanitize(e)}sanitizeLabel(e){return null==e||""===e?"":l.sanitize(e.toString()).replaceAll(h," ")}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()],m.prototype,"_headerRequiresTextContainer",null),e([r()],m.prototype,"_menuIsOpen",void 0),e([r()],m.prototype,"autoWidth",void 0),e([r()],m.prototype,"cellValueFormatFunction",void 0),e([r()],m.prototype,"customMenuItems",null),e([r()],m.prototype,"defaultMenuItems",null),e([r()],m.prototype,"description",void 0),e([r()],m.prototype,"direction",void 0),e([r()],m.prototype,"effectiveDescription",null),e([r()],m.prototype,"effectiveLabel",null),e([r()],m.prototype,"effectiveSortable",null),e([r()],m.prototype,"effectiveVisible",null),e([r({constructOnly:!0})],m.prototype,"fieldName",void 0),e([r()],m.prototype,"flexGrow",void 0),e([r()],m.prototype,"footerRenderFunction",void 0),e([r()],m.prototype,"forceVisible",void 0),e([r()],m.prototype,"formatFunction",void 0),e([r()],m.prototype,"frozen",void 0),e([r()],m.prototype,"frozenToEnd",void 0),e([r()],m.prototype,"grid",void 0),e([r()],m.prototype,"headerRenderFunction",void 0),e([r()],m.prototype,"hidden",void 0),e([r()],m.prototype,"icon",void 0),e([r()],m.prototype,"iconNode",null),e([r()],m.prototype,"iconText",void 0),e([r({constructOnly:!0})],m.prototype,"initialSortPriority",void 0),e([r()],m.prototype,"invalid",null),e([r()],m.prototype,"label",void 0),e([r()],m.prototype,"labelTooltipText",void 0),e([r()],m.prototype,"menu",null),e([r()],m.prototype,"menuItems",null),e([r()],m.prototype,"menuConfig",void 0),e([r()],m.prototype,"menuIsOpen",null),e([r()],m.prototype,"menuIsVisible",null),e([r()],m.prototype,"messages",void 0),e([r()],m.prototype,"messagesCommon",void 0),e([r()],m.prototype,"messagesURIUtils",void 0),e([r()],m.prototype,"renderFunction",void 0),e([r()],m.prototype,"resizable",void 0),e([r()],m.prototype,"sortable",void 0),e([r({readOnly:!0})],m.prototype,"sortElement",void 0),e([r()],m.prototype,"store",void 0),e([r()],m.prototype,"tableHasInvalidPendingEdits",null),e([r()],m.prototype,"tableHasPendingEdits",null),e([r()],m.prototype,"tableTimeZone",null),e([r()],m.prototype,"textAlign",void 0),e([r()],m.prototype,"textWrap",void 0),e([r()],m.prototype,"timeZone",void 0),e([r()],m.prototype,"topLayerDisabled",void 0),e([r()],m.prototype,"visibleElements",void 0),e([r()],m.prototype,"width",void 0),m=e([a("esri.widgets.FeatureTable.Grid.Column")],m);const f=m;export{f as default};
|
|
2
|
+
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 h=/<br\s*\/*>/gi;let m=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.topLayerDisabled=!1,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({iconFlipRtl:"start",iconStart:"sort-ascending-arrow",textContent:e?.sortAsc,onclick:()=>this.direction="asc"});t.push(i)}if(!1!==i?.sortDescending){const i=this.createCalciteDropdownItem({iconFlipRtl:"start",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??"",scale:"m",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 tableHasInvalidPendingEdits(){return this.store.hasInvalidPendingEdits}get tableHasPendingEdits(){return this.store.hasPendingEdits}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,className:n,disabled:o,icon:s,label:l,scale:r,slot:a,text:c,textEnabled:d,onclick:p}=e;return t.alignment=i??"center",t.className=n??"",t.disabled=!!o,s&&(t.icon=s),t.label=l??"",t.scale=r??"s",t.slot=a??"",t.text=t.title=c??"",t.textEnabled=!!d,t.onclick=p??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:h,width:m}=e;return t.alignment=i??"center",t.className=o??"",t.scale=p??"s",t.appearance=n??"transparent",t.disabled=!!s,l&&(t.iconEnd=l),r&&(t.iconFlipRtl=r),t.kind=a??"brand",t.loading=!!c,t.textContent=u??"",h&&(t.title=h),t.width=m??"auto",t.onclick=d??null,t}createCalciteDropdownItem(e){const t=document.createElement("calcite-dropdown-item"),{disabled:i,hidden:n,iconClass:o,iconFlipRtl:s,iconStart:l,textContent:r,onclick:a,selected:d}=e,p=r??"";if(o&&!l){const e=document.createElement("span"),i=document.createElement("span");i.classList.add(c.headerMenuIcon,o),e.textContent=e.title=p,e.insertBefore(i,e.firstChild),t.appendChild(e)}else l&&(t.iconStart=l),t.textContent=t.title=p;return t.disabled=!!i,t.hidden="function"==typeof n?n():!!n,t.selected=!!d,s&&(t.iconFlipRtl=s),a&&(t.addEventListener("calciteDropdownItemSelect",a),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}itemHasInvalidPendingEdits(e,t){return this.store.itemHasInvalidPendingEdits(e,t)}itemHasPendingEdits(e,t){return this.store.itemHasPendingEdits(e,t)}openMenu(){this.menuIsVisible&&(this.menu.open=!0,u(this.menuItems[0]))}removeCellContent(e){if(e?.firstChild)try{for(;e?.firstChild;)e.removeChild(e.firstChild)}catch(t){}}sanitizeContent(e){return s.sanitize(e)}sanitizeLabel(e){return null==e||""===e?"":l.sanitize(e.toString()).replaceAll(h," ")}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()],m.prototype,"_headerRequiresTextContainer",null),e([r()],m.prototype,"_menuIsOpen",void 0),e([r()],m.prototype,"autoWidth",void 0),e([r()],m.prototype,"cellValueFormatFunction",void 0),e([r()],m.prototype,"customMenuItems",null),e([r()],m.prototype,"defaultMenuItems",null),e([r()],m.prototype,"description",void 0),e([r()],m.prototype,"direction",void 0),e([r()],m.prototype,"effectiveDescription",null),e([r()],m.prototype,"effectiveLabel",null),e([r()],m.prototype,"effectiveSortable",null),e([r({constructOnly:!0})],m.prototype,"fieldName",void 0),e([r()],m.prototype,"flexGrow",void 0),e([r()],m.prototype,"footerRenderFunction",void 0),e([r()],m.prototype,"formatFunction",void 0),e([r()],m.prototype,"frozen",void 0),e([r()],m.prototype,"frozenToEnd",void 0),e([r()],m.prototype,"grid",void 0),e([r()],m.prototype,"headerRenderFunction",void 0),e([r()],m.prototype,"hidden",void 0),e([r()],m.prototype,"icon",void 0),e([r()],m.prototype,"iconNode",null),e([r()],m.prototype,"iconText",void 0),e([r({constructOnly:!0})],m.prototype,"initialSortPriority",void 0),e([r()],m.prototype,"invalid",null),e([r()],m.prototype,"label",void 0),e([r()],m.prototype,"labelTooltipText",void 0),e([r()],m.prototype,"menu",null),e([r()],m.prototype,"menuItems",null),e([r()],m.prototype,"menuConfig",void 0),e([r()],m.prototype,"menuIsOpen",null),e([r()],m.prototype,"menuIsVisible",null),e([r()],m.prototype,"messages",void 0),e([r()],m.prototype,"messagesCommon",void 0),e([r()],m.prototype,"messagesURIUtils",void 0),e([r()],m.prototype,"renderFunction",void 0),e([r()],m.prototype,"resizable",void 0),e([r()],m.prototype,"sortable",void 0),e([r({readOnly:!0})],m.prototype,"sortElement",void 0),e([r()],m.prototype,"store",void 0),e([r()],m.prototype,"tableHasInvalidPendingEdits",null),e([r()],m.prototype,"tableHasPendingEdits",null),e([r()],m.prototype,"tableTimeZone",null),e([r()],m.prototype,"textAlign",void 0),e([r()],m.prototype,"textWrap",void 0),e([r()],m.prototype,"timeZone",void 0),e([r()],m.prototype,"topLayerDisabled",void 0),e([r()],m.prototype,"visibleElements",void 0),e([r()],m.prototype,"width",void 0),m=e([a("esri.widgets.FeatureTable.Grid.Column")],m);const f=m;export{f as default};
|