@arcgis/core 5.1.0-next.100 → 5.1.0-next.102
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/arcgisGlobal.d.ts +1449 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0d81409721d29d8bc276.js +1 -0
- package/assets/esri/core/workers/chunks/{9478a0478fb49a88685e.js → 119b84f5349f90d1dd28.js} +1 -1
- package/assets/esri/core/workers/chunks/15167eeb6d7dbe7e392d.js +1 -0
- package/assets/esri/core/workers/chunks/{6881ae969b48bd04f064.js → 1ba37706e5d5eaabcb8e.js} +1 -1
- package/assets/esri/core/workers/chunks/{889a0405e3cdfa59b8e7.js → 1faa8a42d5a437fc40a3.js} +1 -1
- package/assets/esri/core/workers/chunks/{40137b23d8ad4af7ff9c.js → 3996149146dd1eca7cc5.js} +1 -1
- package/assets/esri/core/workers/chunks/{38b1d2ffcc318ac0119d.js → 48fcc10768d93e95a04e.js} +1 -1
- package/assets/esri/core/workers/chunks/{e7637d6a8ce0af46843c.js → 55ccb8ed7325efb62091.js} +2 -2
- package/assets/esri/core/workers/chunks/{2b2e5628d08d0e3108d2.js → 5663df3cd1dfd4b43c73.js} +1 -1
- package/assets/esri/core/workers/chunks/{0253292939b981134663.js → 5bc299f7f89a07a6e6a6.js} +1 -1
- package/assets/esri/core/workers/chunks/5dafd35801dca4229aed.js +1 -0
- package/assets/esri/core/workers/chunks/{d345030a89914348d3c5.js → 6f96ce41c47cae82e687.js} +1 -1
- package/assets/esri/core/workers/chunks/{b6b6f190687813267d77.js → 7db09c5bf024242becfa.js} +1 -1
- package/assets/esri/core/workers/chunks/{df232b8aa77f7e3285e3.js → 86bff154d46f8a562887.js} +1 -1
- package/assets/esri/core/workers/chunks/{07ddf1b1f7602063ceb0.js → 8f9117d589de7caaa02d.js} +1 -1
- package/assets/esri/core/workers/chunks/{2ad7c221ad317706387a.js → 9e7c84a3a2abec4d49df.js} +2 -2
- package/assets/esri/core/workers/chunks/{490e4a648cb2ab3e7956.js → a318cf6bb900e0ee268c.js} +1 -1
- package/assets/esri/core/workers/chunks/{3ba29e7cf9fba3aa5f41.js → b1b8a7c00ec4d998ab84.js} +1 -1
- package/assets/esri/core/workers/chunks/{fff4b9e43464ebb3fb4e.js → bb5512ecb5300d45d46b.js} +1 -1
- package/assets/esri/core/workers/chunks/{d8c4fb66c733ab2f66d3.js → bb81da98546c4d923e0d.js} +1 -1
- package/assets/esri/core/workers/chunks/{765ee0f2bfcec6d5bcc6.js → bc6a809a965355eb425f.js} +1 -1
- package/assets/esri/core/workers/chunks/{53ff47c06ccfc0be885c.js → d30790c69724258dab2b.js} +1 -1
- package/assets/esri/core/workers/chunks/{7a20941913d0115cfe26.js → de25311b6d13bf1c6089.js} +2 -2
- package/assets/esri/core/workers/chunks/{9940b318f38ea9d7a533.js → e86c073f0b6d395c7a38.js} +1 -1
- package/assets/esri/core/workers/chunks/f5bd0a4f82df5e942b70.js +1 -0
- package/assets/esri/core/workers/chunks/{b8d10d8db44c7c6acebe.js → fa38dc5010f8630a80fe.js} +1 -1
- package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +125 -0
- package/assets/esri/themes/base/widgets/_Directions.scss +5 -1
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_en.json +1 -1
- package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer.json +1 -1
- package/chunks/GaussianSplatShadow.glsl.js +39 -0
- package/chunks/GlobalIllumination.glsl.js +1 -1
- package/config.js +1 -1
- package/form/elements/inputs/MultipleChoiceInput.d.ts +5 -5
- package/form/elements/inputs/MultipleChoiceInput.js +1 -1
- package/interfaces.d.ts +17 -0
- package/kernel.js +1 -1
- package/layers/FeatureLayer.d.ts +29 -39
- package/layers/KnowledgeGraphLayer.d.ts +1 -1
- package/layers/KnowledgeGraphLayer.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/OrientedImageryLayer.d.ts +233 -0
- package/layers/OrientedImageryLayer.js +1 -1
- package/layers/ParquetLayer.d.ts +73 -24
- package/layers/ParquetLayer.js +1 -1
- package/layers/SceneLayer.d.ts +2 -2
- package/layers/VideoLayer.d.ts +35 -9
- package/layers/VideoLayer.js +1 -1
- package/layers/catalog/CatalogFootprintLayer.d.ts +147 -0
- package/layers/graphics/sources/ParquetSource.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphSublayer.d.ts +3 -1
- package/layers/support/FeatureReductionBinning.d.ts +87 -9
- package/layers/support/FeatureReductionCluster.d.ts +87 -9
- package/layers/support/FieldConfiguration.d.ts +1 -1
- package/layers/support/ParquetFilesData.d.ts +46 -0
- package/layers/support/ParquetFilesData.js +2 -0
- package/layers/support/ParquetPortalItemData.d.ts +25 -0
- package/layers/support/ParquetPortalItemData.js +2 -0
- package/layers/support/SubtypeSublayer.d.ts +147 -0
- package/layers/support/TelemetryData.d.ts +5 -0
- package/layers/support/TelemetryData.js +1 -1
- package/layers/support/TelemetryDisplay.d.ts +10 -2
- package/layers/support/TelemetryDisplay.js +1 -1
- package/layers/support/parquetUtils.js +1 -1
- package/layers/support/types.d.ts +9 -0
- package/layers/video/VideoController.js +1 -1
- package/layers/video/types.d.ts +8 -1
- package/layers/video/videoUtils.js +1 -1
- package/networks/UtilityNetworkTraceAnalysis.d.ts +1 -1
- package/networks/UtilityNetworkTraceAnalysis.js +1 -1
- package/package.json +3 -3
- package/portal/jsonTypes.d.ts +7 -0
- package/renderers/support/ClassBreakInfo.d.ts +3 -3
- package/renderers/support/ClassBreakInfo.js +1 -1
- package/renderers/support/UniqueValueInfo.d.ts +3 -3
- package/renderers/support/UniqueValueInfo.js +1 -1
- package/rest/print.js +1 -1
- package/rest/support/PrintParameters.d.ts +8 -1
- package/rest/support/PrintParameters.js +1 -1
- package/support/revision.js +1 -1
- package/third-party-notices.txt +4 -0
- 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/ShaderGraphNode.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/graph/glsl.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityPolygonShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BloomShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/AspectShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/CurvatureShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/MaskShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/RemapShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/SlopeShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/math.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/surface.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/VideoLayerView2D.js +1 -1
- package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
- package/views/3d/webgl/RenderNode.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatUnpacking.glsl.js +5 -2
- package/views/3d/webgl-engine/effects/RenderNodes.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatShadowRenderNode.js +2 -0
- package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatShadow.glsl.js +2 -0
- package/views/3d/webgl-engine/shaders/GaussianSplatShadowTechnique.js +2 -0
- package/views/3d/webgl.js +1 -1
- package/views/Viewport2DBaseMixin.js +1 -1
- package/widgets/Attachments/support/attachmentUtils.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.d.ts +8 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/attachmentUtils.js +2 -0
- package/widgets/BatchAttributeForm/css.js +1 -1
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
- package/widgets/BatchAttributeForm/templates/RelationshipElementTemplate.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
- package/widgets/BatchAttributeForm/types.d.ts +7 -0
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/FeatureForm/RelationshipInput.d.ts +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerVisibleElements.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/constants.js +1 -1
- package/widgets/OrientedImageryViewer/services/SuperimposeService.js +1 -1
- package/widgets/OrientedImageryViewer/services/TransformationService.js +1 -1
- package/widgets/OrientedImageryViewer/support/dataCaptureUtils.js +1 -1
- package/widgets/OrientedImageryViewer/support/geometryUtils.js +1 -1
- package/widgets/OrientedImageryViewer/support/superimposeUtils.js +1 -1
- package/widgets/OrientedImageryViewer/types.js +1 -1
- package/widgets/OrientedImageryViewer/videoViewerUtils.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/PanoramicViewer/PanoramicVideoViewerViewModel.js +1 -1
- package/widgets/VideoPlayer/VideoPlayerViewModel.d.ts +9 -0
- package/widgets/VideoPlayer/VideoPlayerViewModel.js +1 -1
- package/widgets/VideoPlayer/components/PlayerControlsGroup.js +1 -1
- package/widgets/support/forms/formUtils.js +1 -1
- package/assets/esri/core/workers/chunks/26f28406056ddc0e159c.js +0 -1
- package/assets/esri/core/workers/chunks/43cc82373be791b7cb4c.js +0 -1
- package/assets/esri/core/workers/chunks/b06cc59068d32baaaa87.js +0 -1
- package/assets/esri/core/workers/chunks/c9461568e1002ebac534.js +0 -1
- /package/assets/esri/core/workers/chunks/{e7637d6a8ce0af46843c.js.LICENSE.txt → 55ccb8ed7325efb62091.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{7a20941913d0115cfe26.js.LICENSE.txt → de25311b6d13bf1c6089.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import has from"../../../../core/has.js";import{clamp as t,lerp as
|
|
2
|
+
import has from"../../../../core/has.js";import{clamp as t,lerp as e,acosClamped as s}from"../../../../core/mathUtils.js";import{releaseMaybe as i}from"../../../../core/maybe.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as r,multiply as h,invert as c,lookAt as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as n,create as u}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as l,add as m,scale as d,lerp as _,squaredDistance as g,subtract as f,dot as p,negate as x,normalize as b,copy as w}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as M}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{exactEquals as C,copy as j,negate as y,transformMat4 as v,set as H}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as D}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as O,transformMat4 as Q}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as L}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{CascadeCamera as S}from"./CascadeCamera.js";import{applyTextureResizeModulo as V}from"./textureUtils.js";import{assert as T,logWithBase as N,verify as F,rayRay2D as R}from"./Util.js";import{DepthStencilAttachment as W}from"../../../webgl/enums.js";class z{constructor(){this.camera=new S,this.lightMat=u()}}class A{constructor(){this.maxNumCascadesHighQuality=4,this.maxNumCascadesLowQuality=4,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.splitSchemeLambda=0}}class I{constructor(t,e){this._fbos=t,this._viewingMode=e,this._enabled=!1,this._outputs=new Array,this._textureHeight=0,this._numCascades=1,this.settings=new A,this._projectionView=u(),this._projectionViewInverse=u(),this._modelViewLight=u(),this._cascadeDistances=[0,0,0,0,0],this._usedCascadeDistances=L(),this._cascades=[new z,new z,new z,new z],this._lastOrigin=null,this._maxTextureWidth=Math.min(has("esri-mobile")?4096:16384,t.rctx.parameters.maxTextureSize)}dispose(){this.enabled=!1}disposeOutputs(){this._handle=i(this._handle),this._outputs.forEach(t=>t?.release()),this._outputs.length=0}disposeOutput(t){this._outputs[t]=i(this._outputs[t])}set maxCascades(e){this.settings.maxNumCascadesHighQuality=t(Math.floor(e),1,4)}get maxCascades(){return this.settings.maxNumCascadesHighQuality}set enabled(t){this._enabled=t,t||this.disposeOutputs()}get enabled(){return this._enabled}get ready(){return!!this.getOutput(5)||!!this.getOutput(7)}get renderTarget(){return this._handle}get cascades(){for(let t=0;t<this._numCascades;++t)X[t]=this._cascades[t];return X.length=this._numCascades,X}start(t,e,s,i,a){T(this.enabled);const{near:r,far:h}=xt(s);this._computeCascadeDistances(r,h,i),this._textureHeight=this._computeTextureHeight(t,a,i),this._setupMatrices(t,e);const{viewMatrix:c,projectionMatrix:o}=t;for(let n=0;n<this._numCascades;++n)this._constructCascade(n,o,c,e);this._lastOrigin=null,this.clear()}getShadowMapMatrices(t){if(!this._lastOrigin||!C(t,this._lastOrigin)){this._lastOrigin=this._lastOrigin||D(),j(this._lastOrigin,t);for(let e=0;e<this._numCascades;++e){r(Z,this._cascades[e].lightMat,t);for(let t=0;t<16;++t)$[16*e+t]=Z[t]}}return $}finish(t){T(this.enabled),this._outputs[t]?.release(),this._outputs[t]=this._handle,this._handle?.setName(6===t?"shadow map highlight":"shadow map excluding highlight"),this._handle=null}getOutput(t){return this.enabled?this._outputs[t]?.getTexture(W):null}clear(){this._ensureFbo(),this.bindFramebuffer(),this._fbos.rctx.clear(256)}_computeTextureHeight({pixelRatio:t,fullWidth:e,fullHeight:s},i,a){const r=Math.min(window.devicePixelRatio,i)/t,h=a?this.settings.textureSizeModHighQuality:this.settings.textureSizeModLowQuality;return V(Math.max(e,s)*r*h,this._maxTextureWidth/this._numCascades)}_ensureFbo(){this._handle?.fbo?.width===this._textureWidth&&this._handle?.fbo.height===this._textureHeight||(this._handle?.release(),this._handle=this._fbos.acquire(this._textureWidth,this._textureHeight,"shadow map",13),this._handle.getTexture(W)?.setShadowFiltering(!0))}bindFramebuffer(){this._fbos.rctx.bindFramebuffer(this._handle?.fbo)}_constructCascade(t,e,s,i){const a=this._cascades[t],c=-this._cascadeDistances[t],o=-this._cascadeDistances[t+1],n=(e[10]*c+e[14])/Math.abs(e[11]*c+e[15]),u=(e[10]*o+e[14])/Math.abs(e[11]*o+e[15]);T(n<u);for(let r=0;r<8;++r){O(q,r%4==0||r%4==3?-1:1,r%4==0||r%4==1?-1:1,r<4?n:u,1);const t=E[r];Q(t,q,this._projectionViewInverse),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3]}y(K,E[0]),a.camera.viewMatrix=r(U,this._modelViewLight,K);for(let r=0;r<8;++r)v(E[r],E[r],a.camera.viewMatrix);let l=E[0][2],m=E[0][2];for(let r=1;r<8;++r)l=Math.min(l,E[r][2]),m=Math.max(m,E[r][2]);l-=200,m+=200,a.camera.near=-m,a.camera.far=-l,pt(s,i,l,m,a.camera),h(a.lightMat,a.camera.projectionMatrix,a.camera.viewMatrix);const d=this._textureHeight;a.camera.viewport=[t*d,0,d,d]}_setupMatrices(t,e){h(this._projectionView,t.projectionMatrix,t.viewMatrix),c(this._projectionViewInverse,this._projectionView);const s=1===this._viewingMode?t.eye:H(K,0,0,1);o(this._modelViewLight,[0,0,0],[-e[0],-e[1],-e[2]],s)}_computeCascadeDistances(t,s,i){const a=i?this.settings.maxNumCascadesHighQuality:this.settings.maxNumCascadesLowQuality;this._numCascades=Math.min(1+Math.floor(N(s/t,4)),a);const r=(s-t)/this._numCascades,h=(s/t)**(1/this._numCascades);let c=t,o=t;for(let n=0;n<this._numCascades+1;++n)this._cascadeDistances[n]=e(c,o,this.settings.splitSchemeLambda),c*=h,o+=r}get _textureWidth(){return this._textureHeight*this._numCascades}get numCascades(){return this._numCascades}get cascadeDistances(){return O(this._usedCascadeDistances,this._cascadeDistances[0],this._numCascades>1?this._cascadeDistances[1]:1/0,this._numCascades>2?this._cascadeDistances[2]:1/0,this._numCascades>3?this._cascadeDistances[3]:1/0)}get test(){}}const U=u(),q=L(),E=[];for(let bt=0;bt<8;++bt)E.push(L());const P=M(),k=M(),B=M(),G=M(),J=M(),K=D(),X=[];function Y(){X.length=0}const Z=u(),$=n.concat(n,n,n),tt=M(),et=M(),st=[M(),M(),M(),M()],it=M(),at=M(),rt=M(),ht=M(),ct=M(),ot=M(),nt=M();function ut(t,e,s,i,a,r,h,c){l(tt,0,0);for(let l=0;l<4;++l)m(tt,tt,t[l]);d(tt,tt,.25),l(et,0,0);for(let l=4;l<8;++l)m(et,et,t[l]);d(et,et,.25),_(st[0],t[4],t[5],.5),_(st[1],t[5],t[6],.5),_(st[2],t[6],t[7],.5),_(st[3],t[7],t[4],.5);let o=0,n=g(st[0],tt);for(let l=1;l<4;++l){const t=g(st[l],tt);t<n&&(n=t,o=l)}f(it,st[o],t[o+4]);const u=it[0];let M,C;it[0]=-it[1],it[1]=u,f(at,et,tt),p(at,it)<0&&x(it,it),_(it,it,at,s),b(it,it),M=C=p(f(rt,t[0],tt),it);for(let l=1;l<8;++l){const e=p(f(rt,t[l],tt),it);e<M?M=e:e>C&&(C=e)}w(i,tt),d(rt,it,M-e),m(i,i,rt);let j=-1,y=1,v=0,H=0;for(let l=0;l<8;++l){f(ht,t[l],i),b(ht,ht);const e=it[0]*ht[1]-it[1]*ht[0];e>0?e>j&&(j=e,v=l):e<y&&(y=e,H=l)}F(j>0,"leftArea"),F(y<0,"rightArea"),d(ct,it,M),m(ct,ct,tt),d(ot,it,C),m(ot,ot,tt),nt[0]=-it[1],nt[1]=it[0];const D=R(i,t[H],ot,m(rt,ot,nt),1,a),O=R(i,t[v],ot,rt,1,r),Q=R(i,t[v],ct,m(rt,ct,nt),1,h),L=R(i,t[H],ct,rt,1,c);F(D,"rayRay"),F(O,"rayRay"),F(Q,"rayRay"),F(L,"rayRay")}function lt(t,e){return 3*e+t}const mt=M();function dt(t,e){return l(mt,t[e],t[e+3]),mt}const _t=M(),gt=a();function ft(t,e,s,i,a){f(_t,s,i),d(_t,_t,.5),gt[0]=_t[0],gt[1]=_t[1],gt[2]=0,gt[3]=_t[1],gt[4]=-_t[0],gt[5]=0,gt[6]=_t[0]*_t[0]+_t[1]*_t[1],gt[7]=_t[0]*_t[1]-_t[1]*_t[0],gt[8]=1,gt[lt(0,2)]=-p(dt(gt,0),t),gt[lt(1,2)]=-p(dt(gt,1),t);let r=p(dt(gt,0),s)+gt[lt(0,2)],h=p(dt(gt,1),s)+gt[lt(1,2)],c=p(dt(gt,0),i)+gt[lt(0,2)],o=p(dt(gt,1),i)+gt[lt(1,2)];r=-(r+c)/(h+o),gt[lt(0,0)]+=gt[lt(1,0)]*r,gt[lt(0,1)]+=gt[lt(1,1)]*r,gt[lt(0,2)]+=gt[lt(1,2)]*r,r=1/(p(dt(gt,0),s)+gt[lt(0,2)]),h=1/(p(dt(gt,1),s)+gt[lt(1,2)]),gt[lt(0,0)]*=r,gt[lt(0,1)]*=r,gt[lt(0,2)]*=r,gt[lt(1,0)]*=h,gt[lt(1,1)]*=h,gt[lt(1,2)]*=h,gt[lt(2,0)]=gt[lt(1,0)],gt[lt(2,1)]=gt[lt(1,1)],gt[lt(2,2)]=gt[lt(1,2)],gt[lt(1,2)]+=1,r=p(dt(gt,1),e)+gt[lt(1,2)],h=p(dt(gt,2),e)+gt[lt(2,2)],c=p(dt(gt,1),s)+gt[lt(1,2)],o=p(dt(gt,2),s)+gt[lt(2,2)],r=-.5*(r/h+c/o),gt[lt(1,0)]+=gt[lt(2,0)]*r,gt[lt(1,1)]+=gt[lt(2,1)]*r,gt[lt(1,2)]+=gt[lt(2,2)]*r,r=p(dt(gt,1),e)+gt[lt(1,2)],h=p(dt(gt,2),e)+gt[lt(2,2)],c=-h/r,gt[lt(1,0)]*=c,gt[lt(1,1)]*=c,gt[lt(1,2)]*=c,a[0]=gt[0],a[1]=gt[1],a[2]=0,a[3]=gt[2],a[4]=gt[3],a[5]=gt[4],a[6]=0,a[7]=gt[5],a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=gt[6],a[13]=gt[7],a[14]=0,a[15]=gt[8]}function pt(t,e,i,a,r){const h=1/E[0][3],c=1/E[4][3];T(h<c);let o=h+Math.sqrt(h*c);const n=Math.sin(s(t[2]*e[0]+t[6]*e[1]+t[10]*e[2]));o/=n,ut(E,o,n,P,k,B,G,J),ft(P,k,G,J,r.projectionMatrix),r.projectionMatrix[10]=2/(i-a),r.projectionMatrix[14]=-(i+a)/(i-a)}function xt(t){let{near:e,far:s}=t;return e<2&&(e=2),s<2&&(s=2),e>=s&&(e=2,s=4),{near:e,far:s}}export{I as ShadowMap,Y as cleanupShadowmap};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{clamp as t}from"../../../../core/mathUtils.js";import{estimateNumberArrayMemory as e}from"../../../../core/memoryEstimations.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{nan as i,fromValues as r}from"../../../../geometry/support/aaBoundingBox.js";import{newContinuousIndexArray as s}from"../../../../geometry/support/Indices.js";import{MeshIntersectionOptions as a,intersectRayTriangles as o}from"./RayIntersections.js";const c=40,h=.8,d=10,
|
|
2
|
+
import{clamp as t}from"../../../../core/mathUtils.js";import{estimateNumberArrayMemory as e}from"../../../../core/memoryEstimations.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{nan as i,fromValues as r}from"../../../../geometry/support/aaBoundingBox.js";import{newContinuousIndexArray as s}from"../../../../geometry/support/Indices.js";import{MeshIntersectionOptions as a,intersectRayTriangles as o}from"./RayIntersections.js";const c=40,h=.8,d=10,m=1e-6;class l{constructor(e,i,r){this.globalTriangleVertexIndices=e,this.numTriangles=i,this.positions=r,this._rayDirection=n(),this._callback=I,this._intersectionOptions=M,this.bspNodeTree=new Array,this.triangleIndexMap=s(i);const a=x(e,i,r.data,r.stride),o=t(Math.log2(i/c),2,d),m=(t,e,n)=>{const i=u(this.triangleIndexMap,a,t,e),r=e-t;if(r<=c){const n=new g(i,void 0,0,t,e);return this.bspNodeTree.push(n),n}const{axis:s,midValue:d}=p(i),l=f(this.triangleIndexMap,a,t,e,s,d),x=(t,e)=>{if(n>o)return;const i=e-t;return i<c||i>=h*r?void 0:m(t,e,n+1)},y=new g(i,s,d,l.next,l.mid);return this.bspNodeTree.push(y),y.leftNode=x(t,l.next),y.rightNode=x(l.mid,e),y};m(0,i,0)}intersectRayTriangleRange(t,e){if(t>=e)return;const{data:n,stride:i}=this.positions;o(this._rayFrom,this._rayDirection,t,e,this.globalTriangleVertexIndices,n,i,this._intersectionOptions.normalRequired,this._callback,this.triangleIndexMap),l.numFacesTested+=e-t}intersectRay(t,e,n,i){l.numFacesTested=0;const r=t,s=e,a=s[0]-r[0],o=s[1]-r[1],c=s[2]-r[2];if(a*a+o*o+c*c<m)return;this._rayFrom=r;const h=this._rayDirection;h[0]=a,h[1]=o,h[2]=c;const d=this.triangleIndexMap.length;this._callback=i,this._intersectionOptions=n,this.intersectRayBSP(this.bspNodeTree[0],0,d),this._callback=I,this._intersectionOptions=M}intersectRayBSP(t,e,n){const i=this._rayFrom,r=this._rayDirection,s=[{node:t,rangeStart:e,rangeEnd:n}];for(;s.length>0;){const{node:t,rangeStart:e,rangeEnd:n}=s.pop();if(!y(t.aabb,i,r))continue;const a=t.axis,o=t.d;if(i[a]<o||r[a]<0){const n=e,i=t.midStartIndex;if(n<i){const e=t.leftNode;void 0!==e?s.push({node:e,rangeStart:n,rangeEnd:i}):this.intersectRayTriangleRange(n,i)}}if(this.intersectRayTriangleRange(t.midStartIndex,t.rightStartIndex),i[a]>o||r[a]>0){const e=t.rightStartIndex,i=n;if(e<i){const n=t.rightNode;void 0!==n?s.push({node:n,rangeStart:e,rangeEnd:i}):this.intersectRayTriangleRange(e,i)}}}}static{this.numFacesTested=0}get estimatedMemoryUsage(){return e(this.triangleIndexMap)}}class g{constructor(t,e,n,i,r){this.aabb=t,this.axis=e,this.d=n,this.midStartIndex=i,this.rightStartIndex=r}}function f(t,e,n,i,r,s){const a=r+3;let o=n,c=n,h=i;for(;c<h;){const n=t[c],i=6*n;e[i+a]<=s?(t[c]=t[o],t[o]=n,++o,++c):e[i+r]>=s?(--h,t[c]=t[h],t[h]=n):++c}return{next:o,mid:h}}function u(t,e,n,s){if(s<=n)return i;let a=6*t[n],o=e[a++],c=e[a++],h=e[a++],d=e[a++],m=e[a++],l=e[a];for(let i=n+1;i<s;++i)a=6*t[i],o=Math.min(o,e[a++]),c=Math.min(c,e[a++]),h=Math.min(h,e[a++]),d=Math.max(d,e[a++]),m=Math.max(m,e[a++]),l=Math.max(l,e[a]);return r(o,c,h,d,m,l)}function p(t){const e=t[3]-t[0],n=t[4]-t[1],i=t[5]-t[2],r=e>n?e>i?0:n>i?1:2:n>i?1:i>e?2:0;return{axis:r,midValue:(t[r]+t[r+3])/2}}function x(t,e,n,i){const r=new Float64Array(6*e);for(let s=0;s<e;++s){const e=3*s,a=t[e]*i,o=t[e+1]*i,c=t[e+2]*i;for(let t=0;t<3;++t){const e=n[a+t],i=n[o+t],h=n[c+t];r[6*s+t]=Math.min(e,i,h),r[6*s+3+t]=Math.max(e,i,h)}}return r}function y(t,e,n){const i=e,r=n;let s=0,a=1/0;for(let o=0;o<3;++o){{const e=t[o];if(i[o]<e){if(r[o]<=m)return!1;const t=(e-i[o])/r[o];s=Math.max(s,t)}else if(r[o]<=-m){const t=(e-i[o])/r[o];a=Math.min(a,t)}if(s>a)return!1}{const e=t[o+3];if(i[o]>e){if(r[o]>=-m)return!1;const t=(e-i[o])/r[o];s=Math.max(s,t)}else if(r[o]>=m){const t=(e-i[o])/r[o];a=Math.min(a,t)}if(s>a)return!1}}return!0}const M=new a,I=()=>{};export{l as TriangleIntersectionData};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import"../../../../core/libs/gl-matrix-2/math/vec2.js";import"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/output/OutputDepth.glsl.js";import"../core/shaderLibrary/shading/PositionOutsideClipSpace.js";import"../core/shaderLibrary/util/GaussianSplatCovariance.glsl.js";import"../core/shaderLibrary/util/GaussianSplatEvaluation.glsl.js";import"../core/shaderLibrary/util/GaussianSplatTextureFetch.glsl.js";import"../core/shaderLibrary/util/GaussianSplatUnpacking.glsl.js";import"../core/shaderLibrary/util/QuaternionToRotationMatrix.glsl.js";import"../core/shaderModules/Float2BindUniform.js";import"../core/shaderModules/Float3PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Matrix4BindUniform.js";import"../core/shaderModules/Texture2DUintPassUniform.js";import"../../../webgl/ShaderBuilder.js";export{G as GaussianSplatShadowPassParameters,b as build}from"../../../../chunks/GaussianSplatShadow.glsl.js";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import{__decorate as e}from"tslib";import{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{ReloadableShader as s}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as o}from"../core/shaderTechnique/ShaderTechnique.js";import{a as t}from"../../../../chunks/GaussianSplatShadow.glsl.js";import{makePipelineState as a,defaultDepthWrite as i}from"../../../webgl/renderState.js";let l=class extends o{constructor(){super(...arguments),this.shader=new s(t,()=>import("./GaussianSplatShadow.glsl.js"))}initializePipeline(){return a({colorWrite:null,depthTest:{func:515},depthWrite:i})}};l=e([r("esri.views.3d.webgl-engine.shaders.GaussianSplatShadowTechnique")],l);export{l as GaussianSplatShadowTechnique};
|
package/views/3d/webgl.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import o from"../../Camera.js";import{rad2deg as e,deg2rad as r}from"../../core/mathUtils.js";import{create as t}from"../../core/libs/gl-matrix-2/factories/mat4f64.js";import{scale as i,add as n}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import c from"../../geometry/Point.js";import l from"../../geometry/SpatialReference.js";import{computeTranslationToOriginAndRotation as s}from"../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as m}from"../../geometry/projection/projectBuffer.js";import{projectPointToVector as u}from"../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as p}from"../../geometry/projection/projectVectorToVector.js";import{cameraOnContentAlongViewDirection as f}from"./camera/intersectionUtils.js";import{directionToHeadingTilt as
|
|
2
|
+
import o from"../../Camera.js";import{rad2deg as e,deg2rad as r}from"../../core/mathUtils.js";import{create as t}from"../../core/libs/gl-matrix-2/factories/mat4f64.js";import{scale as i,add as n}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import c from"../../geometry/Point.js";import l from"../../geometry/SpatialReference.js";import{computeTranslationToOriginAndRotation as s}from"../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as m}from"../../geometry/projection/projectBuffer.js";import{projectPointToVector as u}from"../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as p}from"../../geometry/projection/projectVectorToVector.js";import{cameraOnContentAlongViewDirection as f}from"./camera/intersectionUtils.js";import{directionToHeadingTilt as A,viewModeDependentUtil as d}from"./support/viewingModeUtils.js";const O={OPAQUE:"opaque-color",TRANSPARENT:"transparent-color",COMPOSITE:"composite-color",FINAL:"final-color"},R=[O.FINAL,O.COMPOSITE,O.OPAQUE,O.TRANSPARENT],T={ANTIALIASING:"aa-color",CUTFILL_COLOR:"cutfill-color",CUTFILL_COMPUTATION:"cutfill-computation",FOCUSAREA_COLOR:"focusarea-color",FOCUSAREA:"focusarea",GAUSSIAN_SPLAT:"gaussian",GROUND_DEPTH:"ground-depth",HIGHLIGHT_COLOR:"highlight-color",LASERLINES:"laserlines",MAGNIFIER:"magnifier",OCCLUDED:"occluded",OPAQUE_OCCLUSION_QUERY:"opaque-occlusion-query",OPAQUE_ENVIRONMENT:"opaque-environment",AMBIENT_ILLUMINATION:"ambient-illumination",SHADOW_CASTERS:"shadow-casters",SHADOW_HIGHLIGHT:"shadow-highlight",TRANSPARENT_ENVIRONMENT:"transparent-environment",VOXEL:"voxel",VIEWSHED:"viewshed"},E=Array.from(Object.values(T)).concat(R);function I(o,e,r,t,i,n,a){return t=t||o.spatialReference,m(e,t,r,i,o.renderCoordsHelper.spatialReference,n,a)?i:null}function N(o,e,r,t,i,n,a){return n=n||o.spatialReference,m(e,o.renderCoordsHelper.spatialReference,r,t,n,i,a)?t:null}function g(o,e,r,i){return i||(i=t()),r=r||o.spatialReference,s(r,e,i,o.renderCoordsHelper.spatialReference)?i:null}function S(r,t,i){const n=r.renderSpatialReference,a=A(r,t.eye,t.viewForward,t.up,C);let s=r.spatialReference;return p(t.eye,n,L,s)||(s=l.WGS84,p(t.eye,n,L,s)),null==i?i=new o(new c(L,s),a.heading,a.tilt,e(t.fov)):(i.position.x=L[0],i.position.y=L[1],i.position.z=L[2],i.position.spatialReference=s,i.heading=a.heading,i.tilt=a.tilt,i.fov=e(t.fov)),i.layout.row=t.row,i.layout.rows=t.rows,i.layout.column=t.column,i.layout.columns=t.columns,i}function j(o,e){return y(o,e,void 0)}function y(o,e,t){if(!e)return null;const c=o.renderSpatialReference,l=d(o).headingTiltToDirectionUp,s=a();if(!u(e.position,s,c))return null;const m=l(s,e.heading,e.tilt);i(m.direction,m.direction,o.state.camera.distance),n(m.direction,m.direction,s);const p=f(o,s,m.direction,m.up,t);return p.fov=r(e.fov),p.row=e.layout.row,p.rows=e.layout.rows,p.column=e.layout.column,p.columns=e.layout.columns,p}const L=a(),C={heading:0,tilt:0};export{E as AllInternalRenderNodeOutputs,R as AllRenderNodeOutputs,T as InternalRenderCategory,O as RenderNodeOutput,S as fromRenderCamera,N as fromRenderCoordinates,g as renderCoordinateTransformAt,j as toRenderCamera,y as toRenderCameraWithScale,I as toRenderCoordinates};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import e from"../Viewpoint.js";import{watch as n,sync as i}from"../core/reactiveUtils.js";import{property as a,subclass as s}from"../core/accessorSupport/decorators.js";import o from"./2d/FrameTask.js";import r from"./2d/MapViewConstraints.js";import{ViewStateManager as l}from"./2d/ViewStateManager.js";import{StationaryManager as p}from"./2d/support/StationaryManager.js";import{ViewEvents as g}from"./input/ViewEvents.js";const h=h=>{const m=h;let d=class extends m{constructor(...t){super(...t),this.fullOpacity=1,this.stateManager=new l({constraints:new r({view:this})}),this.stationaryManager=new p,this.mapViewNavigation=null,this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!1,labelsAnimationTime:0,labelCollisionsEnabled:!1},this.frameTask=new o(this),this.viewEvents=new g(this),this.padding={top:0,right:0,bottom:0,left:0},this.addHandles([n(()=>this.viewpoint,()=>this.stationaryManager.flip(),i)])}get constraintsInfo(){return{lods:null,spatialReference:null}}get extent(){return this.stateManager?.extent??null}set extent(t){this.stateManager.extent=t}get state(){return this.stateManager.state}get interacting(){return!1}get stationary(){return!this.animation&&this.stationaryManager.stationary}set animation(t){const e=this._get("animation");if(t===e)return;if(e&&e.stop(),t!==this.animationManager.animation&&this.animationManager.stop(),!t||t.isFulfilled())return void this._set("animation",null);this._set("animation",t);const n=()=>{this.destroyed||t===this._get("animation")&&(this._set("animation",null),this.frameTask?.requestFrame())};t.when(n,n)}get canZoomIn(){if(!this.ready)return!1;const t=this.constraints?.effectiveMaxScale,e=this.animation?.target,n=(e&&"then"in e?void 0:e?.scale)??this.scale??0;return 0===t||n>t}get canZoomOut(){if(!this.ready)return!1;const t=this.constraints?.effectiveMinScale,e=this.animation?.target,n=(e&&"then"in e?void 0:e?.scale)??this.scale??0;return 0===t||n<t}get constraints(){return this.stateManager?.constraints}set constraints(t){t.view=this;const e=this.stateManager.constraints;this.stateManager.constraints=t,e?.destroy()}get padding(){return this.stateManager?.padding}set padding(t){this.stateManager&&(this.stateManager.padding=t)}get resizeAlign(){return this.stateManager.resizeAlign}set resizeAlign(t){this.stateManager.resizeAlign=t}get rotation(){return this.stateManager.rotation??0}set rotation(t){const{rotationEnabled:e}=this.constraints;this.constraints.rotationEnabled=!0,this.stateManager.rotation=t,this.constraints.rotationEnabled=e}get viewpoint(){return this.stateManager.viewpoint??null}set viewpoint(t){this.stateManager.viewpoint=t,this.frameTask.requestFrame()}async zoomIn(){if(this.canZoomIn)return this.mapViewNavigation.zoomIn()}async zoomOut(){if(this.canZoomOut)return this.mapViewNavigation.zoomOut()}};return t([a({readOnly:!0})],d.prototype,"animationManager",void 0),t([a({readOnly:!0})],d.prototype,"fullOpacity",void 0),t([a()],d.prototype,"stateManager",void 0),t([a()],d.prototype,"constraintsInfo",null),t([a()],d.prototype,"extent",null),t([a({readOnly:!0})],d.prototype,"state",null),t([a({readOnly:!0})],d.prototype,"mapViewNavigation",void 0),t([a()],d.prototype,"renderingOptions",void 0),t([a({readOnly:!0})],d.prototype,"interacting",null),t([a()],d.prototype,"stationary",null),t([a()],d.prototype,"animation",null),t([a({readOnly:!0})],d.prototype,"canZoomIn",null),t([a({readOnly:!0})],d.prototype,"canZoomOut",null),t([a({type:r})],d.prototype,"constraints",null),t([a()],d.prototype,"padding",null),t([a()],d.prototype,"resizeAlign",null),t([a()],d.prototype,"rotation",null),t([a({readOnly:!0})],d.prototype,"viewEvents",void 0),t([a({type:e})],d.prototype,"viewpoint",null),d=t([s("esri.views.Viewport2DBaseMixin")],d),d};export{h as Viewport2DBaseMixin};
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../Viewpoint.js";import{watch as n,sync as i}from"../core/reactiveUtils.js";import{property as a,subclass as s}from"../core/accessorSupport/decorators.js";import o from"./2d/FrameTask.js";import r from"./2d/MapViewConstraints.js";import{ViewStateManager as l}from"./2d/ViewStateManager.js";import{StationaryManager as p}from"./2d/support/StationaryManager.js";import{ViewEvents as g}from"./input/ViewEvents.js";const h=h=>{const m=h;let d=class extends m{constructor(...t){super(...t),this.fullOpacity=1,this.stateManager=new l({constraints:new r({view:this})}),this.stationaryManager=new p,this.mapViewNavigation=null,this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!1,labelsAnimationTime:0,labelCollisionsEnabled:!1},this.frameTask=new o(this),this.viewEvents=new g(this),this.padding={top:0,right:0,bottom:0,left:0},this.addHandles([n(()=>this.viewpoint,()=>this.stationaryManager.flip(),i)])}get constraintsInfo(){return{lods:null,spatialReference:null}}get extent(){return this.stateManager?.extent??null}set extent(t){this.stateManager.extent=t}get state(){return this.stateManager.state}get interacting(){return!1}get stationary(){return!this.animation&&this.stationaryManager.stationary}set animation(t){const e=this._get("animation");if(t===e)return;if(e&&e.stop(),this.animationManager&&t!==this.animationManager.animation&&this.animationManager.stop(),!t||t.isFulfilled())return void this._set("animation",null);this._set("animation",t);const n=()=>{this.destroyed||t===this._get("animation")&&(this._set("animation",null),this.frameTask?.requestFrame())};t.when(n,n)}get canZoomIn(){if(!this.ready)return!1;const t=this.constraints?.effectiveMaxScale,e=this.animation?.target,n=(e&&"then"in e?void 0:e?.scale)??this.scale??0;return 0===t||n>t}get canZoomOut(){if(!this.ready)return!1;const t=this.constraints?.effectiveMinScale,e=this.animation?.target,n=(e&&"then"in e?void 0:e?.scale)??this.scale??0;return 0===t||n<t}get constraints(){return this.stateManager?.constraints}set constraints(t){t.view=this;const e=this.stateManager.constraints;this.stateManager.constraints=t,e?.destroy()}get padding(){return this.stateManager?.padding}set padding(t){this.stateManager&&(this.stateManager.padding=t)}get resizeAlign(){return this.stateManager.resizeAlign}set resizeAlign(t){this.stateManager.resizeAlign=t}get rotation(){return this.stateManager.rotation??0}set rotation(t){const{rotationEnabled:e}=this.constraints;this.constraints.rotationEnabled=!0,this.stateManager.rotation=t,this.constraints.rotationEnabled=e}get viewpoint(){return this.stateManager.viewpoint??null}set viewpoint(t){this.stateManager.viewpoint=t,this.frameTask.requestFrame()}async zoomIn(){if(this.canZoomIn)return this.mapViewNavigation.zoomIn()}async zoomOut(){if(this.canZoomOut)return this.mapViewNavigation.zoomOut()}};return t([a({readOnly:!0})],d.prototype,"animationManager",void 0),t([a({readOnly:!0})],d.prototype,"fullOpacity",void 0),t([a()],d.prototype,"stateManager",void 0),t([a()],d.prototype,"constraintsInfo",null),t([a()],d.prototype,"extent",null),t([a({readOnly:!0})],d.prototype,"state",null),t([a({readOnly:!0})],d.prototype,"mapViewNavigation",void 0),t([a()],d.prototype,"renderingOptions",void 0),t([a({readOnly:!0})],d.prototype,"interacting",null),t([a()],d.prototype,"stationary",null),t([a()],d.prototype,"animation",null),t([a({readOnly:!0})],d.prototype,"canZoomIn",null),t([a({readOnly:!0})],d.prototype,"canZoomOut",null),t([a({type:r})],d.prototype,"constraints",null),t([a()],d.prototype,"padding",null),t([a()],d.prototype,"resizeAlign",null),t([a()],d.prototype,"rotation",null),t([a({readOnly:!0})],d.prototype,"viewEvents",void 0),t([a({type:e})],d.prototype,"viewpoint",null),d=t([s("esri.views.Viewport2DBaseMixin")],d),d};export{h as Viewport2DBaseMixin};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{getAssetUrl as i}from"../../../assets.js";function e(i){const e=i.toLowerCase();return"image/bmp"===e||"image/emf"===e||"image/exif"===e||"image/gif"===e||"image/x-icon"===e||"image/jpeg"===e||"image/png"===e||"image/tiff"===e||"image/x-wmf"===e}function
|
|
2
|
+
import{getAssetUrl as i}from"../../../assets.js";function e(i){return i?i.startsWith("image/")?"image":i.startsWith("audio/")?"audio":i.startsWith("video/")?"video":i.startsWith("text/")||i.startsWith("application/")||i.startsWith("model/")?"document":"unknown":"unknown"}function p(i){const e=i.toLowerCase();return"image/bmp"===e||"image/emf"===e||"image/exif"===e||"image/gif"===e||"image/x-icon"===e||"image/jpeg"===e||"image/png"===e||"image/tiff"===e||"image/x-wmf"===e}function a(e){const p=i("esri/themes/base/images/files/");return e?"text/plain"===e?`${p}text-32.svg`:"application/pdf"===e?`${p}pdf-32.svg`:"text/csv"===e?`${p}csv-32.svg`:"application/gpx+xml"===e?`${p}gpx-32.svg`:"application/x-dwf"===e?`${p}cad-32.svg`:"application/postscript"===e||"application/json"===e||"text/xml"===e||"model/vrml"===e?`${p}code-32.svg`:"application/x-zip-compressed"===e||"application/x-7z-compressed"===e||"application/x-gzip"===e||"application/x-tar"===e||"application/x-gtar"===e||"application/x-bzip2"===e||"application/gzip"===e||"application/x-compress"===e||"application/x-apple-diskimage"===e||"application/x-rar-compressed"===e||"application/zip"===e?`${p}zip-32.svg`:e.includes("image/")?`${p}image-32.svg`:e.includes("audio/")?`${p}sound-32.svg`:e.includes("video/")?`${p}video-32.svg`:e.includes("msexcel")||e.includes("ms-excel")||e.includes("spreadsheetml")?`${p}excel-32.svg`:e.includes("msword")||e.includes("ms-word")||e.includes("wordprocessingml")?`${p}word-32.svg`:e.includes("powerpoint")||e.includes("presentationml")?`${p}report-32.svg`:`${p}generic-32.svg`:`${p}generic-32.svg`}function s(i){return i?"text/plain"===i?"file-text":"application/pdf"===i?"file-pdf":"text/csv"===i?"file-csv":"application/gpx+xml"===i?"file-gpx":"application/x-dwf"===i?"file-cad":"application/postscript"===i||"application/json"===i||"text/xml"===i||"model/vrml"===i?"file-code":"application/x-zip-compressed"===i||"application/x-7z-compressed"===i||"application/x-gzip"===i||"application/x-tar"===i||"application/x-gtar"===i||"application/x-bzip2"===i||"application/gzip"===i||"application/x-compress"===i||"application/x-apple-diskimage"===i||"application/x-rar-compressed"===i||"application/zip"===i?"file-zip":i.includes("image/")?"file-image":i.includes("audio/")?"file-sound":i.includes("video/")?"file-video":i.includes("msexcel")||i.includes("ms-excel")||i.includes("spreadsheetml")?"file-excel":i.includes("msword")||i.includes("ms-word")||i.includes("wordprocessingml")?"file-word":i.includes("powerpoint")||i.includes("presentationml")?"file-ppt":"file":"file"}export{e as getAttachmentTypeCategory,s as getCalciteIconForAttachment,a as getIconPath,p as isSupportedImage};
|
|
@@ -7,7 +7,7 @@ import type FieldInput from "./inputs/FieldInput.js";
|
|
|
7
7
|
import type { EventedAccessor } from "../../core/Evented.js";
|
|
8
8
|
import type { FieldValue } from "../../layers/support/fieldUtils.js";
|
|
9
9
|
import type { TimeZone } from "../../time/types.js";
|
|
10
|
-
import type { AttachmentsChangeEvent, AttributeFormSupportedLayerInfo, AttributeFormSupportedLayerUnion, BatchAttributeFormMode, BatchAttributeFormState, ValueChangeEvent, SubmitEvent } from "./types.js";
|
|
10
|
+
import type { AttachmentsChangeEvent, AttributeFormSupportedLayerInfo, AttributeFormSupportedLayerUnion, BatchAttributeFormMode, BatchAttributeFormState, SelectedAttachmentInfo, ValueChangeEvent, SubmitEvent } from "./types.js";
|
|
11
11
|
import type { FormInput } from "./inputs/types.js";
|
|
12
12
|
import type { EditType } from "../support/forms/types.js";
|
|
13
13
|
|
|
@@ -195,6 +195,8 @@ export default class BatchAttributeFormViewModel extends EventedAccessor {
|
|
|
195
195
|
* @default false
|
|
196
196
|
*/
|
|
197
197
|
accessor readOnly: boolean;
|
|
198
|
+
/** @internal */
|
|
199
|
+
get selectedAttachment(): SelectedAttachmentInfo | null;
|
|
198
200
|
/** The set of form inputs used in `batch` editing [mode](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/BatchAttributeFormViewModel/#mode). */
|
|
199
201
|
get sharedForm(): BatchFormInputs;
|
|
200
202
|
/**
|
|
@@ -272,6 +274,11 @@ export default class BatchAttributeFormViewModel extends EventedAccessor {
|
|
|
272
274
|
* @returns The current attribute values for the given feature.
|
|
273
275
|
*/
|
|
274
276
|
getValues(feature: Graphic): Graphic["attributes"];
|
|
277
|
+
/**
|
|
278
|
+
* @param value - Selected attachment info, or `null`/`undefined` to clear the selection.
|
|
279
|
+
* @internal
|
|
280
|
+
*/
|
|
281
|
+
setSelectedAttachment(value: SelectedAttachmentInfo | null | undefined): void;
|
|
275
282
|
/**
|
|
276
283
|
* @param elementId - Attachment element identifier.
|
|
277
284
|
* @param files - Files to stage for addition.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{pushIfSome as t}from"../../core/arrayUtils.js";import{createTask as s}from"../../core/asyncUtils.js";import r from"../../core/Collection.js";import i from"../../core/Error.js";import{EventedAccessor as a}from"../../core/Evented.js";import n from"../../core/Logger.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{abortMaybe as h,destroyMaybe as p}from"../../core/maybe.js";import{throwIfAborted as l,isAbortError as u}from"../../core/promiseUtils.js";import m from"../../core/ReactiveMap.js";import{on as c,sync as d,watch as f,whenOnce as y}from"../../core/reactiveUtils.js";import{property as g,subclass as v}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as F}from"../../core/support/UpdatingHandles.js";import _ from"../../geometry/SpatialReference.js";import{getGraphicLayer as A}from"../../graphic/graphicOriginUtils.js";import{system as x}from"../../time/constants.js";import{createReactiveGraphic as w,isAttributeFormSupportedLayerWithAttachments as I,layerSupportsQueryAttachments as C,queryAttachmentsForElements as E}from"./batchAttributeFormUtils.js";import{ArcadeExecutorProvider as M}from"./expressions/ArcadeExecutorProvider.js";import{ExpressionsManager as b}from"./expressions/ExpressionsManager.js";import{ExpressionsModel as k}from"./expressions/ExpressionsModel.js";import T from"./inputs/BatchFormInputs.js";import{createBatchFormInputsFromBatchFormTemplate as V}from"./inputs/support/createBatchFormInputs.js";import{isGroupInput as j,isFieldInput as H}from"./inputs/support/inputUtils.js";import L from"./templates/BatchFormTemplate.js";import{getLayerContingentValuesMetaData as B}from"./templates/support/contingentValuesUtils.js";import{createBatchFormTemplate as R}from"./templates/support/createBatchFormTemplate.js";import{isExcludedFromSharedForm as G,isGroupElementTemplate as U}from"./templates/support/templateUtils.js";import{isEmptyValue as S}from"../support/forms/formUtils.js";function W(e,t){return e?.find(e=>e.layer===t)}let N=class extends a{constructor(e){super(e),this._attachmentCache=new m,this.activeFeatureIndex=-1,this.disabled=!1,this.editType="NA",this.features=new r,this._hasAsyncArcadeExpressions=!1,this.maximumFeatureCount=2e3,this.maximumFeatureCountWithComplexForms=50,this.map=null,this.readOnly=!1,this.spatialReference=null,this.submitHasBeenAttempted=!1,this.timeZone=null,this.userHasChangedValues=!1,this.layerInfos=null,this._arcadeExecutorProvider=new M,this._activeFormInputsByElementId=new Map,this._emptyForm=new T({inputs:[]}),this._emptyFormTemplate=new L({elements:[]}),this._featureFormMap=new Map,this._prepareTask=null,this._reactiveGraphicLookup=new m,this._updatingHandles=new F,this._layerTemplateMap=new m,this._layerContingentValuesMap=new m,this._workingFeatures=new r,this._expressionsManager=new b({arcadeContext:{editType:"NA",spatialReference:null,map:null,timeZone:x}}),this.sharedForm=this._emptyForm,this.sharedFormTemplate=this._emptyFormTemplate}initialize(){this.addHandles([c(()=>this.features,"after-changes",()=>{this.notifyChange("layers"),this._prepare()},d),f(()=>[this.features,this.map,this.timeZone,this.editType],()=>this._prepare(),d),f(()=>this.activeForm,()=>this._activeFormInputsByElementId.clear(),d),f(()=>[this.activeFeature,this.activeLayer,this.activeForm],()=>{this._syncAttachments()},d)]),this._prepare()}destroy(){this._prepareTask=h(this._prepareTask),this._workingFeatures.destroyAll(),p(this._expressionsManager),this._updatingHandles.destroy(),this._reactiveGraphicLookup=new m,this._emptyForm.destroy(),this._emptyFormTemplate.destroy()}get activeFeature(){const e=this.activeFeatureIndex;return e<0?null:this.features.at(e)}get activeForm(){if("batch"===this.mode)return this.sharedForm;const e=this._workingFeatures.at(this.activeFeatureIndex);if(!e)return this._emptyForm;const t=this._featureFormMap.get(e);if(t)return t;const s=this._makeBatchFormInputsForFeature(e);return s!==this._emptyForm&&this._featureFormMap.set(e,s),s}get activeLayer(){const{activeFeature:e}=this;if(!e)return null;return A(e)??null}get calculating(){return this._expressionsManager.calculating}get expressionEvaluationFailed(){return this._expressionsManager.expressionEvaluationFailed}get hasNonActiveInvalidFeatures(){if("batch"===this.mode)return!1;const{activeFeature:e}=this;return this.invalidFeatures.some(t=>t!==e)}get hasAsyncArcadeExpressions(){return this._hasAsyncArcadeExpressions}get hasTooManyFeatures(){return this._workingFeatures.length>this.maximumFeatureCount}get hasTooManyComplexFeatures(){return this._workingFeatures.length>this.maximumFeatureCountWithComplexForms&&this.hasAsyncArcadeExpressions}get invalidFeatures(){return this.sharedForm.invalidFeatures}get hasVisibleInputs(){return this.visibleInputs.length>0}get hasLayersWithContingentValues(){for(const e of this.layers){const t=this._layerContingentValuesMap.get(e);if(t&&t.size>0)return!0}return!1}get visibleInputs(){return this.activeForm.inputs.filter(e=>e.visible)}get noVisibleElementsReason(){if(this.hasVisibleInputs)return null;if(0===this.activeForm.inputs.length)return"noElements";const e=new Set;for(const t of this.activeForm.inputs)switch(t.visibilityCode){case"hidden:not-in-all-layers":case"hidden:no-domain-in-common":e.add("noElementsInCommon");break;case"hidden:field-definition":case"hidden:group-visibility-expression:all-features":case"hidden:visibility-expression:all-features":e.add("allElementsHidden");break;case"hidden:group-visibility-expression:some-features":case"hidden:visibility-expression:some-features":return"elementsHiddenInSome"}return e.has("allElementsHidden")?"allElementsHidden":"noElementsInCommon"}get status(){const e=this._prepareTask;return null==e?"not-loaded":e.finished?null!=e.error?"failed":"loaded":"loading"}get submittable(){return this.valid,!0}get updating(){return this._updatingHandles.updating||this.calculating}get valid(){return this.sharedForm.valid&&Array.from(this._featureFormMap.values()).every(e=>e.valid)}get layers(){const e=new Set;return this.features.forEach(t=>{const s=A(t);s&&e.add(s)}),Array.from(e)}get mode(){return this.activeFeatureIndex>-1?"single":"batch"}submit(){this.submitHasBeenAttempted=!0,this.emit("submit",{name:"submit",results:this._makeSubmitResults(),valid:this.valid})}findFieldInput(e){if(null==e)return;const t=this._activeFormInputsByElementId;if(t.has(e))return t.get(e);const s=this.activeForm.allFieldInputs.find(t=>t.template.elementId===e);return void 0!==s?(t.set(e,s),s):void 0}getFirstVisibleInvalidFieldInput(){if(this.hasVisibleInputs&&!this.activeForm.valid)for(const e of this.visibleInputs){if(j(e)){const t=e.inputs.find(e=>H(e)&&!e.valid);if(t)return{input:t,groupInput:e}}if(H(e)&&!e.valid)return{input:e}}}getFieldInputValue(e){return this.findFieldInput(e)?.value}getValues(e){const t=this._reactiveGraphicLookup.get(e);if(!t)throw new i("feature-not-found","The given feature is not present in the BatchAttributeForm");return{...t.attributes}}notifyGeometriesChanged(e){const t=[];for(const s of e){const e=this._reactiveGraphicLookup.get(s);e&&(t.push(e),e.geometry=s.geometry)}this._expressionsManager.runGeometryDependentExpressions(t)}async setFieldInputValue(e,t){const s=new Set(this.invalidFeatures);await e.setValueFromUser(t),this.userHasChangedValues=!0,this._trackValidityChange(s),this.emit("value-change",{features:e.features.toArray().map(e=>e.source),fieldName:e.fieldName,name:"value-change",value:t})}async setValue(e,t){const s=this.findFieldInput(e);if(null==s)throw new i("no-FieldInput-found",`Cannot set the value of FieldInput with ID: ${e} because none was found in the active form`);await this.setFieldInputValue(s,t)}async stageAddAttachments(e,t){if(0===t.length)return[];const s=this._findAttachmentInput(e);if(!s)return[];const r=await s.stageAddAttachments(t,this._expressionsManager.arcadeContext);return this.userHasChangedValues=!0,this._emitAttachmentsChange(s),r}stageDeleteAttachment(e,t){const s=this._findAttachmentInput(e);if(!s)return;const r=this._findAttachment(s,t);r&&(s.stageDeleteAttachment(r),this.userHasChangedValues=!0,this._emitAttachmentsChange(s))}stageRenameAttachment(e,t,s){const r=this._findAttachmentInput(e);if(!r)return;const i=this._findAttachment(r,t);i&&0!==s.trim().length&&(r.stageRenameAttachment(i,s.trim()),this.userHasChangedValues=!0,this._emitAttachmentsChange(r))}async stageReplaceAttachment(e,t,s){const r=this._findAttachmentInput(e);if(!r)return;const i=this._findAttachment(r,t);i&&(await r.stageReplaceAttachment(i,s,this._expressionsManager.arcadeContext),this.userHasChangedValues=!0,this._emitAttachmentsChange(r))}clearAttachmentChanges(e){const t=this._findAttachmentInput(e);t&&(t.clearAttachmentChanges(),this._emitAttachmentsChange(t))}userChangesHaveMadeFeatureInvalid(e){return!!this._reactiveGraphicLookup.get(e)?.userChangesHaveMadeInvalid}async _trackValidityChange(e){await y(()=>!1===this.calculating);const t=this.invalidFeatures;for(const s of t)!1===e.has(s)&&this._reactiveGraphicLookup.has(s)&&(this._reactiveGraphicLookup.get(s).userChangesHaveMadeInvalid=!0)}validate(){return!1}_makeBatchFormInputsForFeature(e){const t=this._layerTemplateMap.get(e.layer);return t?V(t,new r([e]),this._expressionsManager):this._emptyForm}_makeSubmitResults(){const e=new Map;for(const[s,r]of this._reactiveGraphicLookup){const i=[],a=[],n=this._featureFormMap.get(r)?.allAttachmentElementInputs??[];for(const e of n)t(i,e.toSubmitEdits()),e.valid||a.push(e.template.elementId);e.set(s,{feature:s,values:{...r.attributes},invalidFields:[],attachmentEdits:i,invalidAttachmentElementIds:a})}for(const t of this.sharedForm.allFieldInputs)for(const s of t.invalidFeatures)e.get(s)?.invalidFields.push(t.fieldName);return Array.from(e.values())}_findAttachmentInput(e){const t=this.activeForm.allAttachmentElementInputs.find(t=>t.template.elementId===e);return t||n.getLogger(this).error(`Attachment input not found for elementId '${e}'`),t}_findAttachment(e,t){const s=e.findAttachment(t);return s||n.getLogger(this).error(`Attachment '${t}' not found for attachment element '${e.template.elementId}'`),s}_makeAttachmentEdits(e){const s=[];for(const r of e.allAttachmentElementInputs)t(s,r.toSubmitEdits());return s}_emitAttachmentsChange(e){const t=e.single.feature;if(!t)return;const s=this._featureFormMap.get(t);this.emit("attachments-change",{name:"attachments-change",feature:t.source,attachmentEdits:this._makeAttachmentEdits(s??this.activeForm),valid:this.valid})}_prepare(){this._hasAsyncArcadeExpressions=!1,this._prepareTask=h(this._prepareTask),this._updateWorkingFeatures(),p(this._expressionsManager),this.userHasChangedValues=!1,this._expressionsManager=new b({arcadeContext:{editType:this.editType,spatialReference:this.spatialReference??_.WebMercator,map:this.map,timeZone:this.timeZone||"system"}});const{layers:e}=this;if(0===e.length)return;const t=s(async t=>{try{l(t);const s=new Map;for(const i of e){const e=await B(i);if(l(t),e){const t=e.fieldGroups.flatMap(e=>e.fields);this._layerContingentValuesMap.set(i,new Set(t))}else this._layerContingentValuesMap.set(i,new Set);const r=W(this.layerInfos,i),a=await R(i,{arcadeExecutorProvider:this._arcadeExecutorProvider,formTimeZone:this.timeZone},r?.formTemplate);l(t),this._layerTemplateMap.set(i,a);const n=a.getExpressionExecutorsForLayer(i);if(this._expressionsManager.layerExpressionsModelMap.set(i,new k({preserveFieldValuesWhenHidden:a.preserveFieldValuesWhenHidden,executorMap:n})),!this._hasAsyncArcadeExpressions)for(const t of n.keys()){const e=n.get(t);if(this._hasAsyncArcadeExpressions=!0===(e.editableExpression?.isAsync||e.requiredExpression?.isAsync||e.valueExpression?.isAsync||e.visibilityExpression?.isAsync),this._hasAsyncArcadeExpressions)break}for(const t of a.elements){if(G(t))continue;const e=t.clone();U(e)&&(e.elements=e.elements.filter(e=>!G(e)));const{elementId:r}=e;s.has(r)?s.get(r).foldIn(e):s.set(r,e)}}if(this.hasTooManyComplexFeatures)throw new i("too-many-features-with-complex-forms","There are too many features to load into the form with the configured complexity");if(this.hasTooManyFeatures)throw new i("too-many-features","There are too many features to load into the form.");const r=new L({elements:Array.from(s.values())});this.sharedFormTemplate=r,this.sharedForm=V(r,this._workingFeatures,this._expressionsManager),await this._expressionsManager.runAllExpressions(this._workingFeatures.toArray())}catch(s){throw u(s)||n.getLogger(this).error("Failed preparing form",s),s}});this._updatingHandles.consumePromise(t.promise),this._prepareTask=t}_updateWorkingFeatures(){this._workingFeatures.destroyAll();for(const t of this._featureFormMap.values())t.destroy();this._featureFormMap.clear(),this._attachmentCache.clear();const{features:e}=this;if(this._reactiveGraphicLookup=new m,0!==e.length){this._workingFeatures.addMany(e.map(w));for(const e of this._workingFeatures)this._reactiveGraphicLookup.set(e.source,e)}}async _syncAttachments(){const{activeFeature:e,activeLayer:t,activeForm:s}=this;if(!(e&&s&&I(t)&&C(t)))return;const r=e.getObjectId();if(null==r)return;const i=this._attachmentCache.get(t),a=s.allAttachmentElementInputs;if(!a.length)return;let n;if(i){const e=i.get(r);e&&(n=e)}if(!n){n=await E(t,r,a);o(this._attachmentCache,t,()=>new m).set(r,n)}for(const o of a)o.applyFetchedAttachments(D(o,n))}};e([g()],N.prototype,"_attachmentCache",void 0),e([g({readOnly:!0})],N.prototype,"activeFeature",null),e([g()],N.prototype,"activeFeatureIndex",void 0),e([g({readOnly:!0})],N.prototype,"activeForm",null),e([g({readOnly:!0})],N.prototype,"activeLayer",null),e([g()],N.prototype,"disabled",void 0),e([g()],N.prototype,"calculating",null),e([g()],N.prototype,"editType",void 0),e([g()],N.prototype,"features",void 0),e([g()],N.prototype,"expressionEvaluationFailed",null),e([g()],N.prototype,"hasNonActiveInvalidFeatures",null),e([g()],N.prototype,"hasAsyncArcadeExpressions",null),e([g()],N.prototype,"_hasAsyncArcadeExpressions",void 0),e([g()],N.prototype,"invalidFeatures",null),e([g()],N.prototype,"hasVisibleInputs",null),e([g()],N.prototype,"hasLayersWithContingentValues",null),e([g()],N.prototype,"maximumFeatureCount",void 0),e([g()],N.prototype,"maximumFeatureCountWithComplexForms",void 0),e([g()],N.prototype,"visibleInputs",null),e([g()],N.prototype,"map",void 0),e([g()],N.prototype,"noVisibleElementsReason",null),e([g()],N.prototype,"readOnly",void 0),e([g()],N.prototype,"spatialReference",void 0),e([g()],N.prototype,"submitHasBeenAttempted",void 0),e([g()],N.prototype,"timeZone",void 0),e([g()],N.prototype,"updating",null),e([g()],N.prototype,"valid",null),e([g()],N.prototype,"layers",null),e([g()],N.prototype,"mode",null),e([g()],N.prototype,"sharedForm",void 0),e([g()],N.prototype,"sharedFormTemplate",void 0),e([g()],N.prototype,"userHasChangedValues",void 0),e([g()],N.prototype,"layerInfos",void 0),e([g()],N.prototype,"_arcadeExecutorProvider",void 0),e([g()],N.prototype,"_prepareTask",void 0),e([g()],N.prototype,"_reactiveGraphicLookup",void 0),e([g()],N.prototype,"_layerTemplateMap",void 0),e([g()],N.prototype,"_layerContingentValuesMap",void 0),e([g()],N.prototype,"_workingFeatures",void 0),e([g()],N.prototype,"_expressionsManager",void 0),N=e([v("esri.widgets.BatchAttributeForm.BatchAttributeFormViewModel")],N);const O=N;function Z(e){return null!=e&&e.trim().length>0}function P(e,t){const s=e.keywords;return Z(s)&&s.toLowerCase()===t}function D(e,t){const s="attachment"===e.input?.type?e.input.attachmentAssociationType:"exact",r=e.attachmentKeyword;if("any"===s)return t;if("exactOrNone"===s){if(S(r))return t.filter(e=>!Z(e.keywords));const e=r.toLowerCase();return t.filter(t=>!Z(t.keywords)||P(t,e))}if(S(r))return t;const i=r.toLowerCase();return t.filter(e=>P(e,i))}export{O as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{pushIfSome as t}from"../../core/arrayUtils.js";import{createTask as s}from"../../core/asyncUtils.js";import r from"../../core/Collection.js";import i from"../../core/Error.js";import{EventedAccessor as a}from"../../core/Evented.js";import n from"../../core/Logger.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{abortMaybe as h,destroyMaybe as l}from"../../core/maybe.js";import{throwIfAborted as p,isAbortError as u}from"../../core/promiseUtils.js";import m from"../../core/ReactiveMap.js";import{on as c,sync as d,watch as f,whenOnce as y}from"../../core/reactiveUtils.js";import{property as g,subclass as v}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as _}from"../../core/support/UpdatingHandles.js";import F from"../../geometry/SpatialReference.js";import{getGraphicLayer as A}from"../../graphic/graphicOriginUtils.js";import{system as x}from"../../time/constants.js";import{createReactiveGraphic as w,isAttributeFormSupportedLayerWithAttachments as I,layerSupportsQueryAttachments as C,queryAttachmentsForElements as E}from"./batchAttributeFormUtils.js";import{ArcadeExecutorProvider as M}from"./expressions/ArcadeExecutorProvider.js";import{ExpressionsManager as b}from"./expressions/ExpressionsManager.js";import{ExpressionsModel as k}from"./expressions/ExpressionsModel.js";import T from"./inputs/BatchFormInputs.js";import{createBatchFormInputsFromBatchFormTemplate as V}from"./inputs/support/createBatchFormInputs.js";import{isGroupInput as j,isFieldInput as H}from"./inputs/support/inputUtils.js";import L from"./templates/BatchFormTemplate.js";import{getLayerContingentValuesMetaData as B}from"./templates/support/contingentValuesUtils.js";import{createBatchFormTemplate as R}from"./templates/support/createBatchFormTemplate.js";import{isExcludedFromSharedForm as S,isGroupElementTemplate as G}from"./templates/support/templateUtils.js";import{isEmptyValue as U}from"../support/forms/formUtils.js";function W(e,t){return e?.find(e=>e.layer===t)}let N=class extends a{constructor(e){super(e),this._attachmentCache=new m,this.activeFeatureIndex=-1,this.disabled=!1,this.editType="NA",this.features=new r,this._hasAsyncArcadeExpressions=!1,this.maximumFeatureCount=2e3,this.maximumFeatureCountWithComplexForms=50,this.map=null,this.readOnly=!1,this.spatialReference=null,this.submitHasBeenAttempted=!1,this.timeZone=null,this.userHasChangedValues=!1,this.layerInfos=null,this._arcadeExecutorProvider=new M,this._selectedAttachment=null,this._activeFormInputsByElementId=new Map,this._emptyForm=new T({inputs:[]}),this._emptyFormTemplate=new L({elements:[]}),this._featureFormMap=new Map,this._prepareTask=null,this._reactiveGraphicLookup=new m,this._updatingHandles=new _,this._layerTemplateMap=new m,this._layerContingentValuesMap=new m,this._workingFeatures=new r,this._expressionsManager=new b({arcadeContext:{editType:"NA",spatialReference:null,map:null,timeZone:x}}),this.sharedForm=this._emptyForm,this.sharedFormTemplate=this._emptyFormTemplate}initialize(){this.addHandles([c(()=>this.features,"after-changes",()=>{this.setSelectedAttachment(null),this.notifyChange("layers"),this._prepare()},d),f(()=>[this.features,this.map,this.timeZone,this.editType],()=>this._prepare(),d),f(()=>this.activeForm,()=>{this._activeFormInputsByElementId.clear(),this._syncAttachments()},d),f(()=>this.activeFeature,()=>{this.setSelectedAttachment(null),this._syncAttachments()},d)]),this._prepare()}destroy(){this._prepareTask=h(this._prepareTask),this._workingFeatures.destroyAll(),l(this._expressionsManager),this._updatingHandles.destroy(),this._reactiveGraphicLookup=new m,this._emptyForm.destroy(),this._emptyFormTemplate.destroy()}get activeFeature(){const e=this.activeFeatureIndex;return e<0?null:this.features.at(e)}get activeForm(){if("batch"===this.mode)return this.sharedForm;const e=this._workingFeatures.at(this.activeFeatureIndex);if(!e)return this._emptyForm;const t=this._featureFormMap.get(e);if(t)return t;const s=this._makeBatchFormInputsForFeature(e);return s!==this._emptyForm&&this._featureFormMap.set(e,s),s}get activeLayer(){const{activeFeature:e}=this;if(!e)return null;return A(e)??null}get calculating(){return this._expressionsManager.calculating}get expressionEvaluationFailed(){return this._expressionsManager.expressionEvaluationFailed}get hasNonActiveInvalidFeatures(){if("batch"===this.mode)return!1;const{activeFeature:e}=this;return this.invalidFeatures.some(t=>t!==e)}get hasAsyncArcadeExpressions(){return this._hasAsyncArcadeExpressions}get hasTooManyFeatures(){return this._workingFeatures.length>this.maximumFeatureCount}get hasTooManyComplexFeatures(){return this._workingFeatures.length>this.maximumFeatureCountWithComplexForms&&this.hasAsyncArcadeExpressions}get invalidFeatures(){return this.sharedForm.invalidFeatures}get hasVisibleInputs(){return this.visibleInputs.length>0}get hasLayersWithContingentValues(){for(const e of this.layers){const t=this._layerContingentValuesMap.get(e);if(t&&t.size>0)return!0}return!1}get visibleInputs(){return this.activeForm.inputs.filter(e=>e.visible)}get noVisibleElementsReason(){if(this.hasVisibleInputs)return null;if(0===this.activeForm.inputs.length)return"noElements";const e=new Set;for(const t of this.activeForm.inputs)switch(t.visibilityCode){case"hidden:not-in-all-layers":case"hidden:no-domain-in-common":e.add("noElementsInCommon");break;case"hidden:field-definition":case"hidden:group-visibility-expression:all-features":case"hidden:visibility-expression:all-features":e.add("allElementsHidden");break;case"hidden:group-visibility-expression:some-features":case"hidden:visibility-expression:some-features":return"elementsHiddenInSome"}return e.has("allElementsHidden")?"allElementsHidden":"noElementsInCommon"}get status(){const e=this._prepareTask;return null==e?"not-loaded":e.finished?null!=e.error?"failed":"loaded":"loading"}get submittable(){return this.valid,!0}get updating(){return this._updatingHandles.updating||this.calculating}get valid(){return this.sharedForm.valid&&Array.from(this._featureFormMap.values()).every(e=>e.valid)}get layers(){const e=new Set;return this.features.forEach(t=>{const s=A(t);s&&e.add(s)}),Array.from(e)}get mode(){return this.activeFeatureIndex>-1?"single":"batch"}submit(){this.submitHasBeenAttempted=!0,this.emit("submit",{name:"submit",results:this._makeSubmitResults(),valid:this.valid})}get selectedAttachment(){return this._selectedAttachment}findFieldInput(e){if(null==e)return;const t=this._activeFormInputsByElementId;if(t.has(e))return t.get(e);const s=this.activeForm.allFieldInputs.find(t=>t.template.elementId===e);return void 0!==s?(t.set(e,s),s):void 0}getFirstVisibleInvalidFieldInput(){if(this.hasVisibleInputs&&!this.activeForm.valid)for(const e of this.visibleInputs){if(j(e)){const t=e.inputs.find(e=>H(e)&&!e.valid);if(t)return{input:t,groupInput:e}}if(H(e)&&!e.valid)return{input:e}}}getFieldInputValue(e){return this.findFieldInput(e)?.value}getValues(e){const t=this._reactiveGraphicLookup.get(e);if(!t)throw new i("feature-not-found","The given feature is not present in the BatchAttributeForm");return{...t.attributes}}notifyGeometriesChanged(e){const t=[];for(const s of e){const e=this._reactiveGraphicLookup.get(s);e&&(t.push(e),e.geometry=s.geometry)}this._expressionsManager.runGeometryDependentExpressions(t)}async setFieldInputValue(e,t){const s=new Set(this.invalidFeatures);await e.setValueFromUser(t),this.userHasChangedValues=!0,this._trackValidityChange(s),this.emit("value-change",{features:e.features.toArray().map(e=>e.source),fieldName:e.fieldName,name:"value-change",value:t})}async setValue(e,t){const s=this.findFieldInput(e);if(null==s)throw new i("no-FieldInput-found",`Cannot set the value of FieldInput with ID: ${e} because none was found in the active form`);await this.setFieldInputValue(s,t)}async stageAddAttachments(e,t){if(0===t.length)return[];const s=this._findAttachmentInput(e);if(!s)return[];const r=await s.stageAddAttachments(t,this._expressionsManager.arcadeContext);return this.userHasChangedValues=!0,this._emitAttachmentsChange(s),r}stageDeleteAttachment(e,t){const s=this._findAttachmentInput(e);if(!s)return;const r=this._findAttachment(s,t);r&&(s.stageDeleteAttachment(r),this.userHasChangedValues=!0,this._emitAttachmentsChange(s))}stageRenameAttachment(e,t,s){const r=this._findAttachmentInput(e);if(!r)return;const i=this._findAttachment(r,t);i&&0!==s.trim().length&&(r.stageRenameAttachment(i,s.trim()),this.userHasChangedValues=!0,this._emitAttachmentsChange(r))}async stageReplaceAttachment(e,t,s){const r=this._findAttachmentInput(e);if(!r)return;const i=this._findAttachment(r,t);i&&(await r.stageReplaceAttachment(i,s,this._expressionsManager.arcadeContext),this.userHasChangedValues=!0,this._emitAttachmentsChange(r))}clearAttachmentChanges(e){const t=this._findAttachmentInput(e);t&&(t.clearAttachmentChanges(),this._emitAttachmentsChange(t))}setSelectedAttachment(e){this._selectedAttachment=e??null}userChangesHaveMadeFeatureInvalid(e){return!!this._reactiveGraphicLookup.get(e)?.userChangesHaveMadeInvalid}async _trackValidityChange(e){await y(()=>!1===this.calculating);const t=this.invalidFeatures;for(const s of t)!1===e.has(s)&&this._reactiveGraphicLookup.has(s)&&(this._reactiveGraphicLookup.get(s).userChangesHaveMadeInvalid=!0)}validate(){return!1}_makeBatchFormInputsForFeature(e){const t=this._layerTemplateMap.get(e.layer);return t?V(t,new r([e]),this._expressionsManager):this._emptyForm}_makeSubmitResults(){const e=new Map;for(const[s,r]of this._reactiveGraphicLookup){const i=[],a=[],n=this._featureFormMap.get(r)?.allAttachmentElementInputs??[];for(const e of n)t(i,e.toSubmitEdits()),e.valid||a.push(e.template.elementId);e.set(s,{feature:s,values:{...r.attributes},invalidFields:[],attachmentEdits:i,invalidAttachmentElementIds:a})}for(const t of this.sharedForm.allFieldInputs)for(const s of t.invalidFeatures)e.get(s)?.invalidFields.push(t.fieldName);return Array.from(e.values())}_findAttachmentInput(e){const t=this.activeForm.allAttachmentElementInputs.find(t=>t.template.elementId===e);return t||n.getLogger(this).error(`Attachment input not found for elementId '${e}'`),t}_findAttachment(e,t){const s=e.findAttachment(t);return s||n.getLogger(this).error(`Attachment '${t}' not found for attachment element '${e.template.elementId}'`),s}_makeAttachmentEdits(e){const s=[];for(const r of e.allAttachmentElementInputs)t(s,r.toSubmitEdits());return s}_emitAttachmentsChange(e){const t=e.single.feature;if(!t)return;const s=this._featureFormMap.get(t);this.emit("attachments-change",{name:"attachments-change",feature:t.source,attachmentEdits:this._makeAttachmentEdits(s??this.activeForm),valid:this.valid})}_prepare(){this._hasAsyncArcadeExpressions=!1,this._prepareTask=h(this._prepareTask),this._updateWorkingFeatures(),l(this._expressionsManager),this.userHasChangedValues=!1,this._expressionsManager=new b({arcadeContext:{editType:this.editType,spatialReference:this.spatialReference??F.WebMercator,map:this.map,timeZone:this.timeZone||"system"}});const{layers:e}=this;if(0===e.length)return;const t=s(async t=>{try{p(t);const s=new Map;for(const i of e){const e=await B(i);if(p(t),e){const t=e.fieldGroups.flatMap(e=>e.fields);this._layerContingentValuesMap.set(i,new Set(t))}else this._layerContingentValuesMap.set(i,new Set);const r=W(this.layerInfos,i),a=await R(i,{arcadeExecutorProvider:this._arcadeExecutorProvider,formTimeZone:this.timeZone},r?.formTemplate);p(t),this._layerTemplateMap.set(i,a);const n=a.getExpressionExecutorsForLayer(i);if(this._expressionsManager.layerExpressionsModelMap.set(i,new k({preserveFieldValuesWhenHidden:a.preserveFieldValuesWhenHidden,executorMap:n})),!this._hasAsyncArcadeExpressions)for(const t of n.keys()){const e=n.get(t);if(this._hasAsyncArcadeExpressions=!0===(e.editableExpression?.isAsync||e.requiredExpression?.isAsync||e.valueExpression?.isAsync||e.visibilityExpression?.isAsync),this._hasAsyncArcadeExpressions)break}for(const t of a.elements){if(S(t))continue;const e=t.clone();G(e)&&(e.elements=e.elements.filter(e=>!S(e)));const{elementId:r}=e;s.has(r)?s.get(r).foldIn(e):s.set(r,e)}}if(this.hasTooManyComplexFeatures)throw new i("too-many-features-with-complex-forms","There are too many features to load into the form with the configured complexity");if(this.hasTooManyFeatures)throw new i("too-many-features","There are too many features to load into the form.");const r=new L({elements:Array.from(s.values())});this.sharedFormTemplate=r,this.sharedForm=V(r,this._workingFeatures,this._expressionsManager),await this._expressionsManager.runAllExpressions(this._workingFeatures.toArray())}catch(s){throw u(s)||n.getLogger(this).error("Failed preparing form",s),s}});this._updatingHandles.consumePromise(t.promise),this._prepareTask=t}_updateWorkingFeatures(){this._workingFeatures.destroyAll();for(const t of this._featureFormMap.values())t.destroy();this._featureFormMap.clear(),this._attachmentCache.clear();const{features:e}=this;if(this._reactiveGraphicLookup=new m,0!==e.length){this._workingFeatures.addMany(e.map(w));for(const e of this._workingFeatures)this._reactiveGraphicLookup.set(e.source,e)}}async _syncAttachments(){const{activeFeature:e,activeLayer:t,activeForm:s}=this;if(!(e&&s&&I(t)&&C(t)))return;const r=e.getObjectId();if(null==r)return;const i=this._attachmentCache.get(t),a=s.allAttachmentElementInputs;if(!a.length)return;let n;if(i){const e=i.get(r);e&&(n=e)}if(!n){n=await E(t,r,a);o(this._attachmentCache,t,()=>new m).set(r,n)}for(const o of a)o.applyFetchedAttachments(D(o,n))}};e([g()],N.prototype,"_attachmentCache",void 0),e([g({readOnly:!0})],N.prototype,"activeFeature",null),e([g()],N.prototype,"activeFeatureIndex",void 0),e([g({readOnly:!0})],N.prototype,"activeForm",null),e([g({readOnly:!0})],N.prototype,"activeLayer",null),e([g()],N.prototype,"disabled",void 0),e([g()],N.prototype,"calculating",null),e([g()],N.prototype,"editType",void 0),e([g()],N.prototype,"features",void 0),e([g()],N.prototype,"expressionEvaluationFailed",null),e([g()],N.prototype,"hasNonActiveInvalidFeatures",null),e([g()],N.prototype,"hasAsyncArcadeExpressions",null),e([g()],N.prototype,"_hasAsyncArcadeExpressions",void 0),e([g()],N.prototype,"invalidFeatures",null),e([g()],N.prototype,"hasVisibleInputs",null),e([g()],N.prototype,"hasLayersWithContingentValues",null),e([g()],N.prototype,"maximumFeatureCount",void 0),e([g()],N.prototype,"maximumFeatureCountWithComplexForms",void 0),e([g()],N.prototype,"visibleInputs",null),e([g()],N.prototype,"map",void 0),e([g()],N.prototype,"noVisibleElementsReason",null),e([g()],N.prototype,"readOnly",void 0),e([g()],N.prototype,"spatialReference",void 0),e([g()],N.prototype,"submitHasBeenAttempted",void 0),e([g()],N.prototype,"timeZone",void 0),e([g()],N.prototype,"updating",null),e([g()],N.prototype,"valid",null),e([g()],N.prototype,"layers",null),e([g()],N.prototype,"mode",null),e([g()],N.prototype,"sharedForm",void 0),e([g()],N.prototype,"sharedFormTemplate",void 0),e([g()],N.prototype,"selectedAttachment",null),e([g()],N.prototype,"userHasChangedValues",void 0),e([g()],N.prototype,"layerInfos",void 0),e([g()],N.prototype,"_arcadeExecutorProvider",void 0),e([g()],N.prototype,"_selectedAttachment",void 0),e([g()],N.prototype,"_prepareTask",void 0),e([g()],N.prototype,"_reactiveGraphicLookup",void 0),e([g()],N.prototype,"_layerTemplateMap",void 0),e([g()],N.prototype,"_layerContingentValuesMap",void 0),e([g()],N.prototype,"_workingFeatures",void 0),e([g()],N.prototype,"_expressionsManager",void 0),N=e([v("esri.widgets.BatchAttributeForm.BatchAttributeFormViewModel")],N);const O=N;function Z(e){return null!=e&&e.trim().length>0}function P(e,t){const s=e.keywords;return Z(s)&&s.toLowerCase()===t}function D(e,t){const s="attachment"===e.input?.type?e.input.attachmentAssociationType:"exact",r=e.attachmentKeyword;if("any"===s)return t;if("exactOrNone"===s){if(U(r))return t.filter(e=>!Z(e.keywords));const e=r.toLowerCase();return t.filter(t=>!Z(t.keywords)||P(t,e))}if(U(r))return t;const i=r.toLowerCase();return t.filter(e=>P(e,i))}export{O as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import{isString as t}from"../../support/guards.js";import{isSupportedImage as n}from"../Attachments/support/attachmentUtils.js";function r(t){return String(t.globalId||t.id||t.name)}function u(n,r,u){const{size:e,url:o}=n;if(!t(o)||!o.length)return null;const s=[];return r&&null!=u&&s.push(`w=${u}`),null==e||Number.isNaN(e)||s.push(`s=${e}`),s.length?`${o}${o.includes("?")?"&":"?"}${s.join("&")}`:o}function e(t){return n(t.contentType)}export{r as getAttachmentKey,u as getAttachmentUrl,e as isImageAttachment};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
const
|
|
2
|
+
const t="esri-batch-attribute-form",e=`${t}__group`,a=`${t}__input`,i=`${t}__attachment-element`,n={base:t,form:`${t}__form`,formHeader:`${t}__form-header`,noticeError:`${t}__notice-error`,label:`${t}__label`,labelTextContent:`${t}__label-text-content`,fieldInput:`${a}`,textElementInput:`${t}__text-element-input`,attachmentElementInput:`${i}-input`,attachmentElementLabel:`${i}-label`,attachmentElementList:`${i}-list`,attachmentElementListItem:`${i}-list-item`,attachmentElementListItemStart:`${i}-list-item-start`,attachmentElementListItemThumb:`${i}-list-item-thumb`,attachmentElementListItemIcon:`${i}-list-item-icon`,attachmentElementEmptyState:`${i}-empty-state`,attachmentElementEmptyAction:`${i}-empty-action`,attachmentElementDetail:`${i}-detail`,attachmentElementDetailPreview:`${i}-detail-preview`,attachmentElementDetailPreviewImage:`${i}-detail-preview-image`,attachmentElementDetailPreviewIcon:`${i}-detail-preview-icon`,attachmentElementDetailActions:`${i}-detail-actions`,attachmentElementDetailMetadata:`${i}-detail-metadata`,attachmentElementDetailMetadataLabel:`${i}-detail-metadata-label`,attachmentElementDetailMetadataValue:`${i}-detail-metadata-value`,relationshipElementInput:`${t}__relationship-element-input`,utilityNetworkAssociationsElementInput:`${t}__utility-network-associations-element-input`,inputRadio:`${a}--radio`,placeholderRadio:`${a}--radio-placeholder`,inputRadioGroup:`${a}--radio-group`,inputRadioLabel:`${a}--radio-label`,inputDisabled:`${a}--disabled`,inputSwitch:`${a}--switch`,centeredButton:`${t}__centered-button`,description:`${t}__description-text`,dateInputContainer:`${`${t}__date`}-input-container`,block:`${t}__block`,group:e,groupSequential:`${e}--sequential`,individualElement:`${e}__individual-element`};export{n as css};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import e from"../../../core/Collection.js";import a from"../../../core/Logger.js";import{isAbortError as n}from"../../../core/promiseUtils.js";import s from"../../../core/ReactiveMap.js";import i from"../../../core/ReactiveSet.js";import{generateBracedUUID as o}from"../../../core/uuid.js";import{property as r,subclass as l}from"../../../core/accessorSupport/decorators.js";import d from"../../../rest/query/support/AttachmentInfo.js";import{isAttributeFormSupportedLayer as c}from"../batchAttributeFormUtils.js";import h from"./EditableInput.js";import
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../../core/Collection.js";import a from"../../../core/Logger.js";import{isAbortError as n}from"../../../core/promiseUtils.js";import s from"../../../core/ReactiveMap.js";import i from"../../../core/ReactiveSet.js";import{generateBracedUUID as o}from"../../../core/uuid.js";import{property as r,subclass as l}from"../../../core/accessorSupport/decorators.js";import{getEffectiveLayerCapabilities as d}from"../../../layers/support/layerUtils.js";import m from"../../../rest/query/support/AttachmentInfo.js";import{isAttributeFormSupportedLayer as c}from"../batchAttributeFormUtils.js";import h from"./EditableInput.js";import p from"./SingleFeatureInputAdapter.js";let u=-1,g=class extends h{constructor(t){super(t),this.attachments=[],this.group=null,this.single=new p({input:this}),this.type="attachment",this._initialAttachments=[],this._stagedAdds=new e,this._stagedDeletes=new i,this._stagedUpdates=new s}get allowUserRename(){return this.template.allowUserRename}get attachmentKeyword(){return this.template.attachmentKeyword?.trim()}get displayFilename(){return this.template.displayFilename}get feature(){return this.single.feature}get hasAttachmentChanges(){return this._stagedAdds.length>0||this._stagedUpdates.size>0||this._stagedDeletes.size>0}get input(){return this.template.input}get layer(){return this.single.layer}get maxAttachmentCount(){return this.template.maxAttachmentCount}get minAttachmentCount(){return this.template.minAttachmentCount}get supportsResize(){const{layer:t}=this;if(!t)return!1;const e=d(t);return!!e&&("attachment"in e&&!!e.attachment?.supportsResize)}get useOriginalFilename(){return this.template.useOriginalFilename}get valid(){const t=this.attachments.length,e=this.minAttachmentCount??-1/0,a=this.maxAttachmentCount??1/0,n=this.hasAttachmentChanges;return!(t<e||t>a)||!n}get _expressionLayer(){const t=this.layer;if(t)return"scene"===t.type&&"associatedLayer"in t&&null!=t.associatedLayer?t.associatedLayer:"feature"===t.type?t:void 0}applyFetchedAttachments(t){for(const e of t)this._normalizeAttachmentName(e);this._initialAttachments=t,this._recomputeAttachments()}clearAttachmentChanges(){this._stagedAdds.removeAll(),this._stagedUpdates.clear(),this._stagedDeletes.clear(),this._recomputeAttachments()}stageAddAttachment(t){const{contentType:e,data:a,name:n}=t,s=t.globalId??o(),i=a instanceof Blob?a.size:void 0,r=n.trim(),l=new m({contentType:e??void 0,globalId:s,id:u--,keywords:this.attachmentKeyword??void 0,name:r,size:i});return this._stagedAdds.add({globalId:s,info:l,data:a}),this._recomputeAttachments(),l}async stageAddAttachments(t,e){if(0===t.length)return[];const a=[],n=new Map,s=Date.now();for(let i=0;i<t.length;i++){const o=t[i],r=o instanceof File?o.name:`attachment-${s}_${i+1}`,l=await this._computeAttachmentFilename(r,e),d=this._makeUniqueFilenameForOperation(n,l);a.push(this.stageAddAttachment({contentType:o.type,data:o,name:d}))}return a}findAttachment(t){if(t)return this.attachments.find(e=>e.globalId===t)}stageDeleteAttachment(t){const e=t.globalId;if(!e)return;const a=this._stagedAdds.findIndex(t=>t.globalId===e);if(a>-1)return this._stagedAdds.removeAt(a),void this._recomputeAttachments();this._stagedUpdates.delete(e),this._stagedDeletes.add(e),this._recomputeAttachments()}stageRenameAttachment(t,e){const a=t.globalId;if(!a)return;const n=e.trim(),s=this._stagedAdds.find(t=>t.globalId===a);if(s)return s.info.name=n,void this._recomputeAttachments();const i=this._stagedUpdates.get(a);this._stagedUpdates.set(a,{...i,info:t,name:n}),this._recomputeAttachments()}async stageReplaceAttachment(t,e,a){const n=e instanceof File?e.name:t.name,s=await this._computeAttachmentFilename(n,a);this._stageReplaceAttachment(t,e,s)}toSubmitEdits(){const t=[],e=[],n=Array.from(this._stagedDeletes);if(0===this._stagedAdds.length&&0===this._stagedUpdates.size&&0===n.length)return null;const s=this._featureIdentifier;if(!s)return a.getLogger(this).error("Unable to build attachment edits without a valid feature and layer."),null;for(const a of this._stagedAdds)t.push({feature:s,attachment:{globalId:a.globalId,contentType:a.info.contentType,data:a.data,name:a.info.name}});for(const[a,i]of this._stagedUpdates)e.push({feature:s,attachment:{globalId:a,contentType:i.contentType,data:i.data,name:i.name}});return{label:this.template.label,attachmentKeyword:this.attachmentKeyword,add:t,delete:n,update:e}}_recomputeAttachments(){const t=this._stagedDeletes,e=[];for(const a of this._stagedAdds)e.push(a.info);for(const a of this._initialAttachments){const n=a.globalId;if(!n||!t.has(n)){if(n&&this._stagedUpdates.has(n)){const t=this._stagedUpdates.get(n),s=a.clone();t.data instanceof Blob&&(s.size=t.data.size),null!=t.name&&(s.name=t.name),e.push(s);continue}e.push(a)}}this.attachments=e}get _featureIdentifier(){const t=this.single.feature,e=this.layer;if(!t||!c(e))return null;const a=e.objectIdField,n="globalIdField"in e?e.globalIdField:null,s=t.getGlobalId()??(n?t.getAttribute(n):void 0);if(s)return{globalId:s};const i=t.getObjectId()??t.getAttribute(a),o=Number(i);return null==i||isNaN(o)?null:{objectId:o}}async _computeAttachmentFilename(t,e){const s=this.template.filenameExpressionExecutor;if(!s)return t;const i=this.single.feature,o=i?.plainGraphic,r=this._expressionLayer,l={$originalfeature:i?.original,$editcontext:{editType:e.editType},$layer:r,$featureset:r,$datastore:r?.url,$feature:o,$map:e.map},d={rawOutput:!0,spatialReference:e.spatialReference,timeZone:e.timeZone};try{const t=s.isAsync?await s.executeAsync(l,d):s.execute(l,d);if("string"==typeof t&&t.trim().length>0)return t.trim()}catch(m){n(m)||a.getLogger(this).error("Failed evaluating attachment filename expression",m)}return t}_makeUniqueFilenameForOperation(t,e){const a=e.toLowerCase(),n=t.get(a)??0;if(t.set(a,n+1),0===n)return e;const s=e.lastIndexOf(".");return`${s>0?e.slice(0,s):e}_${n}${s>0?e.slice(s):""}`}_stageReplaceAttachment(t,e,a){const n=t.globalId;if(!n)return;const s=a.trim(),i=this._stagedAdds.find(t=>t.globalId===n);if(i)return i.data=e,i.info.name=s,i.info.contentType=e.type,i.info.size=e.size,void this._recomputeAttachments();const o=this._stagedUpdates.get(n);this._stagedUpdates.set(n,{...o,info:t,contentType:e.type||o?.contentType,data:e,name:s}),this._recomputeAttachments()}_normalizeAttachmentName(t){const{name:e}=t;"string"==typeof e&&(t.name=e.trim())}};t([r()],g.prototype,"allowUserRename",null),t([r()],g.prototype,"attachmentKeyword",null),t([r()],g.prototype,"attachments",void 0),t([r()],g.prototype,"displayFilename",null),t([r()],g.prototype,"feature",null),t([r()],g.prototype,"group",void 0),t([r({readOnly:!0})],g.prototype,"hasAttachmentChanges",null),t([r()],g.prototype,"input",null),t([r()],g.prototype,"layer",null),t([r()],g.prototype,"maxAttachmentCount",null),t([r()],g.prototype,"minAttachmentCount",null),t([r({readOnly:!0})],g.prototype,"single",void 0),t([r({readOnly:!0})],g.prototype,"type",void 0),t([r({readOnly:!0})],g.prototype,"supportsResize",null),t([r()],g.prototype,"useOriginalFilename",null),t([r({readOnly:!0})],g.prototype,"valid",null),t([r()],g.prototype,"_initialAttachments",void 0),t([r()],g.prototype,"_expressionLayer",null),t([r()],g.prototype,"_stagedAdds",void 0),t([r()],g.prototype,"_stagedDeletes",void 0),t([r()],g.prototype,"_stagedUpdates",void 0),t([r()],g.prototype,"_featureIdentifier",null),g=t([l("esri.widgets.BatchAttributeForm.inputs.AttachmentElementInput")],g);const f=g;export{f as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{property as
|
|
2
|
+
import{__decorate as t}from"tslib";import{property as o,subclass as e}from"../../../core/accessorSupport/decorators.js";import{ElementTemplateBase as p}from"./ElementTemplateBase.js";let i=class extends p{constructor(t){super(t),this.displayCount=3,this.displayType="list",this.group=null,this.orderByFields=null,this.relationshipId=null,this.type="relationship"}};t([o()],i.prototype,"displayCount",void 0),t([o()],i.prototype,"displayType",void 0),t([o({clonable:!1})],i.prototype,"group",void 0),t([o()],i.prototype,"orderByFields",void 0),t([o()],i.prototype,"relationshipId",void 0),t([o({readOnly:!0})],i.prototype,"type",void 0),i=t([e("esri.widgets.BatchAttributeForm.templates.RelationshipElementTemplate")],i);export{i as RelationshipElementTemplate};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{createArcadeProfile as e,createArcadeExecutor as t}from"../../../../arcade.js";import r from"../../../../core/Error.js";import n from"../../../../core/Logger.js";import{getEffectiveFieldAlias as o}from"../../../../editing/fieldUtils.js";import i from"../../../../form/ExpressionInfo.js";import{isAttachmentElement as s,isFieldElement as a,isGroupElement as l,isRelationshipElement as m,isTextElement as d,isUtilityNetworkAssociationsElement as p}from"../../../../form/support/formUtils.js";import{getLowerCaseEditTrackingFields as c,isFieldVisibleByDefault as f}from"../../../../layers/support/fieldUtils.js";import{isSubtypeSublayer as u,isSubtypeGroupLayer as x}from"../../../../layers/support/layerUtils.js";import{
|
|
2
|
+
import{createArcadeProfile as e,createArcadeExecutor as t}from"../../../../arcade.js";import r from"../../../../core/Error.js";import n from"../../../../core/Logger.js";import{getEffectiveFieldAlias as o}from"../../../../editing/fieldUtils.js";import i from"../../../../form/ExpressionInfo.js";import{isAttachmentElement as s,isFieldElement as a,isGroupElement as l,isRelationshipElement as m,isTextElement as d,isUtilityNetworkAssociationsElement as p}from"../../../../form/support/formUtils.js";import{getLowerCaseEditTrackingFields as c,isFieldVisibleByDefault as f}from"../../../../layers/support/fieldUtils.js";import{isSubtypeSublayer as u,isSubtypeGroupLayer as x}from"../../../../layers/support/layerUtils.js";import{isNumber as y}from"../../../../support/guards.js";import{unknown as w}from"../../../../time/constants.js";import{makeExpressionInfosMap as E,makeExecutorSetForFormElement as b}from"../../expressions/expressionUtils.js";import{AttachmentElementTemplate as h}from"../AttachmentElementTemplate.js";import T from"../BatchFormTemplate.js";import{FieldElementTemplate as I}from"../FieldElementTemplate.js";import{GroupElementTemplate as v}from"../GroupElementTemplate.js";import{RelationshipElementTemplate as g}from"../RelationshipElementTemplate.js";import{TextElementTemplate as F}from"../TextElementTemplate.js";import{UtilityNetworkAssociationsElementTemplate as j}from"../UtilityNetworkAssociationsElementTemplate.js";import{compileTextElementMarkdownToHTML as P}from"./textElementTemplateUtils.js";const L="expression/dea57012-47ca4b55a000-8df62742ed0c",A=e("form-attachment-filename-calculation"),C=()=>n.getLogger("esri.widgets.BatchAttributeForm.templates.templateUtils");async function U(e,t,r=e.formTemplate){return r?.elements&&r.elements.length>0?B(r,e,t):Z(e,t)}async function Z(e,{arcadeExecutorProvider:t,formTimeZone:r}){const n=new Set(c(e)),o={arcadeExecutorProvider:t,formTimeZone:r,layer:e},i=[];for(const a of e.fields)O(a,e,n)&&i.push(K(a,o));const s=await Promise.all(i);return new T({elements:s,preserveFieldValuesWhenHidden:!0})}function k(e,t){for(const r of e??[])if("group"!==r.type){if("field"===r.type){if(!1===r.editable&&!r.editableExpression)return!0;if(t.subtypeField&&(u(t)||x(t))&&r.fieldName?.toLowerCase()===t.subtypeField.toLowerCase())return!0}}else if(k(r.elements??[],t))return!0;return!1}async function B(e,t,r){let n=null;k(e.elements??[],t)&&(n=new i({title:"",name:L,expression:"false"}));const o=E(n?[...e.expressionInfos??[],n]:e.expressionInfos),s={description:e.description,elements:new Array,title:e.title,preserveFieldValuesWhenHidden:e.preserveFieldValuesWhenHidden,supportsAttachmentElements:e.supportsAttachmentElements},{elements:a}=e;if(!a)return new T(s);const{arcadeExecutorProvider:l,formTimeZone:m}=r;for(const i of a){const e=await N(i,{arcadeExecutorProvider:l,expressionInfos:o,layer:t,formTimeZone:m});e&&s.elements.push(e)}return e.supportsAttachmentElements,new T(s)}async function H(e,{arcadeExecutorProvider:r,expressionInfos:n,layer:o}){const i=n.get(e.filenameExpression),s=i?await t(i.expression,A):null,a=new h({allowUserRename:e.allowUserRename,attachmentKeyword:e.attachmentKeyword,description:e.description,displayFilename:e.displayFilename,filenameExpressionExecutor:s,input:e.input,label:e.label,maxAttachmentCount:e.maxAttachmentCount,minAttachmentCount:e.minAttachmentCount,useOriginalFilename:e.useOriginalFilename}),l=await b({element:e,expressionInfos:n,provider:r});return a.addLayer(o,l),a}async function N(e,t){return s(e)?H(e,{arcadeExecutorProvider:t.arcadeExecutorProvider,expressionInfos:t.expressionInfos,layer:t.layer}):a(e)?R(e,t):l(e)?S(e,t):m(e)?V(e,t):d(e)?W(e,t):p(e)?z(e,t):null}async function R(e,{arcadeExecutorProvider:t,expressionInfos:n,layer:o,formTimeZone:i}){const{fieldsIndex:s}=o,{description:a,domain:l,fieldName:m,hint:d,input:p,label:c}=e;if(null==m||!s.has(m))return C().warn(new r("batch-attribute-form:invalid-form-element-field",`Field element with label '${c}' does not refer to a valid field`)),null;!1!==e.editable||e.editableExpression||((e=e.clone()).editableExpression=L),o.subtypeField&&(u(o)||x(o))&&e.fieldName?.toLowerCase()===o.subtypeField.toLowerCase()&&((e=e.clone()).editableExpression=L);const f=new I({description:a,domain:l,field:s.get(m),hint:d,input:p,formTimeZone:i,layerTimeZone:G(o),label:c}),y=await b({element:e,expressionInfos:n,provider:t});return f.addLayer(o,y),f}async function S(e,t){const{arcadeExecutorProvider:r,expressionInfos:n,layer:o}=t,{description:i,label:s,initialState:a}=e,l=[];for(const p of e.elements){const e=await N(p,t);e&&l.push(e)}const m=new v({description:i,elements:l,label:s,initialState:a??"expanded"}),d=await b({element:e,expressionInfos:n,provider:r});return m.addLayer(o,d),m}async function V(e,t){const{description:r,label:n,displayCount:o,displayType:i,orderByFields:s,relationshipId:a}=e,{arcadeExecutorProvider:l,expressionInfos:m,layer:d}=t,p=new g({description:r,...y(o)&&{displayCount:o},displayType:i,label:n,orderByFields:s,relationshipId:a}),c=await b({element:e,expressionInfos:m,provider:l});return p.addLayer(d,c),p}async function W(e,{arcadeExecutorProvider:t,expressionInfos:r,layer:n}){const{description:o,label:i,text:s,textFormat:a}=e,{fieldsIndex:l}=n,m=s&&"markdown"===a?await P(s):s,d=new F({compiledText:m,description:o,fieldsIndex:l,label:i}),p=await b({element:e,expressionInfos:r,provider:t}),{expressionParts:c}=d;if(c.length){const e=await Promise.all(c.map(e=>{const n=r.get(e)?.expression??e;return t.getArcadeExecutor(n)}));p.textExpressions=e}return d.addLayer(n,p),d}async function z(e,t){const{associationTypes:r,description:n,label:o}=e,{arcadeExecutorProvider:i,expressionInfos:s,layer:a}=t,l=new j({associationTypes:r,description:n,label:o}),m=await b({element:e,expressionInfos:s,provider:i});return l.addLayer(a,m),l}async function K(e,{arcadeExecutorProvider:t,layer:r,formTimeZone:n}){const i=o(e,r)||e.name,s=new I({field:e,label:i,formTimeZone:n,layerTimeZone:G(r)}),a={},l=(x(r)||u(r))&&r.subtypeField&&r.subtypeField.toLowerCase()===e.name.toLowerCase();return!l&&e.editable&&r.userHasUpdateItemPrivileges&&(a.editableExpression=await t.getArcadeExecutor("true")),l&&(a.editableExpression=await t.getArcadeExecutor("false")),s.addLayer(r,a),s}function O(e,t,r){return!r.has(e.name.toLowerCase())&&f(e,t)}function G(e){return u(e)&&e.parent&&(e=e.parent),e&&"datesInUnknownTimezone"in e&&e.datesInUnknownTimezone?w:e&&"preferredTimeZone"in e&&e.preferredTimeZone?e.preferredTimeZone:null}export{U as createBatchFormTemplate,Z as createBatchFormTemplateFromFields};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{numericHash as t}from"../../../../core/string.js";import{isBarcodeScannerInput as n,isComboBoxInput as e,isRadioButtonsInput as i,isDatePickerInput as o,isDateTimePickerInput as r,isDateTimeOffsetPickerInput as $,isSwitchInput as u,isTextAreaInput as c,isTextBoxInput as l,isTimePickerInput as
|
|
2
|
+
import{numericHash as t}from"../../../../core/string.js";import{isBarcodeScannerInput as n,isComboBoxInput as e,isRadioButtonsInput as i,isDatePickerInput as o,isDateTimePickerInput as r,isDateTimeOffsetPickerInput as $,isSwitchInput as u,isTextAreaInput as c,isTextBoxInput as l,isTimePickerInput as s,isMultipleChoiceInput as a}from"../../../../form/elements/inputs/inputUtils.js";import{isFieldElementTemplate as m,isGroupElementTemplate as f,isRelationshipElementTemplate as p,isTextElementTemplate as d,isAttachmentElementTemplate as g,isUtilityNetworkAssociationsElementTemplate as h,isExcludedFromSharedForm as S}from"./templateUtils.js";const y="",O="num:";function x(n){return m(n)?t(C(n)).toString():f(n)?t(N(n)).toString():p(n)?t(b(n)).toString():d(n)?t(T(n)).toString():g(n)?t(V(n)).toString():h(n)?t(j(n)).toString():t(JSON.stringify(n)).toString()}function C(t){return`${J(t)}.${U(t.field)}.${B(t.domain)}.${t.hint??y}.${v(t.input)}`}function N(t){const n=J(t)+`.${t.initialState}`;let e=y;for(const i of t.elements)S(i)||(e+="."+x(i).toString());return`${n}${e}`}function b(t){const{displayCount:n,displayType:e,relationshipId:i}=t;return`${J(t)}.${n}.${e}.${i}.${L(t.orderByFields??[])}`}function T(t){const n=J(t),{compiledText:e}=t;return`${n}.${e??y}`}function V(t){return`${J(t)}.${t.allowUserRename}.${t.attachmentKeyword??y}.${t.displayFilename}.${w(t.input)}.${t.maxAttachmentCount??y}.${t.minAttachmentCount??y}.${t.useOriginalFilename}`}function j(t){return`${J(t)}.${A(t.associationTypes)}`}function J(t){return`${t.label??y}.${t.description??y}.${t.layerTimeZone??y}`}function v(t){if(!t)return y;const{type:m}=t;if(n(t))return m??y;if(e(t)||i(t)){const{showNoValueOption:n}=t;return`${m}.${n}.${t.noValueOptionLabel??y}`}if(o(t))return`${m}.${F(t)}`;if(r(t)){const n=t.min?.getTime(),e=t.max?.getTime(),{includeTime:i}=t;return`${m}.${n}.${e}.${i}`}if($(t)){const n=F(t),{includeTimeOffset:e,timeResolution:i}=t;return`${m}.${n}.${e}.${i}`}if(u(t)){const{offValue:n,onValue:e}=t;return`${m}.${I(n)}.${I(e)}`}if(c(t)||l(t)){return`${m}.${t.minLength?.toString()??y}.${t.maxLength?.toString()??y}`}if(s(t)){const n=F(t),{timeResolution:e}=t;return`${m}.${n}.${e}`}if(a(t)){return`${m}.${F({min:t.minimumChoices?.toString(),max:t.maximumChoices?.toString()})}.${t.choiceDelimiter??y}.${t.includeSelectAllChoices}.${t.otherChoice?.fieldName??y}.${t.otherChoice?.label??y}.${t.otherChoice?.hint??y}.${R(t)}`}return JSON.stringify(t)}function w(t){return t?JSON.stringify(t.toJSON()):y}function A(t){return t.map(t=>JSON.stringify(t.toJSON())).sort().join(".")}function F(t){return`${t.min??y}.${t.max??y}`}function L(t){return t.map(({field:t,order:n})=>`${t}.${n}`).sort().join(".")}function R(t){return(t.choices??[]).map(({label:t,value:n})=>`${t}.${n}`).sort().join(".")}function U(t){const n=t.name,e=t.alias??y;return`${n}.${e===n?y:e}.${t.nullable}.${t.type}.${t.length??y}.${t.defaultValue??y}.${t.description??y}.${t.editable}.${t.visible}`}function B(t){return t?"coded-value"===t.type?D(t):"range"===t.type?K(t):JSON.stringify(t):y}function D(t){const{type:n}=t;return`${n}.${t.codedValues.map(({code:t,name:n})=>`${I(t)}.${n}`).sort().join(".")}`}function I(t){return"number"==typeof t?`${O}${t}`:t}function K(t){const{maxValue:n,minValue:e,type:i}=t;return`${i}.${e}.${n}`}export{x as hashElementTemplate};
|
|
@@ -156,6 +156,13 @@ export interface AttachmentsChangeEvent {
|
|
|
156
156
|
valid: boolean;
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
+
/**
|
|
160
|
+
* Selected attachment reference information.
|
|
161
|
+
*
|
|
162
|
+
* @since 5.1
|
|
163
|
+
*/
|
|
164
|
+
export interface SelectedAttachmentInfo {}
|
|
165
|
+
|
|
159
166
|
/** @since 5.0 */
|
|
160
167
|
export interface ValueChangeEvent {
|
|
161
168
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{deprecateWidget as i}from"../core/deprecate.js";import n from"../core/Logger.js";import{getOrCreateMapValue as o}from"../core/MapUtils.js";import{watch as a,on as s}from"../core/reactiveUtils.js";import{property as r,subclass as l}from"../core/accessorSupport/decorators.js";import{isIntegerField as d}from"../layers/support/fieldUtils.js";import{isString as p}from"../support/guards.js";import u from"./Widget.js";import{getHiddenFieldsValidationErrorMessage as m,getVisibleFieldInputValidationErrorMessage as c,isElementTemplateWithInputType as h}from"./BatchAttributeForm/batchAttributeFormUtils.js";import v from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as b}from"./BatchAttributeForm/css.js";import f from"./BatchAttributeForm/VisibleElements.js";import{isGroupInput as C,isFieldInput as g,isTextElementInput as _,isRelationshipElementInput as y,isUtilityNetworkAssociationsElementInput as F,differentValuesString as I}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{loadCalciteComponents as w}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as x,getIntlOptionsForField as M,prepareISOFieldValueForDateComponents as k,prepareUnixFieldValueForDateComponents as O,normalizeTimeOnlyString as D,getISOFieldValueFromDateComponents as T,getUnixFieldValueFromDateComponents as V}from"./support/dateUtils.js";import{globalCss as E}from"./support/globalCss.js";import{messageBundle as L,vmEvent as U,tsx as R}from"./support/widget.js";import{setFocus as S}from"./support/widgetUtils.js";import{isEmptyValue as B}from"./support/forms/formUtils.js";const N="data-element-id";let A=class extends u{constructor(e,t){super(e,t),this.headingLevel=2,this.messagesCommon=null,this.messages=null,this.featureFormMessages=null,this.viewModel=new v,this.visibleElements=new f,this.groupDisplay="all",this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._touchedInputs=new Set,this._focusedFieldInput=null,this._batchSwitchInputInitialValues=new Map,this._saveInput=this._saveInput.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this),e?.suppressDeprecationWarning||(this.announceDeprecation=()=>{i(n.getLogger(this),"Editor","arcgis-editor",{version:"5.0"})})}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:t,...i}=e;return i}initialize(){this.addHandles([a(()=>this.features,()=>{this._dateComponentMap.clear()}),a(()=>this.viewModel.activeForm,()=>{this._batchSwitchInputInitialValues.clear()}),s(()=>this.viewModel,"submit",()=>{this.valid||this.goToFirstError()})])}loadDependencies(){return w({input:()=>import("@esri/calcite-components/dist/components/calcite-input"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group")})}get activeFeatureIndex(){return this.viewModel.activeFeatureIndex}set activeFeatureIndex(e){this.viewModel.activeFeatureIndex=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get _effectiveDisabled(){return this.disabled||this.viewModel.updating}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get maximumFeatureCount(){return this.viewModel.maximumFeatureCount}set maximumFeatureCount(e){this.viewModel.maximumFeatureCount=e}get maximumFeatureCountWithComplexForms(){return this.viewModel.maximumFeatureCountWithComplexForms}set maximumFeatureCountWithComplexForms(e){this.viewModel.maximumFeatureCountWithComplexForms=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get icon(){return"edit-attributes"}set icon(e){this._overrideIfSome("icon",e)}get readOnly(){return this.viewModel.readOnly}set readOnly(e){this.viewModel.readOnly=e}get valid(){return this.viewModel.valid}goToFirstError(){const e=this.viewModel.getFirstVisibleInvalidFieldInput();if(!e)return;const{groupInput:t}=e;t&&(t.open||(t.open=!0)),this._focusedFieldInput=e.input,this._attemptFocusOnNextRender=!0,this.scheduleRender()}render(){const{status:e}=this.viewModel;return"failed"===e?this.viewModel.hasTooManyComplexFeatures?this._renderErrorNotice(t(this.messages.formFailedToLoadTooManyComplexFeatures,{num:this.viewModel.maximumFeatureCountWithComplexForms})):this.viewModel.hasTooManyFeatures?this._renderErrorNotice(t(this.messages.formFailedToLoadTooManyFeatures,{num:this.viewModel.maximumFeatureCount})):this._renderErrorNotice(this.messages.formFailedToLoad):this.viewModel.expressionEvaluationFailed?this._renderErrorNotice(this.messages.expressionEvaluationFailed):this.viewModel.hasLayersWithContingentValues?this._renderErrorNotice(this.messages.unsupportedContingentValues):R("div",{class:this.classes(b.base,E.widget,E.panel)},"loaded"===e?this._renderForm():"loading"===e&&this.visibleElements.loadingIndicator?R("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):null)}submit(){this.viewModel.submit()}_setDateTimeTimeZoneMap(e){const{datePart:t,elementId:i}=e.dataset,n=o(this._dateComponentMap,`${i}`,()=>({}));switch(t){case"date":n.date=e;break;case"time":n.time=e;break;case"timeZone":n.timeZone=e}}_renderErrorNotice(e){return R("div",{class:this.classes(b.base,E.widget,E.panel)},R("calcite-notice",{class:b.noticeError,icon:!0,kind:"warning",open:!0},R("div",{slot:"message"},e)))}_renderForm(){return R("form",{class:b.form,onsubmit:this._onFormSubmit},this._renderInvisibleFieldsError(),this._renderContent())}_renderInvisibleFieldsError(){const{viewModel:e}=this,{hasNonActiveInvalidFeatures:t,activeForm:i}=e;let n;if(!e.submitHasBeenAttempted)return null;if(i.invalidHiddenInputs.length>0)if(n=m(i,e.mode,this.messages),"batch"===this.viewModel.mode){const e=i.invalidHiddenInputs.filter(e=>"hidden:group-visibility-expression:all-features"===e.effectiveVisibilityCode||"hidden:visibility-expression:all-features"===e.visibilityCode);e.length>0?n+=` (${e.map(e=>e.label).join(", ")})`:n=null}else n+=` (${i.invalidHiddenInputs.map(e=>e.label).join(", ")})`;else if(t)return null;return n?R("calcite-notice",{class:b.noticeError,icon:!0,kind:"danger",open:!0},R("div",{slot:"message"},n)):null}_renderContent(){if(!this.viewModel.hasVisibleInputs)return[R("calcite-notice",{class:b.noticeError,icon:!0,kind:"warning",open:!0},R("div",{slot:"message"},this.messages.noVisibleFields[this.viewModel.noVisibleElementsReason]))];const{inputs:e}=this.viewModel.activeForm;return e.filter(e=>e.visible).map(e=>this._renderInput(e))}_renderInput(e){return C(e)?this._renderGroupInput(e):g(e)?this._renderLabeledField(e):_(e)?this._renderTextComponent(e):y(e)?this._renderRelationshipElementInput(e):F(e)?this._renderUtilityNetworkAssociationsElementInput(e):void 0}_renderGroupInput(e){const{inputs:t,template:i,open:n}=e,o=t.filter(e=>e.visible),a=i.label??"";return R("calcite-block",{class:this.classes(b.group,"sequential"===this.groupDisplay?b.groupSequential:null,this.disabled?b.inputDisabled:null),collapsible:!0,description:i.description??void 0,disabled:this._effectiveDisabled,expanded:n,heading:a,headingLevel:this.headingLevel,key:`{${i.elementId}-key}`,label:a,onCalciteBlockClose:()=>{e.open=!1},onCalciteBlockOpen:()=>{e.open=!0}},o.map(e=>this._renderInput(e)))}_renderLabeledField(e){const{elementId:i}=e.template,{label:n,required:o,dataType:a}=e,s=o?t(this.messages.requiredFieldLabel,{name:n}):n;return R("calcite-label",{"aria-label":s,class:b.label,key:`field--${i}`},R("div",{class:b.labelTextContent,key:"labelTextContainer"},n,o?R("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==a?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){const t=this.getCommonInputProps(e),{dataType:i}=e;return"date"===i?this._renderDateComponents(e,t):"coded-value"===e.domain?.type?this._renderCodedInputs({input:e,props:t}):"number"===i?this._renderNumberComponent(e,t):this._renderStringComponent(e,t)}_renderAuxiliaryText(e){const{compositeError:t,description:i,submittable:n}=e,o=!n&&t&&(this.viewModel.submitHasBeenAttempted||this._touchedInputs.has(e.template.elementId))?c(e,t,this.messages):null;return o?R("calcite-input-message",{icon:!0,status:"invalid"},o):i?R("calcite-input-message",{class:b.description,icon:!1,status:"idle"},i):null}_renderCodedInputs({input:e,props:t}){const i=e.template.input?.type??null,n=e.codedValueOptions;switch(i){case"switch":return this._renderSwitchField({input:e,props:t});case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:n.flat(),props:t});default:return this._renderComboBoxComponent({options:n,props:t,input:e})}}_renderSwitchField({input:e,props:t}){if((this._batchSwitchInputInitialValues.get(e)===I||e.value===I)&&"batch"===this.viewModel.mode){const i={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,[N]:t[N]},trigger:{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral",slot:"trigger",label:t.label},group:{mode:"single"}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:i,options:[{name:this.messages.differentValuesPlaceholder,value:I,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return R("calcite-switch",{...t,checked:!!h(e.template,"switch")&&e.value===e.template.input.onValue,class:b.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldInput=null},onCalciteSwitchChange:({currentTarget:e})=>this._saveInput(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:i}){const{trigger:n,dropdown:o,group:a}=i;return R("calcite-dropdown",{...o,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,topLayerDisabled:this.topLayerDisabled,onCalciteDropdownSelect:({currentTarget:e})=>this._saveInput(e)},R("calcite-button",{...n},e===I?this.messages.differentValuesPlaceholder:e),R("calcite-dropdown-group",{selectionMode:a.mode},t.map(t=>R("calcite-dropdown-item",{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name))))}_renderComboBoxComponent({input:e,options:t,props:i}){const n="INSERT"===this.viewModel.editType,o=this._touchedInputs.has(e?.template?.elementId),a=n&&e.showNoValueOptionEnabled&&!o?()=>{}:i.onblur,s={...i,onblur:a};return R("calcite-combobox",{...s,selectionMode:"single",topLayerDisabled:this.topLayerDisabled,value:i.placeholder===this.messages.differentValuesPlaceholder?I:String(i.value),onCalciteComboboxChange:({currentTarget:e})=>{e.value!==I&&this._saveInput(e)}},this.renderComboboxOptionsList({input:e,options:t,props:i}))}renderComboboxOptionsList({input:e,options:t,props:i}){const[n,o]=t.map(e=>e.map(({name:e,value:t})=>R("calcite-combobox-item",{heading:e,key:`#${t}`,selected:i.value===t,value:`${t}`}))),a=[...n];o.length>0&&a.push(R("calcite-combobox-item-group",{key:"unsupported",label:this.featureFormMessages.subtypes.unsupportedDomainGroupTitle},o));const s=i.placeholder===this.messages.differentValuesPlaceholder,r=!s&&B(i.value);return e.showNoValueOptionEnabled&&a.unshift(R("calcite-combobox-item",{heading:e.showNoValueLabel||this.messages.empty,key:"empty-option",selected:r,value:""})),s&&a.unshift(R("calcite-combobox-item",{heading:this.messages.differentValuesPlaceholder,key:I,selected:!0,value:I})),a}_renderRadioButtonGroupComponent({input:e,options:t,props:i}){const n=t.map(({name:t,value:n})=>this._renderRadioButtons({label:t,value:n,selected:n===e.value,props:i}));if(e.showNoValueOptionEnabled){const t="",o=e.showNoValueLabel||this.messages.empty,a=B(e.value);n.unshift(this._renderRadioButtons({label:o,value:t,selected:a,props:i}))}return R("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:b.inputRadioGroup,disabled:i.readOnly,key:`${i.key}-radio-group`,layout:"vertical",name:i.name,required:i.required},n,i.placeholder===this.messages.differentValuesPlaceholder?R("calcite-label",{class:b.placeholderRadio,key:i.label,layout:"inline"},R("calcite-radio-button",{checked:!0,class:b.inputRadio,disabled:!0,name:i.placeholder,value:i.placeholder}),i.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:i,props:n}){return R("calcite-label",{class:b.inputRadioLabel,key:n.label,layout:"inline"},R("calcite-radio-button",{...n,afterCreate:void 0,afterUpdate:void 0,checked:t,class:b.inputRadio,disabled:n.readOnly,name:n.label,onblur:()=>{this._focusedFieldInput=null},value:e,onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInput(e)}}),i)}_renderStringComponent(e,t){const{template:i}=e;return!i.field.editable||this.readOnly?this._renderReadOnlyComponent(e):"text-area"===i.input?.type?R("calcite-text-area",{...t,class:this.classes(b.individualElement),resize:"vertical",value:t.value?String(t.value):"",onCalciteTextAreaInput:({currentTarget:e})=>this._saveInput(e)}):R("calcite-input",{...t,class:this.classes(b.individualElement),type:"text",value:t.value?String(t.value):"",onCalciteInputInput:({currentTarget:e})=>this._saveInput(e)})}_renderNumberComponent(e,t){const i=d(e.field);return R("calcite-input-number",{...t,integer:i,type:"number",value:i&&""!==t.value?Math.round(parseFloat(String(t.value))).toString():String(t.value),onCalciteInputNumberInput:({currentTarget:e})=>this._saveInput(e)})}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return R("calcite-input",{...i,class:this.classes(b.fieldInput,b.inputDisabled,b.individualElement),readOnly:!0,type:"text",value:String(t??i.value??"")})}_renderDateComponents(e,t){const{field:i}=e;let n;switch(i.type){case"date":n=this._renderDateFieldComponents(e,t);break;case"date-only":n=this._renderDateOnlyFieldComponent(e,t);break;case"time-only":n=this._renderTimeOnlyFieldComponent(e,t);break;case"timestamp-offset":n=this._renderTimestampOffsetFieldComponents(e,t);break;default:n=this._renderReadOnlyComponent(e,x(i,t.value,{timeZone:e.effectiveTimeZone,...M(e.template.field)}))}return e.value===I?[n,R("calcite-input-message",{icon:"information",key:"diff-values-message",status:"idle"},this.messages.differentValues)]:n}_renderDateOnlyFieldComponent(e,t){const{class:i,key:n,readOnly:o}=t,{rawMax:a,rawMin:s}=e.range;return R("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:i,"data-date-part":"date","data-element-id":t[N],key:`${n}-date-input`,max:p(a)?a:void 0,min:p(s)?s:void 0,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:o,topLayerDisabled:this.topLayerDisabled,value:e.value===I?"":e.value?String(e.value):"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimeOnlyFieldComponent(e,t){const{class:i,key:n,readOnly:o}=t;return R("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:i,"data-date-part":"time","data-element-id":t[N],key:`${n}-time-input`,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:o,value:e.value===I?"":e.value?String(e.value):"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimestampOffsetFieldComponents(e,t){const{class:i,key:n,readOnly:o}=t,{rawMax:a,rawMin:s}=e.range,r=k(a),l=k(s),d=k(e.value===I?"":e.value),p=e.includeTimeOffset,u={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:o,[N]:t[N],onfocus:this._onComponentFocus};return R("div",{class:b.dateInputContainer,key:`${n}-date-time-container`},R("calcite-input-date-picker",{...u,class:i,"data-date-part":"date",key:`${n}-date-input`,max:r?.date??void 0,min:l?.date??void 0,onblur:()=>{this._focusedFieldInput=null},topLayerDisabled:this.topLayerDisabled,value:d.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),R("calcite-input-time-picker",{...u,class:i,"data-date-part":"time",key:`${n}-time-input`,onblur:()=>{this._focusedFieldInput=null},value:d.time??"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),p?R("calcite-input-time-zone",{...u,class:i,clearable:e.value===I||null==e.value,"data-date-part":"timeZone",key:`${n}-timezone-input`,onblur:()=>{this._focusedFieldInput=null},value:d.timeZoneOffset||"",onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:i,key:n,readOnly:o,min:a,max:s}=t,r=e.effectiveTimeZone,l=O(e.value===I?"":e.value,r),d=O(s,r),p=O(a,r),u=e.includeTime,m={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:o,[N]:t[N],onfocus:this._onComponentFocus};return R("div",{class:b.dateInputContainer,key:`${n}-date-time-container`},R("calcite-input-date-picker",{...m,class:i,"data-date-part":"date",key:`${n}-date-input`,max:d?.date??void 0,min:p?.date??void 0,onblur:()=>{this._focusedFieldInput=null},topLayerDisabled:this.topLayerDisabled,value:l.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),u?R("calcite-input-time-picker",{...m,"data-date-part":"time",key:`${n}-time-input`,onblur:()=>{this._focusedFieldInput=null},step:1,value:l.time??"",onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}_renderRelationshipElementInput(e){const{elementId:t}=e.template;return R("div",{class:b.relationshipElementInput,"data-testid":`relationship-element-${t}`,key:`relationship-element-${t}`})}_renderTextComponent(e){const{elementId:t}=e.template;return R("div",{class:b.textElementInput,"data-testid":`text-element-${t}`,innerHTML:e.text,key:`text-element-${t}`})}_renderUtilityNetworkAssociationsElementInput(e){const{elementId:t}=e.template;return R("div",{class:b.utilityNetworkAssociationsElementInput,"data-testid":t,key:t})}getCommonInputProps(e){const{template:t,valid:i,value:n,minLength:o,maxLength:a,required:s,fieldName:r,editable:l,userHasChangedValue:d,range:{max:p,min:u}}=e,m=!l||this.readOnly,c=!m&&this._effectiveDisabled;let h=t.hint??void 0,v=!1;return n===I&&(h=this.messages.differentValuesPlaceholder,v=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":i?"false":"true",class:this.classes(b.fieldInput,m?b.inputDisabled:null),status:!d&&!this.viewModel.submitHasBeenAttempted||i?"idle":"invalid",maxLength:a&&a>-1?a:void 0,minLength:o&&o>-1?o:void 0,key:t.elementId,label:r,name:r,max:null!=p?p:void 0,min:null!=u?u:void 0,disabled:c,readOnly:m,onblur:this._onComponentBlur,required:s,placeholder:h,value:v?"":n??"",[N]:t.elementId,onfocus:this._onComponentFocus}}_onFormSubmit(e){e.preventDefault()}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(N))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),n=t||i;n&&this._afterComponentCreateOrUpdate(n)}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._touchedInputs.add(i.template.elementId),this._focusedFieldInput=i}_afterComponentCreateOrUpdate(e){const t=this._getFieldInputFromHTMLElement(e),i=this._focusedFieldInput;this._attemptFocusOnNextRender&&i===t&&(this._attemptFocusOnNextRender=!1,S(e))}_onComponentBlur(){this._focusedFieldInput=null}_parseValue(e,t){if(h(t.template,"switch")){if("calcite-dropdown"===e.localName&&t.domain)for(const i of t.domain.codedValues)if(i.name===e.selectedItems[0].textContent)return i.code;return e.checked?t.template.input.onValue:t.template.input.offValue}const i=e.value;return null==i||""===i?null:"number"===t.dataType?"-0"===i||"-0."===i||"-0,"===i?i:parseFloat(i):"date"===t.field.type?parseFloat(i):i}_saveInput(e){const t=this._getFieldInputFromHTMLElement(e),{elementId:i}=t.template;if(!t)return;const n=t?.value;if(h(t.template,"switch")&&"single"!==this.viewModel.mode){const e=o(this._batchSwitchInputInitialValues,t,()=>t.value);this._batchSwitchInputInitialValues.set(t,null===e?n:e)}const a=this._parseValue(e,t);a!==n&&this.viewModel.setValue(i,a)}_afterDateComponentCreate(e){this._setDateTimeTimeZoneMap(e),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:i}=e.template,n=e.field.type,o=this._dateComponentMap.get(`${i}`);if(!o)return;const a=e.effectiveTimeZone;let s=e.value===I?void 0:e.value,r=null;"date-only"===n?r=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===n?(s=D(s),r=D(t.value)):r="timestamp-offset"===n?null!=t.value?T({dateComponent:o.date,timeComponent:o.time,oldValue:s,timeZoneComponent:o.timeZone,defaultTimeZone:a}):null:null!=t.value?V({oldValue:s,dateComponent:o.date,timeZone:a,timeComponent:o.time?.value===I?void 0:o.time}):null,s!==r&&(null!==r&&t.value?this.viewModel.setValue(`${i}`,r):this.viewModel.setValue(`${i}`,null))}};e([r()],A.prototype,"activeFeatureIndex",null),e([r()],A.prototype,"disabled",null),e([r()],A.prototype,"_effectiveDisabled",null),e([r()],A.prototype,"features",null),e([r()],A.prototype,"map",null),e([r()],A.prototype,"maximumFeatureCount",null),e([r()],A.prototype,"maximumFeatureCountWithComplexForms",null),e([r()],A.prototype,"spatialReference",null),e([r()],A.prototype,"layerInfos",null),e([r()],A.prototype,"timeZone",null),e([r()],A.prototype,"headingLevel",void 0),e([r()],A.prototype,"icon",null),e([r(),L("esri/t9n/common")],A.prototype,"messagesCommon",void 0),e([r(),L("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],A.prototype,"messages",void 0),e([r(),L("esri/widgets/FeatureForm/t9n/FeatureForm")],A.prototype,"featureFormMessages",void 0),e([r()],A.prototype,"readOnly",null),e([r()],A.prototype,"valid",null),e([r({type:v}),U(["value-change","submit"])],A.prototype,"viewModel",void 0),e([r({type:f,nonNullable:!0})],A.prototype,"visibleElements",void 0),e([r()],A.prototype,"groupDisplay",void 0),A=e([l("esri.widgets.BatchAttributeForm")],A);const $=A;export{$ as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{deprecateWidget as i}from"../core/deprecate.js";import n from"../core/Logger.js";import{getOrCreateMapValue as a}from"../core/MapUtils.js";import{watch as s,on as o}from"../core/reactiveUtils.js";import{formatFileSize as l}from"../core/unitFormatUtils.js";import{property as r,subclass as c}from"../core/accessorSupport/decorators.js";import{isIntegerField as m}from"../layers/support/fieldUtils.js";import{isString as d}from"../support/guards.js";import p from"./Widget.js";import{getAttachmentTypeCategory as u,getCalciteIconForAttachment as h}from"./Attachments/support/attachmentUtils.js";import{getAttachmentKey as v,getAttachmentUrl as b,isImageAttachment as f}from"./BatchAttributeForm/attachmentUtils.js";import{getHiddenFieldsValidationErrorMessage as g,getVisibleFieldInputValidationErrorMessage as _,isElementTemplateWithInputType as C}from"./BatchAttributeForm/batchAttributeFormUtils.js";import y from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as I}from"./BatchAttributeForm/css.js";import F from"./BatchAttributeForm/VisibleElements.js";import{isGroupInput as w,isFieldInput as x,isTextElementInput as k,isRelationshipElementInput as M,isAttachmentElementInput as D,isUtilityNetworkAssociationsElementInput as E,differentValuesString as T}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{downloadAttachmentInfo as A}from"./FeatureTable/support/exportUtils.js";import{loadCalciteComponents as O}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as V,getIntlOptionsForField as L,prepareISOFieldValueForDateComponents as S,prepareUnixFieldValueForDateComponents as U,normalizeTimeOnlyString as R,getISOFieldValueFromDateComponents as P,getUnixFieldValueFromDateComponents as $}from"./support/dateUtils.js";import{globalCss as N}from"./support/globalCss.js";import{messageBundle as B,vmEvent as j,tsx as z}from"./support/widget.js";import{setFocus as Z}from"./support/widgetUtils.js";import{isEmptyValue as H}from"./support/forms/formUtils.js";const G="data-element-id";let q=class extends p{constructor(e,t){super(e,t),this.headingLevel=2,this.messagesCommon=null,this.messages=null,this.messagesUnits=null,this.viewModel=new y,this.visibleElements=new F,this.groupDisplay="all",this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._touchedInputs=new Set,this._focusedFieldInput=null,this._batchSwitchInputInitialValues=new Map,this._attachmentDialogInfo=null,this._maximizeSelectedAttachment=()=>{this._attachmentDialogInfo=this._selectedAttachmentDetails},this._closeAttachmentDialog=()=>{this._attachmentDialogInfo=null},this._saveInput=this._saveInput.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this),e?.suppressDeprecationWarning||(this.announceDeprecation=()=>{i(n.getLogger(this),"Editor","arcgis-editor",{version:"5.0"})})}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:t,...i}=e;return i}initialize(){this.addHandles([s(()=>this.features,()=>{this._dateComponentMap.clear(),this._resetTransientFormState()}),s(()=>this.viewModel.activeForm,()=>{this._batchSwitchInputInitialValues.clear(),this._resetTransientFormState()}),o(()=>this.viewModel,"submit",()=>{this.valid||this.goToFirstError()})])}loadDependencies(){return O({block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group"),dialog:()=>import("@esri/calcite-components/dist/components/calcite-dialog"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group")})}get activeFeatureIndex(){return this.viewModel.activeFeatureIndex}set activeFeatureIndex(e){this.viewModel.activeFeatureIndex=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get _effectiveDisabled(){return this.disabled||this.viewModel.updating}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get maximumFeatureCount(){return this.viewModel.maximumFeatureCount}set maximumFeatureCount(e){this.viewModel.maximumFeatureCount=e}get maximumFeatureCountWithComplexForms(){return this.viewModel.maximumFeatureCountWithComplexForms}set maximumFeatureCountWithComplexForms(e){this.viewModel.maximumFeatureCountWithComplexForms=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get icon(){return"edit-attributes"}set icon(e){this._overrideIfSome("icon",e)}get readOnly(){return this.viewModel.readOnly}set readOnly(e){this.viewModel.readOnly=e}get valid(){return this.viewModel.valid}goToFirstError(){const e=this.viewModel.getFirstVisibleInvalidFieldInput();if(!e)return;const{groupInput:t}=e;t&&(t.open||(t.open=!0)),this._focusedFieldInput=e.input,this._attemptFocusOnNextRender=!0,this.scheduleRender()}render(){const{status:e}=this.viewModel;return"failed"===e?this.viewModel.hasTooManyComplexFeatures?this._renderErrorNotice(t(this.messages.formFailedToLoadTooManyComplexFeatures,{num:this.viewModel.maximumFeatureCountWithComplexForms})):this.viewModel.hasTooManyFeatures?this._renderErrorNotice(t(this.messages.formFailedToLoadTooManyFeatures,{num:this.viewModel.maximumFeatureCount})):this._renderErrorNotice(this.messages.formFailedToLoad):this.viewModel.expressionEvaluationFailed?this._renderErrorNotice(this.messages.expressionEvaluationFailed):this.viewModel.hasLayersWithContingentValues?this._renderErrorNotice(this.messages.unsupportedContingentValues):z("div",{class:this.classes(I.base,N.widget,N.panel)},"loaded"===e?this._renderForm():"loading"===e&&this.visibleElements.loadingIndicator?z("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):null,this._renderAttachmentDialog())}submit(){this.viewModel.submit()}_setDateTimeTimeZoneMap(e){const{datePart:t,elementId:i}=e.dataset,n=a(this._dateComponentMap,`${i}`,()=>({}));switch(t){case"date":n.date=e;break;case"time":n.time=e;break;case"timeZone":n.timeZone=e}}_renderErrorNotice(e){return z("div",{class:this.classes(I.base,N.widget,N.panel)},z("calcite-notice",{class:I.noticeError,icon:!0,kind:"warning",open:!0},z("div",{slot:"message"},e)))}_renderForm(){const e=this._selectedAttachmentDetails;return z("form",{class:I.form,onsubmit:this._onFormSubmit},this._renderInvisibleFieldsError(),e?this._renderAttachmentDetailPanelContent(e):this._renderContent())}_renderInvisibleFieldsError(){const{viewModel:e}=this,{hasNonActiveInvalidFeatures:t,activeForm:i}=e;let n;if(!e.submitHasBeenAttempted)return null;if(i.invalidHiddenInputs.length>0)if(n=g(i,e.mode,this.messages),"batch"===this.viewModel.mode){const e=i.invalidHiddenInputs.filter(e=>"hidden:group-visibility-expression:all-features"===e.effectiveVisibilityCode||"hidden:visibility-expression:all-features"===e.visibilityCode);e.length>0?n+=` (${e.map(e=>e.label).join(", ")})`:n=null}else n+=` (${i.invalidHiddenInputs.map(e=>e.label).join(", ")})`;else if(t)return null;return n?z("calcite-notice",{class:I.noticeError,icon:!0,kind:"danger",open:!0},z("div",{slot:"message"},n)):null}_renderContent(){if(!this.viewModel.hasVisibleInputs)return[z("calcite-notice",{class:I.noticeError,icon:!0,kind:"warning",open:!0},z("div",{slot:"message"},this.messages.noVisibleFields[this.viewModel.noVisibleElementsReason]))];const{inputs:e}=this.viewModel.activeForm;return e.filter(e=>e.visible).map(e=>this._renderInput(e))}_renderInput(e){return w(e)?this._renderGroupInput(e):x(e)?this._renderLabeledField(e):k(e)?this._renderTextComponent(e):M(e)?this._renderRelationshipElementInput(e):D(e)?this._renderAttachmentElementInput(e):E(e)?this._renderUtilityNetworkAssociationsElementInput(e):void 0}_renderGroupInput(e){const{inputs:t,template:i,open:n}=e,a=t.filter(e=>e.visible),s=i.label??"";return z("calcite-block",{class:this.classes(I.group,"sequential"===this.groupDisplay?I.groupSequential:null,this.disabled?I.inputDisabled:null),collapsible:!0,description:i.description??void 0,disabled:this._effectiveDisabled,expanded:n,heading:s,headingLevel:this.headingLevel,key:`{${i.elementId}-key}`,label:s,onCalciteBlockClose:()=>{e.open=!1},onCalciteBlockOpen:()=>{e.open=!0}},a.map(e=>this._renderInput(e)))}_renderLabeledField(e){const{elementId:i}=e.template,{label:n,required:a,dataType:s}=e,o=a?t(this.messages.requiredFieldLabel,{name:n}):n;return z("calcite-label",{"aria-label":o,class:I.label,key:`field--${i}`},z("div",{class:I.labelTextContent,key:"labelTextContainer"},n,a?z("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==s?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){const t=this.getCommonInputProps(e),{dataType:i}=e;return"date"===i?this._renderDateComponents(e,t):"coded-value"===e.domain?.type?this._renderCodedInputs({input:e,props:t}):"number"===i?this._renderNumberComponent(e,t):this._renderStringComponent(e,t)}_renderAuxiliaryText(e){const{compositeError:t,description:i,submittable:n}=e,a=!n&&t&&(this.viewModel.submitHasBeenAttempted||this._touchedInputs.has(e.template.elementId))?_(e,t,this.messages):null;return a?z("calcite-input-message",{icon:!0,status:"invalid"},a):i?z("calcite-input-message",{class:I.description,icon:!1,status:"idle"},i):null}_renderCodedInputs({input:e,props:t}){const i=e.template.input?.type??null,n=e.codedValueOptions;switch(i){case"switch":return this._renderSwitchField({input:e,props:t});case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:n.flat(),props:t});default:return this._renderComboBoxComponent({options:n,props:t,input:e})}}_renderSwitchField({input:e,props:t}){if((this._batchSwitchInputInitialValues.get(e)===T||e.value===T)&&"batch"===this.viewModel.mode){const i={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,[G]:t[G]},trigger:{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral",slot:"trigger",label:t.label},group:{mode:"single"}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:i,options:[{name:this.messages.differentValuesPlaceholder,value:T,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return z("calcite-switch",{...t,checked:!!C(e.template,"switch")&&e.value===e.template.input.onValue,class:I.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldInput=null},onCalciteSwitchChange:({currentTarget:e})=>this._saveInput(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:i}){const{trigger:n,dropdown:a,group:s}=i;return z("calcite-dropdown",{...a,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,topLayerDisabled:this.topLayerDisabled,onCalciteDropdownSelect:({currentTarget:e})=>this._saveInput(e)},z("calcite-button",{...n},e===T?this.messages.differentValuesPlaceholder:e),z("calcite-dropdown-group",{selectionMode:s.mode},t.map(t=>z("calcite-dropdown-item",{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name))))}_renderComboBoxComponent({input:e,options:t,props:i}){const n="INSERT"===this.viewModel.editType,a=this._touchedInputs.has(e?.template?.elementId),s=n&&e.showNoValueOptionEnabled&&!a?()=>{}:i.onblur,o={...i,onblur:s};return z("calcite-combobox",{...o,selectionMode:"single",topLayerDisabled:this.topLayerDisabled,value:i.placeholder===this.messages.differentValuesPlaceholder?T:String(i.value),onCalciteComboboxChange:({currentTarget:e})=>{e.value!==T&&this._saveInput(e)}},this.renderComboboxOptionsList({input:e,options:t,props:i}))}renderComboboxOptionsList({input:e,options:t,props:i}){const[n,a]=t.map(e=>e.map(({name:e,value:t})=>z("calcite-combobox-item",{heading:e,key:`#${t}`,selected:i.value===t,value:`${t}`}))),s=[...n];a.length>0&&s.push(z("calcite-combobox-item-group",{key:"unsupported",label:this.messages.unsupportedDomainGroupTitle},a));const o=i.placeholder===this.messages.differentValuesPlaceholder,l=!o&&H(i.value);return e.showNoValueOptionEnabled&&s.unshift(z("calcite-combobox-item",{heading:e.showNoValueLabel||this.messages.empty,key:"empty-option",selected:l,value:""})),o&&s.unshift(z("calcite-combobox-item",{heading:this.messages.differentValuesPlaceholder,key:T,selected:!0,value:T})),s}_renderRadioButtonGroupComponent({input:e,options:t,props:i}){const n=t.map(({name:t,value:n})=>this._renderRadioButtons({label:t,value:n,selected:n===e.value,props:i}));if(e.showNoValueOptionEnabled){const t="",a=e.showNoValueLabel||this.messages.empty,s=H(e.value);n.unshift(this._renderRadioButtons({label:a,value:t,selected:s,props:i}))}return z("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:I.inputRadioGroup,disabled:i.readOnly,key:`${i.key}-radio-group`,layout:"vertical",name:i.name,required:i.required},n,i.placeholder===this.messages.differentValuesPlaceholder?z("calcite-label",{class:I.placeholderRadio,key:i.label,layout:"inline"},z("calcite-radio-button",{checked:!0,class:I.inputRadio,disabled:!0,name:i.placeholder,value:i.placeholder}),i.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:i,props:n}){return z("calcite-label",{class:I.inputRadioLabel,key:n.label,layout:"inline"},z("calcite-radio-button",{...n,afterCreate:void 0,afterUpdate:void 0,checked:t,class:I.inputRadio,disabled:n.readOnly,name:n.label,onblur:()=>{this._focusedFieldInput=null},value:e,onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInput(e)}}),i)}_renderStringComponent(e,t){const{template:i}=e;return!i.field.editable||this.readOnly?this._renderReadOnlyComponent(e):"text-area"===i.input?.type?z("calcite-text-area",{...t,class:this.classes(I.individualElement),resize:"vertical",value:t.value?String(t.value):"",onCalciteTextAreaInput:({currentTarget:e})=>this._saveInput(e)}):z("calcite-input",{...t,class:this.classes(I.individualElement),type:"text",value:t.value?String(t.value):"",onCalciteInputInput:({currentTarget:e})=>this._saveInput(e)})}_renderNumberComponent(e,t){const i=m(e.field);return z("calcite-input-number",{...t,integer:i,type:"number",value:i&&""!==t.value?Math.round(parseFloat(String(t.value))).toString():String(t.value),onCalciteInputNumberInput:({currentTarget:e})=>this._saveInput(e)})}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return z("calcite-input",{...i,class:this.classes(I.fieldInput,I.inputDisabled,I.individualElement),readOnly:!0,type:"text",value:String(t??i.value??"")})}_renderDateComponents(e,t){const{field:i}=e;let n;switch(i.type){case"date":n=this._renderDateFieldComponents(e,t);break;case"date-only":n=this._renderDateOnlyFieldComponent(e,t);break;case"time-only":n=this._renderTimeOnlyFieldComponent(e,t);break;case"timestamp-offset":n=this._renderTimestampOffsetFieldComponents(e,t);break;default:n=this._renderReadOnlyComponent(e,V(i,t.value,{timeZone:e.effectiveTimeZone,...L(e.template.field)}))}return e.value===T?[n,z("calcite-input-message",{icon:"information",key:"diff-values-message",status:"idle"},this.messages.differentValues)]:n}_renderDateOnlyFieldComponent(e,t){const{class:i,key:n,readOnly:a}=t,{rawMax:s,rawMin:o}=e.range;return z("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:i,"data-date-part":"date","data-element-id":t[G],key:`${n}-date-input`,max:d(s)?s:void 0,min:d(o)?o:void 0,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:a,topLayerDisabled:this.topLayerDisabled,value:e.value===T?"":e.value?String(e.value):"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimeOnlyFieldComponent(e,t){const{class:i,key:n,readOnly:a}=t;return z("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:i,"data-date-part":"time","data-element-id":t[G],key:`${n}-time-input`,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:a,value:e.value===T?"":e.value?String(e.value):"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimestampOffsetFieldComponents(e,t){const{class:i,key:n,readOnly:a}=t,{rawMax:s,rawMin:o}=e.range,l=S(s),r=S(o),c=S(e.value===T?"":e.value),m=e.includeTimeOffset,d={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:a,[G]:t[G],onfocus:this._onComponentFocus};return z("div",{class:I.dateInputContainer,key:`${n}-date-time-container`},z("calcite-input-date-picker",{...d,class:i,"data-date-part":"date",key:`${n}-date-input`,max:l?.date??void 0,min:r?.date??void 0,onblur:()=>{this._focusedFieldInput=null},topLayerDisabled:this.topLayerDisabled,value:c.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),z("calcite-input-time-picker",{...d,class:i,"data-date-part":"time",key:`${n}-time-input`,onblur:()=>{this._focusedFieldInput=null},value:c.time??"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),m?z("calcite-input-time-zone",{...d,class:i,clearable:e.value===T||null==e.value,"data-date-part":"timeZone",key:`${n}-timezone-input`,onblur:()=>{this._focusedFieldInput=null},value:c.timeZoneOffset||"",onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:i,key:n,readOnly:a,min:s,max:o}=t,l=e.effectiveTimeZone,r=U(e.value===T?"":e.value,l),c=U(o,l),m=U(s,l),d=e.includeTime,p={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:a,[G]:t[G],onfocus:this._onComponentFocus};return z("div",{class:I.dateInputContainer,key:`${n}-date-time-container`},z("calcite-input-date-picker",{...p,class:i,"data-date-part":"date",key:`${n}-date-input`,max:c?.date??void 0,min:m?.date??void 0,onblur:()=>{this._focusedFieldInput=null},topLayerDisabled:this.topLayerDisabled,value:r.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),d?z("calcite-input-time-picker",{...p,"data-date-part":"time",key:`${n}-time-input`,onblur:()=>{this._focusedFieldInput=null},step:1,value:r.time??"",onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}_renderRelationshipElementInput(e){const{elementId:t}=e.template;return z("div",{class:I.relationshipElementInput,"data-testid":`relationship-element-${t}`,key:`relationship-element-${t}`})}_renderAttachmentElementInput(e){const{attachments:t,template:{description:i,elementId:n,label:a}}=e;return z("div",{class:I.attachmentElementInput,"data-testid":`attachment-element-${n}`,key:`attachment-element-${n}`},a?z("div",{class:I.attachmentElementLabel,key:`attachment-element-label-${n}`},a):null,i?z("div",{class:I.description,key:`attachment-element-description-${n}`},i):null,t.length?z("calcite-list",{class:I.attachmentElementList,key:`attachment-element-list-${n}`,label:a||this.messagesCommon.details,selectionAppearance:"border",selectionMode:"none"},t.map((t,i)=>{const a=this._formatAttachmentSize(t.size),s=this._getAttachmentLabel(t,i,a,e.displayFilename),o=s===a?void 0:a,l=v(t);return z("calcite-list-item",{class:I.attachmentElementListItem,description:o,key:`attachment-item-${l}`,label:s,onCalciteListItemSelect:()=>this._setSelectedAttachment({attachmentKey:l,elementId:n})},z("div",{class:I.attachmentElementListItemStart,slot:"content-start"},this._renderAttachmentPreviewThumbnail(t,s,e.supportsResize)),z("calcite-icon",{icon:"chevron-right",scale:"s",slot:"actions-end"}))})):z("div",{class:I.attachmentElementEmptyState,key:`attachment-element-empty-state-${n}`},this.messages.attachments.noAttachments),z("div",{class:I.attachmentElementEmptyAction,key:`attachment-element-empty-action-${n}`},z("calcite-button",{appearance:"outline",iconStart:"attachment",kind:"neutral",onclick:()=>{},round:!0},this.messages.attachments.attach)))}_renderAttachmentDetailPanelContent(e){const{attachment:t,input:i}=e,n=v(t),a=!!b(t,i.supportsResize);return z("div",{class:I.attachmentElementDetail,key:`attachment-detail-panel-${i.template.elementId}-${n}`},z("div",{class:I.attachmentElementDetailPreview},this._renderAttachmentPreviewImage(t,i.supportsResize)),z("div",{class:I.attachmentElementDetailActions},z("calcite-button",{appearance:"outline",disabled:!a,iconStart:"download-to",kind:"neutral",onclick:()=>{this._downloadAttachment(t)},scale:"s"},this.messages.attachments.download),f(t)?z("calcite-button",{appearance:"outline",disabled:!a,iconStart:"expand",kind:"neutral",onclick:this._maximizeSelectedAttachment,scale:"s"},this.messages.attachments.maximize):null,z("calcite-button",{appearance:"outline",disabled:!0,iconStart:"refresh",kind:"neutral",scale:"s"},this.messages.attachments.replace)),z("div",{class:I.attachmentElementDetailMetadata},z("span",{class:I.attachmentElementDetailMetadataLabel},this.messages.attachments.fileName),z("span",{class:I.attachmentElementDetailMetadataValue},t.name),z("span",{class:I.attachmentElementDetailMetadataLabel},this.messages.attachments.size),z("span",{class:I.attachmentElementDetailMetadataValue},this._formatAttachmentSize(t.size)),z("span",{class:I.attachmentElementDetailMetadataLabel},this.messages.attachments.type),z("span",{class:I.attachmentElementDetailMetadataValue},this._getLabelForAttachmentType(t))))}_renderAttachmentDialog(){const e=this._attachmentDialogInfo;if(!e)return null;const{attachment:t,input:i}=e;return z("calcite-dialog",{heading:t.name||this.messagesCommon.details,key:"attachment-preview-dialog",modal:!0,open:!0,placement:"cover",width:"l",onCalciteDialogClose:this._closeAttachmentDialog},z("div",{class:I.attachmentElementDetailPreview},this._renderAttachmentPreviewImage(t,i.supportsResize)))}_setSelectedAttachment(e){this.viewModel.setSelectedAttachment(e)}get _selectedAttachmentDetails(){const e=this.viewModel.selectedAttachment,t=this.viewModel.activeForm;if(!e||!t)return null;const i=t.allAttachmentElementInputs.find(t=>t.template.elementId===e.elementId);if(!i)return null;const n=i.attachments.findIndex(t=>v(t)===e.attachmentKey);if(-1===n)return null;return{attachment:i.attachments[n],input:i}}_getAttachmentLabel(e,i,n,a){return!1!==a&&d(e.name)&&e.name.length>0?e.name:n!==this.messagesCommon.notApplicable?n:t(this.messages.attachments.attachmentNumberedLabel,{index:i+1})}_formatAttachmentSize(e){return null==e||Number.isNaN(e)?this.messagesCommon.notApplicable:l(this.messagesUnits,e)}_getLabelForAttachmentType({contentType:e}){if(!e)return this.messagesCommon.notApplicable;const t=this.messages.attachments.attachmentTypes,i=u(e);return t?.[i]||e}_renderAttachmentPreviewThumbnail(e,t,i){const n=b(e,i,64);return n&&f(e)?z("img",{alt:t,class:I.attachmentElementListItemThumb,src:n}):z("calcite-icon",{class:I.attachmentElementListItemIcon,icon:h(e.contentType),scale:"s"})}_renderAttachmentPreviewImage(e,t){const i=b(e,t),n=e.name||this.messagesCommon.details;return i&&f(e)?z("img",{alt:n,class:I.attachmentElementDetailPreviewImage,src:i,title:n}):[z("calcite-icon",{class:I.attachmentElementDetailPreviewIcon,icon:h(e.contentType),scale:"l",textLabel:n,title:n}),this.messages.attachments.noPreviewAvailable]}async _downloadAttachment(e){await A(e)}_renderTextComponent(e){const{elementId:t}=e.template;return z("div",{class:I.textElementInput,"data-testid":`text-element-${t}`,innerHTML:e.text,key:`text-element-${t}`})}_renderUtilityNetworkAssociationsElementInput(e){const{elementId:t}=e.template;return z("div",{class:I.utilityNetworkAssociationsElementInput,"data-testid":t,key:t})}getCommonInputProps(e){const{template:t,valid:i,value:n,minLength:a,maxLength:s,required:o,fieldName:l,editable:r,userHasChangedValue:c,range:{max:m,min:d}}=e,p=!r||this.readOnly,u=!p&&this._effectiveDisabled;let h=t.hint??void 0,v=!1;return n===T&&(h=this.messages.differentValuesPlaceholder,v=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":i?"false":"true",class:this.classes(I.fieldInput,p?I.inputDisabled:null),status:!c&&!this.viewModel.submitHasBeenAttempted||i?"idle":"invalid",maxLength:s&&s>-1?s:void 0,minLength:a&&a>-1?a:void 0,key:t.elementId,label:l,name:l,max:null!=m?m:void 0,min:null!=d?d:void 0,disabled:u,readOnly:p,onblur:this._onComponentBlur,required:o,placeholder:h,value:v?"":n??"",[G]:t.elementId,onfocus:this._onComponentFocus}}_onFormSubmit(e){e.preventDefault()}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(G))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),n=t||i;n&&this._afterComponentCreateOrUpdate(n)}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._touchedInputs.add(i.template.elementId),this._focusedFieldInput=i}_afterComponentCreateOrUpdate(e){const t=this._getFieldInputFromHTMLElement(e),i=this._focusedFieldInput;this._attemptFocusOnNextRender&&i===t&&(this._attemptFocusOnNextRender=!1,Z(e))}_onComponentBlur(){this._focusedFieldInput=null}_resetTransientFormState(){this._attemptFocusOnNextRender=!1,this._focusedFieldInput=null,this._attachmentDialogInfo=null}_parseValue(e,t){if(C(t.template,"switch")){if("calcite-dropdown"===e.localName&&t.domain)for(const i of t.domain.codedValues)if(i.name===e.selectedItems[0].textContent)return i.code;return e.checked?t.template.input.onValue:t.template.input.offValue}const i=e.value;return null==i||""===i?null:"number"===t.dataType?"-0"===i||"-0."===i||"-0,"===i?i:parseFloat(i):"date"===t.field.type?parseFloat(i):i}_saveInput(e){const t=this._getFieldInputFromHTMLElement(e),{elementId:i}=t.template;if(!t)return;const n=t?.value;if(C(t.template,"switch")&&"single"!==this.viewModel.mode){const e=a(this._batchSwitchInputInitialValues,t,()=>t.value);this._batchSwitchInputInitialValues.set(t,null===e?n:e)}const s=this._parseValue(e,t);s!==n&&this.viewModel.setValue(i,s)}_afterDateComponentCreate(e){this._setDateTimeTimeZoneMap(e),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:i}=e.template,n=e.field.type,a=this._dateComponentMap.get(`${i}`);if(!a)return;const s=e.effectiveTimeZone;let o=e.value===T?void 0:e.value,l=null;"date-only"===n?l=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===n?(o=R(o),l=R(t.value)):l="timestamp-offset"===n?null!=t.value?P({dateComponent:a.date,timeComponent:a.time,oldValue:o,timeZoneComponent:a.timeZone,defaultTimeZone:s}):null:null!=t.value?$({oldValue:o,dateComponent:a.date,timeZone:s,timeComponent:a.time?.value===T?void 0:a.time}):null,o!==l&&(null!==l&&t.value?this.viewModel.setValue(`${i}`,l):this.viewModel.setValue(`${i}`,null))}};e([r()],q.prototype,"activeFeatureIndex",null),e([r()],q.prototype,"disabled",null),e([r()],q.prototype,"_effectiveDisabled",null),e([r()],q.prototype,"features",null),e([r()],q.prototype,"map",null),e([r()],q.prototype,"maximumFeatureCount",null),e([r()],q.prototype,"maximumFeatureCountWithComplexForms",null),e([r()],q.prototype,"spatialReference",null),e([r()],q.prototype,"layerInfos",null),e([r()],q.prototype,"timeZone",null),e([r()],q.prototype,"headingLevel",void 0),e([r()],q.prototype,"icon",null),e([r(),B("esri/t9n/common")],q.prototype,"messagesCommon",void 0),e([r(),B("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],q.prototype,"messages",void 0),e([r(),B("esri/core/t9n/Units")],q.prototype,"messagesUnits",void 0),e([r()],q.prototype,"readOnly",null),e([r()],q.prototype,"valid",null),e([r({type:y}),j(["value-change","submit"])],q.prototype,"viewModel",void 0),e([r({type:F,nonNullable:!0})],q.prototype,"visibleElements",void 0),e([r()],q.prototype,"groupDisplay",void 0),e([r()],q.prototype,"_attemptFocusOnNextRender",void 0),e([r()],q.prototype,"_focusedFieldInput",void 0),e([r()],q.prototype,"_attachmentDialogInfo",void 0),q=e([c("esri.widgets.BatchAttributeForm")],q);const W=q;export{W as default};
|
|
@@ -29,7 +29,7 @@ export default class RelationshipInput extends EditableInput<RelationshipElement
|
|
|
29
29
|
/**
|
|
30
30
|
* A string value indicating how to display related records within the relationship content. Currently, `list` is the only supported value.
|
|
31
31
|
*
|
|
32
|
-
* | Value
|
|
32
|
+
* | Value | Description |
|
|
33
33
|
* | ------ | ----------- |
|
|
34
34
|
* | list | Shows a list of related records from the specified relationship. |
|
|
35
35
|
*
|