@arcgis/core 4.30.6 → 4.30.8

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/kernel.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";import{buildDate as s,commitHash as e}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const r="4.30";let t,i=r;i="4.30.6";function n(o){t=o}function m(s){const e=t?.findCredential(s);return e?.token?o(s,"token",e.token):s}has("host-webworker");export{m as addTokenParameter,s as buildDate,i as fullVersion,t as id,e as revision,n as setId,r as version};
5
+ import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";import{buildDate as s,commitHash as e}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const r="4.30";let t,i=r;i="4.30.8";function n(o){t=o}function m(s){const e=t?.findCredential(s);return e?.token?o(s,"token",e.token):s}has("host-webworker");export{m as addTokenParameter,s as buildDate,i as fullVersion,t as id,e as revision,n as setId,r as version};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.30.6",
3
+ "version": "4.30.8",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- const c="20240708",e="c339c8e97fa0431974f215393ececa5992611ad1";export{c as buildDate,e as commitHash};
5
+ const e="20240709",c="4e2e659f53c3b60cdade3d91a30466cbe90b86f9";export{e as buildDate,c as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import t from"../DisplayEntity.js";import e from"../DisplayRecord.js";import{VertexDataWriter as r}from"./VertexDataWriter.js";import i from"../util/Writer.js";class n{constructor(e,r=0){this._id=e,this._sizeHint=r,this._entityRecordCountOffset=0,this._entityCountOffset=0,this._entityIdIndex=0,this._entitySortKeyIndex=0,this._instanceIdToVertexData=new Map,this._recordIndexStart=0,this._recordIndexCount=0,this._recordVertexStart=0,this._recordVertexCount=0,this._current={metric:null,writer:null,start:0,sortKey:0,instanceId:0,layoutHash:0,indexStart:0,vertexStart:0,textureKey:0,metricBoxLenPointer:0},this._entities=new i(Uint32Array,this._sizeHint*t.byteSizeHint),this._entityCountOffset=this._entities.push(0)}get id(){return this._id}serialize(){const t=new Array,e=[],r=this._entities.buffer();for(const i of this._instanceIdToVertexData.values())e.push(i.serialize(t));return{message:{data:e,entities:r},transferList:t}}vertexCount(){return this._current.writer?.vertexCount??0}indexCount(){return this._current.writer?.indexCount??0}vertexEnsureSize(t){this._current.writer.vertexEnsureSize(t)}indexEnsureSize(t){this._current.writer.indexEnsureSize(t)}vertexWrite(t){this._current.writer.writeVertex(t)}vertexWriteRegion(t){this._current.writer.writeVertexRegion(t)}vertexWriteF32(t){this._current.writer.writeVertexF32(t)}recordBounds(t,e,r,i){}indexWrite(t){this._current.writer.writeIndex(t)}metricStart(t){this._current.metric=t}metricEnd(){const t=this._current.writer;this._current.metric.bounds.length&&t.writeMetric(this._current.metric)}metricBoxWrite(t){this._current.metric.bounds.push(t)}entityStart(t,e=t){this._entityIdIndex=this._entities.push(t),this._entitySortKeyIndex=this._entities.writeF32(e),this._entityRecordCountOffset=this._entities.push(0)}entityRecordCount(){return this._entities.getValue(this._entityRecordCountOffset)}entityEnd(){0===this.entityRecordCount()?this._entities.seek(this._entityIdIndex):this._entities.incr(this._entityCountOffset)}recordCount(){return this._entities.getValue(this._entityRecordCountOffset)}recordStart(t,e,r=0){this._current.writer=this._getVertexWriter(t,e),this._current.indexStart=this._current.writer.indexCount,this._current.vertexStart=this._current.writer.vertexCount,this._current.instanceId=t,this._current.layoutHash=e.hash,this._current.textureKey=r}recordEnd(t=0){const r=this._current.vertexStart,i=this._current.writer.vertexCount-r;if(!i)return!1;const n=this._current.indexStart,s=this._current.writer.indexCount-n;return this._recordIndexStart=n,this._recordIndexCount=s,this._recordVertexStart=r,this._recordVertexCount=i,this._entities.incr(this._entityRecordCountOffset),e.write(this._entities,this._current.instanceId,this._current.textureKey,n,s,r,i,t),!0}copyLast(t,r){const i=this._recordVertexStart+this._recordVertexCount;this._entities.incr(this._entityRecordCountOffset),e.write(this._entities,this._current.instanceId,this._current.textureKey,this._recordIndexStart+this._recordIndexCount,this._recordIndexCount,i,this._recordVertexCount,0);const n=this._current.writer.indexWriter,s=this._current.writer.vertexWriter,o=this._recordIndexStart+this._recordIndexCount,c=this._recordVertexCount;for(let e=this._recordIndexStart;e!==o;e++){const t=n.getValue(e);n.push(t+c)}const u=this._current.writer.layout.stride/Uint32Array.BYTES_PER_ELEMENT,h=this._recordVertexStart*u,_=(this._recordVertexStart+this._recordVertexCount)*u;for(let e=h;e!==_;e++){const t=s.getValue(e);s.push(t)}const d=this._current.writer.layout.position,a=d.packPrecisionFactor??1,x=d.offset/Uint32Array.BYTES_PER_ELEMENT,y=t*a,f=r*a;for(let e=i*u;e<=s.length;e+=u)s.i1616Add(e+x,y,f)}copyLastFrom(t,e,r){const i=t._entities.getValue(t._entityIdIndex);if(i!==this._entities.getValue(this._entityIdIndex)){const e=t._entities.getValueF32(t._entitySortKeyIndex);this.entityStart(i,e)}this.recordStart(t._current.instanceId,t._current.writer.layout,t._current.textureKey);const n=this._current.writer.layout.stride/Uint32Array.BYTES_PER_ELEMENT,s=this._current.vertexStart,o=t._current.vertexStart-s,c=this._current.writer.indexWriter,u=this._current.writer.vertexWriter,h=t._current.writer.indexWriter,_=t._current.writer.vertexWriter;for(let l=t._current.indexStart;l!==h.length;l++){const t=h.getValue(l);c.push(t-o)}for(let l=t._current.vertexStart*n;l!==_.length;l++){const t=_.getValue(l);u.push(t)}const d=this._current.writer.layout.position,a=d.packPrecisionFactor??1,x=d.offset/Uint32Array.BYTES_PER_ELEMENT,y=e*a,f=r*a;for(let l=s*n;l<=u.length;l+=n)u.i1616Add(l+x,y,f);this.recordEnd()}_getVertexWriter(t,e){const i=this._instanceIdToVertexData;return i.has(t)||i.set(t,new r(t,e,this._sizeHint)),i.get(t)}}export{n as MeshData};
5
+ import t from"../DisplayEntity.js";import e from"../DisplayRecord.js";import{VertexDataWriter as r}from"./VertexDataWriter.js";import i from"../util/Writer.js";class n{constructor(e,r=0){this._id=e,this._sizeHint=r,this._entityRecordCountOffset=0,this._entityCountOffset=0,this._entityIdIndex=0,this._entitySortKeyIndex=0,this._didEntityStart=!1,this._instanceIdToVertexData=new Map,this._recordIndexStart=0,this._recordIndexCount=0,this._recordVertexStart=0,this._recordVertexCount=0,this._current={metric:null,writer:null,start:0,sortKey:0,instanceId:0,layoutHash:0,indexStart:0,vertexStart:0,textureKey:0,metricBoxLenPointer:0},this._entities=new i(Uint32Array,this._sizeHint*t.byteSizeHint),this._entityCountOffset=this._entities.push(0)}get id(){return this._id}serialize(){const t=new Array,e=[],r=this._entities.buffer();for(const i of this._instanceIdToVertexData.values())e.push(i.serialize(t));return{message:{data:e,entities:r},transferList:t}}vertexCount(){return this._current.writer?.vertexCount??0}indexCount(){return this._current.writer?.indexCount??0}vertexEnsureSize(t){this._current.writer.vertexEnsureSize(t)}indexEnsureSize(t){this._current.writer.indexEnsureSize(t)}vertexWrite(t){this._current.writer.writeVertex(t)}vertexWriteRegion(t){this._current.writer.writeVertexRegion(t)}vertexWriteF32(t){this._current.writer.writeVertexF32(t)}recordBounds(t,e,r,i){}indexWrite(t){this._current.writer.writeIndex(t)}metricStart(t){this._current.metric=t}metricEnd(){const t=this._current.writer;this._current.metric.bounds.length&&t.writeMetric(this._current.metric)}metricBoxWrite(t){this._current.metric.bounds.push(t)}entityStart(t,e=t){this._entityIdIndex=this._entities.push(t),this._entitySortKeyIndex=this._entities.writeF32(e),this._entityRecordCountOffset=this._entities.push(0),this._didEntityStart=!0}entityRecordCount(){return this._entities.getValue(this._entityRecordCountOffset)}entityEnd(){if(!this._didEntityStart)return;0===this.entityRecordCount()?this._entities.seek(this._entityIdIndex):this._entities.incr(this._entityCountOffset),this._didEntityStart=!1}recordCount(){return this._entities.getValue(this._entityRecordCountOffset)}recordStart(t,e,r=0){this._current.writer=this._getVertexWriter(t,e),this._current.indexStart=this._current.writer.indexCount,this._current.vertexStart=this._current.writer.vertexCount,this._current.instanceId=t,this._current.layoutHash=e.hash,this._current.textureKey=r}recordEnd(t=0){const r=this._current.vertexStart,i=this._current.writer.vertexCount-r;if(!i)return!1;const n=this._current.indexStart,s=this._current.writer.indexCount-n;return this._recordIndexStart=n,this._recordIndexCount=s,this._recordVertexStart=r,this._recordVertexCount=i,this._entities.incr(this._entityRecordCountOffset),e.write(this._entities,this._current.instanceId,this._current.textureKey,n,s,r,i,t),!0}copyLast(t,r){const i=this._recordVertexStart+this._recordVertexCount;this._entities.incr(this._entityRecordCountOffset),e.write(this._entities,this._current.instanceId,this._current.textureKey,this._recordIndexStart+this._recordIndexCount,this._recordIndexCount,i,this._recordVertexCount,0);const n=this._current.writer.indexWriter,s=this._current.writer.vertexWriter,o=this._recordIndexStart+this._recordIndexCount,c=this._recordVertexCount;for(let e=this._recordIndexStart;e!==o;e++){const t=n.getValue(e);n.push(t+c)}const u=this._current.writer.layout.stride/Uint32Array.BYTES_PER_ELEMENT,h=this._recordVertexStart*u,_=(this._recordVertexStart+this._recordVertexCount)*u;for(let e=h;e!==_;e++){const t=s.getValue(e);s.push(t)}const d=this._current.writer.layout.position,a=d.packPrecisionFactor??1,x=d.offset/Uint32Array.BYTES_PER_ELEMENT,y=t*a,S=r*a;for(let e=i*u;e<=s.length;e+=u)s.i1616Add(e+x,y,S)}copyLastFrom(t,e,r){const i=t._entities.getValue(t._entityIdIndex);if(i!==this._entities.getValue(this._entityIdIndex)){const e=t._entities.getValueF32(t._entitySortKeyIndex);this.entityStart(i,e)}this.recordStart(t._current.instanceId,t._current.writer.layout,t._current.textureKey);const n=this._current.writer.layout.stride/Uint32Array.BYTES_PER_ELEMENT,s=this._current.vertexStart,o=t._current.vertexStart-s,c=this._current.writer.indexWriter,u=this._current.writer.vertexWriter,h=t._current.writer.indexWriter,_=t._current.writer.vertexWriter;for(let f=t._current.indexStart;f!==h.length;f++){const t=h.getValue(f);c.push(t-o)}for(let f=t._current.vertexStart*n;f!==_.length;f++){const t=_.getValue(f);u.push(t)}const d=this._current.writer.layout.position,a=d.packPrecisionFactor??1,x=d.offset/Uint32Array.BYTES_PER_ELEMENT,y=e*a,S=r*a;for(let f=s*n;f<=u.length;f+=n)u.i1616Add(f+x,y,S);this.recordEnd()}_getVertexWriter(t,e){const i=this._instanceIdToVertexData;return i.has(t)||i.set(t,new r(t,e,this._sizeHint)),i.get(t)}}export{n as MeshData};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import r from"../../../core/Accessor.js";import{isSome as o}from"../../../core/arrayUtils.js";import{ClonableMixin as l}from"../../../core/Clonable.js";import a from"../../../core/Collection.js";import{IdentifiableMixin as s}from"../../../core/Identifiable.js";import{ignoreAbortErrors as i,debounce as n}from"../../../core/promiseUtils.js";import{watch as u,initial as d}from"../../../core/reactiveUtils.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import p from"../../../rest/support/RelationshipQuery.js";import{getFixedFieldName as c,findRelatedLayer as C}from"../support/featureUtils.js";import{getFieldsInTitleAndDesc as _}from"../../FeatureForm/featureFormUtils.js";const b=100;let g=class extends(l(s(r))){constructor(e){super(e),this._loaded=!1,this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.featuresPerPage=10,this.description=null,this.graphic=null,this.layer=null,this.map=null,this.orderByFields=null,this.featureCount=0,this.relationshipId=null,this.showAllEnabled=!1,this.title=null,this._cancelQuery=()=>{const{_queryAbortController:e}=this;e&&e.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{const{_queryFeatureCountAbortController:e}=this;e&&e.abort(),this._queryFeatureCountAbortController=null},this._cancelQueryPage=()=>{const{_queryPageAbortController:e}=this;e&&e.abort(),this._queryPageAbortController=null},this._queryController=async()=>{this._cancelQuery();const e=new AbortController;this._queryAbortController=e,await i(this._query()),this._queryAbortController===e&&(this._queryAbortController=null)},this._queryFeatureCountController=async()=>{this._loaded=!1,this._cancelQueryFeatureCount();const e=new AbortController;this._queryFeatureCountAbortController=e,await i(this._queryFeatureCount()),this._queryFeatureCountAbortController===e&&(this._queryFeatureCountAbortController=null),this._loaded=!0},this._queryPageController=async()=>{const e=new AbortController;this._queryPageAbortController=e,await i(this._queryPage()),this._queryPageAbortController===e&&(this._queryPageAbortController=null)},this._queryDebounced=n(this._queryController,b),this._queryFeatureCountDebounced=n(this._queryFeatureCountController,b),this._queryPageDebounced=n(this._queryPageController,b),this._query=async()=>{const{_queryAbortController:e,relatedFeatures:t}=this;this.featureCount&&(this._destroyRelatedFeatureViewModels(),this.featurePage=1,t.destroyAll(),this.destroyed||t.addMany(this._sliceFeatures(await this._queryRelatedFeatures({signal:e?.signal}))))},this.addHandles([u((()=>[this.displayCount,this.graphic,this.layer,this.layer?.loaded,this.map,this.orderByFields,this.relationshipId,this.featuresPerPage,this.showAllEnabled,this.canQuery,this.featureCount]),(()=>this._queryDebounced()),d),u((()=>[this.featurePage,this.showAllEnabled]),(()=>this._queryPageDebounced())),u((()=>[this.layer,this.relationshipId,this.objectId,this.canQuery]),(()=>this._queryFeatureCountDebounced()))])}destroy(){this._destroyRelatedFeatureViewModels(),this.relatedFeatures.destroyAll(),this._cancelQuery(),this._cancelQueryFeatureCount(),this._cancelQueryPage()}set featurePage(e){const{featuresPerPage:t,featureCount:r}=this,o=1,l=Math.ceil(r/t)||1;this._set("featurePage",Math.min(Math.max(e,o),l))}get featurePage(){return this._get("featurePage")}get orderByFieldsFixedCasing(){const{orderByFields:e,relatedLayer:t}=this;return e&&t?.loaded?e.map((e=>{const r=e.clone();return r.field=c(e.field,t),r})):e??[]}get supportsCacheHint(){return!!this.layer?.capabilities?.queryRelated?.supportsCacheHint}get canLoad(){return!!this.map&&null!=this.relationshipId&&"number"==typeof this.objectId}get canQuery(){const e=this.layer?.capabilities?.queryRelated;return!!(this.relatedLayer&&this.relationship&&null!=this.relationshipId&&null!=this.objectId&&e?.supportsCount&&e?.supportsPagination)}get itemDescriptionFieldName(){return this.orderByFieldsFixedCasing[0]?.field||null}set displayCount(e){const t=0,r=10;this._set("displayCount",Math.min(Math.max(e,t),r))}get displayCount(){return this._get("displayCount")}get objectId(){return(this.objectIdField&&this.graphic?.attributes?.[this.objectIdField])??null}get objectIdField(){return this.layer?.objectIdField||null}get relatedFeatures(){return this._get("relatedFeatures")||new a}get relatedLayer(){const{layer:e,map:t,relationship:r}=this;return e?.loaded&&t&&r?C(t,e,r)??null:null}get relationship(){const{relationshipId:e,layer:t}=this;return null!=e?t?.relationships?.find((({id:t})=>t===e))??null:null}get relatedFeatureViewModels(){return this._get("relatedFeatureViewModels")||new a}get state(){const{_queryAbortController:e,_queryFeatureCountAbortController:t,_queryPageAbortController:r,canQuery:o,_loaded:l,canLoad:a}=this;return t||a&&!l?"loading":e||r?"querying":o?"ready":"disabled"}getRelatedFeatureByObjectId(e){return this.relatedFeatures.find((t=>t.getObjectId()===e))}refresh(){this._queryFeatureCountDebounced()}_destroyRelatedFeatureViewModels(){this.relatedFeatureViewModels?.destroyAll()}async _queryFeatureCount(){const{layer:e,relatedLayer:t,relationshipId:r,objectId:o,_queryFeatureCountAbortController:l,canQuery:a,supportsCacheHint:s}=this;if(await(e?.load()),await(t?.load()),!a||!e||!t||null==o)return void this._set("featureCount",0);const i=t.createQuery(),n=new p({cacheHint:s,relationshipId:r,returnGeometry:!1,objectIds:[o],where:i.where??void 0}),u=await e.queryRelatedFeaturesCount(n,{signal:l?.signal});this._set("featureCount",u[o]||0)}_sliceFeatures(e){const{showAllEnabled:t,displayCount:r}=this;return t?e:r?e.slice(0,r):[]}async _queryPage(){const{relatedFeatures:e,featurePage:t,showAllEnabled:r,_queryPageAbortController:o,featureCount:l}=this;!r||t<2||!l||e.addMany(await this._queryRelatedFeatures({signal:o?.signal}))}async _queryRelatedFeatures(e){const{orderByFieldsFixedCasing:t,showAllEnabled:r,featuresPerPage:l,displayCount:a,layer:s,relationshipId:i,featurePage:n,featureCount:u,relatedLayer:d,supportsCacheHint:y}=this,{canQuery:h,objectId:c}=this;if(!h||!s||!d||null==c)return[];const C=r?((n-1)*l+u)%u:0,b=r?l:a,g=d.objectIdField,F=[...t.map((e=>e.field)),..._(d),g].filter(o),f=t.map((e=>`${e.field} ${e.order}`)),q=d.createQuery(),m=new p({orderByFields:f,start:C,num:b,outFields:F,cacheHint:y,relationshipId:i,returnGeometry:!1,objectIds:[c],where:q.where??void 0}),A=await s.queryRelatedFeatures(m,{signal:e?.signal}),P=A[c]?.features||[];return P.forEach((e=>{e.sourceLayer=d,e.layer=d})),P}};e([y()],g.prototype,"_loaded",void 0),e([y()],g.prototype,"_queryAbortController",void 0),e([y()],g.prototype,"_queryPageAbortController",void 0),e([y()],g.prototype,"_queryFeatureCountAbortController",void 0),e([y({value:1})],g.prototype,"featurePage",null),e([y()],g.prototype,"featuresPerPage",void 0),e([y({readOnly:!0})],g.prototype,"orderByFieldsFixedCasing",null),e([y({readOnly:!0})],g.prototype,"supportsCacheHint",null),e([y({readOnly:!0})],g.prototype,"canLoad",null),e([y({readOnly:!0})],g.prototype,"canQuery",null),e([y()],g.prototype,"description",void 0),e([y({readOnly:!0})],g.prototype,"itemDescriptionFieldName",null),e([y({value:3})],g.prototype,"displayCount",null),e([y({type:t})],g.prototype,"graphic",void 0),e([y()],g.prototype,"layer",void 0),e([y()],g.prototype,"map",void 0),e([y({readOnly:!0})],g.prototype,"objectId",null),e([y({readOnly:!0})],g.prototype,"objectIdField",null),e([y()],g.prototype,"orderByFields",void 0),e([y({readOnly:!0})],g.prototype,"relatedFeatures",null),e([y({readOnly:!0})],g.prototype,"relatedLayer",null),e([y({readOnly:!0})],g.prototype,"relationship",null),e([y()],g.prototype,"featureCount",void 0),e([y({readOnly:!0})],g.prototype,"relatedFeatureViewModels",null),e([y()],g.prototype,"relationshipId",void 0),e([y()],g.prototype,"showAllEnabled",void 0),e([y()],g.prototype,"state",null),e([y()],g.prototype,"title",void 0),g=e([h("esri.widgets.Feature.FeatureRelationship.FeatureRelationshipViewModel")],g);const F=g;export{F as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import r from"../../../core/Accessor.js";import{isSome as o}from"../../../core/arrayUtils.js";import{ClonableMixin as l}from"../../../core/Clonable.js";import s from"../../../core/Collection.js";import{IdentifiableMixin as a}from"../../../core/Identifiable.js";import{ignoreAbortErrors as i,debounce as n}from"../../../core/promiseUtils.js";import{watch as u,initial as d}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as y}from"../../../core/accessorSupport/decorators/subclass.js";import p from"../../../rest/support/RelationshipQuery.js";import{getFixedFieldName as c,findRelatedLayer as C}from"../support/featureUtils.js";import{getFieldsInTitleAndDesc as b}from"../../FeatureForm/featureFormUtils.js";const g=100;let _=class extends(l(a(r))){constructor(e){super(e),this._loaded=!1,this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.featuresPerPage=10,this.description=null,this.graphic=null,this.layer=null,this.map=null,this.orderByFields=null,this.featureCount=0,this.relationshipId=null,this.showAllEnabled=!1,this.title=null,this._cancelQuery=()=>{const{_queryAbortController:e}=this;e&&e.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{const{_queryFeatureCountAbortController:e}=this;e&&e.abort(),this._queryFeatureCountAbortController=null},this._cancelQueryPage=()=>{const{_queryPageAbortController:e}=this;e&&e.abort(),this._queryPageAbortController=null},this._queryController=async()=>{this._cancelQuery();const e=new AbortController;this._queryAbortController=e,await i(this._query()),this._queryAbortController===e&&(this._queryAbortController=null)},this._queryFeatureCountController=async()=>{this._loaded=!1,this._cancelQueryFeatureCount();const e=new AbortController;this._queryFeatureCountAbortController=e,await i(this._queryFeatureCount()),this._queryFeatureCountAbortController===e&&(this._queryFeatureCountAbortController=null),this._loaded=!0},this._queryPageController=async()=>{const e=new AbortController;this._queryPageAbortController=e,await i(this._queryPage()),this._queryPageAbortController===e&&(this._queryPageAbortController=null)},this._queryDebounced=n(this._queryController,g),this._queryFeatureCountDebounced=n(this._queryFeatureCountController,g),this._queryPageDebounced=n(this._queryPageController,g),this._query=async()=>{const{_queryAbortController:e,relatedFeatures:t}=this;this.featureCount&&(this._destroyRelatedFeatureViewModels(),this.featurePage=1,t.destroyAll(),this.destroyed||t.addMany(this._sliceFeatures(await this._queryRelatedFeatures({signal:e?.signal}))))},this.addHandles([u((()=>[this.displayCount,this.graphic,this.layer,this.layer?.loaded,this.map,this.orderByFields,this.relationshipId,this.featuresPerPage,this.showAllEnabled,this.canQuery,this.featureCount]),(()=>this._queryDebounced()),d),u((()=>[this.featurePage,this.showAllEnabled]),(()=>this._queryPageDebounced())),u((()=>[this.layer,this.relationshipId,this.objectId,this.canQuery]),(()=>this._queryFeatureCountDebounced()))])}destroy(){this._destroyRelatedFeatureViewModels(),this.relatedFeatures.destroyAll(),this._cancelQuery(),this._cancelQueryFeatureCount(),this._cancelQueryPage()}set featurePage(e){const{featuresPerPage:t,featureCount:r}=this,o=1,l=Math.ceil(r/t)||1;this._set("featurePage",Math.min(Math.max(e,o),l))}get featurePage(){return this._get("featurePage")}get orderByFieldsFixedCasing(){const{orderByFields:e,relatedLayer:t}=this;return e&&t?.loaded?e.map((e=>{const r=e.clone();return r.field=c(e.field,t),r})):e??[]}get supportsCacheHint(){return!!this.layer?.capabilities?.queryRelated?.supportsCacheHint}get canLoad(){return!!this.map&&null!=this.relationshipId&&"number"==typeof this.objectId}get canQuery(){const e=this.layer?.capabilities?.queryRelated;return!!(this.relatedLayer&&this.relationship&&null!=this.relationshipId&&null!=this.objectId&&e?.supportsCount&&e?.supportsPagination)}get itemDescriptionFieldName(){return this.orderByFieldsFixedCasing[0]?.field||null}set displayCount(e){const t=0,r=10;this._set("displayCount",Math.min(Math.max(e,t),r))}get displayCount(){return this._get("displayCount")}get objectId(){return(this.objectIdField&&this.graphic?.attributes?.[this.objectIdField])??null}get objectIdField(){return this.layer?.objectIdField||null}get relatedFeatures(){return this._get("relatedFeatures")||new s}get relatedLayer(){const{layer:e,map:t,relationship:r}=this;return e?.loaded&&t&&r?C(t,e,r)??null:null}get relationship(){const{relationshipId:e,layer:t}=this;return null!=e?t?.relationships?.find((({id:t})=>t===e))??null:null}get relatedFeatureViewModels(){return this._get("relatedFeatureViewModels")||new s}get state(){const{_queryAbortController:e,_queryFeatureCountAbortController:t,_queryPageAbortController:r,canQuery:o,_loaded:l,canLoad:s}=this;return t||s&&!l?"loading":e||r?"querying":o?"ready":"disabled"}getRelatedFeatureByObjectId(e){return this.relatedFeatures.find((t=>t.getObjectId()===e))}refresh(){this._queryFeatureCountDebounced()}_destroyRelatedFeatureViewModels(){this.relatedFeatureViewModels?.destroyAll()}async _queryFeatureCount(){const{layer:e,relatedLayer:t,relationshipId:r,objectId:o,_queryFeatureCountAbortController:l,canQuery:s,supportsCacheHint:a}=this;if(await(e?.load()),await(t?.load()),!s||!e||!t||null==o)return void this._set("featureCount",0);const i=t.createQuery(),{historicMoment:n,gdbVersion:u}=e,d=new p({cacheHint:a,gdbVersion:u,historicMoment:n,relationshipId:r,returnGeometry:!1,objectIds:[o],where:i.where??void 0}),h=await e.queryRelatedFeaturesCount(d,{signal:l?.signal});this._set("featureCount",h[o]||0)}_sliceFeatures(e){const{showAllEnabled:t,displayCount:r}=this;return t?e:r?e.slice(0,r):[]}async _queryPage(){const{relatedFeatures:e,featurePage:t,showAllEnabled:r,_queryPageAbortController:o,featureCount:l}=this;!r||t<2||!l||e.addMany(await this._queryRelatedFeatures({signal:o?.signal}))}async _queryRelatedFeatures(e){const{orderByFieldsFixedCasing:t,showAllEnabled:r,featuresPerPage:l,displayCount:s,layer:a,relationshipId:i,featurePage:n,featureCount:u,relatedLayer:d,supportsCacheHint:h}=this,{canQuery:y,objectId:c}=this;if(!y||!a||!d||null==c)return[];const C=r?((n-1)*l+u)%u:0,g=r?l:s,_=d.objectIdField,F=[...t.map((e=>e.field)),...b(d),_].filter(o),m=t.map((e=>`${e.field} ${e.order}`)),f=d.createQuery(),{historicMoment:q,gdbVersion:A}=a,P=new p({orderByFields:m,start:C,num:g,outFields:F,cacheHint:h,historicMoment:q,gdbVersion:A,relationshipId:i,returnGeometry:!1,objectIds:[c],where:f.where??void 0}),w=await a.queryRelatedFeatures(P,{signal:e?.signal}),j=w[c]?.features||[];return j.forEach((e=>{e.sourceLayer=d,e.layer=d})),j}};e([h()],_.prototype,"_loaded",void 0),e([h()],_.prototype,"_queryAbortController",void 0),e([h()],_.prototype,"_queryPageAbortController",void 0),e([h()],_.prototype,"_queryFeatureCountAbortController",void 0),e([h({value:1})],_.prototype,"featurePage",null),e([h()],_.prototype,"featuresPerPage",void 0),e([h({readOnly:!0})],_.prototype,"orderByFieldsFixedCasing",null),e([h({readOnly:!0})],_.prototype,"supportsCacheHint",null),e([h({readOnly:!0})],_.prototype,"canLoad",null),e([h({readOnly:!0})],_.prototype,"canQuery",null),e([h()],_.prototype,"description",void 0),e([h({readOnly:!0})],_.prototype,"itemDescriptionFieldName",null),e([h({value:3})],_.prototype,"displayCount",null),e([h({type:t})],_.prototype,"graphic",void 0),e([h()],_.prototype,"layer",void 0),e([h()],_.prototype,"map",void 0),e([h({readOnly:!0})],_.prototype,"objectId",null),e([h({readOnly:!0})],_.prototype,"objectIdField",null),e([h()],_.prototype,"orderByFields",void 0),e([h({readOnly:!0})],_.prototype,"relatedFeatures",null),e([h({readOnly:!0})],_.prototype,"relatedLayer",null),e([h({readOnly:!0})],_.prototype,"relationship",null),e([h()],_.prototype,"featureCount",void 0),e([h({readOnly:!0})],_.prototype,"relatedFeatureViewModels",null),e([h()],_.prototype,"relationshipId",void 0),e([h()],_.prototype,"showAllEnabled",void 0),e([h()],_.prototype,"state",null),e([h()],_.prototype,"title",void 0),_=e([y("esri.widgets.Feature.FeatureRelationship.FeatureRelationshipViewModel")],_);const F=_;export{F as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../request.js";import{unique as t}from"../../../core/arrayUtils.js";import r from"../../../core/Error.js";import o from"../../../core/Logger.js";import{whenOrAbort as i,eachAlways as s}from"../../../core/promiseUtils.js";import{isNumericField as n}from"../../../layers/support/fieldUtils.js";import"../../../core/has.js";import"../../../layers/support/source/DataLayerSource.js";import{executeQueryJSON as l}from"../../../rest/query/executeQueryJSON.js";import"../../../config.js";import"../../../kernel.js";import"../../../core/urlUtils.js";import"../../../core/unitUtils.js";import"../../../geometry/ellipsoidUtils.js";import"../../../geometry/support/spatialReferenceUtils.js";import"../../../geometry/support/aaBoundingBox.js";import"../../../core/mathUtils.js";import"../../../geometry/Extent.js";import"../../../geometry/Geometry.js";import"../../../geometry/Multipoint.js";import"../../../geometry/Point.js";import"../../../geometry/Polygon.js";import"../../../geometry/Polyline.js";import"../../../geometry/support/normalizeUtilsCommon.js";import"../../../geometry/SpatialReference.js";import"../../../geometry/support/Ellipsoid.js";import"../../../geometry.js";import"../../../core/pbf.js";import"../../../rest/support/FeatureSet.js";import a from"../../../rest/support/Query.js";import"../../../rest/query/support/AttachmentInfo.js";import"../../../rest/support/AttachmentQuery.js";import u from"../../../rest/support/RelationshipQuery.js";import"../../../rest/support/TopFeaturesQuery.js";import p from"../../../rest/support/StatisticDefinition.js";import{isRelatedField as c}from"./featureUtils.js";const f="esri.widgets.Feature.support.relatedFeatureUtils",m=()=>o.getLogger(f),d=new Map;function y(e){if(!c(e))return null;const[t,r]=e.split("/").slice(1);return{layerId:t,fieldName:r}}function j(e,t){if(!t.relationships)return null;let r=null;const{relationships:o}=t;return o.some((t=>t.id===parseInt(e,10)&&(r=t,!0))),r}function g({originRelationship:e,relationships:t,layerId:r}){return t.find((({relatedTableId:t,id:o})=>`${t}`===r&&o===e?.id))??null}function h(e,t){const r=t.toLowerCase();for(const o in e)if(o.toLowerCase()===r)return e[o];return null}function F(e,t){const r=j(e,t);if(!r)return;return{url:`${t.url}/${r.relatedTableId}`,sourceSpatialReference:t.spatialReference,relation:r,relatedFields:[],outStatistics:[]}}function I(e,t){if(!t)return;if(!e)return;const{features:r,statsFeatures:o}=e,i=r?.value;t.relatedFeatures=i?i.features:[];const s=o?.value;t.relatedStatsFeatures=s?s.features:[]}function S(e,t,r,o){const i=new u;return i.outFields=["*"],i.relationshipId="number"==typeof t.id?t.id:parseInt(t.id,10),i.objectIds=[e.attributes[r.objectIdField]],r.queryRelatedFeatures?.(i,o)??Promise.resolve({})}function w(e,t,r){let o=0;const i=[];for(;o<t.length;)i.push(`${e} IN (${t.slice(o,r+o)})`),o+=r;return i.join(" OR ")}function b(e){return e?t(e):void 0}function R(e){return e?t(e,((e,t)=>JSON.stringify(e.toJSON())===JSON.stringify(t.toJSON()))):void 0}async function U(e,t,r,o){const i=r.layerId.toString(),{layerInfo:u,relation:p,relatedFields:c,outStatistics:f,url:m,sourceSpatialReference:d}=t,y=b(c),j=R(f);if(!u||!p)return null;const F=g({originRelationship:p,relationships:u.relationships,layerId:i});if(F?.relationshipTableId&&F.keyFieldInRelationshipTable){const t=(await S(e,F,r,o))[e.attributes[r.objectIdField]];if(!t)return null;const i=t.features.map((e=>e.attributes[u.objectIdField]));if(j?.length&&u.supportsStatistics){const e=new a;e.where=w(u.objectIdField,i,1e3),e.outFields=y,e.outStatistics=j,e.sourceSpatialReference=d;const r={features:Promise.resolve(t),statsFeatures:l(m,e)};return s(r)}}const I=F?.keyField;if(I){const t=n(v(u.fields,I)),r=h(e.attributes,p.keyField),i=t?`${I}=${r}`:`${I}='${r}'`,c=l(m,new a({where:i,outFields:y,sourceSpatialReference:d}),o),f=!!j?.length&&u.supportsStatistics?l(m,new a({where:i,outFields:y,outStatistics:j,sourceSpatialReference:d}),o):null,g={features:c};return f&&(g.statsFeatures=f),s(g)}return null}function $(t,r){return e(t,{query:{f:"json"},signal:r?.signal})}function N({relatedInfos:e,layer:t},o){const n={};return e.forEach(((e,o)=>{const{relation:i}=e;if(!i){const e=new r("relation-required","A relation is required on a layer to retrieve related records.");throw m().error(e),e}const{relatedTableId:s}=i;if("number"!=typeof s){const e=new r("A related table ID is required on a layer to retrieve related records.");throw m().error(e),e}const l=`${t.url}/${s}`,a=d.get(l),u=a??$(l);a||d.set(l,u),n[o]=u})),i(s(n),o)}function T({graphic:e,relatedInfos:t,layer:r},o){const i={};return t.forEach(((t,s)=>{t.layerInfo&&(i[s]=U(e,t,r,o))})),s(i)}function q({relatedInfo:e,fieldName:t,fieldInfo:r}){if(e.relatedFields?.push(t),r.statisticType){const o=new p({statisticType:r.statisticType,onStatisticField:t,outStatisticFieldName:t});e.outStatistics?.push(o)}}function v(e,t){if(null!=e){t=t.toLowerCase();for(const r of e)if(r&&r.name.toLowerCase()===t)return r}return null}export{F as createRelatedInfo,g as getDestinationRelation,y as getRelatedFieldInfo,b as getUniqueOutFields,R as getUniqueOutStatistics,N as queryLayerInfos,T as queryRelatedFeatures,I as setRelatedFeatures,q as updateRelatedInfo};
5
+ import e from"../../../request.js";import{unique as t}from"../../../core/arrayUtils.js";import r from"../../../core/Error.js";import o from"../../../core/Logger.js";import{whenOrAbort as i,eachAlways as s}from"../../../core/promiseUtils.js";import{isNumericField as n}from"../../../layers/support/fieldUtils.js";import"../../../core/has.js";import"../../../layers/support/source/DataLayerSource.js";import{executeQueryJSON as l}from"../../../rest/query/executeQueryJSON.js";import"../../../config.js";import"../../../kernel.js";import"../../../core/urlUtils.js";import"../../../core/unitUtils.js";import"../../../geometry/ellipsoidUtils.js";import"../../../geometry/support/spatialReferenceUtils.js";import"../../../geometry/support/aaBoundingBox.js";import"../../../core/mathUtils.js";import"../../../geometry/Extent.js";import"../../../geometry/Geometry.js";import"../../../geometry/Multipoint.js";import"../../../geometry/Point.js";import"../../../geometry/Polygon.js";import"../../../geometry/Polyline.js";import"../../../geometry/support/normalizeUtilsCommon.js";import"../../../geometry/SpatialReference.js";import"../../../geometry/support/Ellipsoid.js";import"../../../geometry.js";import"../../../core/pbf.js";import"../../../rest/support/FeatureSet.js";import a from"../../../rest/support/Query.js";import"../../../rest/query/support/AttachmentInfo.js";import"../../../rest/support/AttachmentQuery.js";import u from"../../../rest/support/RelationshipQuery.js";import"../../../rest/support/TopFeaturesQuery.js";import p from"../../../rest/support/StatisticDefinition.js";import{isRelatedField as c}from"./featureUtils.js";const f="esri.widgets.Feature.support.relatedFeatureUtils",m=()=>o.getLogger(f),d=new Map;function y(e){if(!c(e))return null;const[t,r]=e.split("/").slice(1);return{layerId:t,fieldName:r}}function j(e,t){if(!t.relationships)return null;let r=null;const{relationships:o}=t;return o.some((t=>t.id===parseInt(e,10)&&(r=t,!0))),r}function g({originRelationship:e,relationships:t,layerId:r}){return t.find((({relatedTableId:t,id:o})=>`${t}`===r&&o===e?.id))??null}function h(e,t){const r=t.toLowerCase();for(const o in e)if(o.toLowerCase()===r)return e[o];return null}function F(e,t){const r=j(e,t);if(!r)return;return{url:`${t.url}/${r.relatedTableId}`,sourceSpatialReference:t.spatialReference,relation:r,relatedFields:[],outStatistics:[]}}function I(e,t){if(!t)return;if(!e)return;const{features:r,statsFeatures:o}=e,i=r?.value;t.relatedFeatures=i?i.features:[];const s=o?.value;t.relatedStatsFeatures=s?s.features:[]}function S(e,t,r,o){const i=new u;return i.outFields=["*"],i.relationshipId="number"==typeof t.id?t.id:parseInt(t.id,10),i.objectIds=[e.attributes[r.objectIdField]],i.gdbVersion=r.gdbVersion??null,i.historicMoment=r.historicMoment??null,r.queryRelatedFeatures?.(i,o)??Promise.resolve({})}function b(e,t,r){let o=0;const i=[];for(;o<t.length;)i.push(`${e} IN (${t.slice(o,r+o)})`),o+=r;return i.join(" OR ")}function w(e){return e?t(e):void 0}function R(e){return e?t(e,((e,t)=>JSON.stringify(e.toJSON())===JSON.stringify(t.toJSON()))):void 0}async function U(e,t,r,o){const i=r.layerId.toString(),{layerInfo:u,relation:p,relatedFields:c,outStatistics:f,url:m,sourceSpatialReference:d}=t,y=w(c),j=R(f);if(!u||!p)return null;const F=g({originRelationship:p,relationships:u.relationships,layerId:i});if(F?.relationshipTableId&&F.keyFieldInRelationshipTable){const t=(await S(e,F,r,o))[e.attributes[r.objectIdField]];if(!t)return null;const i=t.features.map((e=>e.attributes[u.objectIdField]));if(j?.length&&u.supportsStatistics){const e=new a;e.where=b(u.objectIdField,i,1e3),e.outFields=y,e.outStatistics=j,e.sourceSpatialReference=d;const r={features:Promise.resolve(t),statsFeatures:l(m,e)};return s(r)}}const I=F?.keyField;if(I){const t=n(v(u.fields,I)),i=h(e.attributes,p.keyField),c=t?`${I}=${i}`:`${I}='${i}'`,f=r.historicMoment,g=r.gdbVersion,F=l(m,new a({where:c,outFields:y,sourceSpatialReference:d,historicMoment:f,gdbVersion:g}),o),S=!!j?.length&&u.supportsStatistics?l(m,new a({where:c,outFields:y,outStatistics:j,sourceSpatialReference:d}),o):null,b={features:F};return S&&(b.statsFeatures=S),s(b)}return null}function $(t,r){return e(t,{query:{f:"json"},signal:r?.signal})}function N({relatedInfos:e,layer:t},o){const n={};return e.forEach(((e,o)=>{const{relation:i}=e;if(!i){const e=new r("relation-required","A relation is required on a layer to retrieve related records.");throw m().error(e),e}const{relatedTableId:s}=i;if("number"!=typeof s){const e=new r("A related table ID is required on a layer to retrieve related records.");throw m().error(e),e}const l=`${t.url}/${s}`,a=d.get(l),u=a??$(l);a||d.set(l,u),n[o]=u})),i(s(n),o)}function T({graphic:e,relatedInfos:t,layer:r},o){const i={};return t.forEach(((t,s)=>{t.layerInfo&&(i[s]=U(e,t,r,o))})),s(i)}function q({relatedInfo:e,fieldName:t,fieldInfo:r}){if(e.relatedFields?.push(t),r.statisticType){const o=new p({statisticType:r.statisticType,onStatisticField:t,outStatisticFieldName:t});e.outStatistics?.push(o)}}function v(e,t){if(null!=e){t=t.toLowerCase();for(const r of e)if(r&&r.name.toLowerCase()===t)return r}return null}export{F as createRelatedInfo,g as getDestinationRelation,y as getRelatedFieldInfo,w as getUniqueOutFields,R as getUniqueOutStatistics,N as queryLayerInfos,T as queryRelatedFeatures,I as setRelatedFeatures,q as updateRelatedInfo};