@arcgis/core 5.1.0-next.59 → 5.1.0-next.60
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/applications/Components/arcadeFeatureUtils.js +1 -1
- package/applications/Components/featureUtils.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{9321f5ec514805307219.js → 05c8d2c0362af4511d86.js} +1 -1
- package/assets/esri/core/workers/chunks/{ad1946c084219bb678a0.js → 06868e4f52de9d918255.js} +1 -1
- package/assets/esri/core/workers/chunks/{8df0c154bb0d79a905c0.js → 06c0b93e276cfc1fb7ac.js} +1 -1
- package/assets/esri/core/workers/chunks/{05d25a98c54679233902.js → 0888baa99c9007ad63bc.js} +1 -1
- package/assets/esri/core/workers/chunks/{1613123918e9b0f7cfdb.js → 0f597c690e5c60fe944b.js} +1 -1
- package/assets/esri/core/workers/chunks/{e2e3c39876bbe019c57a.js → 0f8736242544f9e9a57a.js} +1 -1
- package/assets/esri/core/workers/chunks/{c9c5e6996f36ec4b1558.js → 11a8541f3909f9ffb000.js} +1 -1
- package/assets/esri/core/workers/chunks/{3de17e89973160b42923.js → 16806f5044a9da553b66.js} +1 -1
- package/assets/esri/core/workers/chunks/{3e0752a81a7247c567ab.js → 185f59f90070d5d6ac94.js} +1 -1
- package/assets/esri/core/workers/chunks/1984c0f037065acd21d3.js +1 -0
- package/assets/esri/core/workers/chunks/1af247c86d1c4ae8fef3.js +1 -0
- package/assets/esri/core/workers/chunks/{1f91280032aa42b1585b.js → 2a7e7a497823e9f05aa3.js} +1 -1
- package/assets/esri/core/workers/chunks/2d92ba11781a3cfc3a78.js +1 -0
- package/assets/esri/core/workers/chunks/{9d580b5bcd59857a5702.js → 2f74147597805828cb38.js} +23 -7
- package/assets/esri/core/workers/chunks/{d9444dd0d40aa8332b28.js → 31e0bfc2cab055aebf9a.js} +1 -1
- package/assets/esri/core/workers/chunks/{93d1118f7a909d123b40.js → 32360a55d1836b2a737e.js} +1 -1
- package/assets/esri/core/workers/chunks/{a9eb90b901e64e67b7a3.js → 368b4c0a5eecbb06feac.js} +1 -1
- package/assets/esri/core/workers/chunks/{7b6e3cc086d13da770fa.js → 37729578a7c4cf15eded.js} +1 -1
- package/assets/esri/core/workers/chunks/{4b3622fc355fd2fd8678.js → 3af1e2f0b3d30c58d0c2.js} +1 -1
- package/assets/esri/core/workers/chunks/{83113a9e284701d053b5.js → 3c155efd5768003a91eb.js} +1 -1
- package/assets/esri/core/workers/chunks/{7ed2aa1092c0a2c839c0.js → 3f0d9fdd8c37605dd85d.js} +1 -1
- package/assets/esri/core/workers/chunks/{86a6dd19903fa5023cc7.js → 58614f12796dbba013f4.js} +1 -1
- package/assets/esri/core/workers/chunks/{26cafd20c8d03c274389.js → 5c1abb46b9937a050c32.js} +1 -1
- package/assets/esri/core/workers/chunks/{1f8e22df08c2f5fbb8c8.js → 6172715b2b2853819d8a.js} +1 -1
- package/assets/esri/core/workers/chunks/{87077f4cbca13e030411.js → 62c2757f5dc4aaca2df8.js} +1 -1
- package/assets/esri/core/workers/chunks/{23f6d24bf850bc3280ec.js → 6355de3ee89916b74dae.js} +1 -1
- package/assets/esri/core/workers/chunks/64ad6130de549083caba.js +1 -0
- package/assets/esri/core/workers/chunks/{9b53aa2429573f1b977f.js → 68475eba323b4aa892a3.js} +1 -1
- package/assets/esri/core/workers/chunks/{a7a553e245ba011d259f.js → 78c7eace6ec3fa5c7413.js} +1 -1
- package/assets/esri/core/workers/chunks/7cee28575fd57430cf02.js +1 -0
- package/assets/esri/core/workers/chunks/{b20f4c82d0b44fdb4670.js → 7e1ef2a55f8d123f31e2.js} +1 -1
- package/assets/esri/core/workers/chunks/{5a9f5a49dc68b42762bb.js → 8083dface1ca2dbd12b2.js} +1 -1
- package/assets/esri/core/workers/chunks/{85c72d9fa533552a6e8a.js → 82e0691995d821137d5f.js} +1 -1
- package/assets/esri/core/workers/chunks/{ec1b2eb05410848081c9.js → 8432ffc33843e898bab7.js} +1 -1
- package/assets/esri/core/workers/chunks/{bacc343a79828e456de7.js → 8435b6bf356959009b76.js} +1 -1
- package/assets/esri/core/workers/chunks/{56bce3a6701f8549606b.js → 8878ab87ef7961fafae8.js} +1 -1
- package/assets/esri/core/workers/chunks/{3ef740d25dc17bef11b2.js → 8a893f23827769d42092.js} +1 -1
- package/assets/esri/core/workers/chunks/{e8a23ae30d586e3a973c.js → 8e68b4628e9616356c34.js} +1 -1
- package/assets/esri/core/workers/chunks/{e7e565e7c0ce1464c6b0.js → 8ea67b502f9355dab7e9.js} +1 -1
- package/assets/esri/core/workers/chunks/{66fc3c4d6c54eee231b9.js → 8edae79554843dd77ada.js} +1 -1
- package/assets/esri/core/workers/chunks/{0e88e61d89f89994c4bf.js → 909ef35fa33be2b6da41.js} +1 -1
- package/assets/esri/core/workers/chunks/{c91d39e8e14be3d8bdf5.js → 90b7acc70adba193b215.js} +1 -1
- package/assets/esri/core/workers/chunks/{b1a0a7cdaf50f98adb3e.js → 97f10efb0fe05bedcebd.js} +1 -1
- package/assets/esri/core/workers/chunks/98f5bf1b91f3696b2fce.js +1 -0
- package/assets/esri/core/workers/chunks/{4fb718174c6e07d752e0.js → 9c52d4b54dfdb69dee29.js} +1 -1
- package/assets/esri/core/workers/chunks/{5143f74f1fe7533a6069.js → 9c72127de7afcbaafbaf.js} +1 -1
- package/assets/esri/core/workers/chunks/{155c741a9839d24f04a2.js → 9def5d17b94e5db71883.js} +1 -1
- package/assets/esri/core/workers/chunks/{a41fabf8b2cf15b7d0c9.js → a10be7eb05a007fff1ed.js} +1 -1
- package/assets/esri/core/workers/chunks/{ab3183f2327ff26e2b45.js → a226ba96d9a3ecc14e3e.js} +1 -1
- package/assets/esri/core/workers/chunks/{2bc6edeb3156d241677b.js → a32c87b89567a9fd1efc.js} +1 -1
- package/assets/esri/core/workers/chunks/{e26894655823849947f4.js → a446dff865332268625a.js} +1 -1
- package/assets/esri/core/workers/chunks/a520f83ae0c3c3e78858.js +1 -0
- package/assets/esri/core/workers/chunks/{bb047157f09471ecea53.js → a6d166058e3025bb280e.js} +1 -1
- package/assets/esri/core/workers/chunks/{691d0a60354b6458b9de.js → a80eb704e75d13732878.js} +1 -1
- package/assets/esri/core/workers/chunks/{75e28458e08b0738b35a.js → ab223c508f3dd562e7d3.js} +2 -2
- package/assets/esri/core/workers/chunks/{3cb0f020f9bfc6653c5d.js → b42487c6a989e11a2559.js} +1 -1
- package/assets/esri/core/workers/chunks/b6d94cbd1c5adad2f247.js +1 -0
- package/assets/esri/core/workers/chunks/{cd391415b8b8320e12e4.js → b75165880704efccc47c.js} +1 -1
- package/assets/esri/core/workers/chunks/{45eddf3918973fa8d751.js → ba72989749543122a6fe.js} +1 -1
- package/assets/esri/core/workers/chunks/{0b4a2361b9f9a6c0b8a7.js → ba9e107edc2027238be3.js} +1 -1
- package/assets/esri/core/workers/chunks/be1d2c3a61e6447fbbc7.js +1 -0
- package/assets/esri/core/workers/chunks/{e9dd60d0220036545ebb.js → bf4bad2c9a541cd425f5.js} +1 -1
- package/assets/esri/core/workers/chunks/{78cb6b9ab32abdd1d530.js → c08e9914deb1dc62bc0f.js} +1 -1
- package/assets/esri/core/workers/chunks/{52dbfd7519555028a8af.js → c0bb53d8d58ad18334d3.js} +1 -1
- package/assets/esri/core/workers/chunks/{c6149e0ac1c103e03baf.js → c0d453f93af2d4a6ce64.js} +1 -1
- package/assets/esri/core/workers/chunks/c72e90a952543d06d84b.js +1 -0
- package/assets/esri/core/workers/chunks/{005fe95c3329cfe74219.js → cf7acf5acb6d322fd996.js} +1 -1
- package/assets/esri/core/workers/chunks/{457bbf27e9bc18132464.js → d23dd7da45a7aa341540.js} +1 -1
- package/assets/esri/core/workers/chunks/{929b26999321519824b9.js → d2801df3fa44dee15ec8.js} +1 -1
- package/assets/esri/core/workers/chunks/{932a0b39d85a76377d52.js → d626e08d23330d84413b.js} +1 -1
- package/assets/esri/core/workers/chunks/{9d11e7972bc298cb94ce.js → db6e03fe8dd316f5005f.js} +1 -1
- package/assets/esri/core/workers/chunks/{a37697ef360e2425768a.js → dca595fdd5e1a571e441.js} +1 -1
- package/assets/esri/core/workers/chunks/{da2a10e72a315c3c1f82.js → e2779965db231fb666a5.js} +1 -1
- package/assets/esri/core/workers/chunks/{f7af90c5f9d371eb7009.js → e4144ccc85ad4c76a9b7.js} +1 -1
- package/assets/esri/core/workers/chunks/{9066f095f16448c0a04e.js → e4e2f059c52674dcae5b.js} +1 -1
- package/assets/esri/core/workers/chunks/edc2e87968c958bc852b.js +1 -0
- package/assets/esri/core/workers/chunks/{a256edc8337e462f80f0.js → efdd75896ca53eb6242f.js} +1 -1
- package/assets/esri/core/workers/chunks/{c250799c131aa4ed2c35.js → f1c348cf2a1e35da9b20.js} +1 -1
- package/assets/esri/core/workers/chunks/{861a7d0e665add901e11.js → f4d577ff61da7964e08a.js} +1 -1
- package/assets/esri/core/workers/chunks/{5aff2d6ae0d2a2d92ecc.js → f7da652f8dab57677cc3.js} +1 -1
- package/chunks/GlobalIllumination.glsl.js +24 -8
- package/chunks/OITBlend.glsl.js +4 -3
- package/config.js +1 -1
- package/interfaces.d.ts +7 -0
- package/kernel.js +1 -1
- package/layers/graphics/OptimizedGeometry.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/mixins/RasterJobHandlerMixin.js +1 -1
- package/layers/raster/functions/vectorFieldUtils.js +1 -1
- package/layers/support/RasterJobHandler.js +1 -1
- package/layers/support/RasterWorker.js +1 -1
- package/layers/support/TitleCreator.js +1 -1
- package/layers/video/VideoController.js +1 -1
- package/networks/support/NamedTraceConfiguration.d.ts +2 -1
- package/networks/support/NamedTraceConfiguration.js +1 -1
- package/networks/support/TraceConfiguration.d.ts +4 -2
- package/networks/support/TraceConfiguration.js +1 -1
- package/package.json +2 -2
- package/popup/Feature.d.ts +250 -0
- package/popup/Feature.js +2 -0
- package/popup/support/arcadeFeatureUtils.js +2 -0
- package/popup/support/featureUtils.js +2 -0
- package/popup/support/relatedFeatureUtils.js +2 -0
- package/popup/types.d.ts +17 -3
- package/support/revision.js +1 -1
- package/tables/AttributeTableTemplate.d.ts +2 -2
- package/tables/elements/AttributeTableGroupElement.d.ts +3 -16
- package/tables/support/tablesUtils.d.ts +6 -5
- package/tables/types.d.ts +18 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/AFillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
- package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
- package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
- package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
- package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
- package/views/2d/layers/features/schema/SourceSchema.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
- package/views/2d/layers/features/support/FeatureMetadata.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
- package/views/2d/layers/imagery/ImageryVFStrategy.js +1 -1
- package/views/2d/layers/imagery/VectorFieldView2D.js +1 -1
- package/views/3d/support/GaussianSplatSortWorker.js +1 -1
- package/views/3d/support/GaussianSplatWorkerHandle.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
- package/views/3d/webgl-engine/shaders/GlobalIllumination.glsl.js +1 -1
- package/widgets/Attachments/AttachmentsViewModel.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor/support/EditorEditingCapabilities.js +1 -1
- package/widgets/Feature/FeatureContent/FeatureContentViewModel.js +1 -1
- package/widgets/Feature/FeatureContent.js +1 -1
- package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
- package/widgets/Feature/FeatureFields/FeatureFieldsViewModel.js +1 -1
- package/widgets/Feature/FeatureMedia/FeatureMediaViewModel.js +1 -1
- package/widgets/Feature/FeatureMedia.js +1 -1
- package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
- package/widgets/Feature/FeatureViewModel.js +1 -1
- package/widgets/FeatureForm/FieldInput.js +1 -1
- package/widgets/FeatureForm/RelationshipInput.js +1 -1
- package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
- package/widgets/FeatureForm/UtilityNetworkAssociationInput.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/Popup/actionUtils.js +1 -1
- package/widgets/Search.js +1 -1
- package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/0f2ab57e4eb722b3b0c0.js +0 -1
- package/assets/esri/core/workers/chunks/522bc1d79dbe957301e4.js +0 -1
- package/assets/esri/core/workers/chunks/60ad54e5707d4414d8b9.js +0 -1
- package/assets/esri/core/workers/chunks/76064c2c801da55cd844.js +0 -1
- package/assets/esri/core/workers/chunks/ad4f0a4e2dde44cd43d4.js +0 -1
- package/assets/esri/core/workers/chunks/b3e5dcb530cef678c8f8.js +0 -1
- package/assets/esri/core/workers/chunks/d01a98c13501c89205b6.js +0 -1
- package/assets/esri/core/workers/chunks/d3b3e8c6d7096bc59489.js +0 -1
- package/assets/esri/core/workers/chunks/d53c6fc10425adc2c0cf.js +0 -1
- package/assets/esri/core/workers/chunks/e543bb228f3f9d937d43.js +0 -1
- package/assets/esri/core/workers/chunks/f8ee1a99580a7da42cde.js +0 -1
- package/widgets/Feature/support/arcadeFeatureUtils.js +0 -2
- package/widgets/Feature/support/featureUtils.js +0 -2
- package/widgets/Feature/support/relatedFeatureUtils.js +0 -2
- /package/assets/esri/core/workers/chunks/{75e28458e08b0738b35a.js.LICENSE.txt → ab223c508f3dd562e7d3.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{estimateNumberArrayMemory as e}from"../../../../../core/memoryEstimations.js";import{getFeatureIdInfoFieldNames as
|
|
2
|
+
import{estimateNumberArrayMemory as e}from"../../../../../core/memoryEstimations.js";import{getFeatureIdInfoFieldNames as s}from"../../../../../layers/graphics/data/FeatureIdInfo.js";import t from"../../../../../layers/support/FieldsIndex.js";import{parseField as r,parseTransform as o}from"../../../../../rest/query/operations/pbfFeatureServiceParser.js";const a=268435455;class i{constructor(){this.hasFeatures=!1,this.exceededTransferLimit=!1,this.hasZ=!1,this.hasM=!1,this.fieldCount=0,this.featureCount=0,this.idFieldIndices=[],this.transform=null,this.vertexCount=0,this.offsets={attributes:new Array,geometry:new Array},this.centroid=new Array}get usedMemory(){let s=0;return s+=e(this.idFieldIndices),s+=e(this.offsets.attributes),s+=e(this.offsets.geometry),s+=e(this.centroid),this.displayIds&&(s+=e(this.displayIds)),this.groupIds&&(s+=e(this.groupIds)),s}get stride(){return 2+Number(this.hasZ)+Number(this.hasM)}}function n(e,n,c){const d=9,f=10,u=11,h=12,p=13,g=15,l=e.asUnsafe(),m=l.pos(),k=new i;let y=0,b=0;const I=1,x=2,w=4,C=3;let F=null;const L=[];for(;l.next();)switch(l.tag()){case h:F=l.processMessage(o);break;case d:k.exceededTransferLimit=l.getBool();break;case f:k.hasZ=l.getBool();break;case u:k.hasM=l.getBool();break;case p:{const e=l.processMessage(r);e.index=y++,L.push(e);break}case g:{const e=l.getPackedEnd(),s=k.offsets.geometry,t=k.centroid;s.push(0);const{stride:r}=k;for(t.push(a),t.push(a);l.pos()<e&&l.next();)switch(l.tag()){case I:{k.offsets.attributes.push(l.pos());const e=l.getLength();l.skipLen(e);break}case x:if(n){const e=l.getPackedEnd();for(;l.pos()<e&&l.next();)switch(l.tag()){case C:{const e=l.getPackedEnd();let s=b*r;for(;l.pos()<e;)k.centroid[s++]=l.getSInt64();break}default:l.skip()}}else{k.offsets.geometry[b]=l.pos();const e=l.getLength();k.vertexCount+=e,l.skipLen(e)}break;case w:{const e=l.getLength(),s=l.pos()+e;for(;l.pos()<s&&l.next();)switch(l.tag()){case C:{const e=l.getPackedEnd();let s=b*r;for(;l.pos()<e;)k.centroid[s++]=l.getSInt64();break}default:l.skip()}break}default:l.skip()}b++,k.hasFeatures=!0;break}default:l.skip()}k.fields=new t(L),k.featureCount=b,k.fieldCount=y;const A=s(c);return k.idFieldIndices=Array.from(A,e=>k.fields.get(e)?.index),k.transform=F,k.displayIds=new Uint32Array(k.featureCount),k.groupIds=new Uint16Array(k.featureCount),l.move(m),k}export{i as FeatureSetHeader,n as parseHeader};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import i from"../../../../core/Logger.js";import{debounce as r,isAbortError as
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import i from"../../../../core/Logger.js";import{debounce as r,isAbortError as a}from"../../../../core/promiseUtils.js";import{property as s,subclass as o}from"../../../../core/accessorSupport/decorators.js";import n from"../../../../geometry/Extent.js";import{RasterVFDisplayObject as l}from"../../engine/imagery/RasterVFDisplayObject.js";let c=class extends t{constructor(e){super(e),this._loading=null,this.update=r((e,t)=>this._update(e,t).catch(e=>{a(e)||i.getLogger(this).error(e)}))}get updating(){return!!this._loading}redraw(e){if(!this.container.children.length)return;const t=this.container.children[0];t.symbolizerParameters=e,t.invalidateMeshes(),this.container.symbolTypes="wind_speed"===e.style?["scalar","triangle"]:"simple_scalar"===e.style?["scalar"]:["triangle"],this.container.requestRender()}async _update(e,t,i){if(!e.stationary)return;const{extent:r,spatialReference:a}=e.state,s=new n({xmin:r.xmin,ymin:r.ymin,xmax:r.xmax,ymax:r.ymax,spatialReference:a}),[o,l]=e.state.size;this._loading=this.fetchPixels(s,o,l,i);const c=await this._loading;this._addToDisplay(c,t,e.state),this._loading=null}_addToDisplay(e,t,i){if(null==e.pixelBlock||null==e.magdirData)return this.container.children.forEach(e=>e.destroy()),void this.container.removeAllChildren();const{extent:r,magdirData:a}=e,s=new l(a);s.offset=[0,0],s.symbolizerParameters=t,s.rawPixelData=e,s.invalidateMeshes(),s.x=r.xmin,s.y=r.ymax,s.pixelRatio=i.pixelRatio,s.rotation=i.rotation,s.resolution=i.resolution,s.width=a.width*t.symbolTileSize,s.height=a.height*t.symbolTileSize,this.container.children.forEach(e=>e.destroy()),this.container.removeAllChildren(),this.container.symbolTypes="wind_speed"===t.style?["scalar","triangle"]:"simple_scalar"===t.style?["scalar"]:["triangle"],this.container.addChild(s)}};e([s()],c.prototype,"fetchPixels",void 0),e([s()],c.prototype,"container",void 0),e([s()],c.prototype,"_loading",void 0),e([s()],c.prototype,"updating",null),c=e([o("esri.views.2d.layers.imagery.ImageryVFStrategy")],c);export{c 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 e from"../../../../Graphic.js";import r from"../../../../core/Accessor.js";import i from"../../../../core/Logger.js";import{isAbortError as a}from"../../../../core/promiseUtils.js";import{watch as s,syncAndInitial as o}from"../../../../core/reactiveUtils.js";import{property as n,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{load as c,projectExtent as m}from"../../../../layers/raster/functions/rasterProjectionHelper.js";import{snapImageToSymbolTile as h}from"../../../../layers/raster/functions/vectorFieldUtils.js";import{RasterVFContainer as p}from"../../engine/imagery/RasterVFContainer.js";import y from"./ImageryVFStrategy.js";let d=class extends r{constructor(){super(...arguments),this.attached=!1,this.container=new p,this.type="imageryVF",this._dataParameters={exportParametersVersion:0,bbox:"",symbolTileSize:0,time:""},this._fetchpixels=async(t,e,r,i)=>{const a=await this._projectFullExtentPromise,{layer:s}=this,{symbolTileSize:o}=s.renderer,{extent:n,width:l,height:c}=h(t,e,r,o,a);if(null!=a&&!a.intersects(t))return{extent:n,pixelBlock:null};const m={bbox:`${n.xmin}, ${n.ymin}, ${n.xmax}, ${n.ymax}`,exportParametersVersion:s.exportImageServiceParameters.version,symbolTileSize:o,time:JSON.stringify(this.timeExtent||"")};if(this._canReuseVectorFieldData(m)){const t=this.container.children[0]?.rawPixelData;if(null!=t){if(`${t.extent.xmin}, ${t.extent.ymin}, ${t.extent.xmax}, ${t.extent.ymax}`===m.bbox)return t}}const{pixelBlock:p}=await s.fetchPixels(n,l,c,{timeExtent:this.timeExtent,interpolation:s.interpolation,signal:i});if(this._dataParameters=m,null==p)return{extent:n,pixelBlock:null};const{dataType:y}=s.rasterInfo;return{extent:n,pixelBlock:
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../../../Graphic.js";import r from"../../../../core/Accessor.js";import i from"../../../../core/Logger.js";import{isAbortError as a}from"../../../../core/promiseUtils.js";import{watch as s,syncAndInitial as o}from"../../../../core/reactiveUtils.js";import{property as n,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{load as c,projectExtent as m}from"../../../../layers/raster/functions/rasterProjectionHelper.js";import{snapImageToSymbolTile as h}from"../../../../layers/raster/functions/vectorFieldUtils.js";import{RasterVFContainer as p}from"../../engine/imagery/RasterVFContainer.js";import y from"./ImageryVFStrategy.js";let d=class extends r{constructor(){super(...arguments),this.attached=!1,this.container=new p,this.type="imageryVF",this._dataParameters={exportParametersVersion:0,bbox:"",symbolTileSize:0,time:""},this._fetchpixels=async(t,e,r,i)=>{const a=await this._projectFullExtentPromise,{layer:s}=this,{symbolTileSize:o}=s.renderer,{extent:n,width:l,height:c}=h(t,e,r,o,a);if(null!=a&&!a.intersects(t))return{extent:n,pixelBlock:null};const m={bbox:`${n.xmin}, ${n.ymin}, ${n.xmax}, ${n.ymax}`,exportParametersVersion:s.exportImageServiceParameters.version,symbolTileSize:o,time:JSON.stringify(this.timeExtent||"")};if(this._canReuseVectorFieldData(m)){const t=this.container.children[0]?.rawPixelData;if(null!=t){if(`${t.extent.xmin}, ${t.extent.ymin}, ${t.extent.xmax}, ${t.extent.ymax}`===m.bbox)return t}}const{pixelBlock:p}=await s.fetchPixels(n,l,c,{timeExtent:this.timeExtent,interpolation:s.interpolation,signal:i});if(this._dataParameters=m,null==p)return{extent:n,pixelBlock:null};const{dataType:y}=s.rasterInfo;return{extent:n,pixelBlock:p,magdirData:await s.sampleVectorFieldData({pixelBlock:p,srcDataType:y,tileSize:o},{signal:i})}}}get updating(){return!this.attached||this._strategy.updating}attach(){this._projectFullExtentPromise=this._getProjectedFullExtent(this.view.spatialReference),this._strategy=new y({container:this.container,fetchPixels:this._fetchpixels}),this.addHandles(s(()=>this.layer.renderer,t=>this._updateSymbolizerParams(t),o),"attach")}detach(){this._strategy.destroy(),this.container.children.forEach(t=>t.destroy()),this.container.removeAllChildren(),this.removeHandles("attach"),this._strategy=this.container=this._projectFullExtentPromise=null}getPixelData(){const t=this.container.children[0]?.rawPixelData;if(this.updating||!t)return null;const{extent:e,pixelBlock:r}=t;return{extent:e,pixelBlock:r}}hitTest(t){return new e({attributes:{},geometry:t.clone(),layer:this.layer})}update(t){this._strategy.update(t,this._symbolizerParams).catch(t=>{a(t)||i.getLogger(this).error(t)})}redraw(){const{renderer:t}=this.layer;t&&(this._updateSymbolizerParams(t),this._strategy.redraw(this._symbolizerParams))}_canReuseVectorFieldData(t){const e=this._dataParameters.exportParametersVersion===t.exportParametersVersion,r=this._dataParameters.time===t.time,i=this._dataParameters.symbolTileSize===t.symbolTileSize,a=this._dataParameters.bbox===t.bbox;return e&&r&&i&&a}async _getProjectedFullExtent(t){try{return await c(),m(this.layer.fullExtent,t)}catch{return null}}_updateSymbolizerParams(t){"vector-field"===t?.type&&(this._symbolizerParams=this.layer.symbolizer.generateWebGLParameters({pixelBlock:null}))}};t([n()],d.prototype,"attached",void 0),t([n()],d.prototype,"container",void 0),t([n()],d.prototype,"layer",void 0),t([n()],d.prototype,"timeExtent",void 0),t([n()],d.prototype,"type",void 0),t([n()],d.prototype,"view",void 0),t([n()],d.prototype,"updating",null),d=t([l("esri.views.2d.layers.imagery.VectorFieldView2D")],d);export{d as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
class t{constructor(t,n,
|
|
2
|
+
class t{constructor(t,s,n,e,r=!1){this.distances=t,this.atlasIndices=s,this.sortedAtlasIndices=n,this.numGaussians=e,this.preciseSort=r}}class s{constructor(t,s,n){this.distances=t,this.atlasIndices=s,this.sortedAtlasIndices=n}}let n=null,e=null,r=0,a=0;const l=10,i=20,o=.25,c=1.5;function f(t,s){let n=Math.max(1,t);for(;n<s;)n=Math.ceil(n*c);return n}function u(t,s){t>r&&(r=f(r,t),n=new Uint32Array(r)),s>a&&(a=f(a,s),e=new Uint32Array(a)),e.fill(0,0,s)}function h(t,s,r){const a=t.length,c=Math.max(l,Math.min(i,Math.round(Math.log2(a/o)))),f=1+(1<<c);u(a,f);let h=t[0],d=t[0];for(let n=0;n<t.length;n++)h=Math.min(h,t[n]),d=Math.max(d,t[n]);const b=d-h;if(b<1e-6)for(let l=0;l<a;++l)n[l]=0,e[0]++;else{const s=(1<<c)/b;for(let r=0;r<a;r++){const a=(t[r]-h)*s>>>0;n[r]=a,e[a]++}}for(let n=1;n<f;n++)e[n]+=e[n-1];for(let l=0;l<a;l++){const t=n[l];r[--e[t]]=s[l]}}async function d(t){const{distances:n,atlasIndices:e,sortedAtlasIndices:r,preciseSort:a,numGaussians:l}=t,i=n.subarray(0,l),o=e.subarray(0,l),c=r.subarray(0,l);if(0===i.length||0===o.length||0===c.length)return{result:new s(n,e,r),transferList:[n.buffer,e.buffer,r.buffer]};if(a){const t=new Array(l);for(let s=0;s<l;s++)t[s]=s;t.sort((t,s)=>i[t]-i[s]||t-s);for(let s=0;s<l;s++)c[s]=o[t[s]]}else h(i,o,c);return{result:new s(n,e,r),transferList:[n.buffer,e.buffer,r.buffer]}}function b(){M()}function M(){n=null,e=null,r=0,a=0}export{t as SplatSortWorkerInput,s as SplatSortWorkerOutput,M as clear,b as destroy,d as sort};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{WorkerHandle as r}from"../../../core/workers/WorkerHandle.js";class
|
|
2
|
+
import{WorkerHandle as r}from"../../../core/workers/WorkerHandle.js";class s extends r{constructor(r){super("GaussianSplatSortWorker","sort",{sort:r=>[r.distances.buffer,r.atlasIndices.buffer,r.sortedAtlasIndices.buffer]},r,{strategy:"dedicated"})}sort(r,s){return this.invokeMethod("sort",r,s)}clear(){return this.broadcast({},"clear")}async destroyWorkerAndSelf(){await this.broadcast({},"destroy"),this.destroy()}}export{s as GaussianSplatSortWorkerHandle};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{reallocGrowthFactor as t}from"../../../../core/arrayUtils.js";import{abortMaybe as e}from"../../../../core/maybe.js";import{isAbortError as s}from"../../../../core/promiseUtils.js";import{signal as
|
|
2
|
+
import{reallocGrowthFactor as t}from"../../../../core/arrayUtils.js";import{abortMaybe as e}from"../../../../core/maybe.js";import{isAbortError as s}from"../../../../core/promiseUtils.js";import{signal as i}from"../../../../core/signal.js";import{Milliseconds as r,now as a}from"../../../../core/time.js";import{normalize as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersects as l}from"../../../../geometry/support/aaBoundingBox.js";import{makeScheduleFunction as h}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as d}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as u}from"./GaussianSplatFadeTexture.js";import{GaussianSplatOrderTexture as _}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as c}from"./GaussianSplatTextureAtlas.js";import{TaskPriority as f}from"../../../support/Scheduler.js";class m{constructor(t,e){this._updating=i(!1),this._useDeterministicSort=!1,this.visibleGaussians=0,this._bufferCapacity=0,this._requestedLyr3dVisibilityChange=0,this._latestCompletedLyr3dVisibilityChange=0,this._latestUpdatedGaussianTiles=new Array,this._latestSortedGaussianTiles=new Array,this._nextCommittedVisibleGaussianTiles=new Array,this._cameraDirectionNormalized=n(),this._frameTask=null,this._workerHandle=null,this._sortAbortController=null,this._isSorting=!1,this._pendingSortTask=!1,this._scheduledSortStartTimeout=null,this._lastSortStartTime=r(-1/0),this._sortInterval=r(80),this._renderer=t,this._onSortComplete=e,this._orderTexture=new _(this._renderer.renderingContext),this._fadingTexture=new u(this._renderer.renderingContext),this._textureAtlas=new c(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache);const{resourceController:s}=this._renderer.view;this._workerHandle=new d(h(s)),this._frameTask=s.scheduler.registerTask(f.GAUSSIAN_SPLAT_SORTING)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}forEachTile(t){for(const e of this._latestUpdatedGaussianTiles)t(e)}updateGaussianVisibility(t,e){this._latestUpdatedGaussianTiles=t,this._requestedLyr3dVisibilityChange=e,this.requestSort()}get updating(){return this._updating.value}destroy(){this._sortAbortController=e(this._sortAbortController),this._pendingSortTask=!1,this._updating.value=!1,null!=this._scheduledSortStartTimeout&&(clearTimeout(this._scheduledSortStartTimeout),this._scheduledSortStartTimeout=null),this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}requestSort(){return this._updating.value=!0,!this._pendingSortTask&&(this._pendingSortTask=!0,this._scheduleSortStart(),!0)}_scheduleSortStart(){if(this._isSorting)return;const t=a()-this._lastSortStartTime,e=this._sortInterval-t;e<=0?this._startSortIfRequired():null==this._scheduledSortStartTimeout&&(this._scheduledSortStartTimeout=setTimeout(()=>{this._scheduledSortStartTimeout=null,this._pendingSortTask&&!this._isSorting&&this._scheduleSortStart()},e))}_startSortIfRequired(){if(this._isSorting||!this._pendingSortTask)return;const t=new AbortController;this._sortAbortController=t,this._isSorting=!0,this._pendingSortTask=!1,this._lastSortStartTime=a(),this._sortOnWorker(t.signal).finally(()=>{this._sortAbortController===t&&(this._sortAbortController=null),this._handleSortComplete()})}_handleSortComplete(){this._isSorting=!1,this._pendingSortTask?this._scheduleSortStart():this._updating.value=!1}_clearBuffersAndTextures(){this._atlasIndicesBuffer=void 0,this._sortedAtlasIndicesBuffer=void 0,this._distancesBuffer=void 0,this._bufferCapacity=0,this._orderTexture.clear(),this._textureAtlas.clear()}_computeExpandedCapacity(e,s){let i=Math.max(1,e);for(;i<s;)i=Math.ceil(i*t);return i}_ensureSortBufferCapacities(t){if(this._bufferCapacity<t){const e=this._computeExpandedCapacity(this._bufferCapacity,t);this._atlasIndicesBuffer=new Uint32Array(e),this._sortedAtlasIndicesBuffer=new Uint32Array(e),this._distancesBuffer=new Float64Array(e),this._bufferCapacity=e}}_clearAllBuffersAndTextures(){this._clearBuffersAndTextures(),this._latestSortedGaussianTiles.length=0,this._nextCommittedVisibleGaussianTiles.length=0,this._workerHandle?.clear()}async _sortOnWorker(t){try{if(0===this._latestUpdatedGaussianTiles.length)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=this._requestedLyr3dVisibilityChange,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);this._useDeterministicSort&&this._latestUpdatedGaussianTiles.sort((t,e)=>t.obb.centerX-e.obb.centerX||t.obb.centerY-e.obb.centerY||t.obb.centerZ-e.obb.centerZ);const e=this._latestUpdatedGaussianTiles,s=e.length,i=this._requestedLyr3dVisibilityChange;let r=0;for(let t=0;t<s;t++)r+=e[t].gaussianCount;this._ensureSortBufferCapacities(r),this._textureAtlas.ensureTextureAtlas(),o(this._cameraDirectionNormalized,this._renderer.camera.ray.direction);const a=this._cameraDirectionNormalized[0],n=this._cameraDirectionNormalized[1],h=this._cameraDirectionNormalized[2];let d=0;const u=this._atlasIndicesBuffer,_=this._distancesBuffer,c=this._renderer.clippingBox,f=this._nextCommittedVisibleGaussianTiles;f.length=0;let m=0;for(let t=0;t<s;t++){const s=e[t],{gaussianAtlasIndices:i,relativePositions:r,obb:o}=s,S=s.gaussianCount;if(null!=c&&null!=s.boundingBox&&!l(s.boundingBox,c))continue;const{centerX:p,centerY:T,centerZ:g}=o;u.set(i,d),f[m++]=s;const b=a*p+n*T+h*g,C=d+S;for(let t=d,e=0;t<C;t++,e+=3){const s=r[e],i=r[e+1],o=r[e+2];_[t]=s*a+i*n+o*h+b}d=C}if(f.length=m,0===d)return this.visibleGaussians=0,this._clearAllBuffersAndTextures(),this._latestCompletedLyr3dVisibilityChange=i,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),void this._renderer.requestRender(1);const S={distances:this._distancesBuffer,atlasIndices:this._atlasIndicesBuffer,sortedAtlasIndices:this._sortedAtlasIndicesBuffer,numGaussians:d,preciseSort:this._useDeterministicSort},p=await(this._workerHandle?.sort(S,t));if(t.aborted)return;p&&(this._distancesBuffer=p.distances,this._atlasIndicesBuffer=p.atlasIndices,this._sortedAtlasIndicesBuffer=p.sortedAtlasIndices);const T=async t=>{this._orderTexture.setData(this._sortedAtlasIndicesBuffer,d);const e=this._latestSortedGaussianTiles;this._latestSortedGaussianTiles=f,this._nextCommittedVisibleGaussianTiles=e,this._latestCompletedLyr3dVisibilityChange=i,this.visibleGaussians=d,this._onSortComplete(this._latestSortedGaussianTiles,this._latestCompletedLyr3dVisibilityChange),this._renderer.requestRender(1),t.madeProgress()};await this._frameTask.schedule(T,t)}catch(e){if(s(e))return}}set useDeterministicSort(t){this._useDeterministicSort=t}}export{m as GaussianSplatDataStore};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{reallocGrowthFactor as t}from"../../../../core/arrayUtils.js";import{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../webgl/BufferObject.js";import"../../../webgl/FramebufferObject.js";import"../../../webgl/Program.js";import"../../../../core/has.js";import"../../../webgl/Renderbuffer.js";import r from"../../../webgl/Texture.js";import"../../../../core/Logger.js";import{PixelType as i,SizedPixelFormat as s}from"../../../webgl/enums.js";import"../../../webgl/Util.js";import{minExpectedGaussianCount as a}from"./GaussianSplatAtlasPages.js";import{TextureDescriptor as o}from"../../../webgl/TextureDescriptor.js";class u{constructor(t){this.texture=null,this._orderTextureCapacity=0,this._rctx=t}ensureCapacity(e){if(e<=0)return{textureWidth:0,rowCount:0,paddedSize:0};const u=this.texture;if(this._orderTextureCapacity>=e&&u?.hasWebGLTextureObject){const t=u.descriptor.width,r=Math.ceil(e/t);return{textureWidth:t,rowCount:r,paddedSize:t*r}}const
|
|
2
|
+
import{reallocGrowthFactor as t}from"../../../../core/arrayUtils.js";import{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../webgl/BufferObject.js";import"../../../webgl/FramebufferObject.js";import"../../../webgl/Program.js";import"../../../../core/has.js";import"../../../webgl/Renderbuffer.js";import r from"../../../webgl/Texture.js";import"../../../../core/Logger.js";import{PixelType as i,SizedPixelFormat as s}from"../../../webgl/enums.js";import"../../../webgl/Util.js";import{minExpectedGaussianCount as a}from"./GaussianSplatAtlasPages.js";import{TextureDescriptor as o}from"../../../webgl/TextureDescriptor.js";class u{constructor(t){this.texture=null,this._orderTextureCapacity=0,this._rctx=t}ensureCapacity(e){if(e<=0)return{textureWidth:0,rowCount:0,paddedSize:0};const u=this.texture;if(this._orderTextureCapacity>=e&&u?.hasWebGLTextureObject){const t=u.descriptor.width,r=Math.ceil(e/t);return{textureWidth:t,rowCount:r,paddedSize:t*r}}const d=Math.max(Math.ceil(e*t),a),[l,c]=this._evalTextureSize(d),h=l*c;this._orderTextureCapacity=h,this.texture?.dispose();const p=new o;p.width=l,p.height=c,p.pixelFormat=36244,p.dataType=i.UNSIGNED_INT,p.internalFormat=s.R32UI,p.wrapMode=33071,p.samplingMode=9728,p.isImmutable=!0,this.texture=new r(this._rctx,p);const n=Math.ceil(e/l);return{textureWidth:l,rowCount:n,paddedSize:l*n}}setData(t,e){const{textureWidth:r,rowCount:i,paddedSize:s}=this.ensureCapacity(e);if(t.length>=s)return void this.texture.updateData(0,0,0,r,i,t);(!this._uploadAtlasIndices||this._uploadAtlasIndices.length<s)&&(this._uploadAtlasIndices=new Uint32Array(s));const a=this._uploadAtlasIndices;a.set(t.subarray(0,e)),this.texture.updateData(0,0,0,r,i,a)}clear(){this._orderTextureCapacity=0,this._uploadAtlasIndices=void 0,this.texture?.dispose(),this.texture=null}destroy(){this.clear()}_evalTextureSize(t){const r=Math.ceil(Math.sqrt(t)),i=Math.ceil(t/r);return e(r,i)}}export{u as GaussianSplatOrderTexture};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import"../../../../../core/has.js";import t from"../../../../../core/Logger.js";import{disposeMaybe as
|
|
2
|
+
import{__decorate as e}from"tslib";import"../../../../../core/has.js";import t from"../../../../../core/Logger.js";import{abortMaybe as r,disposeMaybe as s}from"../../../../../core/maybe.js";import{throwIfAborted as i,isAbortError as a}from"../../../../../core/promiseUtils.js";import{watch as o,syncAndInitial as n}from"../../../../../core/reactiveUtils.js";import{property as m,subclass as l}from"../../../../../core/accessorSupport/decorators.js";import{set as u}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{requestImage as h}from"../../../../../request/image.js";import{InternalRenderCategory as c}from"../../../webgl.js";import p from"../../../webgl/RenderNode.js";import{GlobalIlluminationBlurTechnique as d}from"./GlobalIlluminationBlurTechnique.js";import{GlobalIlluminationTechnique as f}from"./GlobalIlluminationTechnique.js";import{GlobalIlluminationTechniqueConfiguration as b}from"./GlobalIlluminationTechniqueConfiguration.js";import{G as _}from"../../../../../chunks/GlobalIllumination.glsl.js";import{G as g}from"../../../../../chunks/GlobalIlluminationBlur.glsl.js";import{DepthStencilAttachment as w,SizedPixelFormat as T}from"../../../../webgl/enums.js";import x from"../../../../webgl/Texture.js";import{TextureDescriptor as P}from"../../../../webgl/TextureDescriptor.js";const j=1;let C=class extends p{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=c.AMBIENT_ILLUMINATION,this._passParameters=new _,this._drawParameters=new g,this._accumulatedFrames=0,this._maxFrames=255,this._configuration=new b,this._resetBuffer=!1}async initialize(){this._abortController=new AbortController;const e=this._abortController.signal;try{const t=(await import("./BlueNoise.js")).data;i(e),await this._loadBlueNoiseTexture(t,e),i(e)}catch(r){a(r)||t.getLogger(this).errorOnce("Failed to load blue noise texture:",r)}this.addHandles(o(()=>this.view.stage.renderer.hasAmbientIllumination,e=>{e&&this.resetAccumulation(),this.requestRender(1)},n))}precompile(){this._canRender&&(this._configuration.hasEmission=this.bindParameters.hasEmission,this.techniques.precompile(f,this._configuration),this.techniques.precompile(d))}destroy(){this._abortController=r(this._abortController),this._passParameters.noiseTexture=s(this._passParameters.noiseTexture)}render(e){const t=e.find(({name:e})=>"normals"===e),r=t?.getTexture(),s=t?.getTexture(w);if(!r||!s)return this._emptyOutput;if(!this._canRender)return this._resetBuffer=!1,this.requestRender(1),this._emptyOutput;const i=this.bindParameters;this._configuration.hasEmission=i.hasEmission;const a=this.techniques.getCompiled(f,this._configuration),o=this.techniques.getCompiled(d);if(!a||!o)return this.requestRender(1),this._emptyOutput;this.view.stage.renderView.updating&&this.resetAccumulation();const n=this.renderingContext,{camera:m}=i;this._passParameters.normalTexture=r,this._passParameters.depthTexture=s,this._passParameters.projScale=1/m.computeScreenPixelSizeAtDist(1);const{fullWidth:l,fullHeight:h}=m,p=this.fboCache.acquire(l,h,"global illumination input");n.bindFramebuffer(p.fbo),n.setViewport(0,0,l,h),n.bindTechnique(a,i,this._passParameters,this._drawParameters),n.screen.draw();const b=Math.round(l/j),_=Math.round(h/j),g=this.fboCache.acquire(b,_,"global illumination blur");n.bindFramebuffer(g.fbo),this._drawParameters.colorTexture=p.getTexture(),u(this._drawParameters.blurSize,0,j/h),n.bindTechnique(o,i,this._passParameters,this._drawParameters),n.setViewport(0,0,b,_),n.screen.draw(),p.release();const T=this.fboCache.acquire(l,h,c.AMBIENT_ILLUMINATION);return n.bindFramebuffer(T.fbo),n.setViewport(0,0,l,h),n.setClearColor(1,1,1,0),n.clear(16384),this._drawParameters.colorTexture=g.getTexture(),u(this._drawParameters.blurSize,j/l,0),n.bindTechnique(o,i,this._passParameters,this._drawParameters),n.setViewport(0,0,b,_),n.screen.draw(),n.setViewport4fv(m.fullViewport),g.release(),this._passParameters.frameCount=(this._passParameters.frameCount+1)%64,++this._accumulatedFrames,this._accumulatedFrames<this._maxFrames&&this.requestRender(1),T}get _emptyOutput(){const e=this.renderingContext,{fullWidth:t,fullHeight:r}=this.bindParameters.camera,s=this.fboCache.acquire(t,r,c.AMBIENT_ILLUMINATION);return e.bindFramebuffer(s.fbo),e.setViewport(0,0,t,r),e.setClearColor(0,0,0,1),e.clear(16384),s}async _loadBlueNoiseTexture(e,t){i(t);const r=await h(e,{signal:t});if(i(t),!r)return;const s=new P;s.internalFormat=T.RGBA8,s.wrapMode=10497,s.isImmutable=!0,this._passParameters.noiseTexture=new x(this.renderingContext,s,r)}get _canRender(){const e=this.bindParameters;return!(!this._passParameters.noiseTexture||e.hasEmission&&!e.reprojection.lastFrameEmission||!e.reprojection.lastFrameDepth||!e.globalIllumination||this._resetBuffer)}resetAccumulation(){this._accumulatedFrames=0}get test(){}};e([m()],C.prototype,"consumes",void 0),e([m()],C.prototype,"produces",void 0),e([m()],C.prototype,"_abortController",void 0),C=e([l("esri.views.3d.webgl-engine.effects.globalIllumination.GlobalIllumination")],C);export{C as GlobalIllumination,j as blurSizePixels};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderLibrary/output/ReadDepthLastFrame.glsl.js";import"../core/shaderLibrary/shading/EncodingColor.glsl.js";import"../core/shaderLibrary/shading/MainLighting.glsl.js";import"../core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js";import"../core/shaderLibrary/util/CameraSpace.glsl.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Matrix4BindUniform.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../../../webgl/NoParameters.js";import"../../../webgl/ShaderBuilder.js";export{G as GlobalIlluminationPassParameters,b as build}from"../../../../chunks/GlobalIllumination.glsl.js";
|
|
2
|
+
import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderLibrary/output/ReadDepthLastFrame.glsl.js";import"../core/shaderLibrary/shading/EncodingColor.glsl.js";import"../core/shaderLibrary/shading/MainLighting.glsl.js";import"../core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js";import"../core/shaderLibrary/util/CameraSpace.glsl.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Matrix4BindUniform.js";import"../core/shaderModules/Texture2DBindUniform.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../../../webgl/NoParameters.js";import"../../../webgl/ShaderBuilder.js";export{G as GlobalIlluminationPassParameters,b as build}from"../../../../chunks/GlobalIllumination.glsl.js";
|
|
@@ -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"../../Graphic.js";import i from"../../core/Accessor.js";import a from"../../core/Collection.js";import n from"../../core/Error.js";import{watch as r,initial as s}from"../../core/reactiveUtils.js";import{property as o,cast as c,subclass as h}from"../../core/accessorSupport/decorators.js";import d from"../../popup/support/AttachmentsOrderByInfo.js";import l
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../Graphic.js";import i from"../../core/Accessor.js";import a from"../../core/Collection.js";import n from"../../core/Error.js";import{watch as r,initial as s}from"../../core/reactiveUtils.js";import{property as o,cast as c,subclass as h}from"../../core/accessorSupport/decorators.js";import d from"../../popup/support/AttachmentsOrderByInfo.js";import{getSourceLayer as l}from"../../popup/support/featureUtils.js";import p from"../../rest/query/support/AttachmentInfo.js";import m from"../../rest/support/AttachmentQuery.js";const u={editing:!1,operations:{add:!0,update:!0,delete:!0}},f=a.ofType(p);let y=class extends i{constructor(t){super(t),this._getAttachmentsPromise=null,this._attachmentLayer=null,this.attachmentKeywords=null,this.attachmentTypes=null,this.capabilities={...u},this.activeAttachmentInfo=null,this.activeFileInfo=null,this.attachmentInfos=new f,this.fileInfos=new a,this.graphic=null,this.mode="view",this.orderByFields=null,this.filesEnabled=!1,this.addHandles(r(()=>this.graphic,()=>this._graphicChanged(),s))}destroy(){this._attachmentLayer=null,this.graphic=null}castCapabilities(t){return{...u,...t}}get state(){return this._getAttachmentsPromise?"loading":this.graphic?"ready":"disabled"}get supportsResizeAttachments(){const{graphic:t}=this;if(!t)return!1;const e=t.sourceLayer??t.layer;return e?.loaded&&"capabilities"in e&&e.capabilities&&"attachment"in e.capabilities&&e.capabilities.attachment&&"supportsResize"in e.capabilities.attachment&&e.capabilities.attachment.supportsResize||!1}get supportsTypeWildcard(){const{graphic:t}=this;if(!t)return!1;const e=t.sourceLayer??t.layer;return e?.loaded&&"capabilities"in e&&e.capabilities&&"attachment"in e.capabilities&&e.capabilities.attachment&&"supportsResize"in e.capabilities.attachment&&e.capabilities.attachment.supportsTypeWildcard||!1}async getAttachments(){const{_attachmentLayer:t,attachmentInfos:e,orderByFields:i,attachmentTypes:a,attachmentKeywords:r,supportsTypeWildcard:s}=this;if(!t||"function"!=typeof t.queryAttachments)throw new n("invalid-layer","getAttachments(): A valid layer is required.");const o=this._getObjectId();if("number"!=typeof o)throw new n("invalid-object-id","getAttachments(): Numeric object id is required");const c=i?.map(t=>`${t.field} ${"descending"===t.order?"DESC":"ASC"}`),h=new m({objectIds:[o],returnMetadata:!0,orderByFields:c,attachmentTypes:s?a?.filter(Boolean).map(t=>`${t}/*`):void 0,keywords:r}),d=[],l=t.queryAttachments(h).then(t=>t[o]||d).catch(()=>d);this._getAttachmentsPromise=l,this.notifyChange("state");const p=await l;return e.destroyAll(),p.length&&e.addMany(p),this._getAttachmentsPromise=null,this.notifyChange("state"),p}async addAttachment(t,e=this.graphic){const{_attachmentLayer:i,attachmentInfos:a,capabilities:r}=this;if(!e)throw new n("invalid-graphic","addAttachment(): A valid graphic is required.",{graphic:e});if(!t)throw new n("invalid-attachment","addAttachment(): An attachment is required.",{attachment:t});if(!r.operations?.add)throw new n("invalid-capabilities","addAttachment(): add capabilities are required.");if(!i||"function"!=typeof i.addAttachment)throw new n("invalid-layer","addAttachment(): A valid layer is required.");const s=i.addAttachment(e,t).then(t=>this._queryAttachment(t.objectId,e)),o=await s;return a.add(o),o}async deleteAttachment(t){const{_attachmentLayer:e,attachmentInfos:i,graphic:a,capabilities:r}=this;if(!t)throw new n("invalid-attachment-info","deleteAttachment(): An attachmentInfo is required.",{attachmentInfo:t});if(!r.operations?.delete)throw new n("invalid-capabilities","deleteAttachment(): delete capabilities are required.");if(!e||"function"!=typeof e.deleteAttachments)throw new n("invalid-layer","deleteAttachment(): A valid layer is required.");if(!a)throw new n("invalid-graphic","deleteAttachment(): A graphic is required.");const s=e.deleteAttachments(a,[t.id]).then(()=>t),o=await s;return i.remove(o),o.destroy(),o}async updateAttachment(t,e=this.activeAttachmentInfo){const{_attachmentLayer:i,attachmentInfos:a,graphic:r,capabilities:s}=this;if(!t)throw new n("invalid-attachment","updateAttachment(): An attachment is required.",{attachment:t});if(!e)throw new n("invalid-attachment-info","updateAttachment(): An attachmentInfo is required.",{attachmentInfo:e});if(!s.operations?.update)throw new n("invalid-capabilities","updateAttachment(): Update capabilities are required.");const o=a.indexOf(e);if(!i||"function"!=typeof i.updateAttachment)throw new n("invalid-layer","updateAttachment(): A valid layer is required.");if(!r)throw new n("invalid-graphic","updateAttachment(): A graphic is required.");const c=i.updateAttachment(r,e.id,t).then(t=>this._queryAttachment(t.objectId)),h=await c;return a.splice(o,1,h),h}async commitFiles(){return await Promise.all(this.fileInfos.items.map(t=>this.addAttachment(t.form))),this.fileInfos.removeAll(),this.getAttachments()}addFile(t,e){if(!t||!e)return null;const i={file:t,form:e};return this.fileInfos.add(i),i}updateFile(t,e,i=this.activeFileInfo){if(!t||!e||!i)return null;const a=this.fileInfos.indexOf(i);return a>-1&&this.fileInfos.splice(a,1,{file:t,form:e}),this.fileInfos.items[a]}deleteFile(t){const e=this.fileInfos.find(e=>e.file===t);return e?(this.fileInfos.remove(e),e):null}async _queryAttachment(t,e){const{_attachmentLayer:i}=this;if(!t||!i?.queryAttachments)throw new n("invalid-attachment-id","Could not query attachment.");const a=this._getObjectId(e);if("number"!=typeof a)throw new n("invalid-object-id","getAttachments(): Numeric object id is required");const r=new m({objectIds:[a],attachmentsWhere:`AttachmentId=${t}`,returnMetadata:!0});return i.queryAttachments(r).then(t=>t[a][0])}_getObjectId(t=this.graphic){return t?.getObjectId()??null}_graphicChanged(){this.graphic&&(this._setAttachmentLayer(),this.getAttachments().catch(()=>this.attachmentInfos.destroyAll()))}_setAttachmentLayer(){const{graphic:t}=this,e=l(t);this._attachmentLayer=e?"scene"===e.type&&null!=e.associatedLayer?e.associatedLayer:e:null}};t([o({type:[String]})],y.prototype,"attachmentKeywords",void 0),t([o({type:[["application","audio","image","model","text","video"]]})],y.prototype,"attachmentTypes",void 0),t([o()],y.prototype,"capabilities",void 0),t([c("capabilities")],y.prototype,"castCapabilities",null),t([o()],y.prototype,"activeAttachmentInfo",void 0),t([o()],y.prototype,"activeFileInfo",void 0),t([o({readOnly:!0,type:f})],y.prototype,"attachmentInfos",void 0),t([o()],y.prototype,"fileInfos",void 0),t([o({type:e})],y.prototype,"graphic",void 0),t([o()],y.prototype,"mode",void 0),t([o({type:[d]})],y.prototype,"orderByFields",void 0),t([o({readOnly:!0})],y.prototype,"state",null),t([o()],y.prototype,"filesEnabled",void 0),t([o({readOnly:!0})],y.prototype,"supportsResizeAttachments",null),t([o({readOnly:!0})],y.prototype,"supportsTypeWildcard",null),y=t([h("esri.widgets.Attachments.AttachmentsViewModel")],y);export{y as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{remove as i}from"../../core/arrayUtils.js";import o from"../../core/Error.js";import{makeHandle as a}from"../../core/handleUtils.js";import r from"../../core/Logger.js";import{abortMaybe as s}from"../../core/maybe.js";import{onAbort as n,createAbortError as l,throwIfAborted as d,debounce as c}from"../../core/promiseUtils.js";import p from"../../core/Queue.js";import{whenOnce as u,watch as w,sync as h,on as f,when as g}from"../../core/reactiveUtils.js";import{last as v}from"../../core/SetUtils.js";import{property as k,subclass as m}from"../../core/accessorSupport/decorators.js";import{getGraphicLayer as y}from"../../graphic/graphicOriginUtils.js";import{isEditableLayer as W}from"../../layers/support/editableLayers.js";import{isFeatureLayer as A,isSubtypeSublayer as _,isSubtypeGroupLayer as b,isTable as S}from"../../layers/support/layerUtils.js";import{createFeatureServices as C}from"../../rest/featureService/utils.js";import M from"../../views/draw/support/HighlightHelper.js";import{ViewEventPriorities as F}from"../../views/input/InputManager.js";import{temporaryHighlightName as R}from"../../views/support/HighlightDefaults.js";import U from"./CreateFeaturesWorkflow.js";import E from"./MergeFeaturesWorkflow.js";import I from"./SplitFeatureWorkflow.js";import j from"./UpdateFeaturesWorkflow.js";import{UpdateFeatureWorkflow as V}from"./UpdateFeatureWorkflow.js";import{UpdateRecordWorkflow as P}from"./UpdateRecordWorkflow.js";import L from"./UpdateWorkflowData.js";import N from"./Workflow.js";import{isFeatureFormViewModel as O,findEditorItemForLayer as T,isSplitFeatureWorkflow as x,workflowInfluencesOutcomeOfParent as D,isAnyUpdateLeafWorkflow as H,isUpdateRecordWorkflow as z,isParentWorkflow as q,findEditorItemForLayerOrThrow as G,createWorkflowSteps as Q,fetchCandidates as $,isUpdateFeaturesWorkflowOptions as B,toFeatureInfos as J,isMergeWorkflowOptions as K,isSplitWorkflowOptions as X}from"./workflowUtils.js";import{assertFeaturesAreFromSameLayer as Y}from"./support/errors.js";import{findUtilityNetwork as Z,isGraphicForRelatableFeatureSupportedLayer as ee}from"../Feature/support/featureUtils.js";var te;let ie=te=class extends N{constructor(e){super(e),this._workflowStack=new p(v),this._sketchStack=new p(v),this.data=void 0,this.type="update"}destroy(){this._drainWorkflowStack(e=>e.cancel({force:!0}))}get formViewModel(){return this.activeWorkflow?.formViewModel}get activeUtilityNetworkAssociationAddAssociationViewModel(){return"add-association"===this.activeWorkflow?.type?this.activeWorkflow.utilityNetworkAssociationAddAssociationViewModel:null}get activeSketchViewModel(){return this._sketchStack.peek()?.viewModel}get canDeleteAssociation(){const{formViewModel:e}=this;if(!this.activeWorkflow||!this.data.viewModel.view?.map||!O(e))return!1;const{activeAssociation:t,feature:i}=e;return!(!t||!i?.sourceLayer||!A(i?.sourceLayer)&&!_(i?.sourceLayer))}get activeWorkflow(){return this._workflowStack.last()}get updating(){return this._updatingHandles.updating||!!this.activeWorkflow?.updating}get hasPreviousStep(){const e=this.activeWorkflow?.formViewModel;return this._stepIndex>0||this.nestedWorkflowCount>1||this.activeWorkflow?.hasPreviousStep||"view"!==this.data.viewModel.attachmentsViewModel.mode||O(e)&&(null!=e.relationshipId||null!=e.associationId||null!=e.associatedLayer)}get hasUpdatableCandidates(){const{candidates:e,viewModel:t}=this.data;return e.some(({layer:e})=>T(t.editorItems,e)?.supportsUpdateWorkflow)}get nestedWorkflowCount(){return this._workflowStack.length}get shouldShowAttachments(){return this.activeWorkflow?.shouldShowAttachments??!1}get shouldAllowAttachmentEditing(){return this.activeWorkflow?.shouldAllowAttachmentEditing??!1}get hasPendingEdits(){return Array.from(this._workflowStack).some(e=>e.hasPendingEdits)}get helpMessage(){return this.activeWorkflow?.helpMessage?this.activeWorkflow.helpMessage:"awaiting-feature-to-update"===this.stepId?"select":void 0}get noticeMessage(){return this.activeWorkflow?.noticeMessage}get reliesOnOwnerAdminPrivileges(){return this.activeWorkflow?.reliesOnOwnerAdminPrivileges??!1}get hasInvalidFormTemplate(){return this.activeWorkflow?.hasInvalidFormTemplate??!1}get curveResizeDisabled(){return this.activeWorkflow?.curveResizeDisabled??!1}get curveUpdatesDisabled(){return this.activeWorkflow?.curveUpdatesDisabled??!1}async back(e=()=>Promise.resolve(!0)){const{activeWorkflow:t}=this,i=t?.formViewModel;if(O(i)){if(i?.activeRelationshipInput){const e=i.activeRelationshipInput;if(e.activeCategory)return void(e.activeCategory=null);if(null!=i.relationshipId)return void(i.relationshipId=null);if(e.showAllEnabled)return void(e.showAllEnabled=!1)}if("add-association"===t?.type){const{activeUtilityNetworkAssociationAddAssociationViewModel:e}=this;if(e?.filterOptionsVisible)return void(e.filterOptionsVisible=!1);e?.featureSpatialItems.length&&e.reset()}if(null!=i?.associatedLayer)return void(i.associatedLayer=null);if(null!=i?.associationId)return void(i.associationId=null)}if("create-features"===t?.type&&t.hasPreviousStep)await t.previous({cancelCurrentStep:!0});else{if(x(t)&&t.hasPreviousStep)return await t.back();if(t){if(t.hasPendingEdits){if(!await e())return}t.hasPreviousStep?await t.previous({cancelCurrentStep:!0}):await this.cancelActiveWorkflow({force:!0})}else this.hasPreviousStep?await this.previous({cancelCurrentStep:!0}):await this.cancel({force:!0})}}async cancelActiveWorkflow(e){await(this.activeWorkflow?.cancel(e)),await this._popWorkflowAndReconcile()}async commit(){await this._drainWorkflowStack(e=>e.commit()),await super.commit()}static create(e){const{startAt:t,applyEdits:i,applyEditsFeatureService:o,...a}=e,r=new te({data:new L({applyEditsCallback:i,applyEditsFeatureServiceCallback:o,...a}),onCommit:async()=>{}});return r._set("steps",this._createWorkflowSteps(r,t)),r}async save(e){const{formViewModel:t}=this;if(t&&(t.submit(),!t.submittable||O(t)&&ae(t)))return;if(this.nestedWorkflowCount<2)return await this.commit();const{activeWorkflow:i}=this;if(await(i?.commit(e)),!D(i))return void await this._popWorkflowAndReconcile();this._popWorkflow();const o=this._workflowStack.peek();if(o&&o===i?.parent&&(await o.cancel(),this._popWorkflow(),0===this.nestedWorkflowCount))return await this.commit();await this._reconcileWorkflowStack()}async startCreatingRelatedRecord(e){const t=this._makeUpdatingResolver();try{const t=this._createNestedCreateFeaturesWorkflow(e);await this._pushWorkflowAndReconcile(t)}catch(i){throw new o("editor:unable-to-start-creating","Could not begin updating the provided feature or table record.",{error:i})}finally{t.resolve()}}async startMergingFeatures(e,t){const i=this._makeUpdatingResolver();try{const i=await this._createNestedMergeFeaturesWorkflow(e,t);await this._pushWorkflowAndReconcile(i)}catch(a){throw new o("editor:unable-to-start-merging","Could not begin merging the provided features.",{error:a})}finally{i.resolve()}}async startSplittingFeature(e,t){const i=this._makeUpdatingResolver();try{const i=await this._createNestedSplitFeatureWorkflow(e,t);await this._pushWorkflowAndReconcile(i)}catch(a){throw new o("editor:unable-to-start-splitting","Could not begin splitting the provided feature.",{error:a})}finally{i.resolve()}}async startUpdatingSingle(e,t){const i=this._makeUpdatingResolver();try{const i=await this._createNestedUpdateWorkflow(e,t);await this._pushWorkflowAndReconcile(i)}catch(a){throw new o("editor:unable-to-start-updating","Could not begin updating the provided feature or table record.",{error:a})}finally{i.resolve()}}async startUpdatingMultiple(e,t){const i=this._makeUpdatingResolver();try{const i=await this._createNestedUpdateFeaturesWorkflow(e,t);await this._pushWorkflowAndReconcile(i)}catch(a){throw new o("editor:unable-to-start-updating","Could not begin updating the provided features or table records.",{error:a})}finally{i.resolve()}}async startAddAssociation(e,t,i){const a=this._makeUpdatingResolver();try{const o=await this._createNestedAddAssociationWorkflow(e,t,i);await this._pushWorkflowAndReconcile(o)}catch(r){throw new o("editor:unable-to-start-updating","Could not begin updating the provided feature or table record.",{error:r})}finally{a.resolve()}}async deleteActiveFeatures(){const{activeWorkflow:e}=this;if(!e)throw new o("editor:nothing-to-delete","There is no feature to delete");const t=H(e);if(t){e.data.stageDelete();const t=z(e)?e.data.edits.feature?[e.data.edits.feature]:[]:e.data.features;this._removeFeaturesFromCandidates(t)}else await e.cancel();this.nestedWorkflowCount<2?t?await this.commit():await this.cancel({force:!0}):(t&&await e.commit(),await this._popWorkflowAndReconcile(),await this._returnToPageWithContent())}async deleteActiveAssociation(){if(!this.canDeleteAssociation)throw new o("editor:nothing-to-delete","There is no association to delete");await this._deleteActiveAssociation(),await this._popWorkflowAndReconcile(),await this._returnToPageWithContent()}async cancelAll(){await this._drainWorkflowStack(e=>e.cancel({force:!0}))}async _deleteActiveAssociation(){const{formViewModel:e}=this;if(!O(e))throw new o("editing:failed-to-delete-association","The active workflow does not support editing associations");const{activeAssociation:t,feature:i}=e,{applyEditsFeatureServiceCallback:a,viewModel:r}=this.data,{sourceLayer:s}=i,n=_(s)&&s.parent?s.parent:s,l=C([n]),d=l.values().next().value?.featureService;if(!d)throw new o("editor:failed-to-delete-association","Could not retrieve feature service needed to delete association");await(d?.load());const c=r.view.map,p=Z(c,n);await(p?.networkSystemLayers.loadAssociationsTable());const u=p?.generateDeleteAssociations([t]);if(!u)throw new o("editor:failed-to-delete-association","Could not create payload needed to delete association");const w=p?.gdbVersion??void 0;await a(d,[u],{gdbVersion:w,globalIdUsed:!0})}_removeFeaturesFromCandidates(e){const{candidates:t}=this.data;if(0!==t.length&&0!==e.length)for(const o of e)i(t,o)}async _returnToPageWithContent(){const{formViewModel:e}=this;if(!O(e)||!e?.activeAssociationInput)return;const{activeAssociationInput:t,associationId:i}=e;await t.refresh(),t.associatedLayer&&!t.associatedFeatures?.length&&(e.associatedLayer=null),null==i||t.associatedFeatureInfos.size||(e.associationId=null)}_createNestedCreateFeaturesWorkflow(e){const{relatedLayer:t}=e,{addAttachmentsCallback:i,applyEditsCallback:a,applyEditsFeatureServiceCallback:r,sketchOptions:s,snappingManager:n,viewModel:l}=this.data;if(!W(t))throw new o("editor:unsupported-layer","Editing is not supported on the provided layer");const d=this._getCreationInfoForNestedCreateFeaturesWorkflow(e),c=d.template||d.initialFeature?"creating-features":"awaiting-feature-creation-info",p=q(this.activeWorkflow)?this.activeWorkflow:void 0;return U.create({addAttachmentsCallback:i,applyEdits:a,applyEditsFeatureService:r,creationInfo:d,isNested:!0,parent:p,sketchOptions:s,snappingManager:n,startAt:c,viewModel:l})}_getCreationInfoForNestedCreateFeaturesWorkflow(e){const{relatedLayer:i}=e;if(!W(i)||b(i))throw new o("editor:unsupported-layer","Editing is not supported on the provided layer");const{viewModel:a}=this.data,r={layer:i,maxFeatures:1},s=this._makeRelatedRecordAttributes(e),n=a.getTemplatesForLayer(i);return n?.length>0?(r.attributeOverrides=s,1===n.length&&(r.template=n[0])):r.initialFeature=new t({sourceLayer:i,attributes:s}),r}async _createNestedUpdateWorkflow(e,t={}){const i=S(e.sourceLayer)?P:V,{applyEditsCallback:o,applyEditsFeatureServiceCallback:a,sketchOptions:r,snappingManager:s,viewModel:n}=this.data,l=q(this.activeWorkflow)?this.activeWorkflow:void 0,d=await i.create({feature:e,parent:l,sketchOptions:r,snappingManager:s,viewModel:n,applyEdits:o,applyEditsFeatureService:a,featureFormCallbacks:{addRelatedRecord:e=>{this.startCreatingRelatedRecord(e)},editRelatedRecord:({relatedFeature:e,readOnly:t})=>{this.startUpdatingSingle(e,{readOnly:t})},selectAssociatedFeature:async({feature:e,association:t})=>await this.startUpdatingSingle(e,{association:t}),addAssociation:e=>{this.startAddAssociation(e.feature,e.utilityNetwork,e.associationType)}},...t});return await u(()=>!d.updating),d}async _createNestedUpdateFeaturesWorkflow(e,t={}){const{applyEditsCallback:i,applyEditsFeatureServiceCallback:o,viewModel:a}=this.data,r=j.create({applyEdits:i,applyEditsFeatureService:o,featureInfos:e,viewModel:a,...t});return await u(()=>!r.updating),r}async _createNestedAddAssociationWorkflow(e,t,i){const{AddAssociationWorkflow:a}=await import("./AddAssociationWorkflow.js"),{applyEditsCallback:r,applyEditsFeatureServiceCallback:s,viewModel:n}=this.data,l=q(this.activeWorkflow)?this.activeWorkflow:void 0,{formViewModel:d}=this,c=O(d)?d.activeAssociationInput:null;if(!c)throw new o("editing:unable-to-add-association","There is no active association input in the current workflow's form.");const p=await a.create({utilityNetwork:t,associationType:i,feature:e,parent:l,viewModel:n,associationInput:c,applyEdits:r,applyEditsFeatureService:s});return await u(()=>!p.updating),p}async _createNestedMergeFeaturesWorkflow(e,t){const{applyEditsCallback:i,applyEditsFeatureServiceCallback:o,viewModel:a}=this.data;Y(e);const r=G(this.data.viewModel.editorItems,y(e[0])),s=q(this.activeWorkflow)?this.activeWorkflow:void 0,n=await E.create({applyEdits:i,applyEditsFeatureService:o,editorItem:r,features:e,parent:s,viewModel:a,...t});return await u(()=>!n.updating),n}async _createNestedSplitFeatureWorkflow(e,t){const{applyEditsCallback:i,applyEditsFeatureServiceCallback:o,sketchOptions:a,snappingManager:r,viewModel:s}=this.data,n=q(this.activeWorkflow)?this.activeWorkflow:void 0,l=G(s.editorItems,e.sourceLayer),d=I.create({applyEdits:i,applyEditsFeatureService:o,editorItem:l,feature:e,parent:n,sketchOptions:a,snappingManager:r,viewModel:s,...t});return await u(()=>!d.updating),d}async _drainWorkflowStack(e){const t=this._workflowStack,i=[];for(const o of t){const t=e(o).finally(()=>o.destroy());this._updatingHandles.consumePromise(t),i.push(t)}await Promise.all(i),this._workflowStack.clear(),this._sketchStack.clear()}_makeUpdatingResolver(){const e=Promise.withResolvers();return this._updatingHandles.consumePromise(e.promise),e}_makeRelatedRecordAttributes(e){const{parentFeature:t,relatedLayer:i,relationshipId:o}=e;if(!ee(t))return;const a=i.relationships?.find(e=>e.id===o);if(!a)return void this._logContinuingWithoutRelationshipWarning("relationship-not-found","Could not begin creating a related record because the relationship specified could not be found on the destination layer.");if("origin"===a.role)return void this._logContinuingWithoutRelationshipWarning("unsupported-role","Creating new related records in the 'origin' table of a relationship is not yet supported");const r=t.sourceLayer;a.relatedTableId!==r.layerId&&this._logContinuingWithoutRelationshipWarning("invalid-argument-combination","The given parent feature does not belong to the relationship designated by the given relationship ID.");const s=r.relationships?.find(e=>e.id===o);if(!s)return void this._logContinuingWithoutRelationshipWarning("relationship-not-found","Could not begin creating a related record because the relationship specified could not be found on the origin layer.");const n=oe(r,s),l=t.getAttribute(n);l||this._logContinuingWithoutRelationshipWarning("no-key-on-origin-feature","The given parent feature does not have a value for the relationship's origin primary key field.");const d=oe(i,a);return{[d]:l}}_popWorkflow(){this._workflowStack.pop()?.destroy(),this._sketchStack.pop()}async _popWorkflowAndReconcile(){this._popWorkflow();const e=await this._reconcileWorkflowStack();if(e.failureCount>0)throw new o("editor:next-workflow-failed","Popped the top workflow, but the next workflow in the stack failed to activate",e)}async _pushWorkflowAndReconcile(e){const t=this._workflowRequiresSketchViewModel(e);this.activeWorkflow?.exit({removeSketchHandles:t});const i=this._sketchStack,a=await(e?.start()),r=i.peek();a?(r?.exit(),i.push(a)):i.push(this._cloneSketchController(r)),this._workflowStack.push(e);const s=await this._reconcileWorkflowStack();if(s.failureCount>0)throw new o("editor:failed-to-start-updating-feature","Failed to enter the provided workflow.",s)}async _reconcileWorkflowStack(){const e=this._workflowStack,t=this._sketchStack;try{const i=e.peek();return await(i?.enter()),await(t.peek()?.enter()),{activeWorkflow:i,failureCount:0}}catch(i){e.pop().destroy(),t.pop();const{activeWorkflow:o,failureCount:a}=await this._reconcileWorkflowStack();return{activeWorkflow:o,failureCount:a+1}}}_cloneSketchController(e){return{enter:e?.enter??(async()=>{}),exit:e?.exit??(async()=>{}),viewModel:e?.viewModel}}_workflowRequiresSketchViewModel(e){const{type:t}=e;return"update-feature"===t||"create-features"===t&&!S(e.data.creationInfo?.layer)}static _createWorkflowSteps(e,t="awaiting-feature-to-update"){const{data:i}=e;return Q(["awaiting-feature-to-update","awaiting-update-feature-candidate","editing-existing-feature","adding-attachment","editing-attachment"],t,{"awaiting-feature-to-update":()=>({id:"awaiting-feature-to-update",async setUp(){const{spinnerViewModel:t}=i.viewModel,o=i.viewModel.view;o.activeTool=null;let r=null;e.addHandles(a(()=>{r=s(r)}),this.id),i.rootFeatures.removeAll(),i.candidates=[];const c=o.on("immediate-click",async a=>{const s=Promise.withResolvers();e._updatingHandles.consumePromise(s.promise);try{t.location=a.mapPoint,t.visible=!0,r?.abort();const{editorItems:s}=i.viewModel;r=new AbortController;const c=await a.defer(()=>new Promise((e,t)=>{n(r?.signal,()=>t(l())),e($(s,o,a,r?.signal))}));if(d(r),i.candidates=c.filter(e=>"fulfilled"===e.status).flatMap(e=>e.value).filter(e=>!e.isAggregate),t.visible=1===i.candidates.length,0===i.candidates.length)return;if(a.stopPropagation(),1===i.candidates.length){const{rootFeatures:o}=i;o.removeAll(),o.add(i.candidates[0]),e.go("editing-existing-feature").catch(()=>{}).then(()=>t.visible=!1)}else e.next()}finally{s.resolve()}},F.TOOL),p=g(()=>null!=o.activeTool,()=>e.cancel({force:!0}),{once:!0});o.focus(),e.addHandles([c,p],this.id)},async tearDown(){0===i.candidates.length&&(i.viewModel.spinnerViewModel.visible=!1),e.removeHandles(this.id)}}),"awaiting-update-feature-candidate":()=>({id:"awaiting-update-feature-candidate",async setUp(){i.rootFeatures.removeAll();const{view:t}=i.viewModel;if(!t)return;const o=new M({view:t,highlightName:R});e.addHandles([f(()=>i.rootFeatures,"change",({added:e,removed:t})=>{t.forEach(e=>o.remove(e)),e.forEach(e=>o.add(e))},h),a(()=>o.removeAll())],this.id)},async tearDown(){e.removeHandles(this.id)}}),"editing-existing-feature":()=>({id:"editing-existing-feature",async setUp(){await re(e);const{data:t}=e;t.viewModel.spinnerViewModel.visible=!1;const i=c(async()=>{await u(()=>!e.updating),e.previous()});e.addHandles([w(()=>e.nestedWorkflowCount,(e,t)=>{0===e&&0!==t&&i()},h)],this.id)},async tearDown(){await e.cancelAll(),e.removeHandles(this.id)}}),"adding-attachment":()=>({id:"adding-attachment",parent:"editing-existing-feature",async setUp(){},async tearDown(){i.viewModel.attachmentsViewModel.mode="view"}}),"editing-attachment":()=>({id:"editing-attachment",parent:"editing-existing-feature",async setUp(){},async tearDown(){i.viewModel.attachmentsViewModel.mode="view"}})})}_logContinuingWithoutRelationshipWarning(e,t){r.getLogger(this).warn(`editor:${e}`,t,"The create operation will be allowed to proceed, but the resulting feature may not be related to the given parent feature.")}};function oe(e,{keyField:t}){return e.getField(t)?.name??t}function ae(e){if(e.pendingSubtypeChoice)return!0;const t=e.getValues();return e.validateContingencyConstraints(t,{includeIncompleteViolations:!0}).length>0}async function re(e){const{data:t}=e,{rootWorkflowOptions:i}=t;if(B(i)){const{rootFeatureInfos:a}=t,r=a.length>0?a:J(t.rootFeatures.toArray());if(0===r.length)throw new o("editing:invalid-parameter","Must supply `rootFeatureInfos` or `rootFeatures` when root workflow type is 'update-multiple'");return await e.startUpdatingMultiple(r,i.props)}const{rootFeatures:a}=t,r=a.getItemAt(0);if(!r)throw new o("editor:no-feature-specified","Cannot setup the 'updating-existing-feature' step until one or more root features are provided");K(i)?await e.startMergingFeatures(a.toArray(),i.props):X(i)?await e.startSplittingFeature(r,i.props):await e.startUpdatingSingle(r)}e([k()],ie.prototype,"formViewModel",null),e([k()],ie.prototype,"activeUtilityNetworkAssociationAddAssociationViewModel",null),e([k()],ie.prototype,"activeSketchViewModel",null),e([k()],ie.prototype,"canDeleteAssociation",null),e([k()],ie.prototype,"activeWorkflow",null),e([k()],ie.prototype,"updating",null),e([k()],ie.prototype,"data",void 0),e([k()],ie.prototype,"hasPreviousStep",null),e([k()],ie.prototype,"hasUpdatableCandidates",null),e([k()],ie.prototype,"nestedWorkflowCount",null),e([k()],ie.prototype,"shouldShowAttachments",null),e([k()],ie.prototype,"shouldAllowAttachmentEditing",null),e([k()],ie.prototype,"hasPendingEdits",null),e([k()],ie.prototype,"helpMessage",null),e([k()],ie.prototype,"noticeMessage",null),e([k()],ie.prototype,"reliesOnOwnerAdminPrivileges",null),e([k()],ie.prototype,"hasInvalidFormTemplate",null),e([k()],ie.prototype,"curveResizeDisabled",null),e([k()],ie.prototype,"curveUpdatesDisabled",null),ie=te=e([m("esri.widgets.Editor.UpdateWorkflow")],ie);const se=ie;export{se as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{remove as i}from"../../core/arrayUtils.js";import o from"../../core/Error.js";import{makeHandle as a}from"../../core/handleUtils.js";import r from"../../core/Logger.js";import{abortMaybe as s}from"../../core/maybe.js";import{onAbort as n,createAbortError as l,throwIfAborted as d,debounce as c}from"../../core/promiseUtils.js";import p from"../../core/Queue.js";import{whenOnce as u,watch as w,sync as h,on as f,when as g}from"../../core/reactiveUtils.js";import{last as v}from"../../core/SetUtils.js";import{property as k,subclass as m}from"../../core/accessorSupport/decorators.js";import{getGraphicLayer as y}from"../../graphic/graphicOriginUtils.js";import{isEditableLayer as W}from"../../layers/support/editableLayers.js";import{isFeatureLayer as A,isSubtypeSublayer as _,isSubtypeGroupLayer as b,isTable as S}from"../../layers/support/layerUtils.js";import{findUtilityNetwork as C,isGraphicForRelatableFeatureSupportedLayer as M}from"../../popup/support/featureUtils.js";import{createFeatureServices as F}from"../../rest/featureService/utils.js";import R from"../../views/draw/support/HighlightHelper.js";import{ViewEventPriorities as U}from"../../views/input/InputManager.js";import{temporaryHighlightName as E}from"../../views/support/HighlightDefaults.js";import I from"./CreateFeaturesWorkflow.js";import j from"./MergeFeaturesWorkflow.js";import V from"./SplitFeatureWorkflow.js";import P from"./UpdateFeaturesWorkflow.js";import{UpdateFeatureWorkflow as L}from"./UpdateFeatureWorkflow.js";import{UpdateRecordWorkflow as N}from"./UpdateRecordWorkflow.js";import O from"./UpdateWorkflowData.js";import T from"./Workflow.js";import{isFeatureFormViewModel as x,findEditorItemForLayer as D,isSplitFeatureWorkflow as H,workflowInfluencesOutcomeOfParent as z,isAnyUpdateLeafWorkflow as q,isUpdateRecordWorkflow as G,isParentWorkflow as Q,findEditorItemForLayerOrThrow as $,createWorkflowSteps as B,fetchCandidates as J,isUpdateFeaturesWorkflowOptions as K,toFeatureInfos as X,isMergeWorkflowOptions as Y,isSplitWorkflowOptions as Z}from"./workflowUtils.js";import{assertFeaturesAreFromSameLayer as ee}from"./support/errors.js";var te;let ie=te=class extends T{constructor(e){super(e),this._workflowStack=new p(v),this._sketchStack=new p(v),this.data=void 0,this.type="update"}destroy(){this._drainWorkflowStack(e=>e.cancel({force:!0}))}get formViewModel(){return this.activeWorkflow?.formViewModel}get activeUtilityNetworkAssociationAddAssociationViewModel(){return"add-association"===this.activeWorkflow?.type?this.activeWorkflow.utilityNetworkAssociationAddAssociationViewModel:null}get activeSketchViewModel(){return this._sketchStack.peek()?.viewModel}get canDeleteAssociation(){const{formViewModel:e}=this;if(!this.activeWorkflow||!this.data.viewModel.view?.map||!x(e))return!1;const{activeAssociation:t,feature:i}=e;return!(!t||!i?.sourceLayer||!A(i?.sourceLayer)&&!_(i?.sourceLayer))}get activeWorkflow(){return this._workflowStack.last()}get updating(){return this._updatingHandles.updating||!!this.activeWorkflow?.updating}get hasPreviousStep(){const e=this.activeWorkflow?.formViewModel;return this._stepIndex>0||this.nestedWorkflowCount>1||this.activeWorkflow?.hasPreviousStep||"view"!==this.data.viewModel.attachmentsViewModel.mode||x(e)&&(null!=e.relationshipId||null!=e.associationId||null!=e.associatedLayer)}get hasUpdatableCandidates(){const{candidates:e,viewModel:t}=this.data;return e.some(({layer:e})=>D(t.editorItems,e)?.supportsUpdateWorkflow)}get nestedWorkflowCount(){return this._workflowStack.length}get shouldShowAttachments(){return this.activeWorkflow?.shouldShowAttachments??!1}get shouldAllowAttachmentEditing(){return this.activeWorkflow?.shouldAllowAttachmentEditing??!1}get hasPendingEdits(){return Array.from(this._workflowStack).some(e=>e.hasPendingEdits)}get helpMessage(){return this.activeWorkflow?.helpMessage?this.activeWorkflow.helpMessage:"awaiting-feature-to-update"===this.stepId?"select":void 0}get noticeMessage(){return this.activeWorkflow?.noticeMessage}get reliesOnOwnerAdminPrivileges(){return this.activeWorkflow?.reliesOnOwnerAdminPrivileges??!1}get hasInvalidFormTemplate(){return this.activeWorkflow?.hasInvalidFormTemplate??!1}get curveResizeDisabled(){return this.activeWorkflow?.curveResizeDisabled??!1}get curveUpdatesDisabled(){return this.activeWorkflow?.curveUpdatesDisabled??!1}async back(e=()=>Promise.resolve(!0)){const{activeWorkflow:t}=this,i=t?.formViewModel;if(x(i)){if(i?.activeRelationshipInput){const e=i.activeRelationshipInput;if(e.activeCategory)return void(e.activeCategory=null);if(null!=i.relationshipId)return void(i.relationshipId=null);if(e.showAllEnabled)return void(e.showAllEnabled=!1)}if("add-association"===t?.type){const{activeUtilityNetworkAssociationAddAssociationViewModel:e}=this;if(e?.filterOptionsVisible)return void(e.filterOptionsVisible=!1);e?.featureSpatialItems.length&&e.reset()}if(null!=i?.associatedLayer)return void(i.associatedLayer=null);if(null!=i?.associationId)return void(i.associationId=null)}if("create-features"===t?.type&&t.hasPreviousStep)await t.previous({cancelCurrentStep:!0});else{if(H(t)&&t.hasPreviousStep)return await t.back();if(t){if(t.hasPendingEdits){if(!await e())return}t.hasPreviousStep?await t.previous({cancelCurrentStep:!0}):await this.cancelActiveWorkflow({force:!0})}else this.hasPreviousStep?await this.previous({cancelCurrentStep:!0}):await this.cancel({force:!0})}}async cancelActiveWorkflow(e){await(this.activeWorkflow?.cancel(e)),await this._popWorkflowAndReconcile()}async commit(){await this._drainWorkflowStack(e=>e.commit()),await super.commit()}static create(e){const{startAt:t,applyEdits:i,applyEditsFeatureService:o,...a}=e,r=new te({data:new O({applyEditsCallback:i,applyEditsFeatureServiceCallback:o,...a}),onCommit:async()=>{}});return r._set("steps",this._createWorkflowSteps(r,t)),r}async save(e){const{formViewModel:t}=this;if(t&&(t.submit(),!t.submittable||x(t)&&ae(t)))return;if(this.nestedWorkflowCount<2)return await this.commit();const{activeWorkflow:i}=this;if(await(i?.commit(e)),!z(i))return void await this._popWorkflowAndReconcile();this._popWorkflow();const o=this._workflowStack.peek();if(o&&o===i?.parent&&(await o.cancel(),this._popWorkflow(),0===this.nestedWorkflowCount))return await this.commit();await this._reconcileWorkflowStack()}async startCreatingRelatedRecord(e){const t=this._makeUpdatingResolver();try{const t=this._createNestedCreateFeaturesWorkflow(e);await this._pushWorkflowAndReconcile(t)}catch(i){throw new o("editor:unable-to-start-creating","Could not begin updating the provided feature or table record.",{error:i})}finally{t.resolve()}}async startMergingFeatures(e,t){const i=this._makeUpdatingResolver();try{const i=await this._createNestedMergeFeaturesWorkflow(e,t);await this._pushWorkflowAndReconcile(i)}catch(a){throw new o("editor:unable-to-start-merging","Could not begin merging the provided features.",{error:a})}finally{i.resolve()}}async startSplittingFeature(e,t){const i=this._makeUpdatingResolver();try{const i=await this._createNestedSplitFeatureWorkflow(e,t);await this._pushWorkflowAndReconcile(i)}catch(a){throw new o("editor:unable-to-start-splitting","Could not begin splitting the provided feature.",{error:a})}finally{i.resolve()}}async startUpdatingSingle(e,t){const i=this._makeUpdatingResolver();try{const i=await this._createNestedUpdateWorkflow(e,t);await this._pushWorkflowAndReconcile(i)}catch(a){throw new o("editor:unable-to-start-updating","Could not begin updating the provided feature or table record.",{error:a})}finally{i.resolve()}}async startUpdatingMultiple(e,t){const i=this._makeUpdatingResolver();try{const i=await this._createNestedUpdateFeaturesWorkflow(e,t);await this._pushWorkflowAndReconcile(i)}catch(a){throw new o("editor:unable-to-start-updating","Could not begin updating the provided features or table records.",{error:a})}finally{i.resolve()}}async startAddAssociation(e,t,i){const a=this._makeUpdatingResolver();try{const o=await this._createNestedAddAssociationWorkflow(e,t,i);await this._pushWorkflowAndReconcile(o)}catch(r){throw new o("editor:unable-to-start-updating","Could not begin updating the provided feature or table record.",{error:r})}finally{a.resolve()}}async deleteActiveFeatures(){const{activeWorkflow:e}=this;if(!e)throw new o("editor:nothing-to-delete","There is no feature to delete");const t=q(e);if(t){e.data.stageDelete();const t=G(e)?e.data.edits.feature?[e.data.edits.feature]:[]:e.data.features;this._removeFeaturesFromCandidates(t)}else await e.cancel();this.nestedWorkflowCount<2?t?await this.commit():await this.cancel({force:!0}):(t&&await e.commit(),await this._popWorkflowAndReconcile(),await this._returnToPageWithContent())}async deleteActiveAssociation(){if(!this.canDeleteAssociation)throw new o("editor:nothing-to-delete","There is no association to delete");await this._deleteActiveAssociation(),await this._popWorkflowAndReconcile(),await this._returnToPageWithContent()}async cancelAll(){await this._drainWorkflowStack(e=>e.cancel({force:!0}))}async _deleteActiveAssociation(){const{formViewModel:e}=this;if(!x(e))throw new o("editing:failed-to-delete-association","The active workflow does not support editing associations");const{activeAssociation:t,feature:i}=e,{applyEditsFeatureServiceCallback:a,viewModel:r}=this.data,{sourceLayer:s}=i,n=_(s)&&s.parent?s.parent:s,l=F([n]),d=l.values().next().value?.featureService;if(!d)throw new o("editor:failed-to-delete-association","Could not retrieve feature service needed to delete association");await(d?.load());const c=r.view.map,p=C(c,n);await(p?.networkSystemLayers.loadAssociationsTable());const u=p?.generateDeleteAssociations([t]);if(!u)throw new o("editor:failed-to-delete-association","Could not create payload needed to delete association");const w=p?.gdbVersion??void 0;await a(d,[u],{gdbVersion:w,globalIdUsed:!0})}_removeFeaturesFromCandidates(e){const{candidates:t}=this.data;if(0!==t.length&&0!==e.length)for(const o of e)i(t,o)}async _returnToPageWithContent(){const{formViewModel:e}=this;if(!x(e)||!e?.activeAssociationInput)return;const{activeAssociationInput:t,associationId:i}=e;await t.refresh(),t.associatedLayer&&!t.associatedFeatures?.length&&(e.associatedLayer=null),null==i||t.associatedFeatureInfos.size||(e.associationId=null)}_createNestedCreateFeaturesWorkflow(e){const{relatedLayer:t}=e,{addAttachmentsCallback:i,applyEditsCallback:a,applyEditsFeatureServiceCallback:r,sketchOptions:s,snappingManager:n,viewModel:l}=this.data;if(!W(t))throw new o("editor:unsupported-layer","Editing is not supported on the provided layer");const d=this._getCreationInfoForNestedCreateFeaturesWorkflow(e),c=d.template||d.initialFeature?"creating-features":"awaiting-feature-creation-info",p=Q(this.activeWorkflow)?this.activeWorkflow:void 0;return I.create({addAttachmentsCallback:i,applyEdits:a,applyEditsFeatureService:r,creationInfo:d,isNested:!0,parent:p,sketchOptions:s,snappingManager:n,startAt:c,viewModel:l})}_getCreationInfoForNestedCreateFeaturesWorkflow(e){const{relatedLayer:i}=e;if(!W(i)||b(i))throw new o("editor:unsupported-layer","Editing is not supported on the provided layer");const{viewModel:a}=this.data,r={layer:i,maxFeatures:1},s=this._makeRelatedRecordAttributes(e),n=a.getTemplatesForLayer(i);return n?.length>0?(r.attributeOverrides=s,1===n.length&&(r.template=n[0])):r.initialFeature=new t({sourceLayer:i,attributes:s}),r}async _createNestedUpdateWorkflow(e,t={}){const i=S(e.sourceLayer)?N:L,{applyEditsCallback:o,applyEditsFeatureServiceCallback:a,sketchOptions:r,snappingManager:s,viewModel:n}=this.data,l=Q(this.activeWorkflow)?this.activeWorkflow:void 0,d=await i.create({feature:e,parent:l,sketchOptions:r,snappingManager:s,viewModel:n,applyEdits:o,applyEditsFeatureService:a,featureFormCallbacks:{addRelatedRecord:e=>{this.startCreatingRelatedRecord(e)},editRelatedRecord:({relatedFeature:e,readOnly:t})=>{this.startUpdatingSingle(e,{readOnly:t})},selectAssociatedFeature:async({feature:e,association:t})=>await this.startUpdatingSingle(e,{association:t}),addAssociation:e=>{this.startAddAssociation(e.feature,e.utilityNetwork,e.associationType)}},...t});return await u(()=>!d.updating),d}async _createNestedUpdateFeaturesWorkflow(e,t={}){const{applyEditsCallback:i,applyEditsFeatureServiceCallback:o,viewModel:a}=this.data,r=P.create({applyEdits:i,applyEditsFeatureService:o,featureInfos:e,viewModel:a,...t});return await u(()=>!r.updating),r}async _createNestedAddAssociationWorkflow(e,t,i){const{AddAssociationWorkflow:a}=await import("./AddAssociationWorkflow.js"),{applyEditsCallback:r,applyEditsFeatureServiceCallback:s,viewModel:n}=this.data,l=Q(this.activeWorkflow)?this.activeWorkflow:void 0,{formViewModel:d}=this,c=x(d)?d.activeAssociationInput:null;if(!c)throw new o("editing:unable-to-add-association","There is no active association input in the current workflow's form.");const p=await a.create({utilityNetwork:t,associationType:i,feature:e,parent:l,viewModel:n,associationInput:c,applyEdits:r,applyEditsFeatureService:s});return await u(()=>!p.updating),p}async _createNestedMergeFeaturesWorkflow(e,t){const{applyEditsCallback:i,applyEditsFeatureServiceCallback:o,viewModel:a}=this.data;ee(e);const r=$(this.data.viewModel.editorItems,y(e[0])),s=Q(this.activeWorkflow)?this.activeWorkflow:void 0,n=await j.create({applyEdits:i,applyEditsFeatureService:o,editorItem:r,features:e,parent:s,viewModel:a,...t});return await u(()=>!n.updating),n}async _createNestedSplitFeatureWorkflow(e,t){const{applyEditsCallback:i,applyEditsFeatureServiceCallback:o,sketchOptions:a,snappingManager:r,viewModel:s}=this.data,n=Q(this.activeWorkflow)?this.activeWorkflow:void 0,l=$(s.editorItems,e.sourceLayer),d=V.create({applyEdits:i,applyEditsFeatureService:o,editorItem:l,feature:e,parent:n,sketchOptions:a,snappingManager:r,viewModel:s,...t});return await u(()=>!d.updating),d}async _drainWorkflowStack(e){const t=this._workflowStack,i=[];for(const o of t){const t=e(o).finally(()=>o.destroy());this._updatingHandles.consumePromise(t),i.push(t)}await Promise.all(i),this._workflowStack.clear(),this._sketchStack.clear()}_makeUpdatingResolver(){const e=Promise.withResolvers();return this._updatingHandles.consumePromise(e.promise),e}_makeRelatedRecordAttributes(e){const{parentFeature:t,relatedLayer:i,relationshipId:o}=e;if(!M(t))return;const a=i.relationships?.find(e=>e.id===o);if(!a)return void this._logContinuingWithoutRelationshipWarning("relationship-not-found","Could not begin creating a related record because the relationship specified could not be found on the destination layer.");if("origin"===a.role)return void this._logContinuingWithoutRelationshipWarning("unsupported-role","Creating new related records in the 'origin' table of a relationship is not yet supported");const r=t.sourceLayer;a.relatedTableId!==r.layerId&&this._logContinuingWithoutRelationshipWarning("invalid-argument-combination","The given parent feature does not belong to the relationship designated by the given relationship ID.");const s=r.relationships?.find(e=>e.id===o);if(!s)return void this._logContinuingWithoutRelationshipWarning("relationship-not-found","Could not begin creating a related record because the relationship specified could not be found on the origin layer.");const n=oe(r,s),l=t.getAttribute(n);l||this._logContinuingWithoutRelationshipWarning("no-key-on-origin-feature","The given parent feature does not have a value for the relationship's origin primary key field.");const d=oe(i,a);return{[d]:l}}_popWorkflow(){this._workflowStack.pop()?.destroy(),this._sketchStack.pop()}async _popWorkflowAndReconcile(){this._popWorkflow();const e=await this._reconcileWorkflowStack();if(e.failureCount>0)throw new o("editor:next-workflow-failed","Popped the top workflow, but the next workflow in the stack failed to activate",e)}async _pushWorkflowAndReconcile(e){const t=this._workflowRequiresSketchViewModel(e);this.activeWorkflow?.exit({removeSketchHandles:t});const i=this._sketchStack,a=await(e?.start()),r=i.peek();a?(r?.exit(),i.push(a)):i.push(this._cloneSketchController(r)),this._workflowStack.push(e);const s=await this._reconcileWorkflowStack();if(s.failureCount>0)throw new o("editor:failed-to-start-updating-feature","Failed to enter the provided workflow.",s)}async _reconcileWorkflowStack(){const e=this._workflowStack,t=this._sketchStack;try{const i=e.peek();return await(i?.enter()),await(t.peek()?.enter()),{activeWorkflow:i,failureCount:0}}catch(i){e.pop().destroy(),t.pop();const{activeWorkflow:o,failureCount:a}=await this._reconcileWorkflowStack();return{activeWorkflow:o,failureCount:a+1}}}_cloneSketchController(e){return{enter:e?.enter??(async()=>{}),exit:e?.exit??(async()=>{}),viewModel:e?.viewModel}}_workflowRequiresSketchViewModel(e){const{type:t}=e;return"update-feature"===t||"create-features"===t&&!S(e.data.creationInfo?.layer)}static _createWorkflowSteps(e,t="awaiting-feature-to-update"){const{data:i}=e;return B(["awaiting-feature-to-update","awaiting-update-feature-candidate","editing-existing-feature","adding-attachment","editing-attachment"],t,{"awaiting-feature-to-update":()=>({id:"awaiting-feature-to-update",async setUp(){const{spinnerViewModel:t}=i.viewModel,o=i.viewModel.view;o.activeTool=null;let r=null;e.addHandles(a(()=>{r=s(r)}),this.id),i.rootFeatures.removeAll(),i.candidates=[];const c=o.on("immediate-click",async a=>{const s=Promise.withResolvers();e._updatingHandles.consumePromise(s.promise);try{t.location=a.mapPoint,t.visible=!0,r?.abort();const{editorItems:s}=i.viewModel;r=new AbortController;const c=await a.defer(()=>new Promise((e,t)=>{n(r?.signal,()=>t(l())),e(J(s,o,a,r?.signal))}));if(d(r),i.candidates=c.filter(e=>"fulfilled"===e.status).flatMap(e=>e.value).filter(e=>!e.isAggregate),t.visible=1===i.candidates.length,0===i.candidates.length)return;if(a.stopPropagation(),1===i.candidates.length){const{rootFeatures:o}=i;o.removeAll(),o.add(i.candidates[0]),e.go("editing-existing-feature").catch(()=>{}).then(()=>t.visible=!1)}else e.next()}finally{s.resolve()}},U.TOOL),p=g(()=>null!=o.activeTool,()=>e.cancel({force:!0}),{once:!0});o.focus(),e.addHandles([c,p],this.id)},async tearDown(){0===i.candidates.length&&(i.viewModel.spinnerViewModel.visible=!1),e.removeHandles(this.id)}}),"awaiting-update-feature-candidate":()=>({id:"awaiting-update-feature-candidate",async setUp(){i.rootFeatures.removeAll();const{view:t}=i.viewModel;if(!t)return;const o=new R({view:t,highlightName:E});e.addHandles([f(()=>i.rootFeatures,"change",({added:e,removed:t})=>{t.forEach(e=>o.remove(e)),e.forEach(e=>o.add(e))},h),a(()=>o.removeAll())],this.id)},async tearDown(){e.removeHandles(this.id)}}),"editing-existing-feature":()=>({id:"editing-existing-feature",async setUp(){await re(e);const{data:t}=e;t.viewModel.spinnerViewModel.visible=!1;const i=c(async()=>{await u(()=>!e.updating),e.previous()});e.addHandles([w(()=>e.nestedWorkflowCount,(e,t)=>{0===e&&0!==t&&i()},h)],this.id)},async tearDown(){await e.cancelAll(),e.removeHandles(this.id)}}),"adding-attachment":()=>({id:"adding-attachment",parent:"editing-existing-feature",async setUp(){},async tearDown(){i.viewModel.attachmentsViewModel.mode="view"}}),"editing-attachment":()=>({id:"editing-attachment",parent:"editing-existing-feature",async setUp(){},async tearDown(){i.viewModel.attachmentsViewModel.mode="view"}})})}_logContinuingWithoutRelationshipWarning(e,t){r.getLogger(this).warn(`editor:${e}`,t,"The create operation will be allowed to proceed, but the resulting feature may not be related to the given parent feature.")}};function oe(e,{keyField:t}){return e.getField(t)?.name??t}function ae(e){if(e.pendingSubtypeChoice)return!0;const t=e.getValues();return e.validateContingencyConstraints(t,{includeIncompleteViolations:!0}).length>0}async function re(e){const{data:t}=e,{rootWorkflowOptions:i}=t;if(K(i)){const{rootFeatureInfos:a}=t,r=a.length>0?a:X(t.rootFeatures.toArray());if(0===r.length)throw new o("editing:invalid-parameter","Must supply `rootFeatureInfos` or `rootFeatures` when root workflow type is 'update-multiple'");return await e.startUpdatingMultiple(r,i.props)}const{rootFeatures:a}=t,r=a.getItemAt(0);if(!r)throw new o("editor:no-feature-specified","Cannot setup the 'updating-existing-feature' step until one or more root features are provided");Y(i)?await e.startMergingFeatures(a.toArray(),i.props):Z(i)?await e.startSplittingFeature(r,i.props):await e.startUpdatingSingle(r)}e([k()],ie.prototype,"formViewModel",null),e([k()],ie.prototype,"activeUtilityNetworkAssociationAddAssociationViewModel",null),e([k()],ie.prototype,"activeSketchViewModel",null),e([k()],ie.prototype,"canDeleteAssociation",null),e([k()],ie.prototype,"activeWorkflow",null),e([k()],ie.prototype,"updating",null),e([k()],ie.prototype,"data",void 0),e([k()],ie.prototype,"hasPreviousStep",null),e([k()],ie.prototype,"hasUpdatableCandidates",null),e([k()],ie.prototype,"nestedWorkflowCount",null),e([k()],ie.prototype,"shouldShowAttachments",null),e([k()],ie.prototype,"shouldAllowAttachmentEditing",null),e([k()],ie.prototype,"hasPendingEdits",null),e([k()],ie.prototype,"helpMessage",null),e([k()],ie.prototype,"noticeMessage",null),e([k()],ie.prototype,"reliesOnOwnerAdminPrivileges",null),e([k()],ie.prototype,"hasInvalidFormTemplate",null),e([k()],ie.prototype,"curveResizeDisabled",null),e([k()],ie.prototype,"curveUpdatesDisabled",null),ie=te=e([m("esri.widgets.Editor.UpdateWorkflow")],ie);const se=ie;export{se as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as r}from"../../../core/accessorSupport/decorators.js";import a from"../../../layers/support/EditingCapabilities.js";import{
|
|
2
|
+
import{__decorate as e}from"tslib";import{property as t,subclass as r}from"../../../core/accessorSupport/decorators.js";import a from"../../../layers/support/EditingCapabilities.js";import{isRelatableFeatureSupportedLayer as l}from"../../../popup/support/featureUtils.js";import{isGeometryEditableSceneLayer as n}from"../../../views/layers/support/editableLayerViews.js";let s=class extends a{constructor(e){super(e),this.layerInfo=null,this.layerView=null}get attachments(){const e=this.defaults.attachments.enabled,t=this.layerInfo;return{enabled:e&&!1!==t?.enabled}}get create(){const{attachments:e,defaults:t,layerInfo:r,layer:a,layerView:l}=this,n=t.create,s=!1!==r?.enabled&&!1!==r?.addEnabled,o=n.enabled&&s;return{attributes:o&&n.attributes,enabled:o,geometry:o&&n.geometry&&i(a,l),attachments:{enabled:e.enabled&&o&&!1!==r?.attachmentsOnCreateEnabled},reliesOnOwnerAdminPrivileges:n.reliesOnOwnerAdminPrivileges}}get defaults(){return new a({layer:this.layer})}get delete(){const{defaults:e,layerInfo:t}=this,r=e.delete,a=!1!==t?.enabled&&!1!==t?.deleteEnabled;return{enabled:r.enabled&&a,reliesOnOwnerAdminPrivileges:r.reliesOnOwnerAdminPrivileges}}get formTemplate(){const{layer:e,layerInfo:t}=this;return t?.formTemplate?t.formTemplate:e&&"formTemplate"in e?e.formTemplate:null}get relationship(){const{layer:e}=this,t=!(!l(e)||!e.relationships?.length),r=!!this.formTemplate?.elements?.some(e=>"relationship"===e.type);return{enabled:t&&r}}get update(){const{attachments:e,defaults:t,layerInfo:r,layer:a,layerView:l}=this,n=t.update,s=!1!==r?.enabled&&!1!==r?.updateEnabled,o=n.enabled&&s,p=o&&n.attributes&&!1!==r?.attributeUpdatesEnabled,d=o&&n.geometry&&!1!==r?.geometryUpdatesEnabled&&i(a,l),m=e.enabled&&!1!==r?.attachmentsOnUpdateEnabled;return{attributes:p,enabled:o,geometry:d,attachments:{enabled:m,create:m&&n.attachments.create,update:m&&n.attachments.update},reliesOnOwnerAdminPrivileges:n.reliesOnOwnerAdminPrivileges}}};function i(e,t){return"scene"!==e.type||null!=t&&"type"in t&&"scene-layer-3d"===t.type&&n(e,t)}e([t()],s.prototype,"attachments",null),e([t()],s.prototype,"create",null),e([t()],s.prototype,"defaults",null),e([t()],s.prototype,"delete",null),e([t()],s.prototype,"formTemplate",null),e([t()],s.prototype,"layerInfo",void 0),e([t()],s.prototype,"layerView",void 0),e([t()],s.prototype,"relationship",null),e([t()],s.prototype,"update",null),s=e([r("esri.widgets.Editor.support.EditorEditingCapabilities")],s);const o=s;export{o 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 e from"../../../Graphic.js";import r from"../../../core/Accessor.js";import{watch as o,initial as s}from"../../../core/reactiveUtils.js";import{property as i,subclass as n}from"../../../core/accessorSupport/decorators.js";import{graphicCallback as a}from"
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../../Graphic.js";import r from"../../../core/Accessor.js";import{watch as o,initial as s}from"../../../core/reactiveUtils.js";import{property as i,subclass as n}from"../../../core/accessorSupport/decorators.js";import{graphicCallback as a}from"../../../popup/support/featureUtils.js";let c=class extends r{constructor(t){super(t),this._loadingPromise=null,this.created=null,this.creator=null,this.destroyer=null,this.graphic=null,this.addHandles(o(()=>this.creator,t=>{this._destroyContent(),this._createContent(t)},s))}destroy(){this._destroyContent()}get state(){return this._loadingPromise?"loading":"ready"}_destroyContent(){const{created:t,graphic:e,destroyer:r}=this;t&&e&&(a({type:"content",value:r,event:{graphic:e}}),this._set("created",null))}async _createContent(t){const e=this.graphic;if(!e||!t)return;const r=a({type:"content",value:t,event:{graphic:e}});this._loadingPromise=r,this.notifyChange("state");const o=await r;r===this._loadingPromise&&(this._loadingPromise=null,this.notifyChange("state"),this._set("created",o))}};t([i({readOnly:!0})],c.prototype,"created",void 0),t([i()],c.prototype,"creator",void 0),t([i()],c.prototype,"destroyer",void 0),t([i({type:e})],c.prototype,"graphic",void 0),t([i({readOnly:!0})],c.prototype,"state",null),c=t([n("esri.widgets.Feature.FeatureContent.FeatureContentViewModel")],c);export{c as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as r}from"../../core/accessorSupport/decorators.js";import o
|
|
2
|
+
import{__decorate as e}from"tslib";import{property as t,subclass as r}from"../../core/accessorSupport/decorators.js";import{shouldOpenInNewTab as o}from"../../popup/support/featureUtils.js";import a from"../Widget.js";import i from"./FeatureContent/FeatureContentViewModel.js";import{tsx as s,isWidget as d}from"../support/widget.js";const n="esri-feature-content",l={base:n,loaderContainer:`${n}__loader-container`,loader:`${n}__loader`};let c=class extends a{constructor(e,t){super(e,t),this.viewModel=null,this._addTargetToAnchors=e=>{Array.from(e.querySelectorAll("a")).forEach(e=>{o(e.href)&&!e.hasAttribute("target")&&e.setAttribute("target","_blank")})}}get creator(){return this.viewModel?.creator}set creator(e){this.viewModel&&(this.viewModel.creator=e)}get graphic(){return this.viewModel?.graphic}set graphic(e){this.viewModel&&(this.viewModel.graphic=e)}render(){const e=this.viewModel?.state;return s("div",{class:l.base},"loading"===e?this._renderLoading():this._renderCreated())}_renderLoading(){return s("div",{class:l.loaderContainer,key:"loader"},s("div",{class:l.loader}))}_renderCreated(){const e=this.viewModel?.created;return e?e instanceof HTMLElement?s("div",{afterCreate:this._attachToNode,bind:e,key:e}):d(e)?s("div",{key:e},!e.destroyed&&e.render()):s("div",{afterCreate:this._addTargetToAnchors,innerHTML:e,key:e}):null}_attachToNode(e){const t=this;e.appendChild(t)}};e([t()],c.prototype,"creator",null),e([t()],c.prototype,"graphic",null),e([t({type:i})],c.prototype,"viewModel",void 0),c=e([r("esri.widgets.Feature.FeatureContent")],c);export{c as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import i from"../../../core/Accessor.js";import{createTask as s}from"../../../core/asyncUtils.js";import{abortMaybe as o}from"../../../core/maybe.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{watch as r,initial as n,when as l}from"../../../core/reactiveUtils.js";import{throttle as p}from"../../../core/throttle.js";import{property as c,subclass as h}from"../../../core/accessorSupport/decorators.js";import m from"../../../geometry/Point.js";import{MediaContent as d,TextContent as u,FieldsContent as f}from"../../../popup/content.js";import v from"../../../popup/ElementExpressionInfo.js";import _
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import i from"../../../core/Accessor.js";import{createTask as s}from"../../../core/asyncUtils.js";import{abortMaybe as o}from"../../../core/maybe.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{watch as r,initial as n,when as l}from"../../../core/reactiveUtils.js";import{throttle as p}from"../../../core/throttle.js";import{property as c,subclass as h}from"../../../core/accessorSupport/decorators.js";import m from"../../../geometry/Point.js";import{MediaContent as d,TextContent as u,FieldsContent as f}from"../../../popup/content.js";import v from"../../../popup/ElementExpressionInfo.js";import{compileExpression as _}from"../../../popup/support/arcadeFeatureUtils.js";import y from"../FeatureContent/FeatureContentViewModel.js";import w from"../FeatureFields/FeatureFieldsViewModel.js";import T from"../FeatureMedia/FeatureMediaViewModel.js";const k=1;let E=class extends i{constructor(e){super(e),this._compileTask=null,this._evaluateTask=null,this.expressionInfo=null,this.graphic=null,this.contentElementViewModel=null,this.interceptor=null,this.location=null,this.view=null,this._createVM=()=>{const e=this.contentElement?.type;this.contentElementViewModel?.destroy();const t="fields"===e?new w:"media"===e?new T:"text"===e?new y:null;this._set("contentElementViewModel",t)},this._compileThrottled=p(this._startCompile,()=>this.notifyChange("state"),k,this),this._evaluateThrottled=p(this._startEvaluate,()=>this.notifyChange("state"),k,this),this.addHandles([r(()=>[this.expressionInfo,this.graphic],()=>this._compileThrottled(),n),r(()=>[this.contentElement],()=>this._createVM(),n),l(()=>{if(!this._compileTask?.finished)return null;const e=this._compileTask.value,t=e?.dependencies;return[e,this.spatialReference,this.map,this.view,t?.has("view-scale")?this.view?.scale:null,t?.has("view-time-extent")?this.view?.timeExtent?.start:null,t?.has("view-time-extent")?this.view?.timeExtent?.end:null]},([e])=>this._evaluateThrottled(e))])}initialize(){this.addHandles([this._compileThrottled,this._evaluateThrottled])}destroy(){this._compileTask=o(this._compileTask),this._evaluateTask=o(this._evaluateTask),this.contentElementViewModel?.destroy(),this._set("contentElementViewModel",null)}get contentElement(){return this._evaluateTask?.value}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){const{contentElement:e,contentElementViewModel:t}=this;return this._compileThrottled.hasPendingUpdates()||this._evaluateThrottled.hasPendingUpdates()||!this._compileTask?.finished||!this._evaluateTask?.finished?"loading":e||t?"ready":"disabled"}get map(){return this.view?.map??null}set map(e){this._override("map",e)}_startCompile(){this._evaluateTask=o(this._evaluateTask),this._compileTask=o(this._compileTask),this._compileTask=s(async e=>{const{expressionInfo:t,graphic:i}=this,s=t?.expression;if(!s||!i)return null;const o=await _({expression:s,graphic:i});return a(e),o})}_startEvaluate(e){this._evaluateTask=o(this._evaluateTask),this._evaluateTask=s(async t=>{const{graphic:i}=this;if(!e||!i)return null;const{interceptor:s,spatialReference:o,map:r,location:n,view:l}=this,p=await e.evaluate({graphic:i,interceptor:s,location:n,map:r,options:{signal:t},spatialReference:o,view:l});a(t);const c=p;if(!c||"esri.arcade.Dictionary"!==c.declaredClass)return null;const h=await c.castAsJsonAsync(t);a(t);const m=h?.type,v="media"===m?d.fromJSON(h):"text"===m?u.fromJSON(h):"fields"===m?f.fromJSON(h):null;return"media"===v.type&&!v.mediaInfos||"fields"===v.type&&!v.fieldInfos||"text"===v.type&&!v.text?null:v})}};e([c()],E.prototype,"_compileTask",void 0),e([c()],E.prototype,"_evaluateTask",void 0),e([c({type:v})],E.prototype,"expressionInfo",void 0),e([c({type:t})],E.prototype,"graphic",void 0),e([c({readOnly:!0})],E.prototype,"contentElement",null),e([c({readOnly:!0})],E.prototype,"contentElementViewModel",void 0),e([c()],E.prototype,"interceptor",void 0),e([c({type:m})],E.prototype,"location",void 0),e([c()],E.prototype,"spatialReference",null),e([c({readOnly:!0})],E.prototype,"state",null),e([c()],E.prototype,"map",null),e([c()],E.prototype,"view",void 0),E=e([h("esri.widgets.Feature.FeatureExpression.FeatureExpressionViewModel")],E);export{E as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as o}from"tslib";import e from"../../../core/Accessor.js";import{property as t,subclass as i}from"../../../core/accessorSupport/decorators.js";import s from"../../../popup/ExpressionInfo.js";import r from"../../../popup/FieldInfo.js";import{getFieldInfoLabel as n,getConfigurableFieldsContainer as
|
|
2
|
+
import{__decorate as o}from"tslib";import e from"../../../core/Accessor.js";import{property as t,subclass as i}from"../../../core/accessorSupport/decorators.js";import s from"../../../popup/ExpressionInfo.js";import r from"../../../popup/FieldInfo.js";import{getFieldInfoLabel as n,getConfigurableFieldsContainer as p,getFieldFormat as l}from"../../../popup/support/featureUtils.js";let f=class extends e{constructor(o){super(o),this.attributes=null,this.expressionInfos=null,this.description=null,this.fieldInfos=null,this.isContentFieldInfos=!1,this.graphic=null,this.layer=null,this.title=null}get formattedFieldInfos(){const{expressionInfos:o,fieldInfos:e,layer:t,isContentFieldInfos:i,graphic:s}=this,r=[];return e?.forEach(e=>{if(!(!e.hasOwnProperty("visible")||e.visible))return;const f=e.clone();f.label=n({fieldInfo:f,expressionInfos:o,layer:t,graphic:s,isContentFieldInfos:i});const d=p({fieldInfo:e,graphic:s,layer:t});d&&(f.fieldFormat=l({configurableFieldsContainer:d,fieldInfo:f,isContentFieldInfos:i})),r.push(f)}),r}};o([t()],f.prototype,"attributes",void 0),o([t({type:[s]})],f.prototype,"expressionInfos",void 0),o([t()],f.prototype,"description",void 0),o([t({type:[r]})],f.prototype,"fieldInfos",void 0),o([t({readOnly:!0})],f.prototype,"formattedFieldInfos",null),o([t()],f.prototype,"isContentFieldInfos",void 0),o([t()],f.prototype,"graphic",void 0),o([t()],f.prototype,"layer",void 0),o([t()],f.prototype,"title",void 0),f=o([i("esri.widgets.Feature.FeatureFields.FeatureFieldsViewModel")],f);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 e from"../../../core/Accessor.js";import{isSome as i}from"../../../core/arrayUtils.js";import{property as o,cast as r,subclass as a}from"../../../core/accessorSupport/decorators.js";import s from"../../../popup/FieldInfo.js";import l from"../../../popup/content/support/ChartMediaInfoValueSeries.js";import{substituteFieldsInLinksAndAttributes as n,fixTokens as p,substituteAttributes as d,getFixedFieldNames as u,getFixedFieldName as f,isRelatedField as m,isExpressionField as c,getFieldInfoLabel as h,getFieldInfo as y}from"
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../../core/Accessor.js";import{isSome as i}from"../../../core/arrayUtils.js";import{property as o,cast as r,subclass as a}from"../../../core/accessorSupport/decorators.js";import s from"../../../popup/FieldInfo.js";import l from"../../../popup/content/support/ChartMediaInfoValueSeries.js";import{substituteFieldsInLinksAndAttributes as n,fixTokens as p,substituteAttributes as d,getFixedFieldNames as u,getFixedFieldName as f,isRelatedField as m,isExpressionField as c,getFieldInfoLabel as h,getFieldInfo as y}from"../../../popup/support/featureUtils.js";import{getRelatedFieldInfo as b}from"../../../popup/support/relatedFeatureUtils.js";const I={chartAnimation:!0};let v=class extends e{constructor(t){super(t),this.abilities={...I},this.activeMediaInfoIndex=0,this.attributes=null,this.description=null,this.fieldInfoMap=null,this.formattedAttributes=null,this.expressionAttributes=null,this.layer=null,this.mediaInfos=null,this.popupTemplate=null,this.relatedInfos=null,this.title=null}castAbilities(t){return{...I,...t}}get activeMediaInfo(){return this.formattedMediaInfos[this.activeMediaInfoIndex]||null}get formattedMediaInfos(){return this._formatMediaInfos()||[]}get formattedMediaInfoCount(){return this.formattedMediaInfos.length}setActiveMedia(t){this._setContentElementMedia(t)}next(){this._pageContentElementMedia(1)}previous(){this._pageContentElementMedia(-1)}_setContentElementMedia(t){const{formattedMediaInfoCount:e}=this,i=(t+e)%e;this.activeMediaInfoIndex=i}_pageContentElementMedia(t){const{activeMediaInfoIndex:e}=this,i=e+t;this._setContentElementMedia(i)}_formatMediaInfos(){const{mediaInfos:t,layer:e}=this,o=this.attributes??{},r=this.formattedAttributes??{},a=this.expressionAttributes??{},s=this.fieldInfoMap??new Map;return t?.map(t=>{const i=t?.clone();if(!i)return null;if(i.title=n({attributes:o,fieldInfoMap:s,globalAttributes:r,expressionAttributes:a,layer:e,text:i.title}),i.caption=n({attributes:o,fieldInfoMap:s,globalAttributes:r,expressionAttributes:a,layer:e,text:i.caption}),i.altText=n({attributes:o,fieldInfoMap:s,globalAttributes:r,expressionAttributes:a,layer:e,text:i.altText}),"image"===i.type){if(!i.value)return;return this._setImageValue({value:i.value,formattedAttributes:r,layer:e}),i.value.sourceURL?i:void 0}if("pie-chart"===i.type||"line-chart"===i.type||"column-chart"===i.type||"bar-chart"===i.type){if(!i.value)return;return this._setChartValue({value:i.value,chartType:i.type,attributes:o,formattedAttributes:r,layer:e,expressionAttributes:a}),i}return null}).filter(i)??[]}_setImageValue(t){const e=this.fieldInfoMap??new Map,{value:i,formattedAttributes:o,layer:r}=t,{linkURL:a,sourceURL:s}=i;if(s){const t=p(s,r);i.sourceURL=d({formattedAttributes:o,template:t,fieldInfoMap:e})}if(a){const t=p(a,r);i.linkURL=d({formattedAttributes:o,template:t,fieldInfoMap:e})}}_setChartValue(t){const{value:e,attributes:i,formattedAttributes:o,chartType:r,layer:a,expressionAttributes:s}=t,{popupTemplate:l,relatedInfos:n}=this,{fields:p,normalizeField:d}=e,c=a;e.fields=u(p,c),d&&(e.normalizeField=f(d,c));if(!p.some(t=>!!(null!=o[t]||m(t)&&n?.size)))return;const h=l?.fieldInfos??[];p.forEach((t,a)=>{const l=e.colors?.[a];if(m(t))return void(e.series=[...e.series,...this._getRelatedChartInfos({fieldInfos:h,fieldName:t,formattedAttributes:o,chartType:r,value:e,color:l})]);const n=this._getChartOption({value:e,attributes:i,chartType:r,formattedAttributes:o,expressionAttributes:s,fieldName:t,fieldInfos:h,color:l});e.series.push(n)})}_getRelatedChartInfos(t){const{fieldInfos:e,fieldName:i,formattedAttributes:o,chartType:r,value:a,color:s}=t,l=[],n=b(i),p=n&&this.relatedInfos?.get(n.layerId.toString());if(!p)return l;const{relatedFeatures:d,relation:u}=p;if(!u||!d)return l;const{cardinality:f}=u;d.forEach(t=>{const{attributes:p}=t;p&&Object.keys(p).forEach(t=>{t===n.fieldName&&l.push(this._getChartOption({value:a,attributes:p,formattedAttributes:o,fieldName:i,chartType:r,relatedFieldName:t,hasMultipleRelatedFeatures:d?.length>1,fieldInfos:e,color:s}))})});return"one-to-many"===f||"many-to-many"===f?l:[l[0]]}_getTooltip({label:t,value:e,chartType:i}){return"pie-chart"===i?`${t}`:`${t}: ${e}`}_getChartOption(t){const{value:e,attributes:i,formattedAttributes:o,expressionAttributes:r,fieldName:a,relatedFieldName:n,fieldInfos:p,chartType:d,hasMultipleRelatedFeatures:u,color:I}=t,{layer:v,graphic:M}=this,A=this.fieldInfoMap??new Map,{normalizeField:g,tooltipField:x}=e,_=g?m(g)?i[b(g).fieldName]:i[g]:null,C=c(a)&&void 0!==r?.[a]?r[a]:n&&void 0!==i[n]?i[n]:void 0!==i[a]?i[a]:o[a],T=void 0===C?null:C&&_?C/_:C,N=new l({fieldName:a,color:I,value:null!=T?"number"==typeof T?T:Number(T):void 0});if(m(a)){const t=A.get(a.toLowerCase()),e=x&&A.get(x.toLowerCase()),r=t?.fieldName??a,s=u&&x?b(x).fieldName:e?.fieldName??x,l=u&&s?i[s]:o[s]??(t&&h({fieldInfo:t,graphic:M,layer:v}))??t?.fieldName??n,p=u&&n?i[n]:o[r];return N.tooltip=this._getTooltip({label:l,value:p,chartType:d}),N}const F=y(p,a),w=f(a,v),E=x&&void 0!==o[x]?o[x]:h({fieldInfo:F||new s({fieldName:w}),expressionInfos:this.popupTemplate?.expressionInfos,graphic:M,layer:v}),R=o[w];return N.tooltip=this._getTooltip({label:E,value:R,chartType:d}),N}};t([o()],v.prototype,"abilities",void 0),t([r("abilities")],v.prototype,"castAbilities",null),t([o()],v.prototype,"activeMediaInfoIndex",void 0),t([o({readOnly:!0})],v.prototype,"activeMediaInfo",null),t([o()],v.prototype,"attributes",void 0),t([o()],v.prototype,"description",void 0),t([o()],v.prototype,"fieldInfoMap",void 0),t([o()],v.prototype,"formattedAttributes",void 0),t([o()],v.prototype,"expressionAttributes",void 0),t([o({readOnly:!0})],v.prototype,"formattedMediaInfos",null),t([o()],v.prototype,"graphic",void 0),t([o()],v.prototype,"layer",void 0),t([o({readOnly:!0})],v.prototype,"formattedMediaInfoCount",null),t([o()],v.prototype,"mediaInfos",void 0),t([o()],v.prototype,"popupTemplate",void 0),t([o()],v.prototype,"relatedInfos",void 0),t([o()],v.prototype,"title",void 0),v=t([a("esri.widgets.Feature.FeatureMedia.FeatureMediaViewModel")],v);export{v as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{substitute as t}from"../../intl.js";import{prefersReducedMotion as i}from"../../core/a11yUtils.js";import{watch as a,initial as r}from"../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../core/accessorSupport/decorators.js";import{getColorsFromRenderer as n}from"../../renderers/support/utils.js";import{isDarkMode as l}from"../../support/modeUtils.js";import d from"../Widget.js";import m from"./FeatureMedia/FeatureMediaViewModel.js";import c from"./support/FeatureElementInfo.js";import{shouldOpenInNewTab as h}from"./support/featureUtils.js";import{loadCalciteComponents as p}from"../support/componentsUtils.js";import{tsx as u,isRTL as f,messageBundle as g}from"../support/widget.js";const M="esri-feature-media",_={base:M,mediaContainer:`${M}__container`,mediaItemContainer:`${M}__item-container`,mediaItem:`${M}__item`,mediaItemText:`${M}__item-text`,mediaItemTitle:`${M}__item-title`,mediaItemCaption:`${M}__item-caption`,mediaNavigation:`${M}__item-navigation`,mediaPagination:`${M}__pagination`,mediaPaginationText:`${M}__pagination-text`,mediaChart:`${M}__chart`,mediaPaginationButton:`${M}__pagination-button`,mediaPaginationIcon:`${M}__pagination-icon`,mediaChartRendered:`${M}__chart--rendered`},v=15,w="category",A="value",I="rgba(50, 50, 50, 1)",C=250,y=500,x=200;let T=class extends d{constructor(e,t){super(e,t),this._refreshTimer=null,this._refreshIntervalInfo=null,this._featureElementInfo=null,this._chartRootMap=new WeakMap,this.viewModel=new m,this.messages=null,this._disposeChart=e=>{this._chartRootMap.get(e)?.dispose(),this._chartRootMap.delete(e)},this._createChart=async e=>{const{destroyed:t,viewModel:i}=this;if(t||!i||!e)return;const{createRoot:a}=await import("../support/chartUtilsAm5.js"),r=await a(e);this._chartRootMap.set(e,r),await this._renderChart({mediaInfo:i.activeMediaInfo,root:r})}}initialize(){this._featureElementInfo=new c,this.addHandles([a(()=>[this.viewModel?.activeMediaInfo,this.viewModel?.activeMediaInfoIndex],()=>this._setupMediaRefreshTimer(),r),a(()=>[this.viewModel?.description,this.viewModel?.title],()=>this._setupFeatureElementInfo(),r)])}loadDependencies(){return p({icon:()=>import("@esri/calcite-components/dist/components/calcite-icon")})}destroy(){this._clearMediaRefreshTimer(),this._featureElementInfo?.destroy()}get attributes(){return this.viewModel.attributes}set attributes(e){this.viewModel.attributes=e}get activeMediaInfoIndex(){return this.viewModel.activeMediaInfoIndex}set activeMediaInfoIndex(e){this.viewModel.activeMediaInfoIndex=e}get description(){return this.viewModel.description}set description(e){this.viewModel.description=e}get fieldInfoMap(){return this.viewModel.fieldInfoMap}set fieldInfoMap(e){this.viewModel.fieldInfoMap=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get mediaInfos(){return this.viewModel.mediaInfos}set mediaInfos(e){this.viewModel.mediaInfos=e}get popupTemplate(){return this.viewModel.popupTemplate}set popupTemplate(e){this.viewModel.popupTemplate=e}get relatedInfos(){return this.viewModel.relatedInfos}set relatedInfos(e){this.viewModel.relatedInfos=e}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}render(){return u("div",{bind:this,class:_.base,onkeyup:this._handleMediaKeyup},this._featureElementInfo?.render(),this._renderMedia())}_renderMedia(){const{formattedMediaInfoCount:e,activeMediaInfoIndex:i}=this.viewModel,a=this._renderMediaText();return e?u("div",{class:_.mediaContainer,key:"media-element-container"},this._renderMediaInfo(),u("div",{class:_.mediaNavigation},a,e>1?u("div",{class:_.mediaPagination},this._renderMediaPageButton("previous"),u("span",{class:_.mediaPaginationText},t(this.messages.pageText,{index:i+1,total:e})),this._renderMediaPageButton("next")):null)):null}_renderMediaText(){const{activeMediaInfo:e}=this.viewModel;if(!e)return null;const t=e&&e.title?u("div",{class:_.mediaItemTitle,innerHTML:e.title,key:"media-title"}):null,i=e&&e.caption?u("div",{class:_.mediaItemCaption,innerHTML:e.caption,key:"media-caption"}):null;return t||i?u("div",{class:_.mediaItemText,key:"media-text"},t,i):null}_renderImageMediaInfo(e){if(!e.value)return null;const{_refreshIntervalInfo:t}=this,{activeMediaInfoIndex:i,formattedMediaInfoCount:a}=this.viewModel,{value:r,refreshInterval:o,altText:s,title:n,type:l}=e,{sourceURL:d,linkURL:m}=r,c=h(m??void 0)?"_blank":"_self",p="_blank"===c?"noreferrer":"",f=o?t:null,g=f?f.timestamp:0,M=f?f.sourceURL:d,_=u("img",{alt:s||n,key:`media-${l}-${i}-${a}-${g}`,src:M??void 0});return(m?u("a",{href:m,rel:p,target:c,title:n},_):null)??_}_renderChartMediaInfo(e){const{activeMediaInfoIndex:t,formattedMediaInfoCount:i}=this.viewModel;return u("div",{afterCreate:this._createChart,afterRemoved:this._disposeChart,bind:this,class:_.mediaChart,key:`media-${e.type}-${t}-${i}`})}_renderMediaInfoType(){const{activeMediaInfo:e}=this.viewModel;return e?"image"===e.type?this._renderImageMediaInfo(e):e.type.includes("chart")?this._renderChartMediaInfo(e):null:null}_renderMediaInfo(){const{activeMediaInfo:e}=this.viewModel;return e?u("div",{class:_.mediaItemContainer,key:"media-container"},u("div",{class:_.mediaItem,key:"media-item-container"},this._renderMediaInfoType())):null}_renderMediaPageButton(e){if(this.viewModel.formattedMediaInfoCount<2)return null;const t="previous"===e,i=t?this.messages.previous:this.messages.next,a=t?"chevron-left":"chevron-right",r=t?"media-previous":"media-next",o=t?this._previous:this._next;return u("button",{"aria-label":i,bind:this,class:_.mediaPaginationButton,key:r,onclick:o,tabIndex:0,title:i,type:"button"},u("calcite-icon",{class:_.mediaPaginationIcon,icon:a,scale:"s"}))}_setupFeatureElementInfo(){const{description:e,title:t}=this;this._featureElementInfo?.set({description:e,title:t})}_next(){this.viewModel.next()}_previous(){this.viewModel.previous()}_getRenderer(){if(!this.viewModel)return;const{graphic:e,layer:t}=this.viewModel;return e?.isAggregate&&t?.featureReduction&&"renderer"in t.featureReduction?t.featureReduction.renderer:t?.renderer}async _getSeriesColors(e){const{colorAm5:t}=await import("./FeatureMedia/chartCommon.js"),i=new Map;return e.forEach(e=>{e.color&&i.set(e,t(e.color.toCss(!0)))}),i}async _getRendererColors(){const{colorAm5:e}=await import("./FeatureMedia/chartCommon.js"),t=new Map,i=this._getRenderer(),a="default";if(!i)return t;const r=await n(i);r.delete(a);return Array.from(r.values()).every(e=>1===e?.length)?(Array.from(r.keys()).forEach(i=>{const a=r.get(i)?.[0]?.toCss(!0);a&&t.set(i,e(a))}),t):t}_handleMediaKeyup(e){const{key:t}=e;"ArrowLeft"===t&&(e.stopPropagation(),this.viewModel.previous()),"ArrowRight"===t&&(e.stopPropagation(),this.viewModel.next())}_canAnimateChart(){return!!this.viewModel&&(!!this.viewModel.abilities.chartAnimation&&!i())}_getChartAnimationMS(){return this._canAnimateChart()?C:0}_getChartSeriesAnimationMS(){return this._canAnimateChart()?y:0}async _renderChart(e){const{root:t,mediaInfo:i}=e,{value:a,type:r}=i,{ResponsiveThemeAm5:o,DarkThemeAm5:s,AnimatedThemeAm5:n,ColorSetAm5:d,ThemeAm5:m,esriChartColorSet:c}=await import("./FeatureMedia/chartCommon.js"),h=m.new(t);h.rule("ColorSet").set("colors",c),h.rule("ColorSet").set("reuse",!0);const p=[o.new(t),h];l(this.container)&&p.push(s.new(t)),this._canAnimateChart()&&p.push(n.new(t)),t.setThemes(p);const u=await this._getRendererColors(),f=await this._getSeriesColors(a.series),g=d.new(t,{}),M=f.get(a.series[0]),_=M?{lineSettings:{stroke:M}}:void 0,v=a.series.map((e,t)=>{const i=f.get(e)||u.get(e.fieldName)||g.getIndex(t);return{[w]:e.tooltip,[A]:e.value,columnSettings:{fill:i,stroke:i},..._}}).filter(e=>"pie-chart"!==r||null!=e.value&&e.value>0);await("pie-chart"===r?this._createPieChart(e,v):this._createXYChart(e,v))}_getDirection(){return f(this.container)?"rtl":"ltr"}async _customizeChartTooltip(e,t="horizontal"){const{colorAm5:i}=await import("./FeatureMedia/chartCommon.js");e.setAll({pointerOrientation:t}),e.get("background")?.setAll({stroke:i(I)}),e.label.setAll({direction:this._getDirection(),oversizedBehavior:"wrap",maxWidth:x})}async _createPieChart(e,t){const{TooltipAm5:i}=await import("./FeatureMedia/chartCommon.js"),{PieChartAm5:a,PieSeriesAm5:r}=await import("./FeatureMedia/pieChart.js"),{mediaInfo:o,root:s}=e,{title:n}=o,l=5,d=o?.altText||o?.title||"",m=s.container.children.push(a.new(s,{ariaLabel:d,focusable:!0,paddingBottom:l,paddingTop:l,paddingLeft:l,paddingRight:l})),c="{category}: {valuePercentTotal.formatNumber('0.00')}%\n ({value})",h=i.new(s,{labelText:c}),p=m.series.push(r.new(s,{name:n,valueField:A,categoryField:w,tooltip:h}));p.ticks.template.set("forceHidden",!0),p.labels.template.set("forceHidden",!0),p.slices.template.states.create("active",{shiftRadius:l}),await this._customizeChartTooltip(h),p.slices.template.setAll({ariaLabel:c,focusable:!0,templateField:"columnSettings"}),p.data.setAll(t),await p.appear(this._getChartSeriesAnimationMS()),await m.appear(this._getChartAnimationMS()),m.root.dom.classList.toggle(_.mediaChartRendered,!0)}_getMinSeriesValue(e){let t=0;return e.forEach(e=>t=Math.min(e.value,t)),t}async _createColumnChart(e,t,i){const{TooltipAm5:a,ScrollbarAm5:r}=await import("./FeatureMedia/chartCommon.js"),{CategoryAxisAm5:o,AxisRendererXAm5:s,ValueAxisAm5:n,AxisRendererYAm5:l,ColumnSeriesAm5:d}=await import("./FeatureMedia/xyChart.js"),{mediaInfo:m,root:c}=t,{value:h,title:p}=m;e.setAll({wheelX:"panX",wheelY:"zoomX"});const u=e.xAxes.push(o.new(c,{renderer:s.new(c,{inversed:f(this.container)}),categoryField:w}));u.get("renderer").labels.template.setAll({forceHidden:!0});const g=e.yAxes.push(n.new(c,{renderer:l.new(c,{inside:!1}),min:this._getMinSeriesValue(h.series)}));g.get("renderer").labels.template.setAll({direction:this._getDirection()});const M="{categoryX}",_=a.new(c,{labelText:M}),I=e.series.push(d.new(c,{name:p,xAxis:u,yAxis:g,valueYField:A,categoryXField:w,tooltip:_}));await this._customizeChartTooltip(_),I.columns.template.setAll({ariaLabel:M,focusable:!0,templateField:"columnSettings"}),h.series.length>v&&e.set("scrollbarX",r.new(c,{orientation:"horizontal"})),u.data.setAll(i),I.data.setAll(i),await I.appear(this._getChartSeriesAnimationMS()),await e.appear(this._getChartAnimationMS())}async _createBarChart(e,t,i){const{TooltipAm5:a,ScrollbarAm5:r}=await import("./FeatureMedia/chartCommon.js"),{CategoryAxisAm5:o,AxisRendererXAm5:s,ValueAxisAm5:n,AxisRendererYAm5:l,ColumnSeriesAm5:d}=await import("./FeatureMedia/xyChart.js"),{mediaInfo:m,root:c}=t,{value:h,title:p}=m;e.setAll({wheelX:"panY",wheelY:"zoomY"});const u=e.yAxes.push(o.new(c,{renderer:l.new(c,{inversed:!0}),categoryField:w}));u.get("renderer").labels.template.setAll({forceHidden:!0});const g=e.xAxes.push(n.new(c,{renderer:s.new(c,{inside:!1,inversed:f(this.container)}),min:this._getMinSeriesValue(h.series)}));g.get("renderer").labels.template.setAll({direction:this._getDirection()});const M="{categoryY}",_=a.new(c,{labelText:M}),I=e.series.push(d.new(c,{name:p,xAxis:g,yAxis:u,valueXField:A,categoryYField:w,tooltip:_}));await this._customizeChartTooltip(_,"vertical"),I.columns.template.setAll({ariaLabel:M,focusable:!0,templateField:"columnSettings"}),h.series.length>v&&e.set("scrollbarY",r.new(c,{orientation:"vertical"})),u.data.setAll(i),I.data.setAll(i),await I.appear(this._getChartSeriesAnimationMS()),await e.appear(this._getChartAnimationMS())}async _createLineChart(e,t,i){const{TooltipAm5:a,ScrollbarAm5:r}=await import("./FeatureMedia/chartCommon.js"),{CategoryAxisAm5:o,AxisRendererXAm5:s,ValueAxisAm5:n,AxisRendererYAm5:l,LineSeriesAm5:d}=await import("./FeatureMedia/xyChart.js"),{root:m,mediaInfo:c}=t,{value:h,title:p}=c;e.setAll({wheelX:"panX",wheelY:"zoomX"});const u=e.xAxes.push(o.new(m,{renderer:s.new(m,{inversed:f(this.container)}),categoryField:w}));u.get("renderer").labels.template.setAll({forceHidden:!0});const g=e.yAxes.push(n.new(m,{renderer:l.new(m,{inside:!1}),min:this._getMinSeriesValue(h.series)}));g.get("renderer").labels.template.setAll({direction:this._getDirection()});const M="{categoryX}",_=i[0]?.lineSettings?.stroke,I=a.new(m,{getFillFromSprite:!_,labelText:M});_&&I.get("background")?.setAll({fill:_});const C=e.series.push(d.new(m,{name:p,xAxis:u,yAxis:g,valueYField:A,categoryXField:w,tooltip:I}));C.strokes.template.setAll({templateField:"lineSettings"}),await this._customizeChartTooltip(I,"vertical"),h.series.length>v&&e.set("scrollbarX",r.new(m,{orientation:"horizontal"})),u.data.setAll(i),C.data.setAll(i),await C.appear(this._getChartSeriesAnimationMS()),await e.appear(this._getChartAnimationMS())}async _createXYChart(e,t){const{XYChartAm5:i,XYCursorAm5:a}=await import("./FeatureMedia/xyChart.js"),{root:r,mediaInfo:o}=e,{type:s}=o,n=o?.altText||o?.title||"",l=r.container.children.push(i.new(r,{ariaLabel:n,focusable:!0,panX:!0,panY:!0}));l.set("cursor",a.new(r,{})),"column-chart"===s&&await this._createColumnChart(l,e,t),"bar-chart"===s&&await this._createBarChart(l,e,t),"line-chart"===s&&await this._createLineChart(l,e,t),l.root.dom.classList.toggle(_.mediaChartRendered,!0)}_clearMediaRefreshTimer(){const{_refreshTimer:e}=this;e&&(clearTimeout(e),this._refreshTimer=null)}_updateMediaInfoTimestamp(e){const t=Date.now();this._refreshIntervalInfo={timestamp:t,sourceURL:e&&this._getImageSource(e,t)}}_setupMediaRefreshTimer(){this._clearMediaRefreshTimer();const{activeMediaInfo:e}=this.viewModel;"image"===e?.type&&e?.refreshInterval>0&&this._setRefreshTimeout(e)}_setRefreshTimeout(e){const{refreshInterval:t,value:i}=e,a=6e4*t;this._updateMediaInfoTimestamp(i.sourceURL);const r=setInterval(()=>{this._updateMediaInfoTimestamp(i.sourceURL)},a);this._refreshTimer=r}_getImageSource(e,t){const i=e.includes("?")?"&":"?",[a,r=""]=e.split("#");return`${a}${i}timestamp=${t}${r?"#":""}${r}`}};e([o()],T.prototype,"_refreshIntervalInfo",void 0),e([o()],T.prototype,"attributes",null),e([o()],T.prototype,"activeMediaInfoIndex",null),e([o()],T.prototype,"description",null),e([o()],T.prototype,"fieldInfoMap",null),e([o()],T.prototype,"layer",null),e([o()],T.prototype,"mediaInfos",null),e([o()],T.prototype,"popupTemplate",null),e([o()],T.prototype,"relatedInfos",null),e([o()],T.prototype,"title",null),e([o({type:m})],T.prototype,"viewModel",void 0),e([o(),g("esri/widgets/Feature/t9n/Feature")],T.prototype,"messages",void 0),T=e([s("esri.widgets.Feature.FeatureMedia")],T);export{T as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{substitute as t}from"../../intl.js";import{prefersReducedMotion as i}from"../../core/a11yUtils.js";import{watch as a,initial as r}from"../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../core/accessorSupport/decorators.js";import{shouldOpenInNewTab as n}from"../../popup/support/featureUtils.js";import{getColorsFromRenderer as l}from"../../renderers/support/utils.js";import{isDarkMode as d}from"../../support/modeUtils.js";import m from"../Widget.js";import c from"./FeatureMedia/FeatureMediaViewModel.js";import h from"./support/FeatureElementInfo.js";import{loadCalciteComponents as p}from"../support/componentsUtils.js";import{tsx as u,isRTL as f,messageBundle as g}from"../support/widget.js";const M="esri-feature-media",_={base:M,mediaContainer:`${M}__container`,mediaItemContainer:`${M}__item-container`,mediaItem:`${M}__item`,mediaItemText:`${M}__item-text`,mediaItemTitle:`${M}__item-title`,mediaItemCaption:`${M}__item-caption`,mediaNavigation:`${M}__item-navigation`,mediaPagination:`${M}__pagination`,mediaPaginationText:`${M}__pagination-text`,mediaChart:`${M}__chart`,mediaPaginationButton:`${M}__pagination-button`,mediaPaginationIcon:`${M}__pagination-icon`,mediaChartRendered:`${M}__chart--rendered`},v=15,w="category",A="value",I="rgba(50, 50, 50, 1)",C=250,y=500,x=200;let T=class extends m{constructor(e,t){super(e,t),this._refreshTimer=null,this._refreshIntervalInfo=null,this._featureElementInfo=null,this._chartRootMap=new WeakMap,this.viewModel=new c,this.messages=null,this._disposeChart=e=>{this._chartRootMap.get(e)?.dispose(),this._chartRootMap.delete(e)},this._createChart=async e=>{const{destroyed:t,viewModel:i}=this;if(t||!i||!e)return;const{createRoot:a}=await import("../support/chartUtilsAm5.js"),r=await a(e);this._chartRootMap.set(e,r),await this._renderChart({mediaInfo:i.activeMediaInfo,root:r})}}initialize(){this._featureElementInfo=new h,this.addHandles([a(()=>[this.viewModel?.activeMediaInfo,this.viewModel?.activeMediaInfoIndex],()=>this._setupMediaRefreshTimer(),r),a(()=>[this.viewModel?.description,this.viewModel?.title],()=>this._setupFeatureElementInfo(),r)])}loadDependencies(){return p({icon:()=>import("@esri/calcite-components/dist/components/calcite-icon")})}destroy(){this._clearMediaRefreshTimer(),this._featureElementInfo?.destroy()}get attributes(){return this.viewModel.attributes}set attributes(e){this.viewModel.attributes=e}get activeMediaInfoIndex(){return this.viewModel.activeMediaInfoIndex}set activeMediaInfoIndex(e){this.viewModel.activeMediaInfoIndex=e}get description(){return this.viewModel.description}set description(e){this.viewModel.description=e}get fieldInfoMap(){return this.viewModel.fieldInfoMap}set fieldInfoMap(e){this.viewModel.fieldInfoMap=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get mediaInfos(){return this.viewModel.mediaInfos}set mediaInfos(e){this.viewModel.mediaInfos=e}get popupTemplate(){return this.viewModel.popupTemplate}set popupTemplate(e){this.viewModel.popupTemplate=e}get relatedInfos(){return this.viewModel.relatedInfos}set relatedInfos(e){this.viewModel.relatedInfos=e}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}render(){return u("div",{bind:this,class:_.base,onkeyup:this._handleMediaKeyup},this._featureElementInfo?.render(),this._renderMedia())}_renderMedia(){const{formattedMediaInfoCount:e,activeMediaInfoIndex:i}=this.viewModel,a=this._renderMediaText();return e?u("div",{class:_.mediaContainer,key:"media-element-container"},this._renderMediaInfo(),u("div",{class:_.mediaNavigation},a,e>1?u("div",{class:_.mediaPagination},this._renderMediaPageButton("previous"),u("span",{class:_.mediaPaginationText},t(this.messages.pageText,{index:i+1,total:e})),this._renderMediaPageButton("next")):null)):null}_renderMediaText(){const{activeMediaInfo:e}=this.viewModel;if(!e)return null;const t=e&&e.title?u("div",{class:_.mediaItemTitle,innerHTML:e.title,key:"media-title"}):null,i=e&&e.caption?u("div",{class:_.mediaItemCaption,innerHTML:e.caption,key:"media-caption"}):null;return t||i?u("div",{class:_.mediaItemText,key:"media-text"},t,i):null}_renderImageMediaInfo(e){if(!e.value)return null;const{_refreshIntervalInfo:t}=this,{activeMediaInfoIndex:i,formattedMediaInfoCount:a}=this.viewModel,{value:r,refreshInterval:o,altText:s,title:l,type:d}=e,{sourceURL:m,linkURL:c}=r,h=n(c??void 0)?"_blank":"_self",p="_blank"===h?"noreferrer":"",f=o?t:null,g=f?f.timestamp:0,M=f?f.sourceURL:m,_=u("img",{alt:s||l,key:`media-${d}-${i}-${a}-${g}`,src:M??void 0});return(c?u("a",{href:c,rel:p,target:h,title:l},_):null)??_}_renderChartMediaInfo(e){const{activeMediaInfoIndex:t,formattedMediaInfoCount:i}=this.viewModel;return u("div",{afterCreate:this._createChart,afterRemoved:this._disposeChart,bind:this,class:_.mediaChart,key:`media-${e.type}-${t}-${i}`})}_renderMediaInfoType(){const{activeMediaInfo:e}=this.viewModel;return e?"image"===e.type?this._renderImageMediaInfo(e):e.type.includes("chart")?this._renderChartMediaInfo(e):null:null}_renderMediaInfo(){const{activeMediaInfo:e}=this.viewModel;return e?u("div",{class:_.mediaItemContainer,key:"media-container"},u("div",{class:_.mediaItem,key:"media-item-container"},this._renderMediaInfoType())):null}_renderMediaPageButton(e){if(this.viewModel.formattedMediaInfoCount<2)return null;const t="previous"===e,i=t?this.messages.previous:this.messages.next,a=t?"chevron-left":"chevron-right",r=t?"media-previous":"media-next",o=t?this._previous:this._next;return u("button",{"aria-label":i,bind:this,class:_.mediaPaginationButton,key:r,onclick:o,tabIndex:0,title:i,type:"button"},u("calcite-icon",{class:_.mediaPaginationIcon,icon:a,scale:"s"}))}_setupFeatureElementInfo(){const{description:e,title:t}=this;this._featureElementInfo?.set({description:e,title:t})}_next(){this.viewModel.next()}_previous(){this.viewModel.previous()}_getRenderer(){if(!this.viewModel)return;const{graphic:e,layer:t}=this.viewModel;return e?.isAggregate&&t?.featureReduction&&"renderer"in t.featureReduction?t.featureReduction.renderer:t?.renderer}async _getSeriesColors(e){const{colorAm5:t}=await import("./FeatureMedia/chartCommon.js"),i=new Map;return e.forEach(e=>{e.color&&i.set(e,t(e.color.toCss(!0)))}),i}async _getRendererColors(){const{colorAm5:e}=await import("./FeatureMedia/chartCommon.js"),t=new Map,i=this._getRenderer(),a="default";if(!i)return t;const r=await l(i);r.delete(a);return Array.from(r.values()).every(e=>1===e?.length)?(Array.from(r.keys()).forEach(i=>{const a=r.get(i)?.[0]?.toCss(!0);a&&t.set(i,e(a))}),t):t}_handleMediaKeyup(e){const{key:t}=e;"ArrowLeft"===t&&(e.stopPropagation(),this.viewModel.previous()),"ArrowRight"===t&&(e.stopPropagation(),this.viewModel.next())}_canAnimateChart(){return!!this.viewModel&&(!!this.viewModel.abilities.chartAnimation&&!i())}_getChartAnimationMS(){return this._canAnimateChart()?C:0}_getChartSeriesAnimationMS(){return this._canAnimateChart()?y:0}async _renderChart(e){const{root:t,mediaInfo:i}=e,{value:a,type:r}=i,{ResponsiveThemeAm5:o,DarkThemeAm5:s,AnimatedThemeAm5:n,ColorSetAm5:l,ThemeAm5:m,esriChartColorSet:c}=await import("./FeatureMedia/chartCommon.js"),h=m.new(t);h.rule("ColorSet").set("colors",c),h.rule("ColorSet").set("reuse",!0);const p=[o.new(t),h];d(this.container)&&p.push(s.new(t)),this._canAnimateChart()&&p.push(n.new(t)),t.setThemes(p);const u=await this._getRendererColors(),f=await this._getSeriesColors(a.series),g=l.new(t,{}),M=f.get(a.series[0]),_=M?{lineSettings:{stroke:M}}:void 0,v=a.series.map((e,t)=>{const i=f.get(e)||u.get(e.fieldName)||g.getIndex(t);return{[w]:e.tooltip,[A]:e.value,columnSettings:{fill:i,stroke:i},..._}}).filter(e=>"pie-chart"!==r||null!=e.value&&e.value>0);await("pie-chart"===r?this._createPieChart(e,v):this._createXYChart(e,v))}_getDirection(){return f(this.container)?"rtl":"ltr"}async _customizeChartTooltip(e,t="horizontal"){const{colorAm5:i}=await import("./FeatureMedia/chartCommon.js");e.setAll({pointerOrientation:t}),e.get("background")?.setAll({stroke:i(I)}),e.label.setAll({direction:this._getDirection(),oversizedBehavior:"wrap",maxWidth:x})}async _createPieChart(e,t){const{TooltipAm5:i}=await import("./FeatureMedia/chartCommon.js"),{PieChartAm5:a,PieSeriesAm5:r}=await import("./FeatureMedia/pieChart.js"),{mediaInfo:o,root:s}=e,{title:n}=o,l=5,d=o?.altText||o?.title||"",m=s.container.children.push(a.new(s,{ariaLabel:d,focusable:!0,paddingBottom:l,paddingTop:l,paddingLeft:l,paddingRight:l})),c="{category}: {valuePercentTotal.formatNumber('0.00')}%\n ({value})",h=i.new(s,{labelText:c}),p=m.series.push(r.new(s,{name:n,valueField:A,categoryField:w,tooltip:h}));p.ticks.template.set("forceHidden",!0),p.labels.template.set("forceHidden",!0),p.slices.template.states.create("active",{shiftRadius:l}),await this._customizeChartTooltip(h),p.slices.template.setAll({ariaLabel:c,focusable:!0,templateField:"columnSettings"}),p.data.setAll(t),await p.appear(this._getChartSeriesAnimationMS()),await m.appear(this._getChartAnimationMS()),m.root.dom.classList.toggle(_.mediaChartRendered,!0)}_getMinSeriesValue(e){let t=0;return e.forEach(e=>t=Math.min(e.value,t)),t}async _createColumnChart(e,t,i){const{TooltipAm5:a,ScrollbarAm5:r}=await import("./FeatureMedia/chartCommon.js"),{CategoryAxisAm5:o,AxisRendererXAm5:s,ValueAxisAm5:n,AxisRendererYAm5:l,ColumnSeriesAm5:d}=await import("./FeatureMedia/xyChart.js"),{mediaInfo:m,root:c}=t,{value:h,title:p}=m;e.setAll({wheelX:"panX",wheelY:"zoomX"});const u=e.xAxes.push(o.new(c,{renderer:s.new(c,{inversed:f(this.container)}),categoryField:w}));u.get("renderer").labels.template.setAll({forceHidden:!0});const g=e.yAxes.push(n.new(c,{renderer:l.new(c,{inside:!1}),min:this._getMinSeriesValue(h.series)}));g.get("renderer").labels.template.setAll({direction:this._getDirection()});const M="{categoryX}",_=a.new(c,{labelText:M}),I=e.series.push(d.new(c,{name:p,xAxis:u,yAxis:g,valueYField:A,categoryXField:w,tooltip:_}));await this._customizeChartTooltip(_),I.columns.template.setAll({ariaLabel:M,focusable:!0,templateField:"columnSettings"}),h.series.length>v&&e.set("scrollbarX",r.new(c,{orientation:"horizontal"})),u.data.setAll(i),I.data.setAll(i),await I.appear(this._getChartSeriesAnimationMS()),await e.appear(this._getChartAnimationMS())}async _createBarChart(e,t,i){const{TooltipAm5:a,ScrollbarAm5:r}=await import("./FeatureMedia/chartCommon.js"),{CategoryAxisAm5:o,AxisRendererXAm5:s,ValueAxisAm5:n,AxisRendererYAm5:l,ColumnSeriesAm5:d}=await import("./FeatureMedia/xyChart.js"),{mediaInfo:m,root:c}=t,{value:h,title:p}=m;e.setAll({wheelX:"panY",wheelY:"zoomY"});const u=e.yAxes.push(o.new(c,{renderer:l.new(c,{inversed:!0}),categoryField:w}));u.get("renderer").labels.template.setAll({forceHidden:!0});const g=e.xAxes.push(n.new(c,{renderer:s.new(c,{inside:!1,inversed:f(this.container)}),min:this._getMinSeriesValue(h.series)}));g.get("renderer").labels.template.setAll({direction:this._getDirection()});const M="{categoryY}",_=a.new(c,{labelText:M}),I=e.series.push(d.new(c,{name:p,xAxis:g,yAxis:u,valueXField:A,categoryYField:w,tooltip:_}));await this._customizeChartTooltip(_,"vertical"),I.columns.template.setAll({ariaLabel:M,focusable:!0,templateField:"columnSettings"}),h.series.length>v&&e.set("scrollbarY",r.new(c,{orientation:"vertical"})),u.data.setAll(i),I.data.setAll(i),await I.appear(this._getChartSeriesAnimationMS()),await e.appear(this._getChartAnimationMS())}async _createLineChart(e,t,i){const{TooltipAm5:a,ScrollbarAm5:r}=await import("./FeatureMedia/chartCommon.js"),{CategoryAxisAm5:o,AxisRendererXAm5:s,ValueAxisAm5:n,AxisRendererYAm5:l,LineSeriesAm5:d}=await import("./FeatureMedia/xyChart.js"),{root:m,mediaInfo:c}=t,{value:h,title:p}=c;e.setAll({wheelX:"panX",wheelY:"zoomX"});const u=e.xAxes.push(o.new(m,{renderer:s.new(m,{inversed:f(this.container)}),categoryField:w}));u.get("renderer").labels.template.setAll({forceHidden:!0});const g=e.yAxes.push(n.new(m,{renderer:l.new(m,{inside:!1}),min:this._getMinSeriesValue(h.series)}));g.get("renderer").labels.template.setAll({direction:this._getDirection()});const M="{categoryX}",_=i[0]?.lineSettings?.stroke,I=a.new(m,{getFillFromSprite:!_,labelText:M});_&&I.get("background")?.setAll({fill:_});const C=e.series.push(d.new(m,{name:p,xAxis:u,yAxis:g,valueYField:A,categoryXField:w,tooltip:I}));C.strokes.template.setAll({templateField:"lineSettings"}),await this._customizeChartTooltip(I,"vertical"),h.series.length>v&&e.set("scrollbarX",r.new(m,{orientation:"horizontal"})),u.data.setAll(i),C.data.setAll(i),await C.appear(this._getChartSeriesAnimationMS()),await e.appear(this._getChartAnimationMS())}async _createXYChart(e,t){const{XYChartAm5:i,XYCursorAm5:a}=await import("./FeatureMedia/xyChart.js"),{root:r,mediaInfo:o}=e,{type:s}=o,n=o?.altText||o?.title||"",l=r.container.children.push(i.new(r,{ariaLabel:n,focusable:!0,panX:!0,panY:!0}));l.set("cursor",a.new(r,{})),"column-chart"===s&&await this._createColumnChart(l,e,t),"bar-chart"===s&&await this._createBarChart(l,e,t),"line-chart"===s&&await this._createLineChart(l,e,t),l.root.dom.classList.toggle(_.mediaChartRendered,!0)}_clearMediaRefreshTimer(){const{_refreshTimer:e}=this;e&&(clearTimeout(e),this._refreshTimer=null)}_updateMediaInfoTimestamp(e){const t=Date.now();this._refreshIntervalInfo={timestamp:t,sourceURL:e&&this._getImageSource(e,t)}}_setupMediaRefreshTimer(){this._clearMediaRefreshTimer();const{activeMediaInfo:e}=this.viewModel;"image"===e?.type&&e?.refreshInterval>0&&this._setRefreshTimeout(e)}_setRefreshTimeout(e){const{refreshInterval:t,value:i}=e,a=6e4*t;this._updateMediaInfoTimestamp(i.sourceURL);const r=setInterval(()=>{this._updateMediaInfoTimestamp(i.sourceURL)},a);this._refreshTimer=r}_getImageSource(e,t){const i=e.includes("?")?"&":"?",[a,r=""]=e.split("#");return`${a}${i}timestamp=${t}${r?"#":""}${r}`}};e([o()],T.prototype,"_refreshIntervalInfo",void 0),e([o()],T.prototype,"attributes",null),e([o()],T.prototype,"activeMediaInfoIndex",null),e([o()],T.prototype,"description",null),e([o()],T.prototype,"fieldInfoMap",null),e([o()],T.prototype,"layer",null),e([o()],T.prototype,"mediaInfos",null),e([o()],T.prototype,"popupTemplate",null),e([o()],T.prototype,"relatedInfos",null),e([o()],T.prototype,"title",null),e([o({type:c})],T.prototype,"viewModel",void 0),e([o(),g("esri/widgets/Feature/t9n/Feature")],T.prototype,"messages",void 0),T=e([s("esri.widgets.Feature.FeatureMedia")],T);export{T as default};
|