@arcgis/core 5.0.0-next.84 → 5.0.0-next.85
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/applySetUtils.d.ts +237 -0
- package/applications/Components/applySetUtils.js +5 -0
- package/applications/Components/editUtils.d.ts +92 -0
- package/applications/Components/editUtils.js +5 -0
- package/applications/Components/symbolUtils.d.ts +37 -0
- package/applications/Components/symbolUtils.js +5 -0
- package/applications/Components/templateUtils.d.ts +106 -0
- package/applications/Components/templateUtils.js +5 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/001fd3d30e5bb0d180c6.js +1 -0
- package/assets/esri/core/workers/chunks/008a555ce169640e2a35.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/0402b7996940ba0f8cc8.js +2 -0
- package/assets/esri/core/workers/chunks/{534ed6574e4a1613ba05.js.LICENSE.txt → 0402b7996940ba0f8cc8.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{5b0ca8d2154ef59da600.js → 055aead7135a2f8bca29.js} +1 -1
- package/assets/esri/core/workers/chunks/0889e3d1a034be031c9e.js +2 -0
- package/assets/esri/core/workers/chunks/{e3d3fc87789fd711f161.js.LICENSE.txt → 0889e3d1a034be031c9e.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/21739c37160061f229ef.js +1 -0
- package/assets/esri/core/workers/chunks/{76d6843d56bff0d4c45e.js → 301fa6276f4098521106.js} +1 -1
- package/assets/esri/core/workers/chunks/4c07b2d1a14906371fc5.js +2 -0
- package/assets/esri/core/workers/chunks/{21ac84b5c7dedcfd747d.js.LICENSE.txt → 4c07b2d1a14906371fc5.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{e881629bf230a148963d.js → 52ae2073604deef63ea2.js} +1 -1
- package/assets/esri/core/workers/chunks/{3909217130048b5feeae.js → 5543de9a0435c319f4f9.js} +1 -1
- package/assets/esri/core/workers/chunks/5eee48b02e1683f022df.js +2 -0
- package/assets/esri/core/workers/chunks/{ef519984fa691aad8d87.js.LICENSE.txt → 5eee48b02e1683f022df.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{911912b0ef7ffed875be.js → 7a1ec6ac88d974cc5074.js} +1 -1
- package/assets/esri/core/workers/chunks/{5e3dd05f1ecfdb21350e.js → 7f7c4ffbdf7b20dc7a54.js} +1 -1
- package/assets/esri/core/workers/chunks/{dc57400b835724204909.js → 8b1fa59d436e2815b2f1.js} +2 -2
- package/assets/esri/core/workers/chunks/{dc57400b835724204909.js.LICENSE.txt → 8b1fa59d436e2815b2f1.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/9264cce4699284eae97c.js +2 -0
- package/assets/esri/core/workers/chunks/{5aee84e827e6fcc9c4c4.js.LICENSE.txt → 9264cce4699284eae97c.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/95e93884b39ca4b312d1.js +2 -0
- package/assets/esri/core/workers/chunks/{90a53bfe95ed687c28c1.js.LICENSE.txt → 95e93884b39ca4b312d1.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{2a1898c5b8d7757e39e3.js → a09099697955eb44bfac.js} +1 -1
- package/assets/esri/core/workers/chunks/{6610d23d8539f06e64ca.js → adecd31fd64d6753682d.js} +1 -1
- package/assets/esri/core/workers/chunks/{df40be5a050b8d20617a.js → b190a776de4859ac00f8.js} +1 -1
- package/assets/esri/core/workers/chunks/c18a2948ae3cb527d8bb.js +1 -0
- package/assets/esri/core/workers/chunks/{d8c8f54532714d4db2cd.js → c791e8ebf3ee0805c479.js} +1 -1
- package/assets/esri/core/workers/chunks/f5ed6953a9255f0bed6a.js.LICENSE.txt +1 -1
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/HUDMaterial.glsl.js +1 -1
- package/config.js +1 -1
- package/copyright.txt +2 -2
- package/editing/sharedTemplates/templateLoader.js +5 -0
- package/editing/templateUtils.js +1 -1
- package/interfaces.d.ts +6 -0
- package/kernel.js +1 -1
- package/layers/mixins/ImageryTileMixin.js +1 -1
- package/layers/raster/datasets/FunctionRaster.js +1 -1
- package/layers/raster/functions/BaseRasterFunction.js +1 -1
- package/layers/raster/functions/StretchFunction.js +1 -1
- package/layers/support/RasterJobHandler.js +1 -1
- package/layers/support/RasterWorker.js +1 -1
- package/networks/CircuitManager.d.ts +1 -1
- package/networks/support/jsonTypes.d.ts +65 -0
- package/package.json +1 -1
- package/rest/featureService/types.d.ts +42 -5
- package/rest/networks/circuits/exportCircuits.js +1 -1
- package/rest/networks/circuits/support/ExportCircuitsParameters.d.ts +10 -2
- package/rest/networks/circuits/support/ExportCircuitsParameters.js +1 -1
- package/rest/support/Query.d.ts +12 -1
- package/support/revision.js +1 -1
- package/symbols/support/symbolUtils.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +1 -1
- package/views/3d/camera/intersectionUtils.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
- package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
- package/views/interactive/snapping/SelfSnappingEngine.js +1 -1
- package/views/interactive/snapping/SnappingContext.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.d.ts +18 -0
- package/widgets/BatchAttributeForm.d.ts +2 -0
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Feature/support/featureUtils.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.d.ts +43 -4
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/types.d.ts +7 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/FeatureTable.d.ts +43 -4
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Search/SearchViewModel.d.ts +5 -0
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/Search/support/layerSearchUtils.js +1 -1
- package/widgets/Search.js +1 -1
- package/assets/esri/core/workers/chunks/21ac84b5c7dedcfd747d.js +0 -2
- package/assets/esri/core/workers/chunks/22503abc06354741d28a.js +0 -1
- package/assets/esri/core/workers/chunks/534ed6574e4a1613ba05.js +0 -2
- package/assets/esri/core/workers/chunks/5aee84e827e6fcc9c4c4.js +0 -2
- package/assets/esri/core/workers/chunks/7b2f848947b296c7c785.js +0 -1
- package/assets/esri/core/workers/chunks/90a53bfe95ed687c28c1.js +0 -2
- package/assets/esri/core/workers/chunks/c16115cfbca879dd6717.js +0 -1
- package/assets/esri/core/workers/chunks/e3d3fc87789fd711f161.js +0 -2
- package/assets/esri/core/workers/chunks/ef519984fa691aad8d87.js +0 -2
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import i from"../../../../core/Logger.js";import{assertIsSome as s}from"../../../../core/maybe.js";import{debounce as r,isAbortError as a}from"../../../../core/promiseUtils.js";import{property as o,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as n}from"../../../../core/support/UpdatingHandles.js";import h from"../../../../geometry/Extent.js";import c from"../../../../geometry/Point.js";import{update as u,unregister as d,getRasterId as p,register as y}from"../../../../layers/raster/datasets/RawBlockCache.js";import{getWorldWidth as m,computeProjectedScales as g}from"../../../../layers/raster/functions/rasterProjectionHelper.js";import _ from"../../../../layers/support/PixelBlock.js";import f from"../../../../layers/support/TileInfo.js";import b from"../../tiling/TileInfoView.js";import"../../tiling/TileKey.js";import w from"../../tiling/TileQueue.js";import P from"../../tiling/TileStrategy.js";import{tileSize as I}from"../../engine/webgl/definitions.js";import{TaskPriority as R}from"../../../support/Scheduler.js";import{getWebGLCapabilities as U}from"../../../webgl/capabilities.js";const C=[0,0];let S=class extends t{constructor(){super(...arguments),this._updatingHandles=new n,this._emptyTilePixelBlock=null,this._tileStrategy=null,this._tileInfoView=null,this._fetchQueue=null,this._blockCacheRegistryUrl=null,this._blockCacheRegistryId=null,this._srcResolutions=[],this.previousLOD=null,this._needBlockCacheUpdate=!1,this._globalSymbolizerParams=null,this._symbolizerParams=null,this._abortController=null,this._isCustomTilingScheme=!1,this._maxIndexedColormapSize=0,this._rasterFunctionState="na",this._globalUpdateRequested=!1,this.attached=!1,this.timeExtent=null,this.redrawOrRefetch=r(async(e={})=>{const t=this._rasterFunctionState,i=e.reprocess||"gpu"===t&&!this.canUseWebGLForProcessing||"cpu"===t&&this.canUseWebGLForProcessing;if(i&&(await this._updatingHandles.addPromise(this.layer.updateRasterFunction()),this.updateRasterFunctionParameters()),!this.previousLOD||this.layerView.suspended)return;const s=this._rasterFunctionState,{type:r}=this;return e.refetch||"raster"!==r&&!!i||"cpu"===s||"cpu"===t?this._updatingHandles.addPromise(this.doRefresh()):this._updatingHandles.addPromise(this._redrawImage(e.signal))})}destroy(){this._updatingHandles.destroy()}get canUseWebGLForProcessing(){return!1}get canUseLocalSymbolizerParams(){return(this.canUseWebGLForProcessing||"rasterVF"===this.type)&&!this.layerView.hasTilingEffects}get isCPUBasedDRA(){const{renderer:e}=this.layer;return"raster-stretch"===e?.type&&e.dynamicRangeAdjustment&&(!this.canUseWebGLForProcessing||!("min-max"===e.stretchType||"standard-deviation"===e.stretchType))}get useWebGLForProcessing(){return this._get("useWebGLForProcessing")??!0}set useWebGLForProcessing(e){this._set("useWebGLForProcessing",e)}get useProgressiveUpdate(){return this._get("useProgressiveUpdate")??!0}set useProgressiveUpdate(e){if(this._tileStrategy&&this.useProgressiveUpdate!==e){this._tileStrategy.destroy(),this.container.removeAllChildren();const t=this._getCacheSize(e);this._tileStrategy=new P({cachePolicy:"purge",acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),cacheSize:t,tileInfoView:this._tileInfoView}),this._set("useProgressiveUpdate",e),this.layerView.requestUpdate()}}update(e){this._fetchQueue.pause(),this._fetchQueue.state=e.state,this._tileStrategy.update(e),this._fetchQueue.resume();const{extent:t,resolution:i,scale:s}=e.state,r=this._tileInfoView.getClosestInfoForScale(s);if(this.layer.raster){if(!this.useProgressiveUpdate||this._needBlockCacheUpdate){const e=this._srcResolutions[r.level],s="toJSON"in t?t:h.fromJSON(t);u(this._blockCacheRegistryUrl,this._blockCacheRegistryId,s,i,e,this.layer.raster.ioConfig.sampling)}this._needBlockCacheUpdate=!1,this.previousLOD?.level!==r.level&&(this.previousLOD=r,null!=this._symbolizerParams&&this.canUseLocalSymbolizerParams&&this._updateSymbolizerParams(),this._tileStrategy.updateCacheSize(0))}}moveEnd(){!this.isCPUBasedDRA&&this.useProgressiveUpdate||(this._abortController&&this._abortController.abort(),this._abortController=new AbortController,0===this._fetchQueue.length&&this._redrawImage(this._abortController.signal).then(()=>{this._globalUpdateRequested=!1,this.layerView.requestUpdate()}));const e=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy.updateCacheSize(e),this.layerView.requestUpdate()}get updating(){return this._globalUpdateRequested||this._updatingHandles?.updating}attach(){const e=U();this._maxIndexedColormapSize=4*(e.maxTextureSize||4096),this._initializeTileInfo(),this._tileInfoView=new b(this.layerView.tileInfo,this.layerView.fullExtent);const t=this._computeFetchConcurrency();this._fetchQueue=new w({tileInfoView:this._tileInfoView,concurrency:t,process:(e,t)=>this._fetchTile(e,t),priority:R.MAPVIEW_FETCH_QUEUE,scheduler:this.scheduler});const i=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy=new P({cachePolicy:"purge",acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),cacheSize:i,tileInfoView:this._tileInfoView}),this._updateBlockCacheRegistry()}detach(){this._tileStrategy.destroy(),this._fetchQueue.clear(),this.container.removeAllChildren(),this._fetchQueue=this._tileStrategy=this._tileInfoView=null,d(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryUrl=this._blockCacheRegistryId=null}acquireTile(e){const t=this.container.createTile(e);return this._updatingHandles.addPromise(this._enqueueTileFetch(t)),this.layerView.requestUpdate(),this._needBlockCacheUpdate=!0,this._globalUpdateRequested=this.isCPUBasedDRA||!this.useProgressiveUpdate,t}releaseTile(e){this._fetchQueue.abort(e.key.id),this.container.removeChild(e),e.once("detach",()=>{e.destroy(),this.layerView.requestUpdate()}),this.layerView.requestUpdate()}createEmptyTilePixelBlock(e=null){const t=null==e||e.join(",")===this._tileInfoView.size.join(",");if(t&&null!=this._emptyTilePixelBlock)return this._emptyTilePixelBlock;e=e||this._tileInfoView.size;const[i,s]=e,r=new _({width:i,height:s,pixels:[new Uint8Array(i*s)],mask:new Uint8Array(i*s),pixelType:"u8"});return t&&(this._emptyTilePixelBlock=r),r}_getBandIds(){if(this.container&&(!("rasterFunctionChain"in this.container)||!this.container.rasterFunctionChain))return this.layer.bandIds;const{bandIds:e,raster:t}=this.layer,i="rasterFunction"in t?t.rasterFunction.rawInputBandIds:null;return e?.length&&i?.length&&1!==t.rasterInfo.bandCount?e.map(e=>i[Math.min(e,i.length-1)]):"rasterFunction"in t?i:e}updateRasterFunctionParameters(){}_fetchTile(e,t){const i=this._getFetchOptions(e.level,t.signal);return this.fetchTile(e,i)}_getFetchOptions(e,t){const{canUseWebGLForProcessing:i}=this,{layerView:s}=this,{tileInfo:r}=s,a=!r.isWrappable&&null!=m(s.view.spatialReference),o=i&&this.layer.raster.hasUniqueSourceStorageInfo,{layer:l}=this.layerView,n=l.serviceRasterInfo?.storageInfo.isBsqTile?l.getRawDisplayBandIds():void 0;return{allowPartialFill:!0,datumTransformation:s.datumTransformation,interpolation:i?"nearest":this.layer.interpolation,registryId:this._blockCacheRegistryId,requestRawData:o,skipRasterFunction:"raster"===this.type&&null!=this.container.rasterFunctionChain,signal:t,srcResolution:this._srcResolutions[e],timeExtent:s.timeExtent,tileInfo:r,bandIds:n,disableWrapAround:a}}_getCacheSize(e){return e?40:0}_initializeTileInfo(){const{layerView:e}=this,t=e.view.spatialReference;if(this._canUseLayerLODs()){const{origin:i,lods:s}=this.layer.tileInfo,r=s.map(({scale:e})=>e),a=f.create({spatialReference:t,size:I,scales:r,origin:i});return e.set("tileInfo",a),void(this._srcResolutions=s.map(({resolution:e})=>({x:e,y:e})))}const{scales:i,srcResolutions:r,isCustomTilingScheme:a}=g(this.layer.serviceRasterInfo,t,{tileSize:I,alignGlobalDatasetWithAGOL:!0,limitToSrcResolution:!1}),o=f.create({spatialReference:t,size:I,scales:i}),l=0===o.origin.x;s(e.fullExtent);const{xmin:n,ymax:h}=e.fullExtent;(l||a&&o.origin.x>n)&&(o.origin=new c({x:n,y:h,spatialReference:t})),this._isCustomTilingScheme=a,e.set("tileInfo",o),this._srcResolutions=r??[]}_canUseLayerLODs(){const{layer:e,layerView:t}=this;if("Map"!==e.raster.tileType)return!1;const{lods:i}=e.tileInfo,s=t.view.constraints?.effectiveLODs;return s?.length===i.length&&s.every(({scale:e},t)=>Math.abs(e-i[t].scale)<.001)}_computeFetchConcurrency(){const{blockBoundary:e}=this.layer.serviceRasterInfo.storageInfo,t=e[e.length-1];return(t.maxCol-t.minCol+1)*(t.maxRow-t.minRow+1)>64?2:10}async _enqueueTileFetch(e,t){if(!this._fetchQueue.has(e.key.id)){try{let t=e.once("detach",()=>t=void 0);const r=await this._fetchQueue.push(e.key),o=this._getBandIds();let l=!this.useProgressiveUpdate||this.isCPUBasedDRA&&!this._globalSymbolizerParams;if(this._globalUpdateRequested&&!this.layerView.moving&&0===this._fetchQueue.length){l=!1;try{await this._redrawImage(this._abortController?.signal)}catch(s){a(s)&&i.getLogger(this).error(s)}this._globalUpdateRequested=!1}if(!t)return;this.canUseLocalSymbolizerParams&&null==this._symbolizerParams&&this._updateSymbolizerParams();const n=this._tileInfoView.getTileCoords(C,e.key),h=this._tileInfoView.getTileResolution(e.key);await this.updateTileSource(e,{source:r,symbolizerParams:this._symbolizerParams,globalSymbolizerParams:this._globalSymbolizerParams,suspended:l,bandIds:o,coords:n,resolution:h}),t&&(e.once("attach",()=>this.layerView.requestUpdate()),this.container.addChild(e),t.remove())}catch(s){a(s)||i.getLogger(this).error(s)}this.layerView.requestUpdate()}}async _redrawImage(e){if(!this.attached||0===this.container.children.length)return;if(await this.layer.updateRenderer(),this.isCPUBasedDRA?await this._updateGlobalSymbolizerParams(e):(this.canUseLocalSymbolizerParams&&this._updateSymbolizerParams(),this._globalSymbolizerParams=null),!this.attached||e?.aborted)return;const t=this.container.children.map(async t=>this.updateTileSymbolizerParameters(t,{local:this._symbolizerParams,global:this._globalSymbolizerParams},e));await Promise.allSettled(t),this.attached&&!e?.aborted&&this.container.requestRender()}async _updateGlobalSymbolizerParams(e){const t=this._getFetchOptions(this.previousLOD.level,e),i=await this.layer.fetchPixels(this.layerView.view.extent,this.layerView.view.width,this.layerView.view.height,{...t,interpolation:"nearest",requestRawData:!1,skipRasterFunction:!1});if(!i?.pixelBlock)return;const{resolution:s}=this.previousLOD,{isBsqTile:r}=this.layer.raster.rasterInfo.storageInfo,a=r?null:this._getBandIds(),o=this.layer.symbolizer.generateWebGLParameters({pixelBlock:i.pixelBlock.extractBands(a),isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:s,y:s},bandIds:a});!this.canUseWebGLForProcessing&&o&&"stretch"===o.type&&"raster-stretch"===this.layer.renderer?.type&&(o.factor=o.factor.map(e=>255*e),o.minOutput=Math.round(255*o.minOutput),o.maxOutput=Math.round(255*o.maxOutput)),this._globalSymbolizerParams=o}_updateSymbolizerParams(){const{resolution:e}=this.previousLOD,t=this._getBandIds();this._symbolizerParams=this.layer.symbolizer.generateWebGLParameters({pixelBlock:null,isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:e,y:e},bandIds:t})}_updateBlockCacheRegistry(e=!1){const{layer:t,layerView:i}=this,{raster:s}=t,{multidimensionalDefinition:r}=t.normalizeRasterFetchOptions({multidimensionalDefinition:t.multidimensionalDefinition,timeExtent:i.timeExtent}),a=s.rasterInfo.multidimensionalInfo?s.getSliceIndex(r):null,o=s.rasterInfo.storageInfo.isBsqTile?t.getRawDisplayBandIds():null,l=p(s.rasterId,a,o);if(l!==this._blockCacheRegistryUrl){if(null!=this._blockCacheRegistryUrl&&d(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryId=y(l,s.rasterInfo),e){const{view:e}=i,t=this._tileInfoView.getClosestInfoForScale(e.scale),r=this._srcResolutions[t.level];u(l,this._blockCacheRegistryId,e.extent,e.resolution,r,s.ioConfig.sampling)}this._blockCacheRegistryUrl=l}}async doRefresh(){if(!this.attached||!this.previousLOD||this.layerView.suspended)return;await this.layer.updateRenderer(),this.canUseLocalSymbolizerParams&&this._updateSymbolizerParams(),this._updateBlockCacheRegistry(!0),this._fetchQueue.reset();const e=[];this._globalUpdateRequested=this.isCPUBasedDRA||!this.useProgressiveUpdate,this._tileStrategy.refresh(t=>e.push(this._enqueueTileFetch(t))),await this._updatingHandles.addPromise(Promise.allSettled(e))}};e([o()],S.prototype,"_globalUpdateRequested",void 0),e([o()],S.prototype,"attached",void 0),e([o()],S.prototype,"canUseWebGLForProcessing",null),e([o()],S.prototype,"canUseLocalSymbolizerParams",null),e([o()],S.prototype,"isCPUBasedDRA",null),e([o()],S.prototype,"container",void 0),e([o()],S.prototype,"layer",void 0),e([o()],S.prototype,"layerView",void 0),e([o()],S.prototype,"scheduler",void 0),e([o()],S.prototype,"type",void 0),e([o()],S.prototype,"useWebGLForProcessing",null),e([o()],S.prototype,"useProgressiveUpdate",null),e([o()],S.prototype,"timeExtent",void 0),e([o()],S.prototype,"updating",null),S=e([l("esri.views.2d.layers.imagery.BaseImageryTileSubView2D")],S);export{S as BaseImageryTileSubView2D};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import s from"../../../../core/Logger.js";import{assertIsSome as i}from"../../../../core/maybe.js";import{debounce as r,isAbortError as a}from"../../../../core/promiseUtils.js";import{property as o,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as l}from"../../../../core/support/UpdatingHandles.js";import h from"../../../../geometry/Extent.js";import c from"../../../../geometry/Point.js";import{isFunctionRaster as u}from"../../../../layers/raster/datasets/datasetUtils.js";import{update as d,unregister as p,getRasterId as y,register as m}from"../../../../layers/raster/datasets/RawBlockCache.js";import{getWorldWidth as g,computeProjectedScales as _}from"../../../../layers/raster/functions/rasterProjectionHelper.js";import{getStretchCutoff as f}from"../../../../layers/raster/functions/stretchUtils.js";import b from"../../../../layers/support/PixelBlock.js";import R from"../../../../layers/support/TileInfo.js";import w from"../../tiling/TileInfoView.js";import"../../tiling/TileKey.js";import P from"../../tiling/TileQueue.js";import I from"../../tiling/TileStrategy.js";import{tileSize as U}from"../../engine/webgl/definitions.js";import{TaskPriority as C}from"../../../support/Scheduler.js";import{getWebGLCapabilities as S}from"../../../webgl/capabilities.js";const v=[0,0];let F=class extends t{constructor(){super(...arguments),this._updatingHandles=new l,this._emptyTilePixelBlock=null,this._tileStrategy=null,this._tileInfoView=null,this._fetchQueue=null,this._blockCacheRegistryUrl=null,this._blockCacheRegistryId=null,this._srcResolutions=[],this.previousLOD=null,this._needBlockCacheUpdate=!1,this._globalSymbolizerParams=null,this._symbolizerParams=null,this._abortController=null,this._isCustomTilingScheme=!1,this._maxIndexedColormapSize=0,this._rasterFunctionState="na",this._refreshOnce=!1,this._globalUpdateRequested=!1,this.attached=!1,this.timeExtent=null,this.redrawOrRefetch=r(async(e={})=>{const t=this._rasterFunctionState,s=e.reprocess||"gpu"===t&&!this.canUseWebGLForProcessing||"cpu"===t&&this.canUseWebGLForProcessing;if(s&&(await this._updatingHandles.addPromise(this.layer.updateRasterFunction()),this.updateRasterFunctionParameters()),!this.previousLOD||this.layerView.suspended)return;const i=this._rasterFunctionState,{type:r}=this;return e.refetch||"raster"!==r&&!!s||"cpu"===i||"cpu"===t?this._updatingHandles.addPromise(this.doRefresh()):this._updatingHandles.addPromise(this._redrawImage(e.signal))})}destroy(){this._updatingHandles.destroy()}get canUseWebGLForProcessing(){return!1}get canUseLocalSymbolizerParams(){return(this.canUseWebGLForProcessing||"rasterVF"===this.type)&&!this.layerView.hasTilingEffects}get hasDRAInRasterFunction(){const{rasterFunction:e}=this.layer;return!!e&&JSON.stringify(e,null,0).includes('"dra":true')}get isCPUBasedDRA(){const{renderer:e}=this.layer;return"raster-stretch"===e?.type&&e.dynamicRangeAdjustment&&(!this.canUseWebGLForProcessing||!("min-max"===e.stretchType||"standard-deviation"===e.stretchType))}get useWebGLForProcessing(){return this._get("useWebGLForProcessing")??!0}set useWebGLForProcessing(e){this._set("useWebGLForProcessing",e)}get useProgressiveUpdate(){return this._get("useProgressiveUpdate")??!0}set useProgressiveUpdate(e){if(this._tileStrategy&&this.useProgressiveUpdate!==e){this._tileStrategy.destroy(),this.container.removeAllChildren();const t=this._getCacheSize(e);this._tileStrategy=new I({cachePolicy:"purge",acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),cacheSize:t,tileInfoView:this._tileInfoView}),this._set("useProgressiveUpdate",e),this.layerView.requestUpdate()}}update(e){this._fetchQueue.pause(),this._fetchQueue.state=e.state,this._tileStrategy.update(e),this._fetchQueue.resume();const{extent:t,resolution:s,scale:i}=e.state,r=this._tileInfoView.getClosestInfoForScale(i);if(this.layer.raster){if(!this.useProgressiveUpdate||this._needBlockCacheUpdate){const e=this._srcResolutions[r.level],i="toJSON"in t?t:h.fromJSON(t);d(this._blockCacheRegistryUrl,this._blockCacheRegistryId,i,s,e,this.layer.raster.ioConfig.sampling)}this._needBlockCacheUpdate=!1,this.previousLOD?.level!==r.level&&(this.previousLOD=r,null!=this._symbolizerParams&&this.canUseLocalSymbolizerParams&&this._updateSymbolizerParams(),this._tileStrategy.updateCacheSize(0))}}async refreshDRAFunctionOnce(){this._refreshOnce||(this._refreshOnce=!0,await this._updateDRAStatistics(this._abortController?.signal),await this.doRefresh().catch(()=>{}),this._refreshOnce=!1)}moveEnd(){(this.isCPUBasedDRA||this.hasDRAInRasterFunction||!this.useProgressiveUpdate)&&(this._abortController&&this._abortController.abort(),this._abortController=new AbortController,0===this._fetchQueue.length&&(this.hasDRAInRasterFunction?(this._globalUpdateRequested=!1,this.refreshDRAFunctionOnce()):this.isCPUBasedDRA&&this._redrawImage(this._abortController.signal).then(()=>{this._globalUpdateRequested=!1,this.layerView.requestUpdate()})));const e=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy.updateCacheSize(e),this.layerView.requestUpdate()}get updating(){return this._globalUpdateRequested||this._updatingHandles?.updating}attach(){const e=S();this._maxIndexedColormapSize=4*(e.maxTextureSize||4096),this._initializeTileInfo(),this._tileInfoView=new w(this.layerView.tileInfo,this.layerView.fullExtent);const t=this._computeFetchConcurrency();this._fetchQueue=new P({tileInfoView:this._tileInfoView,concurrency:t,process:(e,t)=>this._fetchTile(e,t),priority:C.MAPVIEW_FETCH_QUEUE,scheduler:this.scheduler});const s=this._getCacheSize(this.useProgressiveUpdate);this._tileStrategy=new I({cachePolicy:"purge",acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),cacheSize:s,tileInfoView:this._tileInfoView}),this._updateBlockCacheRegistry()}detach(){this._tileStrategy.destroy(),this._fetchQueue.clear(),this.container.removeAllChildren(),this._fetchQueue=this._tileStrategy=this._tileInfoView=null,p(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryUrl=this._blockCacheRegistryId=null}acquireTile(e){const t=this.container.createTile(e);return this._updatingHandles.addPromise(this._enqueueTileFetch(t)),this.layerView.requestUpdate(),this._needBlockCacheUpdate=!0,this._globalUpdateRequested=this.isCPUBasedDRA||this.hasDRAInRasterFunction||!this.useProgressiveUpdate,t}releaseTile(e){this._fetchQueue.abort(e.key.id),this.container.removeChild(e),e.once("detach",()=>{e.destroy(),this.layerView.requestUpdate()}),this.layerView.requestUpdate()}createEmptyTilePixelBlock(e=null){const t=null==e||e.join(",")===this._tileInfoView.size.join(",");if(t&&null!=this._emptyTilePixelBlock)return this._emptyTilePixelBlock;e=e||this._tileInfoView.size;const[s,i]=e,r=new b({width:s,height:i,pixels:[new Uint8Array(s*i)],mask:new Uint8Array(s*i),pixelType:"u8"});return t&&(this._emptyTilePixelBlock=r),r}_getBandIds(){if(this.container&&(!("rasterFunctionChain"in this.container)||!this.container.rasterFunctionChain))return this.layer.bandIds;const{bandIds:e,raster:t}=this.layer,s="rasterFunction"in t?t.rasterFunction.rawInputBandIds:null;return e?.length&&s?.length&&1!==t.rasterInfo.bandCount?e.map(e=>s[Math.min(e,s.length-1)]):"rasterFunction"in t?s:e}updateRasterFunctionParameters(){}_fetchTile(e,t){const s=this._getFetchOptions(e.level,t.signal);return this.fetchTile(e,s)}_getFetchOptions(e,t){const{canUseWebGLForProcessing:s}=this,{layerView:i}=this,{tileInfo:r}=i,a=!r.isWrappable&&null!=g(i.view.spatialReference),o=s&&this.layer.raster.hasUniqueSourceStorageInfo,{layer:n}=this.layerView,l=n.serviceRasterInfo?.storageInfo.isBsqTile?n.getRawDisplayBandIds():void 0;return{allowPartialFill:!0,datumTransformation:i.datumTransformation,interpolation:s?"nearest":this.layer.interpolation,registryId:this._blockCacheRegistryId,requestRawData:o,skipRasterFunction:"raster"===this.type&&null!=this.container.rasterFunctionChain,signal:t,srcResolution:this._srcResolutions[e],timeExtent:i.timeExtent,tileInfo:r,bandIds:l,disableWrapAround:a}}_getCacheSize(e){return e?40:0}_initializeTileInfo(){const{layerView:e}=this,t=e.view.spatialReference;if(this._canUseLayerLODs()){const{origin:s,lods:i}=this.layer.tileInfo,r=i.map(({scale:e})=>e),a=R.create({spatialReference:t,size:U,scales:r,origin:s});return e.set("tileInfo",a),void(this._srcResolutions=i.map(({resolution:e})=>({x:e,y:e})))}const{scales:s,srcResolutions:r,isCustomTilingScheme:a}=_(this.layer.serviceRasterInfo,t,{tileSize:U,alignGlobalDatasetWithAGOL:!0,limitToSrcResolution:!1}),o=R.create({spatialReference:t,size:U,scales:s}),n=0===o.origin.x;i(e.fullExtent);const{xmin:l,ymax:h}=e.fullExtent;(n||a&&o.origin.x>l)&&(o.origin=new c({x:l,y:h,spatialReference:t})),this._isCustomTilingScheme=a,e.set("tileInfo",o),this._srcResolutions=r??[]}_canUseLayerLODs(){const{layer:e,layerView:t}=this;if("Map"!==e.raster.tileType)return!1;const{lods:s}=e.tileInfo,i=t.view.constraints?.effectiveLODs;return i?.length===s.length&&i.every(({scale:e},t)=>Math.abs(e-s[t].scale)<.001)}_computeFetchConcurrency(){const{blockBoundary:e}=this.layer.serviceRasterInfo.storageInfo,t=e[e.length-1];return(t.maxCol-t.minCol+1)*(t.maxRow-t.minRow+1)>64?2:10}async _enqueueTileFetch(e,t){if(!this._fetchQueue.has(e.key.id)){try{let t=e.once("detach",()=>t=void 0);const r=await this._fetchQueue.push(e.key),o=this._getBandIds(),n=this.hasDRAInRasterFunction&&u(this.layer.raster)&&!this.layer.raster.processParameters?.stretchCutoff;let l=!this.useProgressiveUpdate||n||this.isCPUBasedDRA&&!this._globalSymbolizerParams;const h=this._globalUpdateRequested&&!this.layerView.moving&&0===this._fetchQueue.length;if(h){if(l=!1,!this.hasDRAInRasterFunction)try{await this._redrawImage(this._abortController?.signal)}catch(i){a(i)&&s.getLogger(this).error(i)}this._globalUpdateRequested=!1}if(!t)return;this.canUseLocalSymbolizerParams&&null==this._symbolizerParams&&this._updateSymbolizerParams();const c=this._tileInfoView.getTileCoords(v,e.key),d=this._tileInfoView.getTileResolution(e.key);await this.updateTileSource(e,{source:r,symbolizerParams:this._symbolizerParams,globalSymbolizerParams:this._globalSymbolizerParams,suspended:l,bandIds:o,coords:c,resolution:d}),t&&(e.once("attach",()=>this.layerView.requestUpdate()),this.container.addChild(e),t.remove()),h&&this.hasDRAInRasterFunction&&!this._refreshOnce&&this.refreshDRAFunctionOnce()}catch(i){a(i)||s.getLogger(this).error(i)}this.layerView.requestUpdate()}}async _updateDRAStatistics(e){if(!u(this.layer.raster))return;const t=await this.layer.getDynamicRangeInputRaster();if(!t)return;const{raster:s,functionArguments:i}=t,r=this._getFetchOptions(this.previousLOD.level,e),{extent:a,width:o,height:n}=this.layerView.view,{pixelBlock:l}=await s.fetchPixels(a,o,n,{...r,interpolation:"nearest",requestRawData:!1,skipRasterFunction:!1}),h=f(i,{rasterInfo:s.rasterInfo,pixelBlock:l});this.layer.raster.processParameters={stretchCutoff:h}}async _redrawImage(e){if(!this.attached||0===this.container.children.length)return;if(await this.layer.updateRenderer(),this.isCPUBasedDRA?await this._updateGlobalSymbolizerParams(e):(this.canUseLocalSymbolizerParams&&this._updateSymbolizerParams(),this._globalSymbolizerParams=null),!this.attached||e?.aborted)return;const t=this.container.children.map(async t=>this.updateTileSymbolizerParameters(t,{local:this._symbolizerParams,global:this._globalSymbolizerParams},e));await Promise.allSettled(t),this.attached&&!e?.aborted&&this.container.requestRender()}async _updateGlobalSymbolizerParams(e){const t=this._getFetchOptions(this.previousLOD.level,e),s=await this.layer.fetchPixels(this.layerView.view.extent,this.layerView.view.width,this.layerView.view.height,{...t,interpolation:"nearest",requestRawData:!1,skipRasterFunction:!1});if(!s?.pixelBlock)return;const{resolution:i}=this.previousLOD,{isBsqTile:r}=this.layer.raster.rasterInfo.storageInfo,a=r?null:this._getBandIds(),o=this.layer.symbolizer.generateWebGLParameters({pixelBlock:s.pixelBlock.extractBands(a),isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:i,y:i},bandIds:a});!this.canUseWebGLForProcessing&&o&&"stretch"===o.type&&"raster-stretch"===this.layer.renderer?.type&&(o.factor=o.factor.map(e=>255*e),o.minOutput=Math.round(255*o.minOutput),o.maxOutput=Math.round(255*o.maxOutput)),this._globalSymbolizerParams=o}_updateSymbolizerParams(){const{resolution:e}=this.previousLOD,t=this._getBandIds();this._symbolizerParams=this.layer.symbolizer.generateWebGLParameters({pixelBlock:null,isGCS:this.layerView.view.spatialReference.isGeographic,resolution:{x:e,y:e},bandIds:t})}_updateBlockCacheRegistry(e=!1){const{layer:t,layerView:s}=this,{raster:i}=t,{multidimensionalDefinition:r}=t.normalizeRasterFetchOptions({multidimensionalDefinition:t.multidimensionalDefinition,timeExtent:s.timeExtent}),a=i.rasterInfo.multidimensionalInfo?i.getSliceIndex(r):null,o=i.rasterInfo.storageInfo.isBsqTile?t.getRawDisplayBandIds():null,n=u(i)?i.primaryRasters.rasters[0]??i:i,l=y(n.rasterId,a,o);if(l!==this._blockCacheRegistryUrl){if(null!=this._blockCacheRegistryUrl&&p(this._blockCacheRegistryUrl,this._blockCacheRegistryId),this._blockCacheRegistryId=m(l,n.rasterInfo),e){const{view:e}=s,t=this._tileInfoView.getClosestInfoForScale(e.scale),r=this._srcResolutions[t.level];d(l,this._blockCacheRegistryId,e.extent,e.resolution,r,i.ioConfig.sampling)}this._blockCacheRegistryUrl=l}}async doRefresh(){if(!this.attached||!this.previousLOD||this.layerView.suspended)return;await this.layer.updateRenderer(),this.canUseLocalSymbolizerParams&&this._updateSymbolizerParams(),this._updateBlockCacheRegistry(!0),this._fetchQueue.reset();const e=[];this._globalUpdateRequested=this.isCPUBasedDRA||this.hasDRAInRasterFunction||!this.useProgressiveUpdate,this._tileStrategy.refresh(t=>e.push(this._enqueueTileFetch(t))),await this._updatingHandles.addPromise(Promise.allSettled(e))}};e([o()],F.prototype,"_globalUpdateRequested",void 0),e([o()],F.prototype,"attached",void 0),e([o()],F.prototype,"canUseWebGLForProcessing",null),e([o()],F.prototype,"canUseLocalSymbolizerParams",null),e([o()],F.prototype,"hasDRAInRasterFunction",null),e([o()],F.prototype,"isCPUBasedDRA",null),e([o()],F.prototype,"container",void 0),e([o()],F.prototype,"layer",void 0),e([o()],F.prototype,"layerView",void 0),e([o()],F.prototype,"scheduler",void 0),e([o()],F.prototype,"type",void 0),e([o()],F.prototype,"useWebGLForProcessing",null),e([o()],F.prototype,"useProgressiveUpdate",null),e([o()],F.prototype,"timeExtent",void 0),e([o()],F.prototype,"updating",null),F=e([n("esri.views.2d.layers.imagery.BaseImageryTileSubView2D")],F);export{F as BaseImageryTileSubView2D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import has from"../../../../core/has.js";import{numberMaxFloat32 as t}from"../../../../core/mathUtils.js";import{property as r,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{isFunctionRaster as i}from"../../../../layers/raster/datasets/datasetUtils.js";import{getBytesPerPixel as n}from"../../../../layers/raster/formats/pixelRangeUtils.js";import{convertGeometryToMask as o}from"../../../../layers/raster/functions/clipUtils.js";import{maxMapSizeGpu as a}from"../../../../layers/raster/functions/pixelUtils.js";import{RasterTileContainer as l}from"../../engine/imagery/RasterTileContainer.js";import{BaseImageryTileSubView2D as c}from"./BaseImageryTileSubView2D.js";import{canUseMajorityInterpolationOnDataSource as p}from"../support/util.js";import{defaultColor as u}from"../../../support/HighlightDefaults.js";import{getHighlightName as
|
|
5
|
+
import{__decorate as e}from"tslib";import has from"../../../../core/has.js";import{numberMaxFloat32 as t}from"../../../../core/mathUtils.js";import{property as r,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{isFunctionRaster as i}from"../../../../layers/raster/datasets/datasetUtils.js";import{getBytesPerPixel as n}from"../../../../layers/raster/formats/pixelRangeUtils.js";import{convertGeometryToMask as o}from"../../../../layers/raster/functions/clipUtils.js";import{maxMapSizeGpu as a}from"../../../../layers/raster/functions/pixelUtils.js";import{RasterTileContainer as l}from"../../engine/imagery/RasterTileContainer.js";import{BaseImageryTileSubView2D as c}from"./BaseImageryTileSubView2D.js";import{canUseMajorityInterpolationOnDataSource as p}from"../support/util.js";import{defaultColor as u}from"../../../support/HighlightDefaults.js";import{getHighlightName as h}from"../../../support/highlightOptionsUtils.js";const d=[1024,1024];let m=class extends c{constructor(){super(...arguments),this.type="raster"}get canUseWebGLForProcessing(){const{loaded:e,symbolizer:t}=this.layer;if(!e||!t||this.hasDRAInRasterFunction)return!1;const r=t.lookup.colormapLut?.indexedColormap,s=r&&r.length>this._maxIndexedColormapSize,i=n(this.layer.serviceRasterInfo);return!(has("ios")&&i>4)&&this.useWebGLForProcessing&&t.canRenderInWebGL&&!s&&!("majority"===this.layer.interpolation&&p(this.layer))}attach(){super.attach(),this.container=new l(this._tileInfoView),this.container.isCustomTilingScheme=this._isCustomTilingScheme,this.updateRasterFunctionParameters()}detach(){super.detach(),this.container.removeAllChildren(),this.container=null}fetchTile(e,t){return this.layer.fetchTile(e.level,e.row,e.col,t)}updateRasterFunctionParameters(){const{raster:e,type:t}=this.layer,{container:r}=this;if("Function"!==e.datasetFormat||"wcs"===t)return r.rasterFunctionChain=null,r.children.forEach(e=>{const{bitmap:t}=e;t&&(t.suspended=!0,t.processed=!1,t.projected&&(t.invalidateTexture(),t.rasterTexture=null))}),void(this._rasterFunctionState="na");const s=this._rasterFunctionState,{rasterFunction:i,primaryRasters:n}=e,o=i.supportsGPU&&(!n||n.rasters.length<=1),a=o?i.flatWebGLFunctionChain:null,{renderer:l}=this.layer,c=!o||!a?.functions.length||"raster-stretch"===l?.type&&l.dynamicRangeAdjustment||!this.canUseWebGLForProcessing;r.rasterFunctionChain=c?null:this._addProjection(a);const p=null==i?"na":r.rasterFunctionChain?"gpu":"cpu",u=s===p||"na"===s&&"cpu"===p&&0===a?.functions?.length;r.children.forEach(e=>{const{bitmap:t}=e;t&&(t.suspended=!u,t.processed=!1,t.processedTexture=null)}),this._rasterFunctionState=p}async updateTileSource(e,t){const r=this._getBandIds(),s=this._getLayerInterpolation(),{canUseWebGLForProcessing:n}=this,{source:a,globalSymbolizerParams:l,suspended:c,coords:p,resolution:u}=t,h=this.isCPUBasedDRA?l:t.symbolizerParams,{bitmap:d}=e;if([d.x,d.y]=p,d.resolution=u,null!=a?.pixelBlock){const e={extent:a.extent,pixelBlock:a.pixelBlock,srcPixelSize:a.srcTilePixelSize};if(d.rawPixelData=e,n)d.source=a.pixelBlock,d.isRendereredSource=!1;else{const t=await this.layer.applyRenderer(e,"stretch"===l?.type?l:void 0);d.source=t,d.isRendereredSource=!0}d.symbolizerParameters=n?h:null,d.transformGrid=n?a.transformGrid:null}else{const e=this.createEmptyTilePixelBlock();d.source=e,d.symbolizerParameters=n?h:null,d.transformGrid=null}const{isBsqTile:m}=this.layer.raster.rasterInfo.storageInfo;d.bandIds=n&&!m?r:null,d.width=this._tileInfoView.size[0],d.height=this._tileInfoView.size[1],d.interpolation=s,d.suspended=c;const{raster:y}=this.layer;if(i(y)){const t=y.getClippingGeometry(this.layerView.view.spatialReference);if(t){const r=y.getTileExtentFromTileInfo(e.key.level,e.key.row,e.key.col,this._tileInfoView.tileInfo);r&&(d.mask=o({srcExtent:r,geometry:t,size:[d.width,d.height]}))}}d.invalidateTexture()}async updateTileSymbolizerParameters(e,t,r){const{local:s,global:i}=t,n=this._getBandIds(),o=this._getLayerInterpolation(),{canUseWebGLForProcessing:a}=this,{bitmap:l}=e,{rawPixelData:c}=l;a||null==c?(l.isRendereredSource&&null!=c&&(l.source=c.pixelBlock),l.isRendereredSource=!1):(l.source=await this.layer.applyRenderer(c,"stretch"===i?.type?i:void 0,{signal:r}),l.isRendereredSource=!0),l.symbolizerParameters=a?this.layerView.hasTilingEffects?i:s:null;const{isBsqTile:p}=this.layer.raster.rasterInfo.storageInfo;l.bandIds=a&&!p?n:null,l.interpolation=o,l.suspended=!1}updateHighlightOptions(e){if(!e.length)return void(this.container.pixelHighlights=void 0);const r=[],{highlights:s}=this.layerView.view;e.sort((e,t)=>s.findIndex(({name:e})=>e===h(t.options))-s.findIndex(({name:t})=>t===h(e.options)));for(const{target:i,options:n}of e){const{pixelRanges:e}=i,l=h(n),c=(s.find(e=>e.name===l)?.color??u).toUnitRGBA();if(Array.isArray(e)){const s=Array.from({length:2*a},()=>0);for(let t=0;t<e.length;t++)s[2*t]=e[t][0],s[2*t+1]=e[t][1];for(let r=e.length;r<a;r++)s[2*r]=t,s[2*r+1]=-t;const n=i.bandId??0;r.push({ranges:s,bandId:n,color:c,type:"single-band"})}else{const t="extent"===e.type?e:e.extent;if(!t)continue;const s=[t.xmin,t.xmax],n=[t.ymin,t.ymax],{xBandId:a,yBandId:l}=i,p={xRange:s,yRange:n,bandIds:[a,l],color:c,type:"xy-band"};"polygon"===e.type&&(p.maskSize=d,p.mask=o({srcExtent:t,geometry:e,size:d})),r.push(p)}}this.container.pixelHighlights=r}_getLayerInterpolation(){const{interpolation:e,renderer:t}=this.layer;if(!t)return e;const r=t.type;return"raster-colormap"===r||"unique-value"===r?"nearest":"raster-stretch"===t.type&&null!=t.colorRamp?"bilinear"===e||"cubic"===e?"bilinear":"nearest":e}_addProjection(e){return e?.functions?.length&&!e.hasFocalFunction&&e.functions.unshift({name:"Reproject",parameters:{targetImageSize:this._tileInfoView.size,requireNNEdge:e.isSourceSingleBand},pixelType:"f32",id:0,isNoopProcess:!1}),e}};e([r()],m.prototype,"canUseWebGLForProcessing",null),e([r()],m.prototype,"container",void 0),e([r()],m.prototype,"layer",void 0),e([r()],m.prototype,"type",void 0),m=e([s("esri.views.2d.layers.imagery.ImageryTileView2D")],m);export{m as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{deg2rad as i}from"../../../../core/mathUtils.js";import{valueInUnit as o}from"../../../../core/quantity.js";import{watch as e,sync as s,syncAndInitial as
|
|
5
|
+
import{__decorate as t}from"tslib";import{deg2rad as i}from"../../../../core/mathUtils.js";import{valueInUnit as o}from"../../../../core/quantity.js";import{watch as e,sync as s,syncAndInitial as n}from"../../../../core/reactiveUtils.js";import{verticalLengthUnitFromSpatialReference as a,convertUnit as r}from"../../../../core/units.js";import{property as l,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{rotateZ as h}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{subtract as c,lerp as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromArray as d,clone as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{sv3d as f,sm4d as v}from"../../../../geometry/support/vectorStacks.js";import{ShiftManipulator as y}from"../Slice/ShiftManipulator.js";import{IsShiftEdgeOnScreenFlag as _}from"../Slice/sliceToolUtils.js";import{calculateTranslateRotateFromBases as w}from"../../interactive/manipulatorUtils.js";import{screenToZConstrained as g}from"../../interactive/editingTools/dragEventPipeline3D.js";import{createManipulatorDragEventPipeline as T,addMapTranslation as M}from"../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as U}from"../../../interactive/InteractiveToolBase.js";import j from"../../../interactive/sketch/SketchOptions.js";import O from"../../../interactive/sketch/Units.js";import{makeTooltip as k,enterInputModeIfAvailable as S}from"../../../interactive/tooltip/tooltipCommonUtils.js";import{ElevationTooltipInfo as V}from"../../../interactive/tooltip/infos/ElevationTooltipInfo.js";import{elevationFromZ as E}from"../../../support/euclideanLengthMeasurementUtils.js";let I=class extends U{constructor(t){super(t),this.multiTouchEnabled=!1,this.sketchOptions=new j}initialize(){const{view:t}=this;this._shiftManipulator=new y(t,0),this._shiftManipulator.state|=_,this.manipulators.add(this._shiftManipulator),this.addHandles([this._createDragPipeline(),e(()=>this.analysisViewData.targetGeometry,()=>this._updateManipulatorPosition(),s),e(()=>this._showManipulator,t=>this._updateManipulatorVisibility(t),n)]),this._initializeTooltip(),this.finishToolCreation()}_initializeTooltip(){const{view:t}=this;this.tooltip=k(()=>({view:t,options:this.sketchOptions.tooltips})),this._tooltipInfo=new V({sketchOptions:this.sketchOptions}),this.sketchOptions.tooltips.placement="trailing",this._updateSketchOptions(),this.addHandles([e(()=>this.analysisViewData.effectiveTargetElevation,()=>this._updateTooltip()),e(()=>this._shouldShowTooltip,t=>{t?this._showTooltip():this._hideTooltip()}),this.tooltip.on("commit",()=>{const t=this._tooltipInfo.elevation.actual,i=a(this.view.spatialReference);if(null==t||null==i)return;const e=o(t,i);this._updateValue(e,{recordUndo:this.analysis.cutFillOptions.targetElevation})}),e(()=>[this.analysis.displayUnits.elevation,this.analysis.inputUnits.elevation],()=>this._updateSketchOptions(),n)])}destroy(){this._shiftManipulator.destroy(),this.tooltip.destroy()}onInputEvent(t){if(!this.destroyed&&!S(t,this.tooltip))return super.onInputEvent(t)}get _shouldShowTooltip(){return this.hasFocusedManipulators||"input"===this.tooltip.mode}get _showManipulator(){const{interactive:t,targetGeometry:i,visible:o}=this.analysisViewData,{measureType:e}=this.analysis;return o&&t&&null!=i&&"cut-fill"===e}_createDragPipeline(){return T(this._shiftManipulator,(t,i,o)=>{const e=m(t.renderLocation),s=this.analysis.inputUnits.elevation??"meters",n=a(this.view.spatialReference);let l;i.next(g(this.view,e,this.view.spatialReference)).next(M()).next(t=>{if("start"===t.action){const{targetElevation:t}=this.analysis.cutFillOptions;l=t&&n?r(t,s,n):void 0}return this._updateValue(null!=l?l+t.translationZ:t.mapEnd.z,"end"===t.action?{recordUndo:l}:void 0),t}),o.next(()=>{this._updateValue(l)})})}_updateManipulatorPosition(){const{targetGeometry:t}=this.analysisViewData,{renderCoordsHelper:o}=this.view;if(!t)return;const e=.5,s=t.rings[0],n=d(s[0]),a=d(s[1]);o.toRenderCoords(n,t.spatialReference,n),o.toRenderCoords(a,t.spatialReference,a);const r=f.get();c(r,a,n);const l=f.get();u(l,n,a,e);const p=o.worldBasisAtPosition(l,1,f.get()),y=o.worldBasisAtPosition(l,0,f.get()),_=w(p,y,l,v.get()),g=o.headingAtPosition(l,r),T=t.isClockwise(t.rings[0])?-Math.PI/2:Math.PI/2;h(_,_,i(g)+T),_[12]=0,_[13]=0,_[14]=0,this._shiftManipulator.renderLocation=m(l),this._shiftManipulator.modelTransform=_}_updateManipulatorVisibility(t){this._shiftManipulator.available=t}_updateValue(t,i){const o=E(t,this.view.spatialReference);if(null==o)return;const e=this.analysis.inputUnits.elevation??"meters",s=r(o.value,o.unit,e),n=t=>{this.analysis.cutFillOptions.targetElevation=t};if(n(s),i&&"recordUndo"in i){const t=i.recordUndo;this.emit("record-undo",{apply:()=>n(s),undo:()=>n(t)})}}_getUpdatedTooltipInfo(){const{effectiveTargetElevation:t}=this.analysisViewData;return t?(this._tooltipInfo.elevation.actual=E(t,this.view.spatialReference),this._tooltipInfo):this._tooltipInfo}_updateTooltip(){this._shouldShowTooltip&&(this.tooltip.info=this._getUpdatedTooltipInfo())}_showTooltip(){this._updateTooltip()}_hideTooltip(){this.tooltip?.clear()}_updateSketchOptions(){const{analysis:t}=this,{displayUnits:i,inputUnits:o}=t;this.sketchOptions.values.inputUnits=new O({verticalLength:o.elevation}),this.sketchOptions.values.displayUnits=new O({verticalLength:i.elevation})}};t([l()],I.prototype,"multiTouchEnabled",void 0),t([l({constructOnly:!0})],I.prototype,"analysis",void 0),t([l({constructOnly:!0})],I.prototype,"view",void 0),t([l({constructOnly:!0})],I.prototype,"analysisViewData",void 0),t([l({constructOnly:!0,type:j})],I.prototype,"sketchOptions",void 0),t([l()],I.prototype,"_shouldShowTooltip",null),t([l()],I.prototype,"_showManipulator",null),I=t([p("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementShiftTool")],I);export{I as VolumeMeasurementShiftTool};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{copy as e,squaredDistance as r,scale as t,subtract as n,add as i,
|
|
5
|
+
import{copy as e,squaredDistance as r,scale as t,subtract as n,add as i,length as o,dot as s,distance as a}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as l}from"../../../geometry/ellipsoidUtils.js";import{containsPoint as u}from"../../../geometry/support/aaBoundingRect.js";import{Intersector as d}from"../webgl-engine/lib/Intersector.js";function g(e,r,t,n){return null!=e.renderCoordsHelper.fromRenderCoords(r.eye,H,n)&&u(t,H)}function f(e,r){return e.elevationProvider?e.elevationProvider.getElevation(r[0],r[1],r[2],e.renderCoordsHelper.spatialReference,"ground")??0:0}function m(o,s,a,c){const l=o.state.camera.clone();s&&a&&c&&(l.eye=s,l.center=a,l.up=c),v(o,l.ray,R)||e(R,l.center);const u=o.state.constraints,d=u.minimumPoiDistance;if(r(l.eye,R)<d){const r=u.collision.enabled;e(j,l.viewForward),t(j,j,d),r?l.eye=n(H,R,j):i(R,l.eye,j);const s=o.renderCoordsHelper,a=s.getAltitude(l.eye),c=u.collision.elevationMargin;r&&a<c&&(n(j,R,l.eye),l.eye=s.setAltitude(H,c,l.eye),i(R,l.eye,j))}return l.center=R,l}function p(e,r,t){const{origin:n,direction:i}=r;if(o(n)<e)return!0;const c=-s(i,n)/o(i);return c<0||c>=a(t,n)}function y(e,t,n){if(!e.state.isGlobal||!e.stateManager.constraintsManager)return!1;const i=f(e,t),o=e.stateManager.constraintsManager.nearFarHeuristic.computeFarDistance(t,i,e.stage.renderer.sceneDepthRange.value.far),s=o*o;return r(t,n)>s}function v(e,r,t){let n=M[e.viewingMode];n||(n=new d(e.state.viewingMode),n.options.backfacesTerrain=!e.state.isGlobal,n.options.invisibleTerrain=!0,M[e.viewingMode]=n);const{isGlobal:i}=e.state,o=i?l(e.spatialReference).radius:0;return!(!e.sceneIntersectionHelper.intersectRay(r,n,t)||y(e,r.origin,t)||i&&!p(o,n.ray,t))||(!(!e.renderCoordsHelper.intersectManifold(r,0,t)||y(e,r.origin,t)||i&&!p(o,n.ray,t))||!!i&&b(r,t,o))}function b(e,r,n){const a=s(e.origin,e.origin)-n*n,c=a>0?Math.sqrt(a)/3:1;return t(r,e.direction,c/o(e.direction)),i(r,r,e.origin),!0}let M={};function w(){M={}}const H=c(),R=c(),j=c();export{m as cameraOnContentAlongViewDirection,w as cleanupIntersectionUtils,g as eyeWithinExtent,f as surfaceElevationBelowRenderLocation};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{signal as r}from"../../../../core/signal.js";import{normalize as t}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersectsSphere as i}from"../../../../geometry/support/frustum.js";import{Sphere as n}from"../../../../geometry/support/sphere.js";import{makeScheduleFunction as a}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as o}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as u}from"./GaussianSplatFadeTexture.js";import{GaussianSplatOrderTexture as h}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as d}from"./GaussianSplatTextureAtlas.js";import{TaskPriority as l}from"../../../support/Scheduler.js";class _{constructor(e){this._updating=r(!1),this._useDeterministicSort=!1,this.visibleGaussians=0,this._visibleGaussianTiles=new Array,this._workerHandle=null,this._isSorting=!1,this._pendingSortTask=!1,this._bufferCapacity=0,this._minimumBoundingSphere=new n,this._cameraDirectionNormalized=s(),this._frameTask=null,this._renderer=e,this._orderTexture=new h(this._renderer.renderingContext),this._fadingTexture=new u(this._renderer.renderingContext),this._textureAtlas=new d(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache);const{resourceController:t}=this._renderer.view;this._workerHandle=new o(a(t)),this._frameTask=t.scheduler.registerTask(l.GAUSSIAN_SPLAT_SORTING)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}get visibleGaussianTiles(){return this._visibleGaussianTiles}updateGaussianVisibility(e){this._visibleGaussianTiles=e,this.requestSort()}isUpdating(){return this._updating.value}destroy(){this._pendingSortTask=!1,this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}requestSort(){this._updating.value=!0,this._isSorting?this._pendingSortTask=!0:(this._isSorting=!0,this._pendingSortTask=!1,this._sortOnWorker().then(()=>this._handleSortComplete()).catch(()=>this._handleSortComplete()))}_handleSortComplete(){this._isSorting=!1,this._pendingSortTask?this.requestSort():this._updating.value=!1}_clearBuffersAndTextures(){this._bufferCapacity=0,this._orderTexture.clear(),this._textureAtlas.clear()}_ensureBufferCapacity(r){if(this._bufferCapacity<r){const t=Math.ceil(r*e);this._atlasIndicesBuffer=new Uint32Array(t),this._sortedAtlasIndicesBuffer=new Uint32Array(t),this._distancesBuffer=new Float64Array(t),this._sortOrderBuffer=new Uint32Array(t),this._bufferCapacity=t}}async _sortOnWorker(){if(0===this._visibleGaussianTiles.length)return this.visibleGaussians=0,this._clearBuffersAndTextures(),void this._renderer.requestRender(1);this._useDeterministicSort&&this._visibleGaussianTiles.sort((e,r)=>e.obb.centerX-r.obb.centerX||e.obb.centerY-r.obb.centerY||e.obb.centerZ-r.obb.centerZ);let e=this._visibleGaussianTiles.reduce((e,r)=>e+r.gaussianAtlasIndices.length,0);this._ensureBufferCapacity(e),this._textureAtlas.ensureTextureAtlas();const{frustum:r}=this._renderer.camera;t(this._cameraDirectionNormalized,this._renderer.camera.ray.direction);const s=this._cameraDirectionNormalized[0],n=this._cameraDirectionNormalized[1],a=this._cameraDirectionNormalized[2];let o=0;if(this._visibleGaussianTiles.forEach(t=>{const{gaussianAtlasIndices:
|
|
5
|
+
import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{signal as r}from"../../../../core/signal.js";import{normalize as t}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersectsSphere as i}from"../../../../geometry/support/frustum.js";import{Sphere as n}from"../../../../geometry/support/sphere.js";import{makeScheduleFunction as a}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as o}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatFadeTexture as u}from"./GaussianSplatFadeTexture.js";import{GaussianSplatOrderTexture as h}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as d}from"./GaussianSplatTextureAtlas.js";import{TaskPriority as l}from"../../../support/Scheduler.js";class _{constructor(e){this._updating=r(!1),this._useDeterministicSort=!1,this.visibleGaussians=0,this._visibleGaussianTiles=new Array,this._workerHandle=null,this._isSorting=!1,this._pendingSortTask=!1,this._bufferCapacity=0,this._minimumBoundingSphere=new n,this._cameraDirectionNormalized=s(),this._frameTask=null,this._renderer=e,this._orderTexture=new h(this._renderer.renderingContext),this._fadingTexture=new u(this._renderer.renderingContext),this._textureAtlas=new d(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache);const{resourceController:t}=this._renderer.view;this._workerHandle=new o(a(t)),this._frameTask=t.scheduler.registerTask(l.GAUSSIAN_SPLAT_SORTING)}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get fadingTexture(){return this._fadingTexture}get visibleGaussianTiles(){return this._visibleGaussianTiles}updateGaussianVisibility(e){this._visibleGaussianTiles=e,this.requestSort()}isUpdating(){return this._updating.value}destroy(){this._pendingSortTask=!1,this._frameTask.remove(),this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._orderTexture.destroy(),this._fadingTexture.destroy()}requestSort(){this._updating.value=!0,this._isSorting?this._pendingSortTask=!0:(this._isSorting=!0,this._pendingSortTask=!1,this._sortOnWorker().then(()=>this._handleSortComplete()).catch(()=>this._handleSortComplete()))}_handleSortComplete(){this._isSorting=!1,this._pendingSortTask?this.requestSort():this._updating.value=!1}_clearBuffersAndTextures(){this._bufferCapacity=0,this._orderTexture.clear(),this._textureAtlas.clear()}_ensureBufferCapacity(r){if(this._bufferCapacity<r){const t=Math.ceil(r*e);this._atlasIndicesBuffer=new Uint32Array(t),this._sortedAtlasIndicesBuffer=new Uint32Array(t),this._distancesBuffer=new Float64Array(t),this._sortOrderBuffer=new Uint32Array(t),this._bufferCapacity=t}}async _sortOnWorker(){if(0===this._visibleGaussianTiles.length)return this.visibleGaussians=0,this._clearBuffersAndTextures(),void this._renderer.requestRender(1);this._useDeterministicSort&&this._visibleGaussianTiles.sort((e,r)=>e.obb.centerX-r.obb.centerX||e.obb.centerY-r.obb.centerY||e.obb.centerZ-r.obb.centerZ);let e=this._visibleGaussianTiles.reduce((e,r)=>e+r.gaussianAtlasIndices.length,0);this._ensureBufferCapacity(e),this._textureAtlas.ensureTextureAtlas();const{frustum:r}=this._renderer.camera;t(this._cameraDirectionNormalized,this._renderer.camera.ray.direction);const s=this._cameraDirectionNormalized[0],n=this._cameraDirectionNormalized[1],a=this._cameraDirectionNormalized[2];let o=0;const u=1.5;if(this._visibleGaussianTiles.forEach(t=>{const{gaussianAtlasIndices:h,positions:d}=t;if(this._minimumBoundingSphere.center=t.obb.center,this._minimumBoundingSphere.radius=(t.obb.radius+t.maxScale)*u,i(r,this._minimumBoundingSphere))for(let e=0;e<h.length;e++){this._atlasIndicesBuffer[o]=h[e];const r=3*e,t=d[r],i=d[r+1],u=d[r+2];this._distancesBuffer[o]=t*s+i*n+u*a,this._sortOrderBuffer[o]=o,o++}else e-=h.length}),0===e)return this.visibleGaussians=0,this._clearBuffersAndTextures(),void this._renderer.requestRender(1);const h={distances:this._distancesBuffer,sortOrderIndices:this._sortOrderBuffer,numGaussians:e,preciseSort:this._useDeterministicSort};await(this._workerHandle?.sort(h).then(e=>{this._distancesBuffer=e.distances,this._sortOrderBuffer=e.sortedOrderIndices}));const d=async r=>{const t=this._sortedAtlasIndicesBuffer.subarray(0,e);for(let s=0;s<e;s++)t[s]=this._atlasIndicesBuffer[this._sortOrderBuffer[s]];this._orderTexture.setData(t,e),this.visibleGaussians=e,this._renderer.requestRender(1),r.madeProgress()};await this._frameTask.schedule(d)}set useDeterministicSort(e){this._useDeterministicSort=e}}export{_ as GaussianSplatDataStore};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{signal as i}from"../../../../core/signal.js";class e{static{this.fadeInEase=i=>i*(2-i)}static{this.fadeOutEase=i=>i*i}constructor(e){this.layerView=e,this._numFadingTiles=i(0)}get numFadingTiles(){return this._numFadingTiles.value}fadeTile(i,e){const t=this._getTargetOpacity(e);if(i.fadeDirection=e,0===this.fadeDuration)return void this._instantTileFading(i,t);const a=i.opacityModifier;if(a!==t){const e=1-Math.abs(t-a);this._startTileFading(i,e)}else this._stopTileFading(i)}updateAllTileFading(i){this.layerView.tileHandles.forEach(e=>this._updateTileFading(e,i)),this.layerView.updateGaussians()}onFadeDurationChanged(i){0===i&&this.numFadingTiles>0&&this._instantlyFullyFadeAllTiles()}isTileFadingOut(i){return null!=i.fadeProgress&&1===i.fadeDirection}isUpdating(){return this._numFadingTiles.value>0}get fadeDuration(){return this.layerView.view.qualitySettings.fadeDuration}get fadingEnabled(){return 0!==this.fadeDuration}_startTileFading(i,e){null==i.fadeProgress&&this._numFadingTiles.value++,i.fadeProgress=e}_stopTileFading(i){null!=i.fadeProgress&&(1===i.fadeDirection&&this._onTileFullyFadedOut(i),this._numFadingTiles.value--,i.fadeProgress=null)}_updateTileFading(i,t){const{fadeProgress:a,fadeDirection:s}=i;if(null==a)return;const n=this._fadeDirectionToSign(s),l=n*this.fadeDuration,d=this._getTargetOpacity(s),r=t/Math.abs(l||1),o=Math.min(a+r,1),u=n*(1-(0===s?e.fadeInEase:e.fadeOutEase)(o)),g=1===o;i.opacityModifier=g?d:d-u,g?this._stopTileFading(i):i.fadeProgress=o,this._updateOpacityModifier(i)}_updateOpacityModifier(i){const e=255*i.opacityModifier;for(let t=0;t<i.pageIds.length;t++){const a=i.pageIds[t];this.layerView.data.fadingTexture.updateBuffer(e,a)}}_instantTileFading(i,e){i.fadeProgress=null,i.opacityModifier=e,this._updateOpacityModifier(i),1===i.fadeDirection&&this._onTileFullyFadedOut(i)}_instantlyFullyFadeAllTiles(){this.layerView.tileHandles.forEach(i=>{null!=i.fadeProgress&&this._instantTileFading(i,this._getTargetOpacity(i.fadeDirection))}),this.layerView.updateGaussians(),this._numFadingTiles.value=0}_onTileFullyFadedOut(i){i.isVisible=!1,this.layerView.moveTileToCache(i)}_fadeDirectionToSign(i){return 0===i?1:-1}_getTargetOpacity(i){return 0===i?1:0}}export{e as GaussianSplatFadeHelper};
|
|
5
|
+
import{signal as i}from"../../../../core/signal.js";class e{static{this.fadeInEase=i=>i*(2-i)}static{this.fadeOutEase=i=>i*i}constructor(e){this.layerView=e,this._numFadingTiles=i(0)}get numFadingTiles(){return this._numFadingTiles.value}fadeTile(i,e){const t=this._getTargetOpacity(e);if(i.fadeDirection=e,0===this.fadeDuration)return void this._instantTileFading(i,t);const a=i.opacityModifier;if(a!==t){const e=1-Math.abs(t-a);this._startTileFading(i,e)}else this._stopTileFading(i)}updateAllTileFading(i){this.layerView.tileHandles.forEach(e=>this._updateTileFading(e,i)),this.layerView.updateGaussians()}onFadeDurationChanged(i){0===i&&this.numFadingTiles>0&&this._instantlyFullyFadeAllTiles()}isTileFadingOut(i){return null!=i.fadeProgress&&1===i.fadeDirection}isUpdating(){return this._numFadingTiles.value>0}get fadeDuration(){return 2*this.layerView.view.qualitySettings.fadeDuration}get fadingEnabled(){return 0!==this.fadeDuration}_startTileFading(i,e){null==i.fadeProgress&&this._numFadingTiles.value++,i.fadeProgress=e}_stopTileFading(i){null!=i.fadeProgress&&(1===i.fadeDirection&&this._onTileFullyFadedOut(i),this._numFadingTiles.value--,i.fadeProgress=null)}_updateTileFading(i,t){const{fadeProgress:a,fadeDirection:s}=i;if(null==a)return;const n=this._fadeDirectionToSign(s),l=n*this.fadeDuration,d=this._getTargetOpacity(s),r=t/Math.abs(l||1),o=Math.min(a+r,1),u=n*(1-(0===s?e.fadeInEase:e.fadeOutEase)(o)),g=1===o;i.opacityModifier=g?d:d-u,g?this._stopTileFading(i):i.fadeProgress=o,this._updateOpacityModifier(i)}_updateOpacityModifier(i){const e=255*i.opacityModifier;for(let t=0;t<i.pageIds.length;t++){const a=i.pageIds[t];this.layerView.data.fadingTexture.updateBuffer(e,a)}}_instantTileFading(i,e){i.fadeProgress=null,i.opacityModifier=e,this._updateOpacityModifier(i),1===i.fadeDirection&&this._onTileFullyFadedOut(i)}_instantlyFullyFadeAllTiles(){this.layerView.tileHandles.forEach(i=>{null!=i.fadeProgress&&this._instantTileFading(i,this._getTargetOpacity(i.fadeDirection))}),this.layerView.updateGaussians(),this._numFadingTiles.value=0}_onTileFullyFadedOut(i){i.isVisible=!1,this.layerView.moveTileToCache(i)}_fadeDirectionToSign(i){return 0===i?1:-1}_getTargetOpacity(i){return 0===i?1:0}}export{e as GaussianSplatFadeHelper};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import"../../../../core/has.js";import{disposeMaybe as e,destroyMaybe as i}from"../../../../core/maybe.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{multiply as s,fromTranslation as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as u,sub as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{RenderCategory as
|
|
5
|
+
import{__decorate as t}from"tslib";import"../../../../core/has.js";import{disposeMaybe as e,destroyMaybe as i}from"../../../../core/maybe.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{multiply as s,fromTranslation as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as u,sub as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{RenderCategory as c}from"../../webgl.js";import{debugFlags as f}from"../../support/debugFlags.js";import{glLayout as d}from"../../support/buffer/glUtil.js";import{newLayout as _}from"../../support/buffer/InterleavedLayout.js";import l from"../../webgl/RenderNode.js";import{Pos2Locations as m}from"./DefaultVertexBufferLayouts.js";import{VertexArrayObject as g}from"./VertexArrayObject.js";import{TaskPriority as x}from"../../../support/Scheduler.js";import{Yield as v}from"../../../support/Yield.js";import{BufferObject as b}from"../../../webgl/BufferObject.js";import{DataType as w,PixelType as y}from"../../../webgl/enums.js";import{makePipelineState as T,defaultColorWrite as j}from"../../../webgl/renderState.js";import{Sync as P}from"../../../webgl/Sync.js";import C from"../../../webgl/Texture.js";import{TextureDescriptor as B}from"../../../webgl/TextureDescriptor.js";import{fromLayout as O}from"../../../webgl/VertexAttributeLocations.js";import{VertexBuffer as D}from"../../../webgl/VertexBuffer.js";let M=class extends l{constructor(t){super(t),this.category=c.COMPOSITE,this._debugVao=null,this._debugVaoLength=0,this.readyToRun=!1,this.done=!0,this._start=!1,this._origin=p(),this._textureWidth=256,this._uploadBuffer=new Float32Array(3*this._textureWidth),this._counter=0,this._width=0,this._height=0,this._pipeline=T({colorWrite:j}),this._format=0}initialize(){const t=this.view.resourceController.scheduler.registerTask(x.GRAPHICS_CORE,this);this.addHandles(t),this.produces="disabled",this.consumes.required=[this.category],this.formatOverride&&(this._format=this.formatOverride)}destroy(){this._program=e(this._program),this._debugProgram=e(this._debugProgram),this._debugVao=e(this._debugVao),this._sync=i(this._sync),this._pixelBuffer=e(this._pixelBuffer),this._texture=e(this._texture)}precompile(){this._ensureProgram(this.renderingContext)}render(t){const e=t.find(({name:t})=>t===this.category),i=this.renderingContext,r=this.gl,o=e.getTexture(r.DEPTH_STENCIL_ATTACHMENT),s=this.view.stage?.renderer.fboCache;if(!o||!s||this._sync||!this._start)return e;this._start=!1,this.produces=f.OCCLUSION_QUERY_DEBUG_PIXEL?this.category:"disabled";const n=s.acquire(this._width,this._height,"hud visibility",10);i.bindFramebuffer(n.fbo),i.setPipelineState(this._pipeline);const h=this._ensureProgram(i);return i.useProgram(h),F(h,this.camera,this._origin),i.bindTexture(o,0),h.setUniform1i("depthTex",0),i.bindTexture(this._texture,1),h.setUniform1i("positionTex",1),h.setUniform1i("count",this._counter),i.screen.draw(),0===this._format&&(this._format=6403===r.getParameter(r.IMPLEMENTATION_COLOR_READ_FORMAT)&&r.getParameter(r.IMPLEMENTATION_COLOR_READ_TYPE)===w.FLOAT?6403:6408),this._pixelBuffer??=b.createPixelPack(i,r.STREAM_READ),this._pixelBuffer.setSize(this._width*this._height*(6403===this._format?4:16)),i.bindBuffer(this._pixelBuffer),r.readPixels(0,0,this._width,this._height,this._format,w.FLOAT,0),i.unbindBuffer(35051),i.bindFramebuffer(null),n.release(),this._sync=new P(r),setTimeout(()=>this.readyToRun=!0,0),e}runTask(){if(this._sync&&this._pixelBuffer){try{if(!this._sync.poll())return v}catch(t){return this.readyToRun=!1,void(this._sync=i(this._sync))}this.readyToRun=!1,this._sync=i(this._sync),this._cpuBuffer=new Float32Array(this._width*this._height*(6403===this._format?1:4)),this._pixelBuffer.getSubData(this._cpuBuffer),this.done=!0}else this.readyToRun=!1}cancel(){this._start=!1,this._sync=i(this._sync)}init(t,e){this.cancel();const i=this._textureWidth;if(this._width=i,this._height=Math.ceil(t/i),this._counter=0,this._texture?.dispose(),0===this._height)return;const r=new B(this._width,this._height);r.pixelFormat=6407,r.dataType=y.FLOAT,r.samplingMode=9728,this._texture=new C(this.renderingContext,r),this.done=!1,u(this._origin,Math.fround(e[0]),Math.fround(e[1]),Math.fround(e[2]))}addPosition(t){const e=this._width;if(this._counter>=e*this._height)return-1;const i=this._counter%e;return a(L,t,this._origin),this._uploadBuffer[3*i+0]=L[0],this._uploadBuffer[3*i+1]=L[1],this._uploadBuffer[3*i+2]=L[2],i===e-1&&this._flush(),this._counter++}start(){if(0===this._width||0===this._height)return void(this.done=!0);const t=this._width;this._counter%t>0&&this._flush(),this.produces=this.category,this._start=!0,this.requestRender(1)}getOcclusion(t){return this._cpuBuffer?.[6403===this._format?t:4*t]??-1}get usedMemory(){return(this._texture?.usedMemory??0)+(this._pixelBuffer?.usedMemory??0)+4*(this._uploadBuffer?.length??0)+4*(this._cpuBuffer?.length??0)}_flush(){const t=this._width,e=Math.floor(this._counter/t);this._texture?.updateData(0,0,e,t,1,this._uploadBuffer)}_ensureProgram(t){return this._program??=t.programCache.acquire(R,E,m),this._program}_ensureDebugProgram(t){return this._debugProgram??=t.programCache.acquire(V,A,z),this._debugProgram}_ensureDebugVao(t,i){if(!this._debugVao||this._debugVaoLength<i){const r=new Float32Array(i);for(let t=0;t<i;t++)r[t]=t;this._debugVao=e(this._debugVao),this._debugVao=new g(t,new D(t,I,r))}return this._debugVao}};t([r()],M.prototype,"category",void 0),t([r()],M.prototype,"formatOverride",void 0),t([r()],M.prototype,"readyToRun",void 0),t([r()],M.prototype,"done",void 0),M=t([o("esri.views.3d.webgl-engine.lib.GPUPointOcclusionQuery")],M);const V="#version 300 es\nprecision highp float;\nprecision highp int;\n\nin highp float componentIndex;\n\nuniform highp mat4 proj;\nuniform highp mat4 view;\n\nuniform highp sampler2D positionTex;\n\nvoid main() {\n int width = textureSize(positionTex, 0).x;\n int u = int(componentIndex) % width;\n int v = int(componentIndex) / width;\n\n vec4 posWorld = vec4(texelFetch(positionTex, ivec2(u, v), 0).rgb, 1.0);\n vec4 posView = view * posWorld;\n vec4 projected = proj * posView;\n\n gl_Position = projected;\n gl_PointSize = 1.0;\n}",A="#version 300 es\nout highp vec4 fragColor;\nuniform lowp vec4 color;\nvoid main() {\n fragColor = color;\n}\n",R="#version 300 es\nprecision highp float;\nin vec2 position;\n\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n}",E="#version 300 es\nprecision highp float;\nout highp vec4 fragColor;\n\nuniform highp mat4 proj;\nuniform highp mat4 view;\n\nuniform highp int count;\n\nuniform highp sampler2D depthTex;\nuniform highp sampler2D positionTex;\n\nfloat linearizeDepth(float depth) {\n float depthNdc = depth * 2.0 - 1.0;\n float c1 = proj[3][2];\n float c2 = proj[2][2];\n return -c1 / (depthNdc + c2 + 1e-7);\n}\n\nvoid main() {\n int u = int(floor(gl_FragCoord.x));\n int v = int(floor(gl_FragCoord.y));\n if (u + v * textureSize(positionTex, 0).x >= count) {\n fragColor = vec4(-1);\n return;\n }\n vec4 posWorld = vec4(texelFetch(positionTex, ivec2(u, v), 0).rgb, 1.0);\n vec4 posView = view * posWorld;\n vec4 projected = proj * posView;\n\n vec3 clipPos = projected.xyz / projected.w;\n\n if (clipPos.x < -1.0 || clipPos.x > 1.0 || clipPos.y < -1.0 || clipPos.y > 1.0) {\n fragColor = vec4(-1);\n return;\n }\n\n vec3 uvDepth = 0.5 * clipPos + vec3(0.5);\n\n float depth = texture(depthTex, uvDepth.xy).r;\n\n if (uvDepth.z <= depth) {\n fragColor = vec4(0);\n return;\n }\n\n fragColor = vec4(linearizeDepth(depth) - linearizeDepth(uvDepth.z));\n}\n";function F(t,e,i){s(S,e.viewMatrix,n(S,i)),t.setUniformMatrix4fv("view",S),t.setUniformMatrix4fv("proj",e.projectionMatrix)}const L=p(),S=h(),I=d(_().f32("componentIndex")),z=O(I);export{M as GPUPointOcclusionQuery};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import s from"../../../core/Accessor.js";import
|
|
5
|
+
import{__decorate as t}from"tslib";import s from"../../../core/Accessor.js";import e from"../../../core/Collection.js";import{property as i,subclass as o}from"../../../core/accessorSupport/decorators.js";import{LineSnapper as n}from"./LineSnapper.js";import{ParallelLineSnapper as p}from"./ParallelLineSnapper.js";import{RightAngleSnapper as r}from"./RightAngleSnapper.js";import{RightAngleTriangleSnapper as a}from"./RightAngleTriangleSnapper.js";import{sortCandidatesInPlace as c}from"./snappingUtils.js";let h=class extends s{constructor(t){super(t),this.updating=!1,this._snappers=new e,this._domain=2}initialize(){this._snappers.push(new p(this.view,this.options),new n(this.view,this.options,this.geodesicLengthMeasurementUtils),new r(this.view,this.options,this.geodesicLengthMeasurementUtils),new a(this.view,this.options))}set options(t){this._set("options",t);for(const s of this._snappers)s.options=t}async fetchCandidates(t,s,e){if(!(s&this._domain)||!this.options.effectiveSelfEnabled||e.suppressSelfSnapping)return[];const i=[];for(const o of this._snappers.items)for(const s of o.snap(t,e))i.push(s);return c(t,i),i}};t([i({readOnly:!0})],h.prototype,"updating",void 0),t([i({constructOnly:!0})],h.prototype,"view",void 0),t([i({constructOnly:!0})],h.prototype,"geodesicLengthMeasurementUtils",void 0),t([i()],h.prototype,"options",null),h=t([o("esri.views.interactive.snapping.SelfSnappingEngine")],h);export{h as SelfSnappingEngine};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
class e{constructor(e){this.vertexHandle=null,this.excludeFeature=null,this.visualizer=null,this.selfSnappingZ=null,this.drawConstraints=null,this.editGeometryOperations=e.editGeometryOperations,this.elevationInfo=e.elevationInfo,this.pointer=e.pointer,this.vertexHandle=e.vertexHandle,this.excludeFeature=e.excludeFeature,this.feature=e.feature,this.visualizer=e.visualizer,this.selfSnappingZ=e.selfSnappingZ,this.drawConstraints=e.drawConstraints}get coordinateHelper(){return this.editGeometryOperations.data.coordinateHelper}get spatialReference(){return this.coordinateHelper.spatialReference}}export{e as SnappingContext};
|
|
5
|
+
class e{constructor(e){this.vertexHandle=null,this.excludeFeature=null,this.visualizer=null,this.suppressSelfSnapping=!1,this.selfSnappingZ=null,this.drawConstraints=null,this.editGeometryOperations=e.editGeometryOperations,this.elevationInfo=e.elevationInfo,this.pointer=e.pointer,this.vertexHandle=e.vertexHandle,this.excludeFeature=e.excludeFeature,this.feature=e.feature,this.visualizer=e.visualizer,this.selfSnappingZ=e.selfSnappingZ,this.drawConstraints=e.drawConstraints,this.suppressSelfSnapping=e.suppressSelfSnapping}get coordinateHelper(){return this.editGeometryOperations.data.coordinateHelper}get spatialReference(){return this.coordinateHelper.spatialReference}}export{e as SnappingContext};
|
|
@@ -207,6 +207,8 @@ export default class BatchAttributeFormViewModel extends EventedAccessor {
|
|
|
207
207
|
accessor submitHasBeenAttempted: boolean;
|
|
208
208
|
/** The time zone used to interpret date values in the form. If this property is `null` or set to `"unknown"`, date values are displayed in the time zone specified by the layer's [FeatureLayer#preferredTimeZone](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#preferredTimeZone). If none is provided there, date values are interpreted in UTC. */
|
|
209
209
|
accessor timeZone: TimeZone | null | undefined;
|
|
210
|
+
/** Indicates whether the form is updating or calculating expressions. */
|
|
211
|
+
get updating(): boolean;
|
|
210
212
|
/**
|
|
211
213
|
* Indicates whether any values, for any features, have been modified by the
|
|
212
214
|
* user. This property does not take into account changes to attribute values
|
|
@@ -240,6 +242,13 @@ export default class BatchAttributeFormViewModel extends EventedAccessor {
|
|
|
240
242
|
* @returns Returns the associated field value, or `undefined` if there is no matching attribute.
|
|
241
243
|
*/
|
|
242
244
|
getFieldInputValue(elementId: string): FieldValue | undefined;
|
|
245
|
+
/**
|
|
246
|
+
* Gets the updated attribute values for the given feature.
|
|
247
|
+
*
|
|
248
|
+
* @param feature
|
|
249
|
+
* @returns The current attribute values for the given feature.
|
|
250
|
+
*/
|
|
251
|
+
getValues(feature: Graphic): Graphic["attributes"];
|
|
243
252
|
/**
|
|
244
253
|
* This method triggers the `"submit"` event, and causes [submitHasBeenAttempted](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-BatchAttributeForm-BatchAttributeFormViewModel.html#submitHasBeenAttempted) to become `true`. It does _not_ do anything to persist the updated values. It is up to the client these values as appropriate — for example, by calling [FeatureLayer#applyEdits()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#applyEdits) method to update the features' attributes.
|
|
245
254
|
*
|
|
@@ -252,4 +261,13 @@ export default class BatchAttributeFormViewModel extends EventedAccessor {
|
|
|
252
261
|
* on(dom.byId("btnUpdate"), "click", form.submit());
|
|
253
262
|
*/
|
|
254
263
|
submit(): void;
|
|
264
|
+
/**
|
|
265
|
+
* Determines if user input has caused the given feature to become invalid. Only returns `true` if _all_ of the following three conditions are true of the given feature:
|
|
266
|
+
* 1. It had no validation errors at the start of the editing session.
|
|
267
|
+
* 2. It currently has validation errors.
|
|
268
|
+
* 3. At least one of the validation errors was caused by user input, as opposed to a [value expression](https://developers.arcgis.com/javascript/latest/api-reference/esri-form-elements-FieldElement.html#valueExpression).
|
|
269
|
+
*
|
|
270
|
+
* @param feature
|
|
271
|
+
*/
|
|
272
|
+
userChangesHaveMadeFeatureInvalid(feature: Graphic): boolean;
|
|
255
273
|
}
|
|
@@ -184,6 +184,8 @@ export default class BatchAttributeForm extends Widget<BatchAttributeFormPropert
|
|
|
184
184
|
/** Defines which elements are visible in the widget. */
|
|
185
185
|
get visibleElements(): VisibleElements;
|
|
186
186
|
set visibleElements(value: VisibleElementsProperties);
|
|
187
|
+
/** Focus the form on the first input element with an error. */
|
|
188
|
+
goToFirstError(): void;
|
|
187
189
|
/**
|
|
188
190
|
* This method is typically called when the user clicks a submit button or when the form is programmatically submitted and calls the [FeatureLayer#applyEdits()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#applyEdits) method
|
|
189
191
|
* to update the features' attributes.
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{getOrCreateMapValue as i}from"../core/MapUtils.js";import{watch as n,on as o}from"../core/reactiveUtils.js";import{property as a,subclass as s}from"../core/accessorSupport/decorators.js";import{isIntegerField as r}from"../layers/support/fieldUtils.js";import{isString as l}from"../support/guards.js";import d from"./Widget.js";import{getHiddenFieldsValidationErrorMessage as p,getVisibleFieldInputValidationErrorMessage as u,isElementTemplateWithInputType as m}from"./BatchAttributeForm/batchAttributeFormUtils.js";import c from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as h}from"./BatchAttributeForm/css.js";import v from"./BatchAttributeForm/VisibleElements.js";import{isGroupInput as f,isFieldInput as b,isTextElementInput as C,differentValuesString as g}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{loadCalciteComponents as _}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as y,getIntlOptionsForField as F,prepareISOFieldValueForDateComponents as w,prepareUnixFieldValueForDateComponents as I,normalizeTimeOnlyString as x,getISOFieldValueFromDateComponents as M,getUnixFieldValueFromDateComponents as k}from"./support/dateUtils.js";import{globalCss as O}from"./support/globalCss.js";import{messageBundle as T,vmEvent as V,tsx as D}from"./support/widget.js";import{setFocus as U}from"./support/widgetUtils.js";import{isEmptyValue as E}from"./support/forms/formUtils.js";const S="data-element-id";let R=class extends d{constructor(e,t){super(e,t),this.headingLevel=2,this.messagesCommon=null,this.messages=null,this.featureFormMessages=null,this.viewModel=new c,this.visibleElements=new v,this.groupDisplay="all",this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._touchedInputs=new Set,this._focusedFieldInput=null,this._batchSwitchInputInitialValues=new Map,this._saveInput=this._saveInput.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this)}initialize(){this.addHandles([n(()=>this.features,()=>{this._dateComponentMap.clear()}),n(()=>this.viewModel.activeForm,()=>{this._batchSwitchInputInitialValues.clear()}),o(()=>this.viewModel,"submit",()=>{this.valid||this.goToClosestError()})])}loadDependencies(){return _({input:()=>import("@esri/calcite-components/dist/components/calcite-input"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group")})}get activeFeatureIndex(){return this.viewModel.activeFeatureIndex}set activeFeatureIndex(e){this.viewModel.activeFeatureIndex=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get _effectiveDisabled(){return this.disabled||this.viewModel.updating}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get maximumFeatureCount(){return this.viewModel.maximumFeatureCount}set maximumFeatureCount(e){this.viewModel.maximumFeatureCount=e}get maximumFeatureCountWithComplexForms(){return this.viewModel.maximumFeatureCountWithComplexForms}set maximumFeatureCountWithComplexForms(e){this.viewModel.maximumFeatureCountWithComplexForms=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get icon(){return"edit-attributes"}set icon(e){this._overrideIfSome("icon",e)}get readOnly(){return this.viewModel.readOnly}set readOnly(e){this.viewModel.readOnly=e}get valid(){return this.viewModel.valid}goToClosestError(){const e=this.viewModel.getFirstVisibleInvalidFieldInput();if(!e)return;const{groupInput:t}=e;t&&(t.open||(t.open=!0)),this._focusedFieldInput=e.input,this._attemptFocusOnNextRender=!0,this.scheduleRender()}render(){const{status:e}=this.viewModel;return"failed"===e?this.viewModel.hasTooManyComplexFeatures?this._renderErrorNotice(t(this.messages.formFailedToLoadTooManyComplexFeatures,{num:this.viewModel.maximumFeatureCountWithComplexForms})):this.viewModel.hasTooManyFeatures?this._renderErrorNotice(t(this.messages.formFailedToLoadTooManyFeatures,{num:this.viewModel.maximumFeatureCount})):this._renderErrorNotice(this.messages.formFailedToLoad):this.viewModel.expressionEvaluationFailed?this._renderErrorNotice(this.messages.expressionEvaluationFailed):this.viewModel.hasLayersWithContingentValues?this._renderErrorNotice(this.messages.unsupportedContingentValues):D("div",{class:this.classes(h.base,O.widget,O.panel)},"loaded"===e?this._renderForm():"loading"===e&&this.visibleElements.loadingIndicator?D("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):null)}submit(){this.viewModel.submit()}_setDateTimeTimeZoneMap(e){const{datePart:t,elementId:n}=e.dataset,o=i(this._dateComponentMap,`${n}`,()=>({}));switch(t){case"date":o.date=e;break;case"time":o.time=e;break;case"timeZone":o.timeZone=e}}_renderErrorNotice(e){return D("div",{class:this.classes(h.base,O.widget,O.panel)},D("calcite-notice",{class:h.noticeError,icon:!0,kind:"warning",open:!0},D("div",{slot:"message"},e)))}_renderForm(){return D("form",{class:h.form,onsubmit:this._onFormSubmit},this._renderInvisibleFieldsError(),this._renderContent())}_renderInvisibleFieldsError(){const{viewModel:e}=this,{hasNonActiveInvalidFeatures:t,activeForm:i}=e;let n;if(!e.submitHasBeenAttempted)return null;if(i.invalidHiddenInputs.length>0)if(n=p(i,e.mode,this.messages),"batch"===this.viewModel.mode){const e=i.invalidHiddenInputs.filter(e=>"hidden:group-visibility-expression:all-features"===e.effectiveVisibilityCode||"hidden:visibility-expression:all-features"===e.visibilityCode);e.length>0?n+=` (${e.map(e=>e.label).join(", ")})`:n=null}else n+=` (${i.invalidHiddenInputs.map(e=>e.label).join(", ")})`;else if(t)return null;return n?D("calcite-notice",{class:h.noticeError,icon:!0,kind:"danger",open:!0},D("div",{slot:"message"},n)):null}_renderContent(){if(!this.viewModel.hasVisibleInputs)return[D("calcite-notice",{class:h.noticeError,icon:!0,kind:"warning",open:!0},D("div",{slot:"message"},this.messages.noVisibleFields[this.viewModel.noVisibleElementsReason]))];const{inputs:e}=this.viewModel.activeForm;return e.filter(e=>e.visible).map(e=>this._renderInput(e))}_renderInput(e){return f(e)?this._renderGroupInput(e):b(e)?this._renderLabeledField(e):C(e)?this._renderTextComponent(e):void 0}_renderGroupInput(e){const{inputs:t,template:i,open:n}=e,o=t.filter(e=>e.visible),a=i.label??"";return D("calcite-block",{class:this.classes(h.group,"sequential"===this.groupDisplay?h.groupSequential:null,this.disabled?h.inputDisabled:null),collapsible:!0,description:i.description??void 0,disabled:this._effectiveDisabled,expanded:n,heading:a,headingLevel:this.headingLevel,key:`{${i.elementId}-key}`,label:a,onCalciteBlockClose:()=>{e.open=!1},onCalciteBlockOpen:()=>{e.open=!0}},o.map(e=>this._renderInput(e)))}_renderLabeledField(e){const{elementId:i}=e.template,{label:n,required:o,dataType:a}=e,s=o?t(this.messages.requiredFieldLabel,{name:n}):n;return D("calcite-label",{"aria-label":s,class:h.label,key:`field--${i}`},D("div",{class:h.labelTextContent,key:"labelTextContainer"},n,o?D("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==a?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){const t=this.getCommonInputProps(e),{dataType:i}=e;return"date"===i?this._renderDateComponents(e,t):"coded-value"===e.domain?.type?this._renderCodedInputs({input:e,props:t}):"number"===i?this._renderNumberComponent(e,t):this._renderStringComponent(e,t)}_renderAuxiliaryText(e){const{compositeError:t,description:i,submittable:n}=e,o=!n&&t&&(this.viewModel.submitHasBeenAttempted||this._touchedInputs.has(e.template.elementId))?u(e,t,this.messages):null;return o?D("calcite-input-message",{icon:!0,status:"invalid"},o):i?D("calcite-input-message",{class:h.description,icon:!1,status:"idle"},i):null}_renderCodedInputs({input:e,props:t}){const i=e.template.input?.type??null,n=e.codedValueOptions;switch(i){case"switch":return this._renderSwitchField({input:e,props:t});case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:n.flat(),props:t});default:return this._renderComboBoxComponent({options:n,props:t,input:e})}}_renderSwitchField({input:e,props:t}){if((this._batchSwitchInputInitialValues.get(e)===g||e.value===g)&&"batch"===this.viewModel.mode){const i={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,[S]:t[S]},trigger:{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral",slot:"trigger",label:t.label},group:{mode:"single"}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:i,options:[{name:this.messages.differentValuesPlaceholder,value:g,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return D("calcite-switch",{...t,checked:!!m(e.template,"switch")&&e.value===e.template.input.onValue,class:h.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldInput=null},onCalciteSwitchChange:({currentTarget:e})=>this._saveInput(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:i}){const{trigger:n,dropdown:o,group:a}=i;return D("calcite-dropdown",{...o,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,onCalciteDropdownSelect:({currentTarget:e})=>this._saveInput(e)},D("calcite-button",{...n},e===g?this.messages.differentValuesPlaceholder:e),D("calcite-dropdown-group",{selectionMode:a.mode},t.map(t=>D("calcite-dropdown-item",{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name))))}_renderComboBoxComponent({input:e,options:t,props:i}){const n="INSERT"===this.viewModel.editType,o=this._touchedInputs.has(e?.template?.elementId),a=n&&e.showNoValueOptionEnabled&&!o?()=>{}:i.onblur,s={...i,onblur:a};return D("calcite-combobox",{...s,selectionMode:"single",value:i.placeholder===this.messages.differentValuesPlaceholder?g:String(i.value),onCalciteComboboxChange:({currentTarget:e})=>{e.value!==g&&this._saveInput(e)}},this.renderComboboxOptionsList({input:e,options:t,props:i}))}renderComboboxOptionsList({input:e,options:t,props:i}){const[n,o]=t.map(e=>e.map(({name:e,value:t})=>D("calcite-combobox-item",{heading:e,key:`#${t}`,selected:i.value===t,value:`${t}`}))),a=[...n];o.length>0&&a.push(D("calcite-combobox-item-group",{key:"unsupported",label:this.featureFormMessages.subtypes.unsupportedDomainGroupTitle},o));const s=i.placeholder===this.messages.differentValuesPlaceholder,r=!s&&E(i.value);return e.showNoValueOptionEnabled&&a.unshift(D("calcite-combobox-item",{heading:e.showNoValueLabel||this.messages.empty,key:"empty-option",selected:r,value:""})),s&&a.unshift(D("calcite-combobox-item",{heading:this.messages.differentValuesPlaceholder,key:g,selected:!0,value:g})),a}_renderRadioButtonGroupComponent({input:e,options:t,props:i}){const n=t.map(({name:t,value:n})=>this._renderRadioButtons({label:t,value:n,selected:n===e.value,props:i}));if(e.showNoValueOptionEnabled){const t="",o=e.showNoValueLabel||this.messages.empty,a=E(e.value);n.unshift(this._renderRadioButtons({label:o,value:t,selected:a,props:i}))}return D("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:h.inputRadioGroup,disabled:i.readOnly,key:`${i.key}-radio-group`,layout:"vertical",name:i.name,required:i.required},n,i.placeholder===this.messages.differentValuesPlaceholder?D("calcite-label",{class:h.placeholderRadio,key:i.label,layout:"inline"},D("calcite-radio-button",{checked:!0,class:h.inputRadio,disabled:!0,name:i.placeholder,value:i.placeholder}),i.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:i,props:n}){return D("calcite-label",{class:h.inputRadioLabel,key:n.label,layout:"inline"},D("calcite-radio-button",{...n,afterCreate:void 0,afterUpdate:void 0,checked:t,class:h.inputRadio,disabled:n.readOnly,name:n.label,onblur:()=>{this._focusedFieldInput=null},value:e,onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInput(e)}}),i)}_renderStringComponent(e,t){const{template:i}=e;return!i.field.editable||this.readOnly?this._renderReadOnlyComponent(e):"text-area"===i.input?.type?D("calcite-text-area",{...t,class:this.classes(h.individualElement),resize:"vertical",value:t.value?String(t.value):"",onCalciteTextAreaInput:({currentTarget:e})=>this._saveInput(e)}):D("calcite-input",{...t,class:this.classes(h.individualElement),type:"text",value:t.value?String(t.value):"",onCalciteInputInput:({currentTarget:e})=>this._saveInput(e)})}_renderNumberComponent(e,t){const i=r(e.field);return D("calcite-input-number",{...t,integer:i,type:"number",value:i&&""!==t.value?Math.round(parseFloat(String(t.value))).toString():String(t.value),onCalciteInputNumberInput:({currentTarget:e})=>this._saveInput(e)})}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return D("calcite-input",{...i,class:this.classes(h.fieldInput,h.inputDisabled,h.individualElement),readOnly:!0,type:"text",value:String(t??i.value??"")})}_renderDateComponents(e,t){const{field:i}=e;let n;switch(i.type){case"date":n=this._renderDateFieldComponents(e,t);break;case"date-only":n=this._renderDateOnlyFieldComponent(e,t);break;case"time-only":n=this._renderTimeOnlyFieldComponent(e,t);break;case"timestamp-offset":n=this._renderTimestampOffsetFieldComponents(e,t);break;default:n=this._renderReadOnlyComponent(e,y(i,t.value,{timeZone:e.effectiveTimeZone,...F(e.template.field)}))}return e.value===g?[n,D("calcite-input-message",{icon:"information",key:"diff-values-message",status:"idle"},this.messages.differentValues)]:n}_renderDateOnlyFieldComponent(e,t){const{class:i,key:n,readOnly:o}=t,{rawMax:a,rawMin:s}=e.range;return D("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:i,"data-date-part":"date","data-element-id":t[S],key:`${n}-date-input`,max:l(a)?a:void 0,min:l(s)?s:void 0,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:o,value:e.value===g?"":e.value?String(e.value):"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimeOnlyFieldComponent(e,t){const{class:i,key:n,readOnly:o}=t;return D("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:i,"data-date-part":"time","data-element-id":t[S],key:`${n}-time-input`,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:o,value:e.value===g?"":e.value?String(e.value):"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimestampOffsetFieldComponents(e,t){const{class:i,key:n,readOnly:o}=t,{rawMax:a,rawMin:s}=e.range,r=w(a),l=w(s),d=w(e.value===g?"":e.value),p=e.includeTimeOffset,u={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:o,[S]:t[S],onfocus:this._onComponentFocus};return D("div",{class:h.dateInputContainer,key:`${n}-date-time-container`},D("calcite-input-date-picker",{...u,class:i,"data-date-part":"date",key:`${n}-date-input`,max:r?.date??void 0,min:l?.date??void 0,onblur:()=>{this._focusedFieldInput=null},value:d.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),D("calcite-input-time-picker",{...u,class:i,"data-date-part":"time",key:`${n}-time-input`,onblur:()=>{this._focusedFieldInput=null},value:d.time??"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),p?D("calcite-input-time-zone",{...u,class:i,clearable:e.value===g||null==e.value,"data-date-part":"timeZone",key:`${n}-timezone-input`,onblur:()=>{this._focusedFieldInput=null},value:d.timeZoneOffset||"",onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:i,key:n,readOnly:o,min:a,max:s}=t,r=e.effectiveTimeZone,l=I(e.value===g?"":e.value,r),d=I(s,r),p=I(a,r),u=e.includeTime,m={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:o,[S]:t[S],onfocus:this._onComponentFocus};return D("div",{class:h.dateInputContainer,key:`${n}-date-time-container`},D("calcite-input-date-picker",{...m,class:i,"data-date-part":"date",key:`${n}-date-input`,max:d?.date??void 0,min:p?.date??void 0,onblur:()=>{this._focusedFieldInput=null},value:l.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),u?D("calcite-input-time-picker",{...m,"data-date-part":"time",key:`${n}-time-input`,onblur:()=>{this._focusedFieldInput=null},step:1,value:l.time??"",onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}_renderTextComponent(e){const{elementId:t}=e.template;return D("div",{class:h.textElementInput,"data-testid":`text-element-${t}`,innerHTML:e.text,key:`text-element-${t}`})}getCommonInputProps(e){const{template:t,valid:i,value:n,minLength:o,maxLength:a,required:s,fieldName:r,editable:l,userHasChangedValue:d,range:{max:p,min:u}}=e,m=!l||this.readOnly,c=!m&&this._effectiveDisabled;let v=t.hint??void 0,f=!1;return n===g&&(v=this.messages.differentValuesPlaceholder,f=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":i?"false":"true",class:this.classes(h.fieldInput,m?h.inputDisabled:null),status:!d&&!this.viewModel.submitHasBeenAttempted||i?"idle":"invalid",maxLength:a&&a>-1?a:void 0,minLength:o&&o>-1?o:void 0,key:t.elementId,label:r,name:r,max:null!=p?p:void 0,min:null!=u?u:void 0,disabled:c,readOnly:m,onblur:this._onComponentBlur,required:s,placeholder:v,value:f?"":n??"",[S]:t.elementId,onfocus:this._onComponentFocus}}_onFormSubmit(e){e.preventDefault()}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(S))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),n=t||i;n&&this._afterComponentCreateOrUpdate(n)}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._touchedInputs.add(i.template.elementId),this._focusedFieldInput=i}_afterComponentCreateOrUpdate(e){const t=this._getFieldInputFromHTMLElement(e),i=this._focusedFieldInput;this._attemptFocusOnNextRender&&i===t&&(this._attemptFocusOnNextRender=!1,U(e))}_onComponentBlur(){this._focusedFieldInput=null}_parseValue(e,t){if(m(t.template,"switch")){if("calcite-dropdown"===e.localName&&t.domain)for(const i of t.domain.codedValues)if(i.name===e.selectedItems[0].textContent)return i.code;return e.checked?t.template.input.onValue:t.template.input.offValue}const i=e.value;return null==i||""===i?null:"number"===t.dataType?"-0"===i||"-0."===i||"-0,"===i?i:parseFloat(i):"date"===t.field.type?parseFloat(i):i}_saveInput(e){const t=this._getFieldInputFromHTMLElement(e),{elementId:n}=t.template;if(!t)return;const o=t?.value;if(m(t.template,"switch")&&"single"!==this.viewModel.mode){const e=i(this._batchSwitchInputInitialValues,t,()=>t.value);this._batchSwitchInputInitialValues.set(t,null===e?o:e)}const a=this._parseValue(e,t);a!==o&&this.viewModel.setValue(n,a)}_afterDateComponentCreate(e){this._setDateTimeTimeZoneMap(e),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:i}=e.template,n=e.field.type,o=this._dateComponentMap.get(`${i}`);if(!o)return;const a=e.effectiveTimeZone;let s=e.value===g?void 0:e.value,r=null;"date-only"===n?r=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===n?(s=x(s),r=x(t.value)):r="timestamp-offset"===n?null!=t.value?M({dateComponent:o.date,timeComponent:o.time,oldValue:s,timeZoneComponent:o.timeZone,defaultTimeZone:a}):null:null!=t.value?k({oldValue:s,dateComponent:o.date,timeZone:a,timeComponent:o.time?.value===g?void 0:o.time}):null,s!==r&&(null!==r&&t.value?this.viewModel.setValue(`${i}`,r):this.viewModel.setValue(`${i}`,null))}};e([a()],R.prototype,"activeFeatureIndex",null),e([a()],R.prototype,"disabled",null),e([a()],R.prototype,"_effectiveDisabled",null),e([a()],R.prototype,"features",null),e([a()],R.prototype,"map",null),e([a()],R.prototype,"maximumFeatureCount",null),e([a()],R.prototype,"maximumFeatureCountWithComplexForms",null),e([a()],R.prototype,"spatialReference",null),e([a()],R.prototype,"layerInfos",null),e([a()],R.prototype,"timeZone",null),e([a()],R.prototype,"headingLevel",void 0),e([a()],R.prototype,"icon",null),e([a(),T("esri/t9n/common")],R.prototype,"messagesCommon",void 0),e([a(),T("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],R.prototype,"messages",void 0),e([a(),T("esri/widgets/FeatureForm/t9n/FeatureForm")],R.prototype,"featureFormMessages",void 0),e([a()],R.prototype,"readOnly",null),e([a()],R.prototype,"valid",null),e([a({type:c}),V(["value-change","submit"])],R.prototype,"viewModel",void 0),e([a({type:v,nonNullable:!0})],R.prototype,"visibleElements",void 0),e([a()],R.prototype,"groupDisplay",void 0),R=e([s("esri.widgets.BatchAttributeForm")],R);const B=R;export{B as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{getOrCreateMapValue as i}from"../core/MapUtils.js";import{watch as n,on as o}from"../core/reactiveUtils.js";import{property as a,subclass as s}from"../core/accessorSupport/decorators.js";import{isIntegerField as r}from"../layers/support/fieldUtils.js";import{isString as l}from"../support/guards.js";import d from"./Widget.js";import{getHiddenFieldsValidationErrorMessage as p,getVisibleFieldInputValidationErrorMessage as u,isElementTemplateWithInputType as m}from"./BatchAttributeForm/batchAttributeFormUtils.js";import c from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as h}from"./BatchAttributeForm/css.js";import v from"./BatchAttributeForm/VisibleElements.js";import{isGroupInput as f,isFieldInput as b,isTextElementInput as C,differentValuesString as g}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{loadCalciteComponents as _}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as y,getIntlOptionsForField as F,prepareISOFieldValueForDateComponents as w,prepareUnixFieldValueForDateComponents as I,normalizeTimeOnlyString as x,getISOFieldValueFromDateComponents as M,getUnixFieldValueFromDateComponents as k}from"./support/dateUtils.js";import{globalCss as O}from"./support/globalCss.js";import{messageBundle as T,vmEvent as V,tsx as D}from"./support/widget.js";import{setFocus as U}from"./support/widgetUtils.js";import{isEmptyValue as E}from"./support/forms/formUtils.js";const S="data-element-id";let R=class extends d{constructor(e,t){super(e,t),this.headingLevel=2,this.messagesCommon=null,this.messages=null,this.featureFormMessages=null,this.viewModel=new c,this.visibleElements=new v,this.groupDisplay="all",this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._touchedInputs=new Set,this._focusedFieldInput=null,this._batchSwitchInputInitialValues=new Map,this._saveInput=this._saveInput.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this)}initialize(){this.addHandles([n(()=>this.features,()=>{this._dateComponentMap.clear()}),n(()=>this.viewModel.activeForm,()=>{this._batchSwitchInputInitialValues.clear()}),o(()=>this.viewModel,"submit",()=>{this.valid||this.goToFirstError()})])}loadDependencies(){return _({input:()=>import("@esri/calcite-components/dist/components/calcite-input"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group")})}get activeFeatureIndex(){return this.viewModel.activeFeatureIndex}set activeFeatureIndex(e){this.viewModel.activeFeatureIndex=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get _effectiveDisabled(){return this.disabled||this.viewModel.updating}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get maximumFeatureCount(){return this.viewModel.maximumFeatureCount}set maximumFeatureCount(e){this.viewModel.maximumFeatureCount=e}get maximumFeatureCountWithComplexForms(){return this.viewModel.maximumFeatureCountWithComplexForms}set maximumFeatureCountWithComplexForms(e){this.viewModel.maximumFeatureCountWithComplexForms=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get icon(){return"edit-attributes"}set icon(e){this._overrideIfSome("icon",e)}get readOnly(){return this.viewModel.readOnly}set readOnly(e){this.viewModel.readOnly=e}get valid(){return this.viewModel.valid}goToFirstError(){const e=this.viewModel.getFirstVisibleInvalidFieldInput();if(!e)return;const{groupInput:t}=e;t&&(t.open||(t.open=!0)),this._focusedFieldInput=e.input,this._attemptFocusOnNextRender=!0,this.scheduleRender()}render(){const{status:e}=this.viewModel;return"failed"===e?this.viewModel.hasTooManyComplexFeatures?this._renderErrorNotice(t(this.messages.formFailedToLoadTooManyComplexFeatures,{num:this.viewModel.maximumFeatureCountWithComplexForms})):this.viewModel.hasTooManyFeatures?this._renderErrorNotice(t(this.messages.formFailedToLoadTooManyFeatures,{num:this.viewModel.maximumFeatureCount})):this._renderErrorNotice(this.messages.formFailedToLoad):this.viewModel.expressionEvaluationFailed?this._renderErrorNotice(this.messages.expressionEvaluationFailed):this.viewModel.hasLayersWithContingentValues?this._renderErrorNotice(this.messages.unsupportedContingentValues):D("div",{class:this.classes(h.base,O.widget,O.panel)},"loaded"===e?this._renderForm():"loading"===e&&this.visibleElements.loadingIndicator?D("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):null)}submit(){this.viewModel.submit()}_setDateTimeTimeZoneMap(e){const{datePart:t,elementId:n}=e.dataset,o=i(this._dateComponentMap,`${n}`,()=>({}));switch(t){case"date":o.date=e;break;case"time":o.time=e;break;case"timeZone":o.timeZone=e}}_renderErrorNotice(e){return D("div",{class:this.classes(h.base,O.widget,O.panel)},D("calcite-notice",{class:h.noticeError,icon:!0,kind:"warning",open:!0},D("div",{slot:"message"},e)))}_renderForm(){return D("form",{class:h.form,onsubmit:this._onFormSubmit},this._renderInvisibleFieldsError(),this._renderContent())}_renderInvisibleFieldsError(){const{viewModel:e}=this,{hasNonActiveInvalidFeatures:t,activeForm:i}=e;let n;if(!e.submitHasBeenAttempted)return null;if(i.invalidHiddenInputs.length>0)if(n=p(i,e.mode,this.messages),"batch"===this.viewModel.mode){const e=i.invalidHiddenInputs.filter(e=>"hidden:group-visibility-expression:all-features"===e.effectiveVisibilityCode||"hidden:visibility-expression:all-features"===e.visibilityCode);e.length>0?n+=` (${e.map(e=>e.label).join(", ")})`:n=null}else n+=` (${i.invalidHiddenInputs.map(e=>e.label).join(", ")})`;else if(t)return null;return n?D("calcite-notice",{class:h.noticeError,icon:!0,kind:"danger",open:!0},D("div",{slot:"message"},n)):null}_renderContent(){if(!this.viewModel.hasVisibleInputs)return[D("calcite-notice",{class:h.noticeError,icon:!0,kind:"warning",open:!0},D("div",{slot:"message"},this.messages.noVisibleFields[this.viewModel.noVisibleElementsReason]))];const{inputs:e}=this.viewModel.activeForm;return e.filter(e=>e.visible).map(e=>this._renderInput(e))}_renderInput(e){return f(e)?this._renderGroupInput(e):b(e)?this._renderLabeledField(e):C(e)?this._renderTextComponent(e):void 0}_renderGroupInput(e){const{inputs:t,template:i,open:n}=e,o=t.filter(e=>e.visible),a=i.label??"";return D("calcite-block",{class:this.classes(h.group,"sequential"===this.groupDisplay?h.groupSequential:null,this.disabled?h.inputDisabled:null),collapsible:!0,description:i.description??void 0,disabled:this._effectiveDisabled,expanded:n,heading:a,headingLevel:this.headingLevel,key:`{${i.elementId}-key}`,label:a,onCalciteBlockClose:()=>{e.open=!1},onCalciteBlockOpen:()=>{e.open=!0}},o.map(e=>this._renderInput(e)))}_renderLabeledField(e){const{elementId:i}=e.template,{label:n,required:o,dataType:a}=e,s=o?t(this.messages.requiredFieldLabel,{name:n}):n;return D("calcite-label",{"aria-label":s,class:h.label,key:`field--${i}`},D("div",{class:h.labelTextContent,key:"labelTextContainer"},n,o?D("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==a?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){const t=this.getCommonInputProps(e),{dataType:i}=e;return"date"===i?this._renderDateComponents(e,t):"coded-value"===e.domain?.type?this._renderCodedInputs({input:e,props:t}):"number"===i?this._renderNumberComponent(e,t):this._renderStringComponent(e,t)}_renderAuxiliaryText(e){const{compositeError:t,description:i,submittable:n}=e,o=!n&&t&&(this.viewModel.submitHasBeenAttempted||this._touchedInputs.has(e.template.elementId))?u(e,t,this.messages):null;return o?D("calcite-input-message",{icon:!0,status:"invalid"},o):i?D("calcite-input-message",{class:h.description,icon:!1,status:"idle"},i):null}_renderCodedInputs({input:e,props:t}){const i=e.template.input?.type??null,n=e.codedValueOptions;switch(i){case"switch":return this._renderSwitchField({input:e,props:t});case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:n.flat(),props:t});default:return this._renderComboBoxComponent({options:n,props:t,input:e})}}_renderSwitchField({input:e,props:t}){if((this._batchSwitchInputInitialValues.get(e)===g||e.value===g)&&"batch"===this.viewModel.mode){const i={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,[S]:t[S]},trigger:{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral",slot:"trigger",label:t.label},group:{mode:"single"}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:i,options:[{name:this.messages.differentValuesPlaceholder,value:g,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return D("calcite-switch",{...t,checked:!!m(e.template,"switch")&&e.value===e.template.input.onValue,class:h.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldInput=null},onCalciteSwitchChange:({currentTarget:e})=>this._saveInput(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:i}){const{trigger:n,dropdown:o,group:a}=i;return D("calcite-dropdown",{...o,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,onCalciteDropdownSelect:({currentTarget:e})=>this._saveInput(e)},D("calcite-button",{...n},e===g?this.messages.differentValuesPlaceholder:e),D("calcite-dropdown-group",{selectionMode:a.mode},t.map(t=>D("calcite-dropdown-item",{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name))))}_renderComboBoxComponent({input:e,options:t,props:i}){const n="INSERT"===this.viewModel.editType,o=this._touchedInputs.has(e?.template?.elementId),a=n&&e.showNoValueOptionEnabled&&!o?()=>{}:i.onblur,s={...i,onblur:a};return D("calcite-combobox",{...s,selectionMode:"single",value:i.placeholder===this.messages.differentValuesPlaceholder?g:String(i.value),onCalciteComboboxChange:({currentTarget:e})=>{e.value!==g&&this._saveInput(e)}},this.renderComboboxOptionsList({input:e,options:t,props:i}))}renderComboboxOptionsList({input:e,options:t,props:i}){const[n,o]=t.map(e=>e.map(({name:e,value:t})=>D("calcite-combobox-item",{heading:e,key:`#${t}`,selected:i.value===t,value:`${t}`}))),a=[...n];o.length>0&&a.push(D("calcite-combobox-item-group",{key:"unsupported",label:this.featureFormMessages.subtypes.unsupportedDomainGroupTitle},o));const s=i.placeholder===this.messages.differentValuesPlaceholder,r=!s&&E(i.value);return e.showNoValueOptionEnabled&&a.unshift(D("calcite-combobox-item",{heading:e.showNoValueLabel||this.messages.empty,key:"empty-option",selected:r,value:""})),s&&a.unshift(D("calcite-combobox-item",{heading:this.messages.differentValuesPlaceholder,key:g,selected:!0,value:g})),a}_renderRadioButtonGroupComponent({input:e,options:t,props:i}){const n=t.map(({name:t,value:n})=>this._renderRadioButtons({label:t,value:n,selected:n===e.value,props:i}));if(e.showNoValueOptionEnabled){const t="",o=e.showNoValueLabel||this.messages.empty,a=E(e.value);n.unshift(this._renderRadioButtons({label:o,value:t,selected:a,props:i}))}return D("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:h.inputRadioGroup,disabled:i.readOnly,key:`${i.key}-radio-group`,layout:"vertical",name:i.name,required:i.required},n,i.placeholder===this.messages.differentValuesPlaceholder?D("calcite-label",{class:h.placeholderRadio,key:i.label,layout:"inline"},D("calcite-radio-button",{checked:!0,class:h.inputRadio,disabled:!0,name:i.placeholder,value:i.placeholder}),i.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:i,props:n}){return D("calcite-label",{class:h.inputRadioLabel,key:n.label,layout:"inline"},D("calcite-radio-button",{...n,afterCreate:void 0,afterUpdate:void 0,checked:t,class:h.inputRadio,disabled:n.readOnly,name:n.label,onblur:()=>{this._focusedFieldInput=null},value:e,onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInput(e)}}),i)}_renderStringComponent(e,t){const{template:i}=e;return!i.field.editable||this.readOnly?this._renderReadOnlyComponent(e):"text-area"===i.input?.type?D("calcite-text-area",{...t,class:this.classes(h.individualElement),resize:"vertical",value:t.value?String(t.value):"",onCalciteTextAreaInput:({currentTarget:e})=>this._saveInput(e)}):D("calcite-input",{...t,class:this.classes(h.individualElement),type:"text",value:t.value?String(t.value):"",onCalciteInputInput:({currentTarget:e})=>this._saveInput(e)})}_renderNumberComponent(e,t){const i=r(e.field);return D("calcite-input-number",{...t,integer:i,type:"number",value:i&&""!==t.value?Math.round(parseFloat(String(t.value))).toString():String(t.value),onCalciteInputNumberInput:({currentTarget:e})=>this._saveInput(e)})}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return D("calcite-input",{...i,class:this.classes(h.fieldInput,h.inputDisabled,h.individualElement),readOnly:!0,type:"text",value:String(t??i.value??"")})}_renderDateComponents(e,t){const{field:i}=e;let n;switch(i.type){case"date":n=this._renderDateFieldComponents(e,t);break;case"date-only":n=this._renderDateOnlyFieldComponent(e,t);break;case"time-only":n=this._renderTimeOnlyFieldComponent(e,t);break;case"timestamp-offset":n=this._renderTimestampOffsetFieldComponents(e,t);break;default:n=this._renderReadOnlyComponent(e,y(i,t.value,{timeZone:e.effectiveTimeZone,...F(e.template.field)}))}return e.value===g?[n,D("calcite-input-message",{icon:"information",key:"diff-values-message",status:"idle"},this.messages.differentValues)]:n}_renderDateOnlyFieldComponent(e,t){const{class:i,key:n,readOnly:o}=t,{rawMax:a,rawMin:s}=e.range;return D("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:i,"data-date-part":"date","data-element-id":t[S],key:`${n}-date-input`,max:l(a)?a:void 0,min:l(s)?s:void 0,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:o,value:e.value===g?"":e.value?String(e.value):"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimeOnlyFieldComponent(e,t){const{class:i,key:n,readOnly:o}=t;return D("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:i,"data-date-part":"time","data-element-id":t[S],key:`${n}-time-input`,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:o,value:e.value===g?"":e.value?String(e.value):"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimestampOffsetFieldComponents(e,t){const{class:i,key:n,readOnly:o}=t,{rawMax:a,rawMin:s}=e.range,r=w(a),l=w(s),d=w(e.value===g?"":e.value),p=e.includeTimeOffset,u={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:o,[S]:t[S],onfocus:this._onComponentFocus};return D("div",{class:h.dateInputContainer,key:`${n}-date-time-container`},D("calcite-input-date-picker",{...u,class:i,"data-date-part":"date",key:`${n}-date-input`,max:r?.date??void 0,min:l?.date??void 0,onblur:()=>{this._focusedFieldInput=null},value:d.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),D("calcite-input-time-picker",{...u,class:i,"data-date-part":"time",key:`${n}-time-input`,onblur:()=>{this._focusedFieldInput=null},value:d.time??"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),p?D("calcite-input-time-zone",{...u,class:i,clearable:e.value===g||null==e.value,"data-date-part":"timeZone",key:`${n}-timezone-input`,onblur:()=>{this._focusedFieldInput=null},value:d.timeZoneOffset||"",onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:i,key:n,readOnly:o,min:a,max:s}=t,r=e.effectiveTimeZone,l=I(e.value===g?"":e.value,r),d=I(s,r),p=I(a,r),u=e.includeTime,m={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:o,[S]:t[S],onfocus:this._onComponentFocus};return D("div",{class:h.dateInputContainer,key:`${n}-date-time-container`},D("calcite-input-date-picker",{...m,class:i,"data-date-part":"date",key:`${n}-date-input`,max:d?.date??void 0,min:p?.date??void 0,onblur:()=>{this._focusedFieldInput=null},value:l.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),u?D("calcite-input-time-picker",{...m,"data-date-part":"time",key:`${n}-time-input`,onblur:()=>{this._focusedFieldInput=null},step:1,value:l.time??"",onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}_renderTextComponent(e){const{elementId:t}=e.template;return D("div",{class:h.textElementInput,"data-testid":`text-element-${t}`,innerHTML:e.text,key:`text-element-${t}`})}getCommonInputProps(e){const{template:t,valid:i,value:n,minLength:o,maxLength:a,required:s,fieldName:r,editable:l,userHasChangedValue:d,range:{max:p,min:u}}=e,m=!l||this.readOnly,c=!m&&this._effectiveDisabled;let v=t.hint??void 0,f=!1;return n===g&&(v=this.messages.differentValuesPlaceholder,f=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":i?"false":"true",class:this.classes(h.fieldInput,m?h.inputDisabled:null),status:!d&&!this.viewModel.submitHasBeenAttempted||i?"idle":"invalid",maxLength:a&&a>-1?a:void 0,minLength:o&&o>-1?o:void 0,key:t.elementId,label:r,name:r,max:null!=p?p:void 0,min:null!=u?u:void 0,disabled:c,readOnly:m,onblur:this._onComponentBlur,required:s,placeholder:v,value:f?"":n??"",[S]:t.elementId,onfocus:this._onComponentFocus}}_onFormSubmit(e){e.preventDefault()}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(S))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),n=t||i;n&&this._afterComponentCreateOrUpdate(n)}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._touchedInputs.add(i.template.elementId),this._focusedFieldInput=i}_afterComponentCreateOrUpdate(e){const t=this._getFieldInputFromHTMLElement(e),i=this._focusedFieldInput;this._attemptFocusOnNextRender&&i===t&&(this._attemptFocusOnNextRender=!1,U(e))}_onComponentBlur(){this._focusedFieldInput=null}_parseValue(e,t){if(m(t.template,"switch")){if("calcite-dropdown"===e.localName&&t.domain)for(const i of t.domain.codedValues)if(i.name===e.selectedItems[0].textContent)return i.code;return e.checked?t.template.input.onValue:t.template.input.offValue}const i=e.value;return null==i||""===i?null:"number"===t.dataType?"-0"===i||"-0."===i||"-0,"===i?i:parseFloat(i):"date"===t.field.type?parseFloat(i):i}_saveInput(e){const t=this._getFieldInputFromHTMLElement(e),{elementId:n}=t.template;if(!t)return;const o=t?.value;if(m(t.template,"switch")&&"single"!==this.viewModel.mode){const e=i(this._batchSwitchInputInitialValues,t,()=>t.value);this._batchSwitchInputInitialValues.set(t,null===e?o:e)}const a=this._parseValue(e,t);a!==o&&this.viewModel.setValue(n,a)}_afterDateComponentCreate(e){this._setDateTimeTimeZoneMap(e),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:i}=e.template,n=e.field.type,o=this._dateComponentMap.get(`${i}`);if(!o)return;const a=e.effectiveTimeZone;let s=e.value===g?void 0:e.value,r=null;"date-only"===n?r=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===n?(s=x(s),r=x(t.value)):r="timestamp-offset"===n?null!=t.value?M({dateComponent:o.date,timeComponent:o.time,oldValue:s,timeZoneComponent:o.timeZone,defaultTimeZone:a}):null:null!=t.value?k({oldValue:s,dateComponent:o.date,timeZone:a,timeComponent:o.time?.value===g?void 0:o.time}):null,s!==r&&(null!==r&&t.value?this.viewModel.setValue(`${i}`,r):this.viewModel.setValue(`${i}`,null))}};e([a()],R.prototype,"activeFeatureIndex",null),e([a()],R.prototype,"disabled",null),e([a()],R.prototype,"_effectiveDisabled",null),e([a()],R.prototype,"features",null),e([a()],R.prototype,"map",null),e([a()],R.prototype,"maximumFeatureCount",null),e([a()],R.prototype,"maximumFeatureCountWithComplexForms",null),e([a()],R.prototype,"spatialReference",null),e([a()],R.prototype,"layerInfos",null),e([a()],R.prototype,"timeZone",null),e([a()],R.prototype,"headingLevel",void 0),e([a()],R.prototype,"icon",null),e([a(),T("esri/t9n/common")],R.prototype,"messagesCommon",void 0),e([a(),T("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],R.prototype,"messages",void 0),e([a(),T("esri/widgets/FeatureForm/t9n/FeatureForm")],R.prototype,"featureFormMessages",void 0),e([a()],R.prototype,"readOnly",null),e([a()],R.prototype,"valid",null),e([a({type:c}),V(["value-change","submit"])],R.prototype,"viewModel",void 0),e([a({type:v,nonNullable:!0})],R.prototype,"visibleElements",void 0),e([a()],R.prototype,"groupDisplay",void 0),R=e([s("esri.widgets.BatchAttributeForm")],R);const B=R;export{B as default};
|