@arcgis/core 4.29.2 → 4.29.4
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/686a76adc741eef369ee.js +1 -0
- package/assets/esri/core/workers/chunks/{b125ab84b7761e761734.js → 6ee0e9e56b80296570cb.js} +1 -1
- package/assets/esri/core/workers/chunks/994ca341d8711a4dd473.js +1 -0
- package/assets/esri/core/workers/chunks/{246cba9cd5cadba6be08.js → 9a8ab968ebb18480481d.js} +1 -1
- package/assets/esri/core/workers/chunks/ad9740559e8e45526796.js +1 -0
- package/assets/esri/core/workers/chunks/bd4cb6b02ed52b82ba56.js +1 -0
- package/assets/esri/core/workers/chunks/{712b5cabf4ea3dc8bf33.js → c34ec99627e7645fd218.js} +1 -1
- package/assets/esri/core/workers/chunks/c442480601f9a36e29b9.js +1 -0
- package/assets/esri/core/workers/chunks/c8ecaac448fddd120421.js +1 -0
- package/interfaces.d.ts +39 -51
- package/kernel.js +1 -1
- package/package.json +1 -1
- package/rest/knowledgeGraph/wasmInterface/wasmToFeatureFactories.js +1 -1
- package/rest/print.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
- package/views/2d/engine/webgl/FeatureTile.js +1 -1
- package/views/2d/engine/webgl/ReshufflePlan.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/Buffer.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/MappedMesh.js +1 -1
- package/views/2d/layers/VectorTileLayerView2D.js +1 -1
- package/views/2d/layers/features/FeatureContainer.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/ProcessorTileMessageQueue.js +5 -0
- package/views/2d/layers/features/RenderState.js +1 -1
- package/views/2d/layers/features/aggregation/GridCell.js +1 -1
- package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
- package/views/2d/layers/features/sources/strategies/AFetchLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/ComputedExpression.js +1 -1
- package/views/2d/layers/features/support/DisplayIdGenerator.js +1 -1
- package/views/2d/layers/features/support/FeatureSetCache.js +5 -0
- package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/Legend/LegendViewModel.js +1 -1
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/TableList.js +1 -1
- package/widgets/VersionManagement/VersionManagementViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/7427d03e693f32a81377.js +0 -1
- package/assets/esri/core/workers/chunks/7a8bba91769ee18cc39f.js +0 -1
- package/assets/esri/core/workers/chunks/8044f34d295ec36aa3f1.js +0 -1
- package/assets/esri/core/workers/chunks/94d72650d556fd0eecc3.js +0 -1
- package/assets/esri/core/workers/chunks/ef3e6209e6ac6a56960b.js +0 -1
- package/assets/esri/core/workers/chunks/ff14214611e1e070235e.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../../request.js";import has from"../../../../../core/has.js";import{ignoreAbortErrors as t,throwIfNotAbortError as s}from"../../../../../core/promiseUtils.js";import{diff as r,hasRootDiffOnly as a,hasRootDiff as i}from"../../../../../core/accessorSupport/diffUtils.js";import{QueryEngine as n}from"../../../../../layers/graphics/data/QueryEngine.js";import{executeQueryForCount as o}from"../../../../../rest/query/operations/query.js";import{FeatureStoreStatistics as h}from"../FeatureStoreStatistics.js";import{FeatureSourceQueryInfo as u}from"./FeatureSourceQueryInfo.js";import{StreamMessenger as d}from"./StreamMessenger.js";import{DrillDownTileLoadStrategy as c}from"./strategies/DrillDownTileLoadStrategy.js";import{PagedTileLoadStrategy as g}from"./strategies/PagedTileLoadStrategy.js";import{SnapshotLoadStrategy as m}from"./strategies/SnapshotLoadStrategy.js";import{StreamLoadStrategy as _}from"./strategies/StreamLoadStrategy.js";import{FeatureSourceChunkStore as l}from"./strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as p}from"../support/FeatureMetadata.js";import{UpdateTracking2D as y}from"../../support/UpdateTracking2D.js";class
|
|
5
|
+
import e from"../../../../../request.js";import has from"../../../../../core/has.js";import{ignoreAbortErrors as t,throwIfNotAbortError as s}from"../../../../../core/promiseUtils.js";import{diff as r,hasRootDiffOnly as a,hasRootDiff as i}from"../../../../../core/accessorSupport/diffUtils.js";import{QueryEngine as n}from"../../../../../layers/graphics/data/QueryEngine.js";import{executeQueryForCount as o}from"../../../../../rest/query/operations/query.js";import{FeatureStoreStatistics as h}from"../FeatureStoreStatistics.js";import{FeatureSourceQueryInfo as u}from"./FeatureSourceQueryInfo.js";import{StreamMessenger as d}from"./StreamMessenger.js";import{DrillDownTileLoadStrategy as c}from"./strategies/DrillDownTileLoadStrategy.js";import{PagedTileLoadStrategy as g}from"./strategies/PagedTileLoadStrategy.js";import{SnapshotLoadStrategy as m}from"./strategies/SnapshotLoadStrategy.js";import{StreamLoadStrategy as _}from"./strategies/StreamLoadStrategy.js";import{FeatureSourceChunkStore as l}from"./strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as p}from"../support/FeatureMetadata.js";import{UpdateTracking2D as y}from"../../support/UpdateTracking2D.js";class f{constructor(e,t,s,r){this._aggregateAdapter=e,this._subscriptions=t,this._onChange=s,this._connection=r,this._updateTracking=new y({debugName:"FeatureSource"}),this._store=new l(this._onChange)}destroy(){this._strategy?.destroy(),this._store.destroy(),this._streamMessenger?.destroy()}get _eventLog(){return this._connection.eventLog}get metadata(){if(!this._metadata)throw new Error("InternalError: Metadata not defined. Was update called?");return this._metadata}get service(){return this._schema.service}get store(){return this._store}get streamMessenger(){return null==this._streamMessenger&&this._initStreamMessenger(),this._streamMessenger}get statistics(){return h.from(this._store)}get updateTracking(){return this._updateTracking}get queryEngine(){if(!this._queryEngine){if(!this._schema)return null;const{dataFilter:e}=this._schema.mutable,t=this._schema.mutable.availableFields,s=this._metadata;this._queryEngine=new n({featureStore:this._store,fieldsIndex:s.fieldsIndex,geometryType:s.geometryType,objectIdField:s.objectIdField,hasM:!1,hasZ:!1,spatialReference:e.outSpatialReference,cacheSpatialQueries:!0,aggregateAdapter:this._aggregateAdapter,timeInfo:s.timeInfo,definitionExpression:e.definitionExpression,availableFields:t})}return this._queryEngine}get isStream(){return"stream"===this._schema.type}chunks(){return Array.from(this._store.chunks())}cleanupRemovedChunks(){return this._store.cleanupRemovedChunks()}onSubscribe(e){this._eventLog.onEvent({type:"subscribe",tile:e.tile.id});const t=this._strategy?.load(e);t&&(t.then((()=>this._eventLog.onEvent({type:"loaded",tile:e.tile.id}))).catch((t=>this._eventLog.onEvent({type:"error",tile:e.tile.id,error:t}))),this._updateTracking.addPromise(t))}onResume(e){this._updateTracking.addPromise(t(this._strategy?.load(e)))}onUnsubscribe(e){this._eventLog.onEvent({type:"unsubscribe",tile:e.tile.id}),this._strategy?.unload(e)}getOverride(e){return this._updateTracking.addPromise(this._doGetOverride(e))}applyOverride(e){this._store.applyOverrides(e)}async update(e,t){const s=e.source,n=r(this._schema?.mutable,s.mutable);if(!n)return!1;if(has("esri-2d-update-debug")&&console.debug(`Version[${t}] FeatureSource.update`,{changes:n}),this._schema=s,this._metadata=new p(this._schema.service.metadata),this._queryEngine?.destroy(),this._queryEngine=null,"feature"===this._schema.type&&null!=this._schema.service.queryMetadata.lastEditDate&&(this._lastEditDate=this._schema.service.queryMetadata.lastEditDate),null==this._streamMessenger&&"stream"===this._schema.type&&this._initStreamMessenger(),a(n,"sourceRefreshVersion")&&this._strategy?.refresh)return await this._strategy.refresh(),!0;if("feature"===s.type&&a(n,"availableFields")){if(await this._queryLastEditDateChanged())await this._updateStrategy(t);else{this._eventLog.onEvent({type:"updateFieldsStart"});try{await this._strategy.updateFields(s.mutable.availableFields),this._eventLog.onEvent({type:"updateFieldsEnd"})}catch(o){this._eventLog.onEvent({type:"updateFieldsError",error:o})}}return!1}return!(!i(n,"dataFilter")&&!i(n,"sourceRefreshVersion"))&&(await this._updateStrategy(t),!0)}_initStreamMessenger(){null==this._streamMessenger&&(this._streamMessenger=new d(this._connection))}async _doGetOverride(e){return this._strategy.queryOverride(e)}async _queryLastEditDateChanged(){if(null==this._lastEditDate)return!1;const t=this._schema.service.source,s={...t.query,f:"json"},r=(await e(t.path,{query:s,responseType:"json"})).data.editingInfo.lastEditDate;return r!==this._lastEditDate&&(this._lastEditDate=r,!0)}async _createStrategy(){const e=this.service,t="isSourceHosted"in e&&e.isSourceHosted,s=Array.isArray(e.source),r=e.source&&"collection"in e.source,a=t||s||r;if("stream"===this._schema.type){const e=new _(this._schema.service,this._schema.mutable.dataFilter,this._store,{outSR:this._schema.mutable.dataFilter.outSpatialReference},this.metadata);return this._streamMessenger.strategy=e,e}const i=u.fromSchema(this._schema,this._metadata),n=await this._supportSnapshotMode(this._schema,i);return n?new m(this._schema.service,i,this._store,n.featureCount,this.metadata,this._eventLog):a?new g(this._schema.service,i,this._store,this.metadata,this._eventLog):new c(this._schema.service,i,this._store,this.metadata,this._eventLog)}async _updateStrategy(e){const t=await this._createStrategy();this._eventLog.onEvent({type:"updateStrategyStart",about:t.about});const r=!!this._strategy;this._store.clear(),this._strategy?.destroy(),this._strategy=t,has("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureSource.updateStrategy`,{strategy:t});const a=Array.from(this._subscriptions.values());if(!a.length)return void this._eventLog.onEvent({type:"updateStrategyEnd"});const i=Promise.all(a.map((e=>this._strategy.load(e).then((()=>this._eventLog.onEvent({type:"loaded",tile:e.tile.id}))).catch((t=>this._eventLog.onEvent({type:"error",tile:e.tile.id,error:t}))))));this._updateTracking.addPromise(i);try{r&&await i}catch(n){s(n)}this._eventLog.onEvent({type:"updateStrategyEnd"}),has("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureSource.updateStrategyEnd`,{strategy:t})}async _supportSnapshotMode(e,t){const{queryMetadata:s}=e.service,r=s.snapshotInfo;if(!r||!r.supportsSnapshotMinThreshold||!r.snapshotCountThresholds)return null;const a=e.service.source,i=t.createQuery();i.inner.orderByFields=[],i.inner.returnGeometry=!1;const n=(await o(a,i.inner,{query:i.customParameters})).data.count,{min:h,max:u}=r.snapshotCountThresholds;return n<=h||r.supportsSnapshotMaxThreshold&&n<u?{featureCount:n}:null}}export{f as FeatureSource};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../../TimeExtent.js";import has from"../../../../../core/has.js";import t from"../../../../../geometry/SpatialReference.js";import r from"../../../../../rest/support/Query.js";const
|
|
5
|
+
import e from"../../../../../TimeExtent.js";import has from"../../../../../core/has.js";import t from"../../../../../geometry/SpatialReference.js";import{isHostedAgolService as r}from"../../../../../layers/support/arcgisLayerUrl.js";import i from"../../../../../rest/support/Query.js";const a=4;function o(i,a){const{service:o}=i,s=o.orderByFields??a.objectIdField+" ASC",n=o.source,u={returnCentroid:!(null!==n&&"object"==typeof n&&"path"in n&&r(n.path))&&"esriGeometryPolygon"===a.geometryType,returnGeometry:!0,timeReferenceUnknownClient:a.timeReferenceUnknownClient??void 0,outSpatialReference:t.fromJSON(i.mutable.dataFilter.outSpatialReference),orderByFields:[s],where:i.mutable.dataFilter.definitionExpression??"1=1",outFields:i.mutable.availableFields};if("feature"===i.type){const{gdbVersion:t,historicMoment:r,timeExtent:a}=i.mutable.dataFilter;return{...u,gdbVersion:t,historicMoment:r?new Date(r):null,timeExtent:a?e.fromJSON(a):null,outFields:i.mutable.availableFields}}return u}class s{static fromSchema(e,t){return new s(o(e,t),e.mutable.dataFilter.customParameters,t.geometryType,e.service.queryMetadata.capabilities)}constructor(e,t,r,i){this._queryParams=e,this._customParameters=t,this._geometryType=r,this._capabilities=i}get pageSize(){if(null==this._capabilities)throw new Error("InternalError: Service does not support paged queries");const{query:e}=this._capabilities,t=e.supportsMaxRecordCountFactor?a:null,r=(e.maxRecordCount??8e3)*(t??1);return Math.min(8e3,r)}updateFields(e){this._queryParams.outFields=e}createPatchFieldsQuery(e,t){const r=e.clone();if("*"===this._queryParams.outFields[0]){if("*"===(r.outFields??[])[0])return null;r.outFields=this._queryParams.outFields}else{const e=new Set(this._queryParams.outFields),i=[];for(const r of e)t.has(r)||i.push(r);if(0===i.length)return null;r.outFields=i}return r.returnGeometry=!1,r.returnCentroid=!1,r.quantizationParameters=null,r.cacheHint=!0,{inner:r,customParameters:this._customParameters}}createQuery(e={}){if(!this._queryParams)throw new Error("InternalError: queryInfo should be defined");return{inner:new i({...this._queryParams,...e}),customParameters:this._customParameters}}createTileQuery(e,t){if(null==this._capabilities)throw new Error("InternalError: Service does not support tile queries");const r=this.createQuery(t),i=r.inner;return i.quantizationParameters=t.quantizationParameters??e.getQuantizationParameters(),i.resultType="tile",i.geometry=e.extent,this._capabilities.query.supportsQuantization?"esriGeometryPolyline"===this._geometryType&&(i.maxAllowableOffset=e.resolution*has("feature-polyline-generalization-factor")):"esriGeometryPolyline"!==this._geometryType&&"esriGeometryPolygon"!==this._geometryType||(i.maxAllowableOffset=e.resolution,"esriGeometryPolyline"===this._geometryType&&(i.maxAllowableOffset*=has("feature-polyline-generalization-factor"))),i.defaultSpatialReferenceEnabled=this._capabilities.query.supportsDefaultSpatialReference,i.compactGeometryEnabled=this._capabilities.query.supportsCompactGeometry,this._capabilities.query.supportsMaxRecordCountFactor&&(i.maxRecordCountFactor=a),r}createPagedTileQuery(e,t){const r=this.pageSize;return this.createTileQuery(e,{start:r*t,num:r,returnExceededLimitFeatures:!0})}createPagedQuery(e){const t=this.pageSize;return this.createQuery({start:t*e,num:t,returnExceededLimitFeatures:!0,maxRecordCountFactor:a})}}export{s as FeatureSourceQueryInfo};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../../../core/Error.js";import t from"../../../../../../rest/support/Query.js";import{ALoadStrategy as r}from"./ALoadStrategy.js";import{createQueryAdapter as s}from"./support/queryAdapters.js";import{QueueProcessor as o}from"../../../../../support/QueueProcessor.js";class n extends r{constructor(e,t,r,n,a){super(r),this._serviceInfo=e,this._queryInfo=t,this._metadata=n,this._eventLog=a,this._queue=new o({concurrency:
|
|
5
|
+
import e from"../../../../../../core/Error.js";import t from"../../../../../../rest/support/Query.js";import{ALoadStrategy as r}from"./ALoadStrategy.js";import{createQueryAdapter as s}from"./support/queryAdapters.js";import{QueueProcessor as o}from"../../../../../support/QueueProcessor.js";class n extends r{constructor(e,t,r,n,a){super(r),this._serviceInfo=e,this._queryInfo=t,this._metadata=n,this._eventLog=a,this._queue=new o({concurrency:16,process:async e=>{const t={signal:e.options?.signal,query:e.query.customParameters};return this._adapter.executeQuery(e.query.inner,t)}}),this._adapter=s(e,n)}async updateFields(r){this._queryInfo.updateFields(r);const s=Array.from(this._store.chunks()).map((async e=>{const r=t.fromJSON(e.queryInfo.queryJSON);if(r)try{return await this._tryUpdateFields(e.reader,r),null}catch(s){return s}})),o=(await Promise.all(s)).filter((e=>e));if(o.length)throw new e("featurelayer-query","Encountered errors when downloading fields",{errors:o})}async queryOverride({edits:e}){const t=[],r=[];for(const n of e.removed)null!=n.objectId&&-1!==n.objectId?t.push(n.objectId):r.push(n.globalId);r.length&&t.push(...this._mapGlobalIdsToObjectIds(r));const s=e.addOrModified.map((({objectId:e})=>e)),o=this._queryInfo.createQuery({objectIds:s});return{reader:await this._fetch(o),removed:t}}_mapGlobalIdsToObjectIds(e){const t=new Set(e),r=this._metadata.globalIdField;if(null==r)throw new Error("InternalError: Recieved an edit with globalIds, but not supported by the service");const s=[];return this._store.forEachUnsafe((e=>{const o=e.readAttribute(r);t.has(o)&&s.push(e.getObjectId())})),s}async _fetch(e,t){const r=await this._enqueue(e,t);return await this._tryUpdateFields(r,e.inner),r}async _tryUpdateFields(e,t){const r=this._queryInfo.createPatchFieldsQuery(t,e.fields);if(!r)return;const s=await this._enqueue(r,this._options);e.joinAttributes(s)}async _enqueue(e,t){return this._eventLog.onEvent({type:"fetchStart"}),this._queue.push({query:e,options:t}).finally((()=>{this._eventLog.onEvent({type:"fetchEnd",done:0===this._queue.length})}))}}export{n as AFetchLoadStrategy};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../../../../core/Evented.js";import has from"../../../../../../../core/has.js";import{create as s}from"../../../../../../../geometry/support/aaBoundingBox.js";import{FeatureStoreQueryAdapter as o}from"../../../FeatureStoreQueryAdapter.js";import{OverrideChunk as r}from"./OverrideChunk.js";class t{constructor(s){this._onChange=s,this._chunks=new Map,this._overrideChunk=new r,this._chunksToRemove=[],this.events=new e,this.featureAdapter=new o}destroy(){this.clear()}clear(){for(const e of this._chunks.values())this._chunksToRemove.push(e);this._chunks.clear()}*chunks(){this._overrideChunk&&(yield this._overrideChunk),yield*this._chunks.values()}insert(e){has("esri-2d-update-debug")&&console.debug(`Chunk[${e.chunkId}] SourceChunkStore.insert`),this._overrideChunk.overridenIds.size&&e.reader.removeIds(this._overrideChunk.overridenIds),this._chunks.set(e.chunkId,e),this.events.emit("changed"),this._onChange()}remove(e){has("esri-2d-update-debug")&&console.debug(`Chunk[${e.chunkId}] SourceChunkStore.remove`),this._chunks.delete(e.chunkId),this._chunksToRemove.push(e)}cleanupRemovedChunks(){const e=this._chunksToRemove;return this._chunksToRemove=[],e}applyOverrides(e){this._overrideChunk.applyOverrides(e);for(const s of this._chunks.values())s.reader.removeIds(this._overrideChunk.overridenIds),s.invalidate()}forEach(e){const s=new Set;for(const o of this.chunks()){const r=o.reader.getCursor();for(;r.next();){const o=r.getObjectId();s.has(o)||(e(r.copy()),s.add(o))}}}forEachUnsafe(e){const s=new Set;for(const o of this.chunks()){const r=o.reader.getCursor();for(;r.next();){const o=r.getObjectId();s.has(o)||(e(r),s.add(o))}}}forEachInBounds(e,s){const o=new Set;for(const r of this.chunks()){const t=r.queryFeaturesInBounds(e);for(;t.next();){const e=t.getObjectId();o.has(e)||(s(t.copy()),o.add(e))}}}forEachBounds(e,o){const r=s();for(const s of e){s.getBounds(r)&&o(r)}}}export{t as FeatureSourceChunkStore};
|
|
5
|
+
import e from"../../../../../../../core/Evented.js";import has from"../../../../../../../core/has.js";import{create as s}from"../../../../../../../geometry/support/aaBoundingBox.js";import{FeatureStoreQueryAdapter as o}from"../../../FeatureStoreQueryAdapter.js";import{OverrideChunk as r}from"./OverrideChunk.js";class t{constructor(s){this._onChange=s,this._chunks=new Map,this._overrideChunk=new r,this._chunksToRemove=[],this.events=new e,this.featureAdapter=new o}destroy(){this.clear()}clear(){for(const e of this._chunks.values())this._chunksToRemove.push(e);this._chunks.clear(),this._overrideChunk&&this._chunksToRemove.push(this._overrideChunk),this._overrideChunk=new r}*chunks(){this._overrideChunk&&(yield this._overrideChunk),yield*this._chunks.values()}insert(e){has("esri-2d-update-debug")&&console.debug(`Chunk[${e.chunkId}] SourceChunkStore.insert`),this._overrideChunk.overridenIds.size&&e.reader.removeIds(this._overrideChunk.overridenIds),this._chunks.set(e.chunkId,e),this.events.emit("changed"),this._onChange()}remove(e){has("esri-2d-update-debug")&&console.debug(`Chunk[${e.chunkId}] SourceChunkStore.remove`),this._chunks.delete(e.chunkId),this._chunksToRemove.push(e)}cleanupRemovedChunks(){const e=this._chunksToRemove;return this._chunksToRemove=[],e}applyOverrides(e){this._overrideChunk.applyOverrides(e);for(const s of this._chunks.values())s.reader.removeIds(this._overrideChunk.overridenIds),s.invalidate()}forEach(e){const s=new Set;for(const o of this.chunks()){const r=o.reader.getCursor();for(;r.next();){const o=r.getObjectId();s.has(o)||(e(r.copy()),s.add(o))}}}forEachUnsafe(e){const s=new Set;for(const o of this.chunks()){const r=o.reader.getCursor();for(;r.next();){const o=r.getObjectId();s.has(o)||(e(r),s.add(o))}}}forEachInBounds(e,s){const o=new Set;for(const r of this.chunks()){const t=r.queryFeaturesInBounds(e);for(;t.next();){const e=t.getObjectId();o.has(e)||(s(t.copy()),o.add(e))}}}forEachBounds(e,o){const r=s();for(const s of e){s.getBounds(r)&&o(r)}}}export{t as FeatureSourceChunkStore};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../../../core/Error.js";import has from"../../../../../core/has.js";import e from"../../../../../core/Logger.js";import{diff as i}from"../../../../../core/accessorSupport/diffUtils.js";import{highlightReasons as s}from"../../../engine/highlightReasons.js";import{attributeStoreInitialSize as r,AttributeDataType as n}from"../../../engine/webgl/definitions.js";import{getDisplayIdTexel as a}from"../../../engine/webgl/DisplayId.js";import{getPixelArrayCtor as o}from"../../../engine/webgl/Utils.js";import{nanMagicNumber as l}from"../../../engine/webgl/shaderGraph/techniques/shaders/constants.js";import{createDebugLogger as h,DEBUG_ATTR_UPDATES as c}from"../../../engine/webgl/util/debug.js";import{DisplayIdGenerator as d}from"./DisplayIdGenerator.js";import u from"./FeatureFilter.js";import{PixelType as p}from"../../../../webgl/enums.js";function g(t,e){if(!t||!e)return t;switch(e){case"radius":case"distance":return 2*t;case"diameter":case"width":return t;case"area":return Math.sqrt(t)}return t}const _=()=>e.getLogger("esri.views.layers.2d.features.support.AttributeStore"),f=h(c,_()),y={sharedArrayBuffer:has("esri-shared-array-buffer"),atomics:has("esri-atomics")};class m{constructor(t,e,i){this.size=0,this.texelSize=4,this.dirtyStart=0,this.dirtyEnd=0;const{pixelType:s,layout:r,textureOnly:n}=e;this.textureOnly=n||!1,this.pixelType=s,this.layout=r,this._resetRange(),this.size=t,this.isLocal=i,n||(this.data=this._initData(s,t))}get buffer(){return this.data?.buffer}unsetComponentAllTexels(t,e){const i=this.data;for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]&=~e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(t,e){const i=this.data;for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]|=255&e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(t,e,i){const s=this.data;for(const r of i)s[r*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)}setComponentTexel(t,e,i){this.data[i*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}unsetComponentTexel(t,e,i){this.data[i*this.texelSize+t]&=~e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}getData(t,e){const i=a(t);return this.data[i*this.texelSize+e]}setData(t,e,i){const s=a(t),r=1<<e;0!=(this.layout&r)?null!=this.data&&(this.data[s*this.texelSize+e]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)):_().error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}expand(t){if(this.size=t,!this.textureOnly){const e=this._initData(this.pixelType,t),i=this.data;e.set(i),this.data=e}}toMessage(){const t=this.dirtyStart,e=this.dirtyEnd,i=this.texelSize;if(t>e)return null;this._resetRange();const s=!this.isLocal,r=this.pixelType,n=this.layout,a=this.data;return{start:t,end:e,data:s&&a.slice(t*i,(e+1)*i)||null,pixelType:r,layout:n}}_initData(t,e){const i=ArrayBuffer,s=o(t),r=new s(new i(e*e*4*s.BYTES_PER_ELEMENT));for(let n=0;n<r.length;n+=4)r[n+1]=255;return r}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class b{constructor(t){this._client=t,this._filters=[],this._blocks=new Array,this._attributeComputeInfo=null,this._abortController=new AbortController,this._size=r,this._idsToHighlight=new Map,this._referencesScale=!1,this._referencesGeometry=!1,this._initialized=!1,this.version=0,this._idGenerator=new d,this._epoch=1}destroy(){this._abortController.abort()}_initialize(){if(null!=this._blockDescriptors)return;const t=p.FLOAT;f(`Creating AttributeStore ${y.sharedArrayBuffer?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:p.UNSIGNED_BYTE,layout:1},{pixelType:p.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:p.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15}],this._blocks=this._blockDescriptors.map((()=>null))}get referencesScale(){return this._referencesScale}get referencesGeometry(){return this._referencesGeometry}get _signal(){return this._abortController.signal}get hasHighlight(){return this._idsToHighlight.size>0}createDisplayIdForObjectId(t){return this._idGenerator.createIdForObjectId(t)}releaseDisplayIdForObjectId(t){return this._idGenerator.releaseIdForObjectId(t)}incrementDisplayIdGeneration(){this._idGenerator.incrementGeneration()}async update(t,e,s,r,n=0){const a=i(this._schema,t);if(this.version=n,a&&(has("esri-2d-update-debug")&&console.debug(`Version[${n}] AttributeStore.update`,{changed:a}),this._schema=t,this._attributeComputeInfo=null,this._initialize(),null!=t))if(s&&(this._filters=await Promise.all(t.filters.map((t=>t?u.create({geometryType:s.geometryType,hasM:!1,hasZ:!1,timeInfo:s.timeInfo,fieldsIndex:s.fieldsIndex,spatialReference:r??s.spatialReference,filterJSON:t}):null)))),"subtype"!==t.type)this._attributeComputeInfo={isSubtype:!1,map:new Map},await Promise.all(t.bindings.map((async t=>{const i=await this._bind(e,t);this._referencesGeometry=this._referencesGeometry||(i?.referencesGeometry()??!1),this._referencesScale=this._referencesScale||(i?.referencesScale()??!1)})));else{this._attributeComputeInfo={isSubtype:!0,subtypeField:t.subtypeField,map:new Map},this._referencesScale=!1,this._referencesGeometry=!1;for(const i in t.bindings){const s=t.bindings[i];await Promise.all(s.map((async t=>{const s=await this._bind(e,t,parseInt(i,10));this._referencesGeometry=this._referencesGeometry||(s?.referencesGeometry()??!1),this._referencesScale=this._referencesScale||(s?.referencesScale()??!1)})))}}}setHighlight(t,e){const i=this._getBlock(0);i.unsetComponentAllTexels(0,(1<<s.length)-1);for(const{displayId:s,highlightFlags:r}of t){if(null==s)continue;const t=a(s);i.setComponent(0,r,[t])}this._idsToHighlight.clear();for(const{objectId:s,highlightFlags:r}of t)this._idsToHighlight.set(s,r);for(const{objectId:s,highlightFlags:r}of e)this._idsToHighlight.set(s,r)}setData(t,e,i,s){const r=a(t);this._ensureSizeForTexel(r),this._getBlock(e).setData(t,i,s)}getData(t,e,i){return this._getBlock(e).getData(t,i)}getHighlightFlags(t){return this._idsToHighlight.get(t)||0}unsetAttributeData(t){const e=a(t);this._getBlock(0).setData(e,0,0)}setAttributeData(t,e,i){const s=a(t);this._ensureSizeForTexel(s),this._getBlock(0).setData(s,0,this.getFilterFlags(e));const r=this._attributeComputeInfo,o=1,h=4;let c=null;r&&(c=r.isSubtype?r.map.get(e.readAttribute(r.subtypeField)):r.map,c?.size&&c.forEach(((t,r)=>{const a=r*o%h,c=Math.floor(r*o/h),d=this._getBlock(c+n.VV);let u=t.field?.read(e,i);t.valueRepresentation&&(u=g(u,t.valueRepresentation));(null===u||isNaN(u)||u===1/0||u===-1/0)&&(u=l),d.setData(s,a,u)})))}get epoch(){return this._epoch}async sendUpdates(){const t=this._blocks.map((t=>null!=t?t.toMessage():null)),e=this._getInitArgs();has("esri-2d-log-updating")&&console.log("AttributeStore: _doSendUpdate.start"),await this._client.update({initArgs:e,blockData:t,version:this.version,sendUpdateEpoch:this._epoch},this._signal),this._epoch+=1,has("esri-2d-log-updating")&&console.log("AttributeStore: _doSendUpdate.end")}_ensureSizeForTexel(t){for(;t>=this._size*this._size;)if(this._expand())return}async _bind(t,e,i){const s=await t.createComputedField(e),{valueRepresentation:r}=e,n=this._attributeComputeInfo;if(n.isSubtype){const t=n.map.get(i)??new Map;t.set(e.binding,{field:s,valueRepresentation:r}),n.map.set(i,t)}else n.map.set(e.binding,{field:s,valueRepresentation:r});return s}_getInitArgs(){return this._initialized?null:(this._initialized=!0,this._getBlock(n.Animation),this._getBlock(n.GPGPU),{blockSize:this._size,blockDescriptors:this._blocks.map((t=>null!=t?{textureOnly:t.textureOnly,buffer:t.buffer,pixelType:t.pixelType}:null))})}_getBlock(t){const e=this._blocks[t];if(null!=e)return e;f(`Initializing AttributeBlock at index ${t}`);const i=new m(this._size,this._blockDescriptors[t],this._client.isLocal);return this._blocks[t]=i,this._initialized=!1,i}_expand(){if(this._size<this._schema.capabilities.maxTextureSize){const t=this._size<<=1;f("Expanding block size to",t,this._blocks);for(const e of this._blocks)e?.expand(t);return this._initialized=!1,this._size=t,0}return _().error(new t("mapview-limitations","Maximum number of onscreen features exceeded.")),-1}isVisible(t){return!!(this._getBlock(0).getData(t,0)&1<<s.length)}getFilterFlags(t){let e=0;for(let s=0;s<this._filters.length;s++){const i=!!(1<<s),r=this._filters[s];e|=(!i||null==r||r.check(t)?1:0)<<s}let i=0;if(this._idsToHighlight.size){const e=t.getObjectId();i=this.getHighlightFlags(e)}return e<<s.length|i}}export{b as AttributeStore,g as getVisualVariableSizeValueRepresentationRatio};
|
|
5
|
+
import t from"../../../../../core/Error.js";import has from"../../../../../core/has.js";import e from"../../../../../core/Logger.js";import{diff as i}from"../../../../../core/accessorSupport/diffUtils.js";import{highlightReasons as s}from"../../../engine/highlightReasons.js";import{attributeStoreInitialSize as r,AttributeDataType as n}from"../../../engine/webgl/definitions.js";import{getDisplayIdTexel as a}from"../../../engine/webgl/DisplayId.js";import{getPixelArrayCtor as o}from"../../../engine/webgl/Utils.js";import{nanMagicNumber as l}from"../../../engine/webgl/shaderGraph/techniques/shaders/constants.js";import{createDebugLogger as h,DEBUG_ATTR_UPDATES as c}from"../../../engine/webgl/util/debug.js";import{DisplayIdGenerator as d}from"./DisplayIdGenerator.js";import u from"./FeatureFilter.js";import{PixelType as p}from"../../../../webgl/enums.js";function g(t,e){if(!t||!e)return t;switch(e){case"radius":case"distance":return 2*t;case"diameter":case"width":return t;case"area":return Math.sqrt(t)}return t}const _=()=>e.getLogger("esri.views.layers.2d.features.support.AttributeStore"),f=h(c,_()),y={sharedArrayBuffer:has("esri-shared-array-buffer"),atomics:has("esri-atomics")};class m{constructor(t,e,i){this.size=0,this.texelSize=4,this.dirtyStart=0,this.dirtyEnd=0;const{pixelType:s,layout:r,textureOnly:n}=e;this.textureOnly=n||!1,this.pixelType=s,this.layout=r,this._resetRange(),this.size=t,this.isLocal=i,n||(this.data=this._initData(s,t))}get buffer(){return this.data?.buffer}unsetComponentAllTexels(t,e){const i=this.data;for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]&=~e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(t,e){const i=this.data;for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]|=255&e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(t,e,i){const s=this.data;for(const r of i)s[r*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)}setComponentTexel(t,e,i){this.data[i*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}unsetComponentTexel(t,e,i){this.data[i*this.texelSize+t]&=~e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}getData(t,e){const i=a(t);return this.data[i*this.texelSize+e]}setData(t,e,i){const s=a(t),r=1<<e;0!=(this.layout&r)?null!=this.data&&(this.data[s*this.texelSize+e]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)):_().error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}expand(t){if(this.size=t,!this.textureOnly){const e=this._initData(this.pixelType,t),i=this.data;e.set(i),this.data=e}}toMessage(){const t=this.dirtyStart,e=this.dirtyEnd,i=this.texelSize;if(t>e)return null;this._resetRange();const s=!this.isLocal,r=this.pixelType,n=this.layout,a=this.data;return{start:t,end:e,data:s&&a.slice(t*i,(e+1)*i)||null,pixelType:r,layout:n}}_initData(t,e){const i=ArrayBuffer,s=o(t),r=new s(new i(e*e*4*s.BYTES_PER_ELEMENT));for(let n=0;n<r.length;n+=4)r[n+1]=255;return r}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class b{constructor(t){this._client=t,this._filters=[],this._blocks=new Array,this._attributeComputeInfo=null,this._abortController=new AbortController,this._size=r,this._idsToHighlight=new Map,this._referencesScale=!1,this._referencesGeometry=!1,this._initialized=!1,this.version=0,this._idGenerator=new d,this._epoch=1}destroy(){this._abortController.abort()}_initialize(){if(null!=this._blockDescriptors)return;const t=p.FLOAT;f(`Creating AttributeStore ${y.sharedArrayBuffer?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:p.UNSIGNED_BYTE,layout:1},{pixelType:p.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:p.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15}],this._blocks=this._blockDescriptors.map((()=>null))}get referencesScale(){return this._referencesScale}get referencesGeometry(){return this._referencesGeometry}get _signal(){return this._abortController.signal}get hasHighlight(){return this._idsToHighlight.size>0}createDisplayIdForObjectId(t){return this._idGenerator.createIdForObjectId(t)}releaseDisplayIdForObjectId(t){return this._idGenerator.releaseIdForObjectId(t)}incrementDisplayIdGeneration(){this._idGenerator.incrementGeneration()}releaseAllIds(){this._idGenerator.releaseAll()}async update(t,e,s,r,n=0){const a=i(this._schema,t);if(this.version=n,a&&(has("esri-2d-update-debug")&&console.debug(`Version[${n}] AttributeStore.update`,{changed:a}),this._schema=t,this._attributeComputeInfo=null,this._initialize(),null!=t))if(s&&(this._filters=await Promise.all(t.filters.map((t=>t?u.create({geometryType:s.geometryType,hasM:!1,hasZ:!1,timeInfo:s.timeInfo,fieldsIndex:s.fieldsIndex,spatialReference:r??s.spatialReference,filterJSON:t}):null)))),"subtype"!==t.type)this._attributeComputeInfo={isSubtype:!1,map:new Map},await Promise.all(t.bindings.map((async t=>{const i=await this._bind(e,t);this._referencesGeometry=this._referencesGeometry||(i?.referencesGeometry()??!1),this._referencesScale=this._referencesScale||(i?.referencesScale()??!1)})));else{this._attributeComputeInfo={isSubtype:!0,subtypeField:t.subtypeField,map:new Map},this._referencesScale=!1,this._referencesGeometry=!1;for(const i in t.bindings){const s=t.bindings[i];await Promise.all(s.map((async t=>{const s=await this._bind(e,t,parseInt(i,10));this._referencesGeometry=this._referencesGeometry||(s?.referencesGeometry()??!1),this._referencesScale=this._referencesScale||(s?.referencesScale()??!1)})))}}}setHighlight(t,e){const i=this._getBlock(0);i.unsetComponentAllTexels(0,(1<<s.length)-1);for(const{displayId:s,highlightFlags:r}of t){if(null==s)continue;const t=a(s);i.setComponent(0,r,[t])}this._idsToHighlight.clear();for(const{objectId:s,highlightFlags:r}of t)this._idsToHighlight.set(s,r);for(const{objectId:s,highlightFlags:r}of e)this._idsToHighlight.set(s,r)}setData(t,e,i,s){const r=a(t);this._ensureSizeForTexel(r),this._getBlock(e).setData(t,i,s)}getData(t,e,i){return this._getBlock(e).getData(t,i)}getHighlightFlags(t){return this._idsToHighlight.get(t)||0}unsetAttributeData(t){const e=a(t);this._getBlock(0).setData(e,0,0)}setAttributeData(t,e,i){const s=a(t);this._ensureSizeForTexel(s),this._getBlock(0).setData(s,0,this.getFilterFlags(e));const r=this._attributeComputeInfo,o=1,h=4;let c=null;r&&(c=r.isSubtype?r.map.get(e.readAttribute(r.subtypeField)):r.map,c?.size&&c.forEach(((t,r)=>{const a=r*o%h,c=Math.floor(r*o/h),d=this._getBlock(c+n.VV);let u=t.field?.read(e,i);t.valueRepresentation&&(u=g(u,t.valueRepresentation));(null===u||isNaN(u)||u===1/0||u===-1/0)&&(u=l),d.setData(s,a,u)})))}get epoch(){return this._epoch}async sendUpdates(){const t=this._blocks.map((t=>null!=t?t.toMessage():null)),e=this._getInitArgs();has("esri-2d-log-updating")&&console.log("AttributeStore: _doSendUpdate.start"),await this._client.update({initArgs:e,blockData:t,version:this.version,sendUpdateEpoch:this._epoch},this._signal),this._epoch+=1,has("esri-2d-log-updating")&&console.log("AttributeStore: _doSendUpdate.end")}_ensureSizeForTexel(t){for(;t>=this._size*this._size;)if(this._expand())return}async _bind(t,e,i){const s=await t.createComputedField(e),{valueRepresentation:r}=e,n=this._attributeComputeInfo;if(n.isSubtype){const t=n.map.get(i)??new Map;t.set(e.binding,{field:s,valueRepresentation:r}),n.map.set(i,t)}else n.map.set(e.binding,{field:s,valueRepresentation:r});return s}_getInitArgs(){return this._initialized?null:(this._initialized=!0,this._getBlock(n.Animation),this._getBlock(n.GPGPU),{blockSize:this._size,blockDescriptors:this._blocks.map((t=>null!=t?{textureOnly:t.textureOnly,buffer:t.buffer,pixelType:t.pixelType}:null))})}_getBlock(t){const e=this._blocks[t];if(null!=e)return e;f(`Initializing AttributeBlock at index ${t}`);const i=new m(this._size,this._blockDescriptors[t],this._client.isLocal);return this._blocks[t]=i,this._initialized=!1,i}_expand(){if(this._size<this._schema.capabilities.maxTextureSize){const t=this._size<<=1;f("Expanding block size to",t,this._blocks);for(const e of this._blocks)e?.expand(t);return this._initialized=!1,this._size=t,0}return _().error(new t("mapview-limitations","Maximum number of onscreen features exceeded.")),-1}isVisible(t){return!!(this._getBlock(0).getData(t,0)&1<<s.length)}getFilterFlags(t){let e=0;for(let s=0;s<this._filters.length;s++){const i=!!(1<<s),r=this._filters[s];e|=(!i||null==r||r.check(t)?1:0)<<s}let i=0;if(this._idsToHighlight.size){const e=t.getObjectId();i=this.getHighlightFlags(e)}return e<<s.length|i}}export{b as AttributeStore,g as getVisualVariableSizeValueRepresentationRatio};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{numericHash as e}from"../../../../../core/string.js";import{createRendererExpression as r}from"../../../../../support/arcadeOnDemand.js";import{callExpressionWithCursor as t,callExpressionWithCursorWithDefault as s}from"../../../arcade/callExpressionWithCursor.js";import{AComputedField as a}from"./AComputedField.js";class c extends a{static async create(t,s){const a=await r(t,s.spatialReference,s.fields),i=e(t);return new c(a,i)}constructor(e,r){super(),this._compiled=e,this._cacheKey=r}resize(e){}read(e,r){return this.referencesScale()||"system"!==r.$view.timeZone?t(this._compiled,e,r):this._readCached(e,r)}readWithDefault(e,r,t){return this.referencesScale()||"system"!==r.$view.timeZone?s(this._compiled,e,r,t):this._readWithDefaultCached(e,r,t)}referencesScale(){return this._compiled?.referencesScale()??!1}referencesGeometry(){return this._compiled?.referencesGeometry()??!1}_readCached(e,r){if(e.setCache(this._cacheKey),e.hasCachedValue())return e.getCachedValue();const s=t(this._compiled,e,r);return e.setCachedValue(s),s}_readWithDefaultCached(e,r,t){if(e.setCache(this._cacheKey),e.hasCachedValue())return e.getCachedValue();const a=s(this._compiled,e,r,t);return e.setCachedValue(a),a}}export{c as ComputedExpression};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{createDisplayId as e}from"../../../engine/webgl/DisplayId.js";class t{constructor(e){this.data=e,this._referenceCount=0}increment(){this._referenceCount+=1}decrement(){this._referenceCount-=1}empty(){return 0===this._referenceCount}}class
|
|
5
|
+
import{createDisplayId as e}from"../../../engine/webgl/DisplayId.js";class t{constructor(e){this.data=e,this._referenceCount=0}increment(){this._referenceCount+=1}decrement(){this._referenceCount-=1}empty(){return 0===this._referenceCount}}class s{constructor(){this._freeIdsGenerationA=[],this._freeIdsGenerationB=[],this._idCounter=1,this._freeIds=this._freeIdsGenerationA,this._objectIdToDisplayId=new Map}createIdForObjectId(s){let r=this._objectIdToDisplayId.get(s);return r?r.increment():(r=new t(e(this._getFreeId(),!1)),r.increment(),this._objectIdToDisplayId.set(s,r)),r.data}releaseIdForObjectId(e){const t=this._objectIdToDisplayId.get(e);t&&(t.decrement(),t.empty()&&(this._objectIdToDisplayId.delete(e),this._freeIds.push(t.data)))}releaseAll(){for(const e of this._objectIdToDisplayId.values())this._freeIds.push(e.data);this._objectIdToDisplayId.clear()}incrementGeneration(){this._freeIds=this._freeIds===this._freeIdsGenerationA?this._freeIdsGenerationB:this._freeIdsGenerationA}_getFreeId(){return this._freeIds.length?this._freeIds.pop():this._idCounter++}}export{s as DisplayIdGenerator};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{StaticBitSet as t}from"./StaticBitSet.js";class a{constructor(a){this._valid=t.create(a),this._data=new Array(a)}has(t){return this._valid.has(t)}set(t,a){this._valid.set(t),this._data[t]=a}get(t){return this._data[t]}}export{a as FeatureSetCache};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../../geometry.js";import{ArcadeDate as e}from"../../../../../arcade/ArcadeDate.js";import has from"../../../../../core/has.js";import{assertIsSome as t}from"../../../../../core/maybe.js";import{DateOnly as r}from"../../../../../core/sql/DateOnly.js";import{TimeOnly as s}from"../../../../../core/sql/TimeOnly.js";import{GeometryCursor as i}from"../../../../../geometry/GeometryCursor.js";import{fromRectValues as
|
|
5
|
+
import"../../../../../geometry.js";import{ArcadeDate as e}from"../../../../../arcade/ArcadeDate.js";import has from"../../../../../core/has.js";import{assertIsSome as t}from"../../../../../core/maybe.js";import{DateOnly as r}from"../../../../../core/sql/DateOnly.js";import{TimeOnly as s}from"../../../../../core/sql/TimeOnly.js";import{GeometryCursor as i}from"../../../../../geometry/GeometryCursor.js";import{fromRectValues as a}from"../../../../../geometry/support/aaBoundingBox.js";import{getLabelPoint as o}from"../../../../../geometry/support/labelPoint.js";import{convertToGeometry as n,unquantizeOptimizedGeometry as d}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as u}from"../../../../../layers/graphics/OptimizedFeature.js";import h from"../../../../../layers/graphics/OptimizedGeometry.js";import{system as c,unknown as l}from"../../../../../time/timeZoneUtils.js";import{FeatureSetCache as m}from"./FeatureSetCache.js";import{StaticBitSet as f}from"./StaticBitSet.js";import{fromJSON as y}from"../../../../../geometry/support/jsonUtils.js";const p=has("featurelayer-simplify-thresholds")??[.5,.5,.5,.5],g=p[0],_=p[1],b=p[2],x=p[3],T=has("featurelayer-simplify-payload-size-factors")??[1,2,4],I=T[0],A=T[1],D=T[2],F=has("featurelayer-simplify-mobile-factor")??2,S=has("esri-mobile"),j=4294967295;function B(e,t,r){if(!(e.length>t))for(;e.length<=t;)e.push(r)}class C{constructor(e){this.metadata=e,this.type="FeatureSetReader",this._deleted=null,this._joined=[],this._objectIdToIndex=null,this._boundsBuffer=[],this._caches=new Map,this.arcadeDeclaredClass="esri.arcade.Feature",this._contextTimeZone=null}get isEmpty(){return null!=this._deleted&&this._deleted.countSet()===this.getSize()}getAreaSimplificationThreshold(e,t){let r=1;const s=S?F:1;t>4e6?r=D*s:t>1e6?r=A*s:t>5e5?r=I*s:t>1e5&&(r=s);let i=0;return e>4e3?i=x*r:e>2e3?i=b*r:e>100?i=_:e>15&&(i=g),i}parseTimestampOffset(e){return e}getBounds(e){if(B(this._boundsBuffer,4*this.getIndex()+4,0),this.getBoundsXMin()===j)return!1;if(0===this.getBoundsXMin()){const t=this.readGeometryWorldSpace();if(!t)return this.setBoundsXMin(j),!1;let r=1/0,s=1/0,i=-1/0,o=-1/0;return t.forEachVertex(((e,t)=>{r=Math.min(r,e),s=Math.min(s,t),i=Math.max(i,e),o=Math.max(o,t)})),this.setBoundsXMin(r),this.setBoundsYMin(s),this.setBoundsXMax(i),this.setBoundsYMax(o),a(e,r,s,i,o),!0}const t=this.getBoundsXMin(),r=this.getBoundsYMin(),s=this.getBoundsXMax(),i=this.getBoundsYMax();return a(e,t,r,s,i),!0}getBoundsXMin(){return this._boundsBuffer[4*this.getIndex()]}setBoundsXMin(e){this._boundsBuffer[4*this.getIndex()]=e}getBoundsYMin(){return this._boundsBuffer[4*this.getIndex()+1]}setBoundsYMin(e){this._boundsBuffer[4*this.getIndex()+1]=e}getBoundsXMax(){return this._boundsBuffer[4*this.getIndex()+2]}setBoundsXMax(e){this._boundsBuffer[4*this.getIndex()+2]=e}getBoundsYMax(){return this._boundsBuffer[4*this.getIndex()+3]}setBoundsYMax(e){this._boundsBuffer[4*this.getIndex()+3]=e}readAttributeAsTimestamp(e){const t=this.readAttribute(e);return"string"==typeof t?new Date(t).getTime():"number"==typeof t||null==t?t:null}readAttribute(e,t=!1){const r=this._readAttribute(e,t);if(void 0!==r)return r;for(const s of this._joined){s.setIndex(this.getIndex());const r=s._readAttribute(e,t);if(void 0!==r)return r}}readAttributes(){const e=this._readAttributes();for(const t of this._joined){t.setIndex(this.getIndex());const r=t._readAttributes();for(const t of Object.keys(r))e[t]=r[t]}return e}joinAttributes(e){this._joined.push(e)}removeIds(e){if(null==this._objectIdToIndex){const e=new Map,r=this.getCursor();for(;r.next();){const s=r.getObjectId();t(s),e.set(s,r.getIndex())}this._objectIdToIndex=e}const r=this._objectIdToIndex;for(const t of e.values())r.has(t)&&this._removeAtIndex(r.get(t))}readOptimizedFeatureWorldSpace(){const e=this.readGeometryWorldSpace(),t=this.readAttributes(),r=this.readCentroidWorldSpace(),s=new u(e,t,r);return s.objectId=this.getObjectId(),s.displayId=this.getDisplayId(),s}readLegacyFeatureForDisplay(){const e=this.readCentroidForDisplay();return{attributes:this.readAttributes(),geometry:this.readLegacyGeometryForDisplay(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyFeatureWorldSpace(){const e=this.readCentroidWorldSpace();return{attributes:this.readAttributes(),geometry:this._readLegacyGeometryWorldSpace(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyGeometryForDisplay(){const e=this.readGeometryForDisplay();return n(e,this.geometryType,!1,!1)}readXForDisplay(){return this._readX()}readYForDisplay(){return this._readY()}readXWorldSpace(){const e=this._readX(),t=this.getInTransform();return null==t?e:e*t.scale[0]+t.translate[0]}readYWorldSpace(){const e=this._readY(),t=this.getInTransform();return null==t?e:t.translate[1]-e*t.scale[1]}readGeometryForDisplay(){const e=this._readGeometryDeltaDecoded(!0);if(!e){const e=this._createGeometryFromServerCentroid();return e?e.deltaDecode():null}return e}readGeometryWorldSpace(){let e=this._readGeometry();if(e||(e=this._createGeometryFromServerCentroid()),!e)return null;const t=e.clone(),r=this.getInTransform();return null!=r&&d(t,t,this.hasZ,this.hasM,r),t}readCentroidForDisplay(){const e=this.readGeometryForDisplay();return e?this._computeDisplayCentroid(e):this._readServerCentroid()}readCentroidWorldSpace(){const e=this.readGeometryForDisplay(),t=e?this._computeDisplayCentroid(e):this._readServerCentroid();if(!t)return null;const r=t.clone(),s=this.getInTransform();return null!=s&&d(r,r,this.hasZ,this.hasM,s),r}setCache(e){let t=this._caches.get(e);null==t&&(t=new m(this.getSize()),this._caches.set(e,t)),this._activeCache=t}setCachedValue(e){this._activeCache.set(this.getIndex(),e)}hasCachedValue(){return this._activeCache.has(this.getIndex())}getCachedValue(){return this._activeCache.get(this.getIndex())}_readGeometryDeltaDecoded(e){const t=this._readGeometry(e);return"esriGeometryPoint"!==this.geometryType&&t&&this.getInTransform()?t.deltaDecode():t}get contextTimeZone(){return this._contextTimeZone}set contextTimeZone(e){this._contextTimeZone=e}readArcadeFeature(){return this}hasField(e){return this.fields.has(e)||this._joined.some((t=>t.hasField(e)))}geometry(){const e=this.readGeometryWorldSpace(),t=n(e,this.geometryType,this.hasZ,this.hasM),r=y(t);if(r){if(!this.metadata.spatialReference)throw new Error("InternalError: Expected spatial reference to be defined");r.spatialReference=this.metadata.spatialReference}return r}autocastArcadeDate(t,r){return r&&r instanceof Date?this.isUnknownDateTimeField(t)?e.unknownDateJSToArcadeDate(r):e.dateJSAndZoneToArcadeDate(r,this.contextTimeZone??c):r}isUnknownDateTimeField(e){return this.metadata.fieldsIndex.getTimeZone(e)===l}field(t){let i=this.fields.get(t);if(i)switch(i.type){case"date-only":case"esriFieldTypeDateOnly":return r.fromReader(this.readAttribute(t,!1));case"time-only":case"esriFieldTypeTimeOnly":return s.fromReader(this.readAttribute(t,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return e.fromReaderAsTimeStampOffset(this.readAttribute(t,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(t,this.readAttribute(t,!0));default:return this.readAttribute(t,!1)}for(const a of this._joined)if(a.setIndex(this.getIndex()),i=a.fields.get(t),i)switch(i.type){case"date-only":case"esriFieldTypeDateOnly":return r.fromReader(a._readAttribute(t,!1));case"time-only":case"esriFieldTypeTimeOnly":return s.fromReader(a._readAttribute(t,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return e.fromReaderAsTimeStampOffset(a._readAttribute(t,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(t,a._readAttribute(t,!0));default:return this.readAttribute(t,!1)}throw new Error(`Field ${t} does not exist`)}setField(e,t){throw new Error("Unable to update feature attribute values, feature is readonly")}keys(){return this.fields.fields.map((e=>e.name))}castToText(e=!1){if(!e)return JSON.stringify(this.readLegacyFeatureForDisplay());const t=this.readLegacyFeatureForDisplay();if(!t)return JSON.stringify(null);const r={geometry:t.geometry,attributes:{...t.attributes??{}}};for(const s in r.attributes){const e=r.attributes[s];e instanceof Date&&(r.attributes[s]=e.getTime())}return JSON.stringify(r)}gdbVersion(){return null}fullSchema(){return this.metadata.arcadeSchema}castAsJson(e=null){return{attributes:this._readAttributes(),geometry:!0===e?.keepGeometryType?this.geometry():this.geometry()?.toJSON()??null}}castAsJsonAsync(e=null,t=null){return Promise.resolve(this.castAsJson(t))}_getExists(){return null==this._deleted||!this._deleted.has(this.getIndex())}_computeDisplayCentroid(e){const t=i.fromOptimized(e,this.geometryType);t.yFactor*=-1;const r=o(t);return r?(r[1]*=-1,new h([],r)):null}copyInto(e){e._joined=this._joined,e._deleted=this._deleted,e._objectIdToIndex=this._objectIdToIndex,e._boundsBuffer=this._boundsBuffer,e._activeCache=this._activeCache,e._caches=this._caches}_readLegacyGeometryWorldSpace(){const e=this.readGeometryWorldSpace();return n(e,this.geometryType,!1,!1)}_createGeometryFromServerCentroid(){const e=this._readServerCentroid();if(!e)return null;const[t,r]=e.coords;return this._createQuantizedExtrudedGeometry(t,r)}_createQuantizedExtrudedGeometry(e,t){return"esriGeometryPolyline"===this.geometryType?this._createQuantizedExtrudedLine(e,t):this._createQuantizedExtrudedQuad(e,t)}_createQuantizedExtrudedQuad(e,t){return new h([5],[e-1,t,1,-1,1,1,-1,1,-1,-1])}_createQuantizedExtrudedLine(e,t){return new h([2],[e-1,t+1,1,-1])}_removeAtIndex(e){null==this._deleted&&(this._deleted=f.create(this.getSize())),this._deleted.set(e)}}export{C as FeatureSetReader};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../../core/Error.js";import t from"../../../../../core/Logger.js";import{assertIsSome as r}from"../../../../../core/maybe.js";import s from"../../../../../core/pbf.js";import n from"../../../../../layers/graphics/OptimizedGeometry.js";import{
|
|
5
|
+
import e from"../../../../../core/Error.js";import t from"../../../../../core/Logger.js";import{assertIsSome as r}from"../../../../../core/maybe.js";import s from"../../../../../core/pbf.js";import n from"../../../../../layers/graphics/OptimizedGeometry.js";import{FeatureSetCache as a}from"./FeatureSetCache.js";import{FeatureSetReader as i}from"./FeatureSetReader.js";import{parseHeader as h}from"./FeatureSetReaderPBFHeader.js";const o=!0,d=268435455,u=128,c=128e3,g={small:{delta:new Int32Array(u),decoded:new Int32Array(u)},large:{delta:new Int32Array(c),decoded:new Int32Array(c)}};function _(e){return e<=g.small.delta.length?g.small:(e<=g.large.delta.length||(g.large.delta=new Int32Array(Math.round(1.25*e)),g.large.decoded=new Int32Array(Math.round(1.25*e))),g.large)}function f(r){try{const e=2,t=new s(new Uint8Array(r),new DataView(r));for(;t.next();){if(t.tag()===e)return l(t.getMessage());t.skip()}}catch(n){const r=new e("query:parsing-pbf","Error while parsing FeatureSet PBF payload",{error:n});t.getLogger("esri.view.2d.layers.features.support.FeatureSetReaderPBF").error(r)}return null}function l(e){const t=1;for(;e.next();){if(e.tag()===t)return e.getMessage();e.skip()}return null}function I(e){const t=1,r=2,s=3,n=4,a=5,i=6,h=7,o=8,d=9,u=e.getLength(),c=e.pos()+u;for(;e.pos()<c&&e.next();)switch(e.tag()){case t:return e.getString();case r:return e.getFloat();case s:return e.getDouble();case n:return e.getSInt32();case a:return e.getUInt32();case i:return e.getInt64();case h:return e.getUInt64();case o:return e.getSInt64();case d:return e.getBool();default:return e.skip(),null}return null}function p(e,t,r,s,n,a){return.5*Math.abs(e*s+r*a+n*t-e*a-r*t-n*s)}function y(e,t,r,s){return 0===e*s-r*t&&e*r+t*s>0}class m extends i{static fromBuffer(e,t,r=!1){const s=t.geometryType,n=f(e),a=h(n,"esriGeometryPoint"===s,r);return new m(n,a,t)}constructor(e,t,r){super(r),this._hasNext=!1,this._isPoints=!1,this._featureIndex=-1,this._featureOffset=0,this._cache={area:0,unquantGeometry:void 0,geometry:void 0,centroid:void 0,legacyFeature:void 0,optFeature:void 0},this._parseCaches=new Array,this._geometryType=r.geometryType,this._reader=e,this._header=t,this._hasNext=t.hasFeatures,this._isPoints="esriGeometryPoint"===r.geometryType}get _size(){return this._header.featureCount}get fields(){return this._header.fields}get geometryType(){return this._geometryType}get hasZ(){return!1}get hasM(){return!1}get hasFeatures(){return this._header.hasFeatures}get hasNext(){return this._hasNext}get exceededTransferLimit(){return this._header.exceededTransferLimit}getSize(){return this._size}getInTransform(){return this._header.transform}getCursor(){return this.copy()}getIndex(){return this._featureIndex}setIndex(e){this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0,this._cache.centroid=void 0,this._cache.legacyFeature=void 0,this._cache.optFeature=void 0,this._featureIndex=e}getAttributeHash(){let e="";for(const t of this._header.fields.fields)e+=this._readAttributeAtIndex(t.index)+".";return e}getObjectId(){return this._readAttributeAtIndex(this._header.objectIdFieldIndex)}getDisplayId(){return this._header.displayIds[this._featureIndex]}setDisplayId(e){this._header.displayIds[this._featureIndex]=e}readGeometryArea(){return this._cache.area||this._readGeometry(!0),this._cache.area}copy(){const e=this._reader.clone(),t=new m(e,this._header,this.metadata);return this.copyInto(t),t}next(){for(this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0,this._cache.centroid=void 0,this._cache.legacyFeature=void 0,this._cache.optFeature=void 0;++this._featureIndex<this._size&&!this._getExists(););return this._featureIndex<this._size}_readX(){return this._header.centroid[2*this._featureIndex]}_readY(){return this._header.centroid[2*this._featureIndex+1]}_readServerCentroid(){const e=this._header.centroid[2*this._featureIndex],t=this._header.centroid[2*this._featureIndex+1];return e===d?null:new n([],[e,t])}_readGeometry(e=!1){if(void 0===this._cache.geometry){let r=null;if(this._isPoints){if(this._header.centroid[2*this._featureIndex]===d)return null;const e=this._header.centroid[2*this._featureIndex],t=this._header.centroid[2*this._featureIndex+1];r=new n([],[e,t])}else{const s=this._header.offsets.geometry[this._featureIndex],n=this._reader;if(0===s)return null;n.move(s);try{r=e?this._parseGeometryForDisplay(n):this._parseGeometry(n)}catch(t){return console.error("Failed to parse geometry!",t),null}}return 0===r?.coords.length&&(r=null),this._cache.geometry=r,r}return this._cache.geometry}_readAttribute(e,t){const r=this._header.fields.get(e);if(null==r)return;let s=this._readAttributeAtIndex(r.index);"esriFieldTypeTimestampOffset"===this.fields.get(e)?.type&&(s=this.parseTimestampOffset(s));const n=this._header.fields.isDateField(r.name);return t?null==s?s:n?new Date(s):s:s}_readAttributes(){const e={};for(const t of this._header.fields.fields)e[t.name]=this._readAttributeAtIndex(t.index);return e}copyInto(e){super.copyInto(e),e._featureIndex=this._featureIndex,e._featureOffset=this._featureOffset,e._hasNext=this._hasNext,e._parseCaches=this._parseCaches}_readAttributeAtIndex(e){let t=this._parseCaches[e];if(t||(t=new a(this.getSize()),this._parseCaches[e]=t),t.has(this._featureIndex))return t.get(this._featureIndex);const r=this._header.offsets.attributes[this._featureIndex*this._header.fieldCount+e],s=this._reader;s.move(r);const n=I(s);return t.set(this._featureIndex,n),n}_readGeometryDeltaDecoded(e=!1){if(void 0===this._cache.unquantGeometry){const t=this._readGeometry(e);if(!t)return this._cache.unquantGeometry=void 0,null;if(!this.getInTransform())return this._cache.unquantGeometry=t,t;const r=_(t.coords.length).decoded,s=t.clone(r),n=s.coords;let a=0;for(const e of s.lengths){for(let t=1;t<e;t++){const e=2*(a+t),r=2*(a+t-1);n[e]+=n[r],n[e+1]+=n[r+1]}a+=e}return this._cache.unquantGeometry=s,s}return this._cache.unquantGeometry}_parseGeometry(e){const t=2,r=3,s=e.asUnsafe(),a=s.getLength(),i=s.pos()+a,h=[],o=[];for(;s.pos()<i&&s.next();)switch(s.tag()){case t:{const e=s.getUInt32(),t=s.pos()+e;for(;s.pos()<t;)o.push(s.getUInt32());break}case r:{const e=s.getUInt32(),t=s.pos()+e;for(h.push(s.getSInt64()),h.push(s.getSInt64()),this.hasZ&&s.getSInt64(),this.hasM&&s.getSInt64();s.pos()<t;)h.push(s.getSInt64()),h.push(s.getSInt64()),this.hasZ&&s.getSInt64(),this.hasM&&s.getSInt64();break}default:s.skip()}return new n(o,h)}_parseGeometryForDisplay(e){const t=2,s=3,a=e.asUnsafe(),i=a.getLength(),h=a.pos()+i,d=[],u=[];let c=0,g=0,f=null,l=0;const I="esriGeometryPolygon"===this.geometryType;for(;a.pos()<h&&a.next();)switch(a.tag()){case t:{const e=a.getUInt32(),t=a.pos()+e;for(;a.pos()<t;){const e=a.getUInt32();d.push(e),c+=e}f=_(2*c).delta;break}case s:{a.getUInt32();const e=2+(this.hasZ?1:0)+(this.hasM?1:0);r(f);for(const t of d)if(g+e*t>f.length)for(let e=0;e<t;e++)a.getSInt32(),a.getSInt32(),this.hasZ&&a.getSInt32(),this.hasM&&a.getSInt32();else if(I&&o){const e=this.getAreaSimplificationThreshold(t,this._header.vertexCount);let r=2,s=1;const n=!1;let i=a.getSInt32(),h=a.getSInt32();f[g++]=i,f[g++]=h,this.hasZ&&a.getSInt32(),this.hasM&&a.getSInt32();let o=a.getSInt32(),d=a.getSInt32();for(this.hasZ&&a.getSInt32(),this.hasM&&a.getSInt32();r<t;){let t=a.getSInt32(),n=a.getSInt32();this.hasZ&&a.getSInt32(),this.hasM&&a.getSInt32();const u=i+o,c=h+d;p(i,h,u,c,u+t,c+n)>=e?(l+=-.5*(u-i)*(c+h),s>1&&y(f[g-2],f[g-1],o,d)?(f[g-2]+=o,f[g-1]+=d):(f[g++]=o,f[g++]=d,s++),i=u,h=c):(t+=o,n+=d),o=t,d=n,r++}s<3||n?g-=2*s:(l+=-.5*(i+o-i)*(h+d+h),y(f[g-2],f[g-1],o,d)?(f[g-2]+=o,f[g-1]+=d,u.push(s)):(f[g++]=o,f[g++]=d,u.push(++s)))}else{let e=0,r=a.getSInt32(),s=a.getSInt32();this.hasZ&&a.getSInt32(),this.hasM&&a.getSInt32(),f[g++]=r,f[g++]=s,e+=1;for(let n=1;n<t;n++){const t=a.getSInt32(),i=a.getSInt32(),h=r+t,o=s+i;l+=-.5*(h-r)*(o+s),this.hasZ&&a.getSInt32(),this.hasM&&a.getSInt32(),n>2&&y(f[g-2],f[g-1],t,i)?(f[g-2]+=t,f[g-1]+=i):(f[g++]=t,f[g++]=i,e+=1),r=h,s=o}u.push(e)}break}default:a.skip()}return this._cache.area=l,u.length?new n(u,f):null}}export{m as FeatureSetReaderPBF};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{deprecatedProperty as i}from"../core/deprecate.js";import s from"../core/Logger.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import{getActionIcon as l,getActionStyles as r}from"../support/actions/actionUtils.js";import a from"./Widget.js";import c from"./BasemapLayerList/BasemapLayerListViewModel.js";import d from"./BasemapLayerList/BasemapLayerListVisibleElements.js";import{css as m}from"./BasemapLayerList/css.js";import p from"./LayerList/ListItem.js";import{minFilterItems as u,getItem as h,getLayerType as g,getStatusIcon as b,getVisibilityIcon as f,sortableRoot as v,sortLayersToIds as _,sortChildLayersToIds as y,listItemHasChildren as I,canSortSublayers as E}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as L}from"./support/componentsUtils.js";import{globalCss as w}from"./support/globalCss.js";import{incrementHeadingLevel as F}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as C}from"./support/decorators/messageBundle.js";import{vmEvent as T}from"./support/decorators/vmEvent.js";import{tsx as M}from"./support/jsxFactory.js";const A=t.ofType(p),k="basemap",S=".*\\S+.*";let x=class extends a{constructor(e,t){super(e,t),this._activeItem=null,this._tooltipReferenceMap=new Map,this._editTitleInput=null,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusEditingFlowItem=!1,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this.collapsed=!1,this.dragEnabled=!1,this.editingTitle=!1,this.filterPlaceholder="",this.baseFilterText="",this.referenceFilterText="",this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.headingLevel=2,this.iconClass=m.widgetIcon,this.messages=null,this.messagesCommon=null,this.minFilterItems=u,this.selectedItems=new A,this.selectionMode="none",this.viewModel=new c,this.visibilityAppearance="default",this.visibleElements=new d,this._canMove=({dragEl:e,fromEl:t,toEl:i},s)=>{const n="pull"===s?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,o=h(e);if(!o?.sortable)return!1;const l=h(t),r=g(t),a=h(i),c=g(i),d=!!r&&!!c&&r===c,m={selected:o,from:l,to:a};return t.group&&i.group&&"function"==typeof n?n.call(null,m):d&&"sublayer"!==o?.layer?.type&&"map-image"!==l?.layer?.type&&"map-image"!==a?.layer?.type},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(m.item)));this._activeItem=h(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:s,dragEl:n,newIndex:o}=e;if(!s||!i||t?.newIndex===o&&t?.dragEl===n&&t?.toEl===i&&t?.fromEl===s)return;this._lastDragDetail=e;const l=s,r=i;if(l!==r)this._moveLayerFromChildList({toEl:r,fromEl:l,dragEl:n,newIndex:o});else{const e=Array.from(s.children).filter((e=>e?.matches("calcite-list-item"))).map((e=>e.value));this._sortLayers(l,e)}}}normalizeCtorArgs(e){return null!=e?.editingEnabled&&null!=e.visibleElements?{...e,visibleElements:new d({...e.visibleElements,editTitleButton:e.editingEnabled})}:e}loadDependencies(){return L({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group.js"),"action-menu":()=>import("@esri/calcite-components/dist/components/calcite-action-menu.js"),block:()=>import("@esri/calcite-components/dist/components/calcite-block.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),input:()=>import("@esri/calcite-components/dist/components/calcite-input.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}destroy(){this._tooltipReferenceMap.clear()}get _baseFilterEnabled(){return this.viewModel.totalBaseItems>=this.minFilterItems&&this.visibleElements.filter}get _referenceFilterEnabled(){return this.viewModel.totalReferenceItems>=this.minFilterItems&&this.visibleElements.filter}get basemapTitle(){return this.viewModel.basemapTitle}set basemapTitle(e){this.viewModel.basemapTitle=e}get baseListItemCreatedFunction(){return this.viewModel.baseListItemCreatedFunction}set baseListItemCreatedFunction(e){this.viewModel.baseListItemCreatedFunction=e}get editingEnabled(){return i(s.getLogger(this),"editingEnabled",{replacement:"selectionMode, dragEnabled, visibleElements.editTitleButton",version:"4.29",warnOnce:!0}),"none"!==this.selectionMode&&this.dragEnabled&&this.visibleElements.editTitleButton}set editingEnabled(e){i(s.getLogger(this),"editingEnabled",{replacement:"selectionMode, dragEnabled, visibleElements.editTitleButton",version:"4.29",warnOnce:!0}),this.dragEnabled=e,this.visibleElements.editTitleButton=e,this.selectionMode=e?this.multipleSelectionEnabled?"multiple":"single":"none"}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get multipleSelectionEnabled(){return i(s.getLogger(this),"multipleSelectionEnabled",{replacement:"selectionMode",version:"4.29",warnOnce:!0}),"multiple"===this.selectionMode}set multipleSelectionEnabled(e){i(s.getLogger(this),"multipleSelectionEnabled",{replacement:"selectionMode",version:"4.29",warnOnce:!0}),this.selectionMode=e?"multiple":this.editingEnabled?"single":"none"}get referenceListItemCreatedFunction(){return this.viewModel.referenceListItemCreatedFunction}set referenceListItemCreatedFunction(e){this.viewModel.referenceListItemCreatedFunction=e}get baseItems(){return this.viewModel.baseItems}get referenceItems(){return this.viewModel.referenceItems}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const{state:e}=this.viewModel,t={[w.hidden]:"loading"===e,[w.disabled]:"disabled"===e};return M("div",{class:this.classes(m.base,w.widget,w.panel,t)},this._renderItems())}_renderItemTooltip(e){return e?M("calcite-tooltip",{key:`tooltip-${e.layer.uid}`,referenceElement:this._tooltipReferenceMap.get(e.layer.uid)},this.messages.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(e){return e?.toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderPanelFlowItems(e){return e?e.flatten((e=>e.children)).filter((e=>!e.hidden)).toArray().filter((({panel:e})=>e?.open&&!e.disabled&&e.flowEnabled)).map((({title:e,panel:t})=>{const i=()=>this._handlePanelFlowItemBack(t);return M("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:e,heading:t.title,headingLevel:this.headingLevel,key:`flow-panel-${t.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),i()}},t.render(),M("calcite-button",{appearance:"transparent",onclick:i,slot:"footer-actions",width:"full"},this.messagesCommon.back))})):[]}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusEditingFlowItemNode(e){this._focusEditingFlowItem&&(this._focusEditingFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_renderItemMessage(e){return e.error?M("div",{class:m.itemMessage,key:"esri-layer-list__error",slot:"content-bottom"},M("calcite-notice",{icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",width:"full"},M("div",{slot:"message"},this.messages.layerError))):e.incompatible?M("div",{class:m.itemMessage,key:"esri-layer-list__incompatible",slot:"content-bottom"},M("calcite-notice",{afterCreate:t=>this._setTooltipReference(t,e),afterRemoved:()=>this._removeTooltipReference(e),icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",tabIndex:0,width:"full"},M("div",{slot:"message"},this.messages.layerIncompatible))):null}_renderItem(e,t,i,s,n){const{_activeItem:o,_selectedDragItemLayerUid:l,selectionMode:r,selectedItems:a,messages:c}=this,d=e.title||c.untitledLayer,p=e.visibleAtCurrentScale?d:`${d} (${c.layerInvisibleAtScale})`,u=this._filterActions(e.actionsSections),h=this._countActions(u);return M("calcite-list-item",{afterCreate:t=>this._focusSelectedDragEl(t,e),afterUpdate:t=>this._focusSelectedDragEl(t,e),class:this.classes(m.item,{[m.itemActive]:o===e}),"data-item":e,dragDisabled:!e.sortable||i,dragSelected:e.layer.uid===l,id:e.layer.uid,key:`list-item-${e.layer.uid}`,label:d,metadata:{parentTitles:n,title:d},open:e.open,selected:"none"!==r&&a.includes(e),title:p,value:e.layer.uid,onCalciteListItemDragHandleChange:t=>this._handleCalciteListItemDragHandleChange(t,e),onCalciteListItemSelect:t=>this._handleCalciteListItemSelect(t,e,s),onCalciteListItemToggle:t=>this._handleCalciteListItemToggle(t,e)},M("div",{class:this.classes({[m.itemContent]:!0,[m.itemInvisibleAtScale]:!e.visibleAtCurrentScale}),slot:"content"},d),this._renderItemStatus(e,s),this._renderItemToggle(e,s),this._renderItemTemporaryIcon(e),this._renderChildList(e,t,n),this._renderItemMessage(e),this._renderPanel(e.panel),this._renderPanelAction(e.panel),h>1?this._renderActionsSections(e,u):1===h?this._renderAction({item:e,action:this._getSingleActionButton(u),textEnabled:!1}):null)}_renderItemStatus(e,t){const{visibleElements:i}=this;if(!i.statusIndicators)return null;const{connectionStatus:s,publishing:n,updating:o}=e,l=o&&!t,r=!!s;return M("calcite-icon",{class:this.classes({[m.statusIndicator]:!0,[m.publishing]:n,[m.updating]:l,[m.connectionStatus]:r,[m.connectionStatusConnected]:r&&"connected"===s}),icon:b({connectionStatus:s,publishing:n}),key:"layer-item-status",scale:"s",slot:"actions-end"})}_renderItemTemporaryIcon(e){return this.visibleElements.temporaryLayerIndicators&&"persistenceEnabled"in e.layer&&!e.layer.persistenceEnabled?M("calcite-icon",{class:m.itemTemporaryIcon,icon:"temporary",key:"temporary-icon",scale:"s",slot:"actions-start",title:this.messages.temporary}):null}_renderItemToggle(e,t){const{messages:i,visibilityAppearance:s}=this,{visible:n}=e,o=t?.visibilityMode;if("inherited"===o)return null;const l=f({visible:n,exclusive:"exclusive"===o,visibilityAppearance:s}),r="checkbox"===s;return M("calcite-action",{appearance:"transparent",class:m.visibleToggle,icon:r?l:void 0,key:"visibility-toggle",onclick:()=>this._toggleVisibility(e,t),scale:"s",slot:r?"actions-start":"actions-end",text:i.layerVisibility,title:i.layerVisibility},r?null:M("calcite-icon",{class:this.classes({[m.visibleIcon]:"exclusive"!==o&&n}),icon:l,scale:"s"}))}_renderPanel(e){return!e?.open||e.disabled||e.flowEnabled?null:M("div",{class:m.itemContentBottom,key:`content-panel-${e.uid}`,slot:"content-bottom"},e.render())}_renderPanelAction(e){if(!e?.visible)return null;const{open:t,title:i,disabled:s}=e;return M("calcite-action",{active:t,appearance:"transparent",disabled:s,icon:l(e),key:`action-${e.uid}`,onclick:()=>this._togglePanel(e),scale:"s",slot:"actions-end",text:i??"",title:i??void 0},this._renderFallbackIcon(e))}_renderActionsSections(e,t){return M("calcite-action-menu",{appearance:"transparent",key:"item-action-menu",label:this.messagesCommon.menu,open:e.actionsOpen,overlayPositioning:"fixed",placement:"bottom-end",scale:"s",slot:"actions-end",onCalciteActionMenuOpen:t=>e.actionsOpen=t.target.open},M("calcite-action",{appearance:"transparent",icon:"ellipsis",scale:"s",slot:"trigger",text:this.messagesCommon.options,title:this.messagesCommon.options}),t.toArray().map(((t,i)=>this._renderActionSection(e,t,i))))}_renderActionSection(e,t,i){return M("calcite-action-group",{key:`action-section-${i}`},t.toArray().map((t=>this._renderAction({item:e,action:t,textEnabled:!0}))))}_renderFallbackIcon(e){const{className:t,icon:i}=e;if(i)return null;const s="image"in e?e.image:void 0,n={[m.itemActionIcon]:!!t,[m.itemActionImage]:!!s};return t&&(n[t]=!0),s||t?M("span",{"aria-hidden":"true",class:this.classes(m.itemActionIcon,n),key:"icon",styles:r(s)}):null}_renderAction(e){const{item:t,action:i,textEnabled:s}=e,{active:n,disabled:o,title:r,type:a,indicator:c}=i;return M("calcite-action",{active:"toggle"===a&&i.value,appearance:"transparent",disabled:o,icon:l(i),indicator:c,key:`action-${i.uid}`,loading:n,onclick:()=>this._triggerAction(t,i),scale:"s",slot:s?void 0:"actions-end",text:r??"",textEnabled:s,title:r??void 0},this._renderFallbackIcon(i))}_setTooltipReference(e,t){this._tooltipReferenceMap.set(t.layer.uid,e)}_removeTooltipReference(e){this._tooltipReferenceMap.delete(e.layer.uid)}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:s}){const n=h(i),o=h(e),l=h(t),r=j(t),a=j(e);r&&a&&this.viewModel.moveListItem({targetItem:n,fromParentItem:l,toParentItem:o,newIndex:s,from:r,to:a})}_handleCalciteListDragEnd(e){const{fromEl:t,dragEl:i,oldIndex:s}=e;t.insertBefore(i,t.children[s])}_sortLayers(e,t){if(e)if(e.group===v){const i=j(e),s="base"===i?this.view?.map?.basemap?.baseLayers:"reference"===i?this.view?.map?.basemap?.referenceLayers:null;_(s,t)}else{const i=h(e);if(!i)return;y(i,t)}}_getSingleActionButton(e){return e.reduce((e=>e)).filter((e=>e&&"button"===e.type)).at(0)}_filterActions(e){return e.map((e=>e.filter((e=>e.visible))))}_countActions(e){return e.reduce(((e,t)=>e+t.length),0)}_triggerAction(e,t){t&&e&&("toggle"===t.type&&(t.value=!t.value),this.triggerAction(t,e))}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const s=e.target.selectedItems.map((e=>h(e))).filter(Boolean);i.removeAll(),i.addMany(s)}_handleCalciteListItemToggle(e,t){e.stopPropagation(),t.open=e.target.open}_focusSelectedDragEl(e,t){this._selectedDragItemLayerUid===t.layer.uid&&requestAnimationFrame((()=>e?.setFocus()))}_handleCalciteListItemDragHandleChange(e,t){e.stopPropagation();const i=e.target.dragSelected;this._selectedDragItemLayerUid=i?t.layer.uid:null}_handleCalciteListItemSelect(e,t,i){h(e.target)===t&&"none"===this.selectionMode&&"inherited"!==i?.visibilityMode&&this._toggleVisibility(t,i)}_togglePanel(e){e.open=!e.open,e.open&&(this._focusPanelFlowItem=!0)}_toggleVisibility(e,t){if(!e)return;const i=t?.visibilityMode;"exclusive"===i&&e.visible||(e.visible=!e.visible)}_renderEditingInput(){const{messages:e}=this,{basemapTitle:t}=this.viewModel;return M("div",{class:m.editing},M("calcite-label",null,e.basemapTitle,M("calcite-input",{afterCreate:e=>this._editTitleInput=e,label:e.basemapTitle,name:"basemaptitle",pattern:S,placeholder:e.basemapTitle,required:!0,title:e.basemapTitle,type:"text",value:t??void 0})))}_renderCancelButton(){const{messagesCommon:{cancel:e}}=this;return M("calcite-button",{appearance:"outline",bind:this,label:e,onclick:this._toggleEditingTitle,slot:"footer",title:e,width:"half"},e)}_renderSubmitButton(){const{messagesCommon:e}=this;return M("calcite-button",{label:e.form.submit,slot:"footer",title:e.form.submit,type:"submit",width:"half"},e.form.ok)}_renderEditingForm(){return this.editingTitle?M("form",{bind:this,onsubmit:this._formSubmit},M("calcite-flow-item",{afterCreate:this._focusEditingFlowItemNode,afterUpdate:this._focusEditingFlowItemNode,bind:this,heading:this.visibleElements.heading?this.messages.basemapTitle:void 0,headingLevel:this.headingLevel,onCalciteFlowItemBack:e=>{e.preventDefault(),this._toggleEditingTitle()}},this._renderEditingInput(),this._renderCancelButton(),this._renderSubmitButton())):null}_renderEditTitleButton(){const{editingTitle:e,visibleElements:{editTitleButton:t},messagesCommon:{edit:i}}=this;return t&&!e?M("calcite-action",{bind:this,icon:"pencil",label:i,onclick:this._toggleEditingTitle,slot:"header-actions-end",text:i,title:i}):null}_renderNoLayersInfoMessage(e){return M("div",{slot:"message"},e)}_renderNoLayersInfo(e,t){return M("div",{class:m.itemMessage},M("calcite-notice",{icon:"information",key:t,kind:"info",open:!0,scale:"m",width:"full"},this._renderNoLayersInfoMessage(e)))}_getFilteredItems(e){return e?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)))}_renderItems(){const{collapsed:e,visible:t,visibleElements:{closeButton:i,collapseButton:s,heading:n,flow:o},messages:l,viewModel:r,referenceItems:a,baseItems:c}=this,d=this.visibleElements.referenceLayers?this._getFilteredItems(a):null,m=this.visibleElements.baseLayers?this._getFilteredItems(c):null,p=[M("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:i,closed:!t,collapsed:e,collapsible:s,heading:n?r.basemapTitle??l.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",onCalciteFlowItemClose:()=>this.visible=!1},this._renderEditTitleButton(),this._renderReferenceSection(d),this._renderBaseSection(m,1===m?.length)),this._renderEditingForm(),this._renderPanelFlowItems(m),this._renderPanelFlowItems(d)];return t?[o?M("calcite-flow",{key:"root-flow"},p):p,this._renderItemTooltips(d),this._renderItemTooltips(m)]:null}_renderChildList(e,t,i=[]){const{dragEnabled:s}=this,{children:n}=e,o=I(e),l=!o&&s&&"group"===e.layer?.type;return o||l?M("calcite-list",{canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),"data-basemap-layer-type":t,"data-item":e,"data-layer-type":k,dragEnabled:!!s&&(e.childrenSortable&&E(e)),group:e.layer.uid},n?.filter((e=>!e.hidden)).toArray().map((s=>this._renderItem(s,t,!1,e,[...i,e.title])))):null}_renderList(e,t,i){const{messages:s,dragEnabled:n,selectionMode:o,filterPlaceholder:l,baseFilterText:r,referenceFilterText:a,_baseFilterEnabled:c,_referenceFilterEnabled:d}=this,p="reference"===t?s.noReferenceLayers:s.noBaseLayers,u="reference"===t?d:c;return M("calcite-block",{class:m.section,collapsible:!0,heading:"reference"===t?s.referenceHeading:s.baseHeading,headingLevel:F(this.headingLevel),key:`block-${t}`,open:!0},0===e?.length?this._renderNoLayersInfo(p,t):null,M("calcite-list",{afterCreate:e=>{e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),"data-basemap-layer-type":t,"data-layer-type":k,dragEnabled:n,filterEnabled:u,filterPlaceholder:l,filterText:"reference"===t?a:r,group:v,key:`list-${t}`,label:s.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:o,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this["reference"===t?"referenceFilterText":"baseFilterText"]=e.target?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},e?.toArray().map((e=>this._renderItem(e,t,i))),e?.length&&u?M("div",{class:m.filterNoResults,slot:"filter-no-results"},M("calcite-notice",{kind:"info",open:!0,scale:"m",width:"full"},this._renderNoLayersInfoMessage(p))):null))}_renderBaseSection(e,t){return this.visibleElements.baseLayers?this._renderList(e,"base",t):null}_renderReferenceSection(e){return this.visibleElements.referenceLayers?this._renderList(e,"reference",!1):null}_toggleEditingTitle(){const{editingTitle:e}=this,t=!e;this.editingTitle=t,t?this._focusEditingFlowItem=!0:this._focusRootFlowItem=!0}_formSubmit(e){e.preventDefault();const t=this._editTitleInput?.value;t?.trim()&&(this.basemapTitle=t),this._toggleEditingTitle()}};function j(e){return e?.getAttribute("data-basemap-layer-type")}e([n()],x.prototype,"_activeItem",void 0),e([n()],x.prototype,"_tooltipReferenceMap",void 0),e([n()],x.prototype,"_focusRootFlowItem",void 0),e([n()],x.prototype,"_focusPanelFlowItem",void 0),e([n()],x.prototype,"_focusEditingFlowItem",void 0),e([n()],x.prototype,"_baseFilterEnabled",null),e([n()],x.prototype,"_referenceFilterEnabled",null),e([n()],x.prototype,"basemapTitle",null),e([n()],x.prototype,"collapsed",void 0),e([n()],x.prototype,"dragEnabled",void 0),e([n()],x.prototype,"editingTitle",void 0),e([n()],x.prototype,"filterPlaceholder",void 0),e([n()],x.prototype,"baseFilterText",void 0),e([n()],x.prototype,"referenceFilterText",void 0),e([n()],x.prototype,"listItemCanGiveFunction",void 0),e([n()],x.prototype,"listItemCanReceiveFunction",void 0),e([n()],x.prototype,"baseListItemCreatedFunction",null),e([n()],x.prototype,"editingEnabled",null),e([n()],x.prototype,"headingLevel",void 0),e([n()],x.prototype,"iconClass",void 0),e([n()],x.prototype,"label",null),e([n(),C("esri/widgets/BasemapLayerList/t9n/BasemapLayerList")],x.prototype,"messages",void 0),e([n(),C("esri/t9n/common")],x.prototype,"messagesCommon",void 0),e([n()],x.prototype,"minFilterItems",void 0),e([n()],x.prototype,"multipleSelectionEnabled",null),e([n()],x.prototype,"referenceListItemCreatedFunction",null),e([n({readOnly:!0})],x.prototype,"baseItems",null),e([n({readOnly:!0})],x.prototype,"referenceItems",null),e([n()],x.prototype,"selectedItems",void 0),e([n()],x.prototype,"selectionMode",void 0),e([n()],x.prototype,"view",null),e([T("trigger-action"),n({type:c})],x.prototype,"viewModel",void 0),e([n()],x.prototype,"visibilityAppearance",void 0),e([n({type:d,nonNullable:!0})],x.prototype,"visibleElements",void 0),x=e([o("esri.widgets.BasemapLayerList")],x);const B=x;export{B as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{deprecatedProperty as i}from"../core/deprecate.js";import s from"../core/Logger.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import{getActionIcon as l,getActionStyles as r}from"../support/actions/actionUtils.js";import a from"./Widget.js";import c from"./BasemapLayerList/BasemapLayerListViewModel.js";import d from"./BasemapLayerList/BasemapLayerListVisibleElements.js";import{css as m}from"./BasemapLayerList/css.js";import p from"./LayerList/ListItem.js";import{minFilterItems as u,getItem as h,getLayerType as g,getStatusIcon as b,getVisibilityIcon as f,sortableRoot as v,sortLayersToIds as _,sortChildLayersToIds as y,listItemHasChildren as I,canSortSublayers as E}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as L}from"./support/componentsUtils.js";import{globalCss as w}from"./support/globalCss.js";import{incrementHeadingLevel as F}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as C}from"./support/decorators/messageBundle.js";import{vmEvent as T}from"./support/decorators/vmEvent.js";import{tsx as M}from"./support/jsxFactory.js";const A=t.ofType(p),k="basemap",S=".*\\S+.*";let x=class extends a{constructor(e,t){super(e,t),this._activeItem=null,this._tooltipReferenceMap=new Map,this._editTitleInput=null,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusEditingFlowItem=!1,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this.collapsed=!1,this.dragEnabled=!1,this.editingTitle=!1,this.filterPlaceholder="",this.baseFilterText="",this.referenceFilterText="",this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.headingLevel=2,this.iconClass=m.widgetIcon,this.messages=null,this.messagesCommon=null,this.minFilterItems=u,this.selectedItems=new A,this.selectionMode="none",this.viewModel=new c,this.visibilityAppearance="default",this.visibleElements=new d,this._canMove=({dragEl:e,fromEl:t,toEl:i},s)=>{const n="pull"===s?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,o=h(e);if(!o?.sortable)return!1;const l=h(t),r=g(t),a=h(i),c=g(i),d=!!r&&!!c&&r===c,m={selected:o,from:l,to:a};return t.group&&i.group&&"function"==typeof n?n.call(null,m):d&&"sublayer"!==o?.layer?.type&&"map-image"!==l?.layer?.type&&"map-image"!==a?.layer?.type},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(m.item)));this._activeItem=h(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:s,dragEl:n,newIndex:o}=e;if(!s||!i||t?.newIndex===o&&t?.dragEl===n&&t?.toEl===i&&t?.fromEl===s)return;this._lastDragDetail=e;const l=s,r=i;if(l!==r)this._moveLayerFromChildList({toEl:r,fromEl:l,dragEl:n,newIndex:o});else{const e=Array.from(s.children).filter((e=>e?.matches("calcite-list-item"))).map((e=>e.value));this._sortLayers(l,e)}}}normalizeCtorArgs(e){return null!=e?.editingEnabled&&null!=e.visibleElements?{...e,visibleElements:new d({...e.visibleElements,editTitleButton:e.editingEnabled})}:e}loadDependencies(){return L({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group.js"),"action-menu":()=>import("@esri/calcite-components/dist/components/calcite-action-menu.js"),block:()=>import("@esri/calcite-components/dist/components/calcite-block.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),input:()=>import("@esri/calcite-components/dist/components/calcite-input.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}destroy(){this._tooltipReferenceMap.clear()}get _baseFilterEnabled(){return this.viewModel.totalBaseItems>=this.minFilterItems&&this.visibleElements.filter}get _referenceFilterEnabled(){return this.viewModel.totalReferenceItems>=this.minFilterItems&&this.visibleElements.filter}get basemapTitle(){return this.viewModel.basemapTitle}set basemapTitle(e){this.viewModel.basemapTitle=e}get baseListItemCreatedFunction(){return this.viewModel.baseListItemCreatedFunction}set baseListItemCreatedFunction(e){this.viewModel.baseListItemCreatedFunction=e}get editingEnabled(){return i(s.getLogger(this),"editingEnabled",{replacement:"selectionMode, dragEnabled, visibleElements.editTitleButton",version:"4.29",warnOnce:!0}),"none"!==this.selectionMode&&this.dragEnabled&&this.visibleElements.editTitleButton}set editingEnabled(e){i(s.getLogger(this),"editingEnabled",{replacement:"selectionMode, dragEnabled, visibleElements.editTitleButton",version:"4.29",warnOnce:!0}),this.dragEnabled=e,this.visibleElements.editTitleButton=e,this.selectionMode=e?this.multipleSelectionEnabled?"multiple":"single":"none"}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get multipleSelectionEnabled(){return i(s.getLogger(this),"multipleSelectionEnabled",{replacement:"selectionMode",version:"4.29",warnOnce:!0}),"multiple"===this.selectionMode}set multipleSelectionEnabled(e){i(s.getLogger(this),"multipleSelectionEnabled",{replacement:"selectionMode",version:"4.29",warnOnce:!0}),this.selectionMode=e?"multiple":this.editingEnabled?"single":"none"}get referenceListItemCreatedFunction(){return this.viewModel.referenceListItemCreatedFunction}set referenceListItemCreatedFunction(e){this.viewModel.referenceListItemCreatedFunction=e}get baseItems(){return this.viewModel.baseItems}get referenceItems(){return this.viewModel.referenceItems}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const{state:e}=this.viewModel,t={[w.hidden]:"loading"===e,[w.disabled]:"disabled"===e};return M("div",{class:this.classes(m.base,w.widget,w.panel,t)},this._renderItems())}_renderItemTooltip(e){return e?M("calcite-tooltip",{key:`tooltip-${e.layer.uid}`,referenceElement:this._tooltipReferenceMap.get(e.layer.uid)},this.messages.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(e){return e?.toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderPanelFlowItems(e){return e?e.flatten((e=>e.children)).filter((e=>!e.hidden)).toArray().filter((({panel:e})=>e?.open&&!e.disabled&&e.flowEnabled)).map((({title:e,panel:t})=>{const i=()=>this._handlePanelFlowItemBack(t);return M("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:e,heading:t.title,headingLevel:this.headingLevel,key:`flow-panel-${t.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),i()}},t.render(),M("calcite-button",{appearance:"transparent",onclick:i,slot:"footer-actions",width:"full"},this.messagesCommon.back))})):[]}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusEditingFlowItemNode(e){this._focusEditingFlowItem&&(this._focusEditingFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_renderItemMessage(e){return e.error?M("div",{class:m.itemMessage,key:"esri-layer-list__error",slot:"content-bottom"},M("calcite-notice",{icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",width:"full"},M("div",{slot:"message"},this.messages.layerError))):e.incompatible?M("div",{class:m.itemMessage,key:"esri-layer-list__incompatible",slot:"content-bottom"},M("calcite-notice",{afterCreate:t=>this._setTooltipReference(t,e),afterRemoved:()=>this._removeTooltipReference(e),icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",tabIndex:0,width:"full"},M("div",{slot:"message"},this.messages.layerIncompatible))):null}_renderItem(e,t,i,s,n){const{_activeItem:o,_selectedDragItemLayerUid:l,selectionMode:r,selectedItems:a,messages:c}=this,d=e.title||c.untitledLayer,p=e.visibleAtCurrentScale?d:`${d} (${c.layerInvisibleAtScale})`,u=this._filterActions(e.actionsSections),h=this._countActions(u);return M("calcite-list-item",{afterCreate:t=>this._focusSelectedDragEl(t,e),afterUpdate:t=>this._focusSelectedDragEl(t,e),class:this.classes(m.item,{[m.itemActive]:o===e}),"data-item":e,dragDisabled:!e.sortable||i,dragSelected:e.layer.uid===l,id:e.layer.uid,key:`list-item-${e.layer.uid}`,label:d,metadata:{parentTitles:n,title:d},open:e.open,selected:"none"!==r&&a.includes(e),title:p,value:e.layer.uid,onCalciteListItemDragHandleChange:t=>this._handleCalciteListItemDragHandleChange(t,e),onCalciteListItemSelect:t=>this._handleCalciteListItemSelect(t,e,s),onCalciteListItemToggle:t=>this._handleCalciteListItemToggle(t,e)},M("div",{class:this.classes({[m.itemContent]:!0,[m.itemInvisibleAtScale]:!e.visibleAtCurrentScale}),slot:"content"},d),this._renderItemStatus(e,s),this._renderItemToggle(e,s),this._renderItemTemporaryIcon(e),this._renderChildList(e,t,n),this._renderItemMessage(e),this._renderPanel(e.panel),this._renderPanelAction(e.panel),h>1?this._renderActionsSections(e,u):1===h?this._renderAction({item:e,action:this._getSingleActionButton(u),textEnabled:!1}):null)}_renderItemStatus(e,t){const{visibleElements:i}=this;if(!i.statusIndicators)return null;const{connectionStatus:s,publishing:n,updating:o}=e,l=o&&!t,r=!!s;return M("calcite-icon",{class:this.classes({[m.statusIndicator]:!0,[m.publishing]:n,[m.updating]:l,[m.connectionStatus]:r,[m.connectionStatusConnected]:r&&"connected"===s}),icon:b({connectionStatus:s,publishing:n}),key:"layer-item-status",scale:"s",slot:"actions-end"})}_renderItemTemporaryIcon(e){return this.visibleElements.temporaryLayerIndicators&&"persistenceEnabled"in e.layer&&!e.layer.persistenceEnabled?M("calcite-icon",{class:m.itemTemporaryIcon,icon:"temporary",key:"temporary-icon",scale:"s",slot:"actions-start",title:this.messages.temporary}):null}_renderItemToggle(e,t){const{messages:i,visibilityAppearance:s}=this,{visible:n}=e,o=t?.visibilityMode;if("inherited"===o)return null;const l=f({visible:n,exclusive:"exclusive"===o,visibilityAppearance:s}),r="checkbox"===s;return M("calcite-action",{appearance:"transparent",class:m.visibleToggle,icon:r?l:void 0,key:"visibility-toggle",onclick:()=>this._toggleVisibility(e,t),scale:"s",slot:r?"actions-start":"actions-end",text:i.layerVisibility,title:i.layerVisibility},r?null:M("calcite-icon",{class:this.classes({[m.visibleIcon]:"exclusive"!==o&&n}),icon:l,scale:"s"}))}_renderPanel(e){return!e?.open||e.disabled||e.flowEnabled?null:M("div",{class:m.itemContentBottom,key:`content-panel-${e.uid}`,slot:"content-bottom"},e.render())}_renderPanelAction(e){if(!e?.visible)return null;const{open:t,title:i,disabled:s}=e;return M("calcite-action",{active:t,appearance:"transparent",disabled:s,icon:l(e),key:`action-${e.uid}`,onclick:()=>this._togglePanel(e),scale:"s",slot:"actions-end",text:i??"",title:i??void 0},this._renderFallbackIcon(e))}_renderActionsSections(e,t){return M("calcite-action-menu",{appearance:"transparent",key:"item-action-menu",label:this.messagesCommon.menu,open:e.actionsOpen,overlayPositioning:"fixed",placement:"bottom-end",scale:"s",slot:"actions-end",onCalciteActionMenuOpen:t=>e.actionsOpen=t.target.open},M("calcite-action",{appearance:"transparent",icon:"ellipsis",scale:"s",slot:"trigger",text:this.messagesCommon.options,title:this.messagesCommon.options}),t.toArray().map(((t,i)=>this._renderActionSection(e,t,i))))}_renderActionSection(e,t,i){return M("calcite-action-group",{key:`action-section-${i}`},t.toArray().map((t=>this._renderAction({item:e,action:t,textEnabled:!0}))))}_renderFallbackIcon(e){const{className:t,icon:i}=e;if(i)return null;const s="image"in e?e.image:void 0,n={[m.itemActionIcon]:!!t,[m.itemActionImage]:!!s};return t&&(n[t]=!0),s||t?M("span",{"aria-hidden":"true",class:this.classes(m.itemActionIcon,n),key:"icon",styles:r(s)}):null}_renderAction(e){const{item:t,action:i,textEnabled:s}=e,{active:n,disabled:o,title:r,type:a,indicator:c}=i;return M("calcite-action",{active:"toggle"===a&&i.value,appearance:"transparent",disabled:o,icon:l(i),indicator:c,key:`action-${i.uid}`,loading:n,onclick:()=>this._triggerAction(t,i),scale:"s",slot:s?void 0:"actions-end",text:r??"",textEnabled:s,title:r??void 0},this._renderFallbackIcon(i))}_setTooltipReference(e,t){this._tooltipReferenceMap.set(t.layer.uid,e)}_removeTooltipReference(e){this._tooltipReferenceMap.delete(e.layer.uid)}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:s}){const n=h(i),o=h(e),l=h(t),r=j(t),a=j(e);r&&a&&this.viewModel.moveListItem({targetItem:n,fromParentItem:l,toParentItem:o,newIndex:s,from:r,to:a})}_handleCalciteListDragEnd(e){const{fromEl:t,dragEl:i,oldIndex:s}=e;t.insertBefore(i,t.children[s])}_sortLayers(e,t){if(e)if(e.group===v){const i=j(e),s="base"===i?this.view?.map?.basemap?.baseLayers:"reference"===i?this.view?.map?.basemap?.referenceLayers:null;_(s,t)}else{const i=h(e);if(!i)return;y(i,t)}}_getSingleActionButton(e){return e.reduce((e=>e)).filter((e=>e&&"button"===e.type)).at(0)}_filterActions(e){return e.map((e=>e.filter((e=>e.visible))))}_countActions(e){return e.reduce(((e,t)=>e+t.length),0)}_triggerAction(e,t){t&&e&&("toggle"===t.type&&(t.value=!t.value),this.triggerAction(t,e))}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const s=e.target.selectedItems.map((e=>h(e))).filter(Boolean);i.removeAll(),i.addMany(s)}_handleCalciteListItemToggle(e,t){e.stopPropagation(),t.open=e.target.open}_focusSelectedDragEl(e,t){this._selectedDragItemLayerUid===t.layer.uid&&requestAnimationFrame((()=>e?.setFocus()))}_handleCalciteListItemDragHandleChange(e,t){e.stopPropagation();const i=e.target.dragSelected;this._selectedDragItemLayerUid=i?t.layer.uid:null}_handleCalciteListItemSelect(e,t,i){h(e.target)===t&&"none"===this.selectionMode&&"inherited"!==i?.visibilityMode&&this._toggleVisibility(t,i)}_togglePanel(e){e.open=!e.open,e.open&&(this._focusPanelFlowItem=!0)}_toggleVisibility(e,t){if(!e)return;const i=t?.visibilityMode;"exclusive"===i&&e.visible||(e.visible=!e.visible)}_renderEditingInput(){const{messages:e}=this,{basemapTitle:t}=this.viewModel;return M("div",{class:m.editing},M("calcite-label",null,e.basemapTitle,M("calcite-input",{afterCreate:e=>this._editTitleInput=e,label:e.basemapTitle,name:"basemaptitle",pattern:S,placeholder:e.basemapTitle,required:!0,title:e.basemapTitle,type:"text",value:t??void 0})))}_renderCancelButton(){const{messagesCommon:{cancel:e}}=this;return M("calcite-button",{appearance:"outline",bind:this,label:e,onclick:this._toggleEditingTitle,slot:"footer",title:e,width:"half"},e)}_renderSubmitButton(){const{messagesCommon:e}=this;return M("calcite-button",{label:e.form.submit,slot:"footer",title:e.form.submit,type:"submit",width:"half"},e.form.ok)}_renderEditingForm(){return this.editingTitle?M("form",{bind:this,onsubmit:this._formSubmit},M("calcite-flow-item",{afterCreate:this._focusEditingFlowItemNode,afterUpdate:this._focusEditingFlowItemNode,bind:this,heading:this.visibleElements.heading?this.messages.basemapTitle:void 0,headingLevel:this.headingLevel,onCalciteFlowItemBack:e=>{e.preventDefault(),this._toggleEditingTitle()}},this._renderEditingInput(),this._renderCancelButton(),this._renderSubmitButton())):null}_renderEditTitleButton(){const{editingTitle:e,visibleElements:{editTitleButton:t},messagesCommon:{edit:i}}=this;return t&&!e?M("calcite-action",{bind:this,icon:"pencil",label:i,onclick:this._toggleEditingTitle,slot:"header-actions-end",text:i,title:i}):null}_renderNoLayersInfoMessage(e){return M("div",{slot:"message"},e)}_renderNoLayersInfo(e,t){return M("div",{class:m.itemMessage},M("calcite-notice",{icon:"information",key:t,kind:"info",open:!0,scale:"m",width:"full"},this._renderNoLayersInfoMessage(e)))}_getFilteredItems(e){return e?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)))}_renderItems(){const{collapsed:e,visible:t,visibleElements:{closeButton:i,collapseButton:s,heading:n,flow:o},messages:l,viewModel:r,referenceItems:a,baseItems:c}=this,d=this.visibleElements.referenceLayers?this._getFilteredItems(a):null,m=this.visibleElements.baseLayers?this._getFilteredItems(c):null,p=[M("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:i,closed:!t,collapsed:e,collapsible:s,heading:n?r.basemapTitle??l.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",onCalciteFlowItemClose:()=>this.visible=!1},this._renderEditTitleButton(),this._renderReferenceSection(d),this._renderBaseSection(m,1===m?.length)),this._renderEditingForm(),this._renderPanelFlowItems(m),this._renderPanelFlowItems(d)];return t?[o?M("calcite-flow",{key:"root-flow"},p):p,this._renderItemTooltips(d),this._renderItemTooltips(m)]:null}_renderChildList(e,t,i=[]){const{dragEnabled:s}=this,{children:n}=e,o=I(e),l=!o&&s&&"group"===e.layer?.type;return o||l?M("calcite-list",{canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),"data-basemap-layer-type":t,"data-item":e,"data-layer-type":k,dragEnabled:!!s&&(e.childrenSortable&&E(e)),group:e.layer.uid},n?.filter((e=>!e.hidden)).toArray().map((s=>this._renderItem(s,t,!1,e,[...i,e.title])))):null}_renderList(e,t,i){const{messages:s,dragEnabled:n,selectionMode:o,filterPlaceholder:l,baseFilterText:r,referenceFilterText:a,_baseFilterEnabled:c,_referenceFilterEnabled:d}=this,p="reference"===t?s.noReferenceLayers:s.noBaseLayers,u="reference"===t?d:c;return M("calcite-block",{class:m.section,collapsible:!0,heading:"reference"===t?s.referenceHeading:s.baseHeading,headingLevel:F(this.headingLevel),key:`block-${t}`,open:!0},0===e?.length?this._renderNoLayersInfo(p,t):null,M("calcite-list",{afterCreate:e=>{e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),"data-basemap-layer-type":t,"data-layer-type":k,dragEnabled:n,filterEnabled:u,filterPlaceholder:l,filterText:u?"reference"===t?a:r:"",group:v,key:`list-${t}`,label:s.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:o,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this["reference"===t?"referenceFilterText":"baseFilterText"]=e.target?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},e?.toArray().map((e=>this._renderItem(e,t,i))),e?.length&&u?M("div",{class:m.filterNoResults,slot:"filter-no-results"},M("calcite-notice",{kind:"info",open:!0,scale:"m",width:"full"},this._renderNoLayersInfoMessage(p))):null))}_renderBaseSection(e,t){return this.visibleElements.baseLayers?this._renderList(e,"base",t):null}_renderReferenceSection(e){return this.visibleElements.referenceLayers?this._renderList(e,"reference",!1):null}_toggleEditingTitle(){const{editingTitle:e}=this,t=!e;this.editingTitle=t,t?this._focusEditingFlowItem=!0:this._focusRootFlowItem=!0}_formSubmit(e){e.preventDefault();const t=this._editTitleInput?.value;t?.trim()&&(this.basemapTitle=t),this._toggleEditingTitle()}};function j(e){return e?.getAttribute("data-basemap-layer-type")}e([n()],x.prototype,"_activeItem",void 0),e([n()],x.prototype,"_tooltipReferenceMap",void 0),e([n()],x.prototype,"_focusRootFlowItem",void 0),e([n()],x.prototype,"_focusPanelFlowItem",void 0),e([n()],x.prototype,"_focusEditingFlowItem",void 0),e([n()],x.prototype,"_baseFilterEnabled",null),e([n()],x.prototype,"_referenceFilterEnabled",null),e([n()],x.prototype,"basemapTitle",null),e([n()],x.prototype,"collapsed",void 0),e([n()],x.prototype,"dragEnabled",void 0),e([n()],x.prototype,"editingTitle",void 0),e([n()],x.prototype,"filterPlaceholder",void 0),e([n()],x.prototype,"baseFilterText",void 0),e([n()],x.prototype,"referenceFilterText",void 0),e([n()],x.prototype,"listItemCanGiveFunction",void 0),e([n()],x.prototype,"listItemCanReceiveFunction",void 0),e([n()],x.prototype,"baseListItemCreatedFunction",null),e([n()],x.prototype,"editingEnabled",null),e([n()],x.prototype,"headingLevel",void 0),e([n()],x.prototype,"iconClass",void 0),e([n()],x.prototype,"label",null),e([n(),C("esri/widgets/BasemapLayerList/t9n/BasemapLayerList")],x.prototype,"messages",void 0),e([n(),C("esri/t9n/common")],x.prototype,"messagesCommon",void 0),e([n()],x.prototype,"minFilterItems",void 0),e([n()],x.prototype,"multipleSelectionEnabled",null),e([n()],x.prototype,"referenceListItemCreatedFunction",null),e([n({readOnly:!0})],x.prototype,"baseItems",null),e([n({readOnly:!0})],x.prototype,"referenceItems",null),e([n()],x.prototype,"selectedItems",void 0),e([n()],x.prototype,"selectionMode",void 0),e([n()],x.prototype,"view",null),e([T("trigger-action"),n({type:c})],x.prototype,"viewModel",void 0),e([n()],x.prototype,"visibilityAppearance",void 0),e([n({type:d,nonNullable:!0})],x.prototype,"visibleElements",void 0),x=e([o("esri.widgets.BasemapLayerList")],x);const B=x;export{B 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.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Logger.js";import{eachAlways as r}from"../../../core/promiseUtils.js";import t from"../../../layers/FeatureLayer.js";import{applyTextFormattingHTML as a,htmlEntities as o}from"./featureUtils.js";import{globalCss as i}from"../../support/globalCss.js";const n="esri.widgets.Feature.support.arcadeFeatureUtils",s=()=>e.getLogger(n);function
|
|
5
|
+
import e from"../../../core/Logger.js";import{eachAlways as r}from"../../../core/promiseUtils.js";import t from"../../../layers/FeatureLayer.js";import{applyTextFormattingHTML as a,htmlEntities as o}from"./featureUtils.js";import{globalCss as i}from"../../support/globalCss.js";const n="esri.widgets.Feature.support.arcadeFeatureUtils",s=()=>e.getLogger(n);function p(e){return"string"==typeof e?a(o(e)):Array.isArray(e)?c(e):"esri.arcade.Dictionary"===e?.declaredClass?u(e):e}function c(e){return`<ul class="esri-widget__list">${e.map((e=>`<li>${"string"==typeof e?a(o(e)):e}</li>`)).join("")}</ul>`}function u(e){const r=e.keys().map((r=>{const t=e.field(r);return`<tr><th>${r}</th><td>${"string"==typeof t?a(o(t)):t}</td></tr>`})).join("");return`<table class="${i.table}">${r}</table>`}function l(){return import("../../../arcade.js")}function d(e){return"createQuery"in e&&"queryFeatures"in e}async function f({graphic:e,view:r,options:t}){const{isAggregate:a,layer:o}=e;if(!a||!o||"2d"!==r?.type)return[];const i=await r.whenLayerView(o);if(!d(i))return[];const n=i.createQuery(),s=e.getObjectId();n.aggregateIds=null!=s?[s]:[];const{features:p}=await i.queryFeatures(n,t);return p}function y({layer:e,aggregatedFeatures:r,interceptor:a}){const{fields:o,objectIdField:i,geometryType:n,spatialReference:s,displayField:p}=e;return new t({fields:o,objectIdField:i,geometryType:n,spatialReference:s,displayField:p,interceptor:a,..."feature"===e.type?{templates:e.templates,typeIdField:e.typeIdField,types:e.types}:null,source:r})}async function g({expressionInfo:e,arcade:r,interceptor:t,spatialReference:a,map:o,graphic:i,location:n,view:p,options:c}){if(!e?.expression)return null;const{isAggregate:u}=i,l=(i.sourceLayer||i.layer)??void 0,d=u?"feature-reduction-popup":"popup",g=r.createArcadeProfile(d),m=r.createArcadeExecutor(e.expression,g).catch((r=>s().error("arcade-executor-error",{error:r,expressionInfo:e}))),[w,h]=await Promise.all([f({graphic:i,view:p,options:c}),m]);if(!h)return null;const F="feature-reduction-popup"===d?y({layer:l,aggregatedFeatures:w,interceptor:t}):void 0,$={..."feature-reduction-popup"===d?{$aggregatedFeatures:F}:{$datastore:l?.url,$layer:"feature"===l?.type||"subtype-sublayer"===l?.type?l:"scene"===l?.type&&null!=l.associatedLayer?l.associatedLayer:void 0,$map:o,$userInput:n,$graph:"knowledge-graph-sublayer"===l?.type?l?.parentCompositeLayer?.knowledgeGraph:void 0},$feature:i},v={abortSignal:c?.signal??void 0,interceptor:t??void 0,rawOutput:!0,spatialReference:a??void 0,timeZone:p?.timeZone};return await h.executeAsync($,v).catch((r=>s().error("arcade-execution-error",{error:r,graphic:i,expressionInfo:e}))).finally((()=>F?.destroy()))}async function m({expressionInfos:e,spatialReference:t,graphic:a,interceptor:o,map:i,view:n,location:s,options:c}){if(!e?.length)return{};const u=await l(),d={};for(const r of e)d[`expression/${r.name}`]=g({expressionInfo:r,arcade:u,interceptor:o,spatialReference:t,map:i,graphic:a,location:s,view:n,options:c});const f=await r(d),y={};for(const r in f)y[r]=p(f[r].value);return y}export{g as createCompiledExpression,m as createCompiledExpressions,l as loadArcade};
|
package/widgets/LayerList.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.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{deprecatedProperty as i}from"../core/deprecate.js";import o from"../core/Logger.js";import s from"../core/ReactiveMap.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import{getActionIcon as r,getActionStyles as a}from"../support/actions/actionUtils.js";import c from"./Widget.js";import{css as d}from"./LayerList/css.js";import m from"./LayerList/LayerListViewModel.js";import p from"./LayerList/LayerListVisibleElements.js";import u from"./LayerList/ListItem.js";import{minDragEnabledItems as h,minFilterItems as g,getItem as v,getLayerType as y,sortableRoot as f,listItemHasChildren as _,canSortSublayers as b,getStatusIcon as I,getVisibilityIcon as w,sortLayersToIds as E,sortChildLayersToIds as L}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as C}from"./support/componentsUtils.js";import{globalCss as A}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as M}from"./support/decorators/messageBundle.js";import{vmEvent as F}from"./support/decorators/vmEvent.js";import{tsx as k}from"./support/jsxFactory.js";const S=t.ofType(u),j="operational";let x=class extends c{constructor(e,t){super(e,t),this._activeItem=null,this._tooltipReferenceMap=new s,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this.collapsed=!1,this.dragEnabled=!1,this.filterPlaceholder="",this.filterText="",this.headingLevel=2,this.icon=null,this.iconClass=d.widgetIcon,this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.messages=null,this.messagesCommon=null,this.minDragEnabledItems=h,this.minFilterItems=g,this.selectedItems=new S,this.selectionMode="none",this.viewModel=new m,this.visibilityAppearance="default",this.visibleElements=new p,this._canMove=({dragEl:e,fromEl:t,toEl:i},o)=>{const s="pull"===o?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,l=v(e);if(!l?.sortable)return!1;const n=v(t),r=y(t),a=v(i),c=y(i),d=!!r&&!!c&&r===c,m={selected:l,from:n,to:a};return t.group&&i.group&&"function"==typeof s?s.call(null,m):d&&"sublayer"!==l?.layer?.type&&"map-image"!==n?.layer?.type&&"map-image"!==a?.layer?.type},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(d.item)));this._activeItem=v(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:o,dragEl:s,newIndex:l}=e;if(o&&i&&!(t?.newIndex===l&&t?.dragEl===s&&t?.toEl===i&&t?.fromEl===o))if(this._lastDragDetail=e,o!==i)this._moveLayerFromChildList({toEl:i,fromEl:o,dragEl:s,newIndex:l});else{const e=Array.from(o.children).filter((e=>e?.matches("calcite-list-item"))).map((e=>e.value));this._sortLayers(o,e)}}}loadDependencies(){return C({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group.js"),"action-menu":()=>import("@esri/calcite-components/dist/components/calcite-action-menu.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}destroy(){this._tooltipReferenceMap.clear()}get _dragEnabled(){return this.viewModel.totalItems>=this.minDragEnabledItems&&this.dragEnabled}get _filterEnabled(){return this.viewModel.totalItems>=this.minFilterItems&&this.visibleElements.filter}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get multipleSelectionEnabled(){return i(o.getLogger(this),"multipleSelectionEnabled",{replacement:"selectionMode",version:"4.29",warnOnce:!0}),"multiple"===this.selectionMode}set multipleSelectionEnabled(e){i(o.getLogger(this),"multipleSelectionEnabled",{replacement:"selectionMode",version:"4.29",warnOnce:!0}),this.selectionMode=e?"multiple":this.selectionEnabled?"single":"none"}get operationalItems(){return this.viewModel.operationalItems}set operationalItems(e){this.viewModel.operationalItems=e}get selectionEnabled(){return i(o.getLogger(this),"selectionEnabled",{replacement:"selectionMode, dragEnabled",version:"4.29",warnOnce:!0}),"none"!==this.selectionMode&&this.dragEnabled}set selectionEnabled(e){i(o.getLogger(this),"selectionEnabled",{replacement:"selectionMode, dragEnabled",version:"4.29",warnOnce:!0}),this.dragEnabled=e,this.selectionMode=e?this.multipleSelectionEnabled?"multiple":"single":"none"}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const e=this.viewModel?.state,t={[A.hidden]:"loading"===e,[A.disabled]:"disabled"===e},i=this.operationalItems?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)));return k("div",{class:this.classes(d.base,A.widget,A.panel,t)},i?.length?[this._renderItemTooltips(i),this._renderItems(i)]:this._renderNoItems())}_renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:i}=this;return e?k("calcite-tooltip",{key:`tooltip-${e.layer.uid}`,referenceElement:t.get(e.layer.uid)},i.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(e){return e?.toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderNoItemsMessage(){return k("div",{slot:"message"},this.messages.noItemsToDisplay)}_renderNoItems(){return k("div",{class:d.itemMessage,key:"esri-layer-list__no-items"},k("calcite-notice",{icon:"information",kind:"info",open:!0,scale:"m",width:"full"},this._renderNoItemsMessage()))}_renderPanelFlowItems(e){return e?e.flatten((e=>e.children)).filter((e=>!e.hidden)).toArray().filter((({panel:e})=>e?.open&&!e.disabled&&e.flowEnabled)).map((({title:e,panel:t})=>{const i=()=>this._handlePanelFlowItemBack(t);return k("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:e,heading:t.title,headingLevel:this.headingLevel,key:`flow-panel-${t.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),i()}},t.render(),k("calcite-button",{appearance:"transparent",onclick:i,slot:"footer-actions",width:"full"},this.messagesCommon.back))})):[]}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_renderItems(e){const{visible:t,collapsed:i,_filterEnabled:o,visibleElements:{closeButton:s,collapseButton:l,heading:n,flow:r},_dragEnabled:a,selectionMode:c,filterText:m,filterPlaceholder:p,messages:u}=this,h=[k("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:s,closed:!t,collapsed:i,collapsible:l,heading:n?u.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",onCalciteFlowItemClose:()=>this.visible=!1},k("calcite-list",{afterCreate:e=>{e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),"data-layer-type":j,dragEnabled:a,filterEnabled:o,filterPlaceholder:p,filterText:m,group:f,key:"root-list",label:u.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:c,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this.filterText=e.target?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},e?.toArray().map((e=>this._renderItem(e))),e?.length&&o?k("div",{class:d.filterNoResults,slot:"filter-no-results"},k("calcite-notice",{kind:"info",open:!0,scale:"m",width:"full"},this._renderNoItemsMessage())):null)),this._renderPanelFlowItems(e)];return t?r?k("calcite-flow",{key:"root-flow"},h):h:null}_renderChildList(e,t=[]){const{_dragEnabled:i}=this,{children:o}=e,s=_(e),l=!s&&i&&"group"===e.layer?.type;return s||l?k("calcite-list",{canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),"data-item":e,"data-layer-type":j,dragEnabled:!!i&&(e.childrenSortable&&b(e)),group:e.layer.uid},o?.filter((e=>!e.hidden)).toArray().map((i=>this._renderItem(i,e,[...t,e.title])))):null}_renderItemMessage(e){return e.error?k("div",{class:d.itemMessage,key:"esri-layer-list__error",slot:"content-bottom"},k("calcite-notice",{icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",width:"full"},k("div",{slot:"message"},this.messages.layerError))):e.incompatible?k("div",{class:d.itemMessage,key:"esri-layer-list__incompatible",slot:"content-bottom"},k("calcite-notice",{afterCreate:t=>this._setTooltipReference(t,e),afterRemoved:()=>this._removeTooltipReference(e),bind:this,icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",tabIndex:0,width:"full"},k("div",{slot:"message"},this.messages.layerIncompatible))):null}_renderItem(e,t,i){const{_activeItem:o,_selectedDragItemLayerUid:s,selectionMode:l,selectedItems:n,messages:r}=this,a=e.title||r.untitledLayer,c=e.visibleAtCurrentScale?a:`${a} (${r.layerInvisibleAtScale})`,m=this._filterActions(e.actionsSections),p=this._countActions(m);return k("calcite-list-item",{afterCreate:t=>this._focusSelectedDragEl(t,e),afterUpdate:t=>this._focusSelectedDragEl(t,e),class:this.classes(d.item,{[d.itemActive]:o===e}),"data-item":e,dragDisabled:!e.sortable,dragSelected:e.layer.uid===s,id:e.layer.uid,key:`list-item-${e.layer.uid}`,label:a,metadata:{parentTitles:i,title:a},open:e.open,selected:"none"!==l&&n.includes(e),title:c,value:e.layer.uid,onCalciteListItemDragHandleChange:t=>this._handleCalciteListItemDragHandleChange(t,e),onCalciteListItemSelect:i=>this._handleCalciteListItemSelect(i,e,t),onCalciteListItemToggle:t=>this._handleCalciteListItemToggle(t,e)},k("div",{class:this.classes({[d.itemContent]:!0,[d.itemInvisibleAtScale]:!e.visibleAtCurrentScale}),slot:"content"},a),this._renderItemStatus(e,t),this._renderItemToggle(e,t),this._renderItemTemporaryIcon(e),this._renderChildList(e,i),this._renderItemMessage(e),this._renderPanel(e.panel),this._renderPanelAction(e.panel),p>1?this._renderActionsSections(e,m):1===p?this._renderAction({item:e,action:this._getSingleActionButton(m),textEnabled:!1}):null)}_renderItemStatus(e,t){const{visibleElements:i}=this;if(!i.statusIndicators)return null;const{connectionStatus:o,publishing:s,updating:l}=e,n=l&&!t,r=!!o;return k("calcite-icon",{class:this.classes({[d.statusIndicator]:!0,[d.publishing]:s,[d.updating]:n,[d.connectionStatus]:r,[d.connectionStatusConnected]:r&&"connected"===o}),icon:I({connectionStatus:o,publishing:s}),key:"layer-item-status",scale:"s",slot:"actions-end"})}_renderItemTemporaryIcon(e){return this.visibleElements.temporaryLayerIndicators&&"persistenceEnabled"in e.layer&&!e.layer.persistenceEnabled?k("calcite-icon",{class:d.itemTemporaryIcon,icon:"temporary",key:"temporary-icon",scale:"s",slot:"actions-start",title:this.messages.temporary}):null}_renderItemToggle(e,t){const{messages:i,visibilityAppearance:o}=this,{visible:s}=e,l=t?.visibilityMode;if("inherited"===l)return null;const n=w({visible:s,exclusive:"exclusive"===l,visibilityAppearance:o}),r="checkbox"===o;return k("calcite-action",{appearance:"transparent",class:d.visibleToggle,icon:r?n:void 0,key:"visibility-toggle",onclick:()=>this._toggleVisibility(e,t),scale:"s",slot:r?"actions-start":"actions-end",text:i.layerVisibility,title:i.layerVisibility},r?null:k("calcite-icon",{class:this.classes({[d.visibleIcon]:"exclusive"!==l&&s}),icon:n,scale:"s"}))}_renderPanel(e){return!e?.open||e.disabled||e.flowEnabled?null:k("div",{class:d.itemContentBottom,key:`content-panel-${e.uid}`,slot:"content-bottom"},e.render())}_renderPanelAction(e){if(!e?.visible)return null;const{open:t,title:i,disabled:o}=e;return k("calcite-action",{active:t,appearance:"transparent",disabled:o,icon:r(e),key:`action-${e.uid}`,onclick:()=>this._togglePanel(e),scale:"s",slot:"actions-end",text:i??"",title:i??void 0},this._renderFallbackIcon(e))}_renderActionsSections(e,t){return k("calcite-action-menu",{appearance:"transparent",key:"item-action-menu",label:this.messagesCommon.menu,open:e.actionsOpen,overlayPositioning:"fixed",placement:"bottom-end",scale:"s",slot:"actions-end",onCalciteActionMenuOpen:t=>e.actionsOpen=t.target.open},k("calcite-action",{appearance:"transparent",icon:"ellipsis",scale:"s",slot:"trigger",text:this.messagesCommon.options,title:this.messagesCommon.options}),t.toArray().map(((t,i)=>this._renderActionSection(e,t,i))))}_renderActionSection(e,t,i){return k("calcite-action-group",{key:`action-section-${i}`},t.toArray().map((t=>this._renderAction({item:e,action:t,textEnabled:!0}))))}_renderFallbackIcon(e){const{className:t,icon:i}=e;if(i)return null;const o="image"in e?e.image:void 0,s={[d.itemActionIcon]:!!t,[d.itemActionImage]:!!o};return t&&(s[t]=!0),o||t?k("span",{"aria-hidden":"true",class:this.classes(d.itemActionIcon,s),key:"icon",styles:a(o)}):null}_renderAction(e){const{item:t,action:i,textEnabled:o}=e,{active:s,disabled:l,title:n,type:a,indicator:c}=i;return k("calcite-action",{active:"toggle"===a&&i.value,appearance:"transparent",disabled:l,icon:r(i),indicator:c,key:`action-${i.uid}`,loading:s,onclick:()=>this._triggerAction(t,i),scale:"s",slot:o?void 0:"actions-end",text:n??"",textEnabled:o,title:n??void 0},this._renderFallbackIcon(i))}_setTooltipReference(e,t){this._tooltipReferenceMap.set(t.layer.uid,e)}_removeTooltipReference(e){this._tooltipReferenceMap.delete(e.layer.uid)}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:o}){const s=v(i),l=v(e),n=v(t);this.viewModel.moveListItem(s,n,l,o)}_handleCalciteListDragEnd(e){const{fromEl:t,dragEl:i,oldIndex:o}=e;t.insertBefore(i,t.children[o])}_sortLayers(e,t){if(e)if(e.group===f)E(this.view?.map?.layers,t);else{const i=v(e);if(!i)return;L(i,t)}}_getSingleActionButton(e){return e.reduce((e=>e)).filter((e=>e&&"button"===e.type)).at(0)}_filterActions(e){return e.map((e=>e.filter((e=>e.visible))))}_countActions(e){return e.reduce(((e,t)=>e+t.length),0)}_triggerAction(e,t){t&&e&&("toggle"===t.type&&(t.value=!t.value),this.triggerAction(t,e))}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const o=e.target.selectedItems.map((e=>v(e))).filter(Boolean);i.removeAll(),i.addMany(o)}_handleCalciteListItemToggle(e,t){e.stopPropagation(),t.open=e.target.open}_focusSelectedDragEl(e,t){this._selectedDragItemLayerUid===t.layer.uid&&requestAnimationFrame((()=>e?.setFocus()))}_handleCalciteListItemDragHandleChange(e,t){e.stopPropagation();const i=e.target.dragSelected;this._selectedDragItemLayerUid=i?t.layer.uid:null}_handleCalciteListItemSelect(e,t,i){v(e.target)===t&&"none"===this.selectionMode&&"inherited"!==i?.visibilityMode&&this._toggleVisibility(t,i)}_togglePanel(e){e.open=!e.open,e.open&&(this._focusPanelFlowItem=!0)}_toggleVisibility(e,t){if(!e)return;const i=t?.visibilityMode;"exclusive"===i&&e.visible||(e.visible=!e.visible)}};e([l()],x.prototype,"_activeItem",void 0),e([l()],x.prototype,"_tooltipReferenceMap",void 0),e([l()],x.prototype,"_focusRootFlowItem",void 0),e([l()],x.prototype,"_focusPanelFlowItem",void 0),e([l()],x.prototype,"_dragEnabled",null),e([l()],x.prototype,"_filterEnabled",null),e([l()],x.prototype,"collapsed",void 0),e([l()],x.prototype,"dragEnabled",void 0),e([l()],x.prototype,"filterPlaceholder",void 0),e([l()],x.prototype,"filterText",void 0),e([l()],x.prototype,"headingLevel",void 0),e([l()],x.prototype,"icon",void 0),e([l()],x.prototype,"iconClass",void 0),e([l()],x.prototype,"label",null),e([l()],x.prototype,"listItemCanGiveFunction",void 0),e([l()],x.prototype,"listItemCanReceiveFunction",void 0),e([l()],x.prototype,"listItemCreatedFunction",null),e([l(),M("esri/widgets/LayerList/t9n/LayerList")],x.prototype,"messages",void 0),e([l(),M("esri/t9n/common")],x.prototype,"messagesCommon",void 0),e([l()],x.prototype,"minDragEnabledItems",void 0),e([l()],x.prototype,"minFilterItems",void 0),e([l()],x.prototype,"multipleSelectionEnabled",null),e([l()],x.prototype,"operationalItems",null),e([l()],x.prototype,"selectionEnabled",null),e([l()],x.prototype,"selectedItems",void 0),e([l()],x.prototype,"selectionMode",void 0),e([l()],x.prototype,"view",null),e([F("trigger-action"),l({type:m})],x.prototype,"viewModel",void 0),e([l()],x.prototype,"visibilityAppearance",void 0),e([l({type:p,nonNullable:!0})],x.prototype,"visibleElements",void 0),x=e([n("esri.widgets.LayerList")],x);const P=x;export{P as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{deprecatedProperty as i}from"../core/deprecate.js";import o from"../core/Logger.js";import s from"../core/ReactiveMap.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import{getActionIcon as r,getActionStyles as a}from"../support/actions/actionUtils.js";import c from"./Widget.js";import{css as d}from"./LayerList/css.js";import m from"./LayerList/LayerListViewModel.js";import p from"./LayerList/LayerListVisibleElements.js";import u from"./LayerList/ListItem.js";import{minDragEnabledItems as h,minFilterItems as g,getItem as v,getLayerType as y,sortableRoot as f,listItemHasChildren as _,canSortSublayers as b,getStatusIcon as I,getVisibilityIcon as w,sortLayersToIds as E,sortChildLayersToIds as L}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as C}from"./support/componentsUtils.js";import{globalCss as A}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as M}from"./support/decorators/messageBundle.js";import{vmEvent as F}from"./support/decorators/vmEvent.js";import{tsx as k}from"./support/jsxFactory.js";const S=t.ofType(u),j="operational";let x=class extends c{constructor(e,t){super(e,t),this._activeItem=null,this._tooltipReferenceMap=new s,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this.collapsed=!1,this.dragEnabled=!1,this.filterPlaceholder="",this.filterText="",this.headingLevel=2,this.icon=null,this.iconClass=d.widgetIcon,this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.messages=null,this.messagesCommon=null,this.minDragEnabledItems=h,this.minFilterItems=g,this.selectedItems=new S,this.selectionMode="none",this.viewModel=new m,this.visibilityAppearance="default",this.visibleElements=new p,this._canMove=({dragEl:e,fromEl:t,toEl:i},o)=>{const s="pull"===o?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,l=v(e);if(!l?.sortable)return!1;const n=v(t),r=y(t),a=v(i),c=y(i),d=!!r&&!!c&&r===c,m={selected:l,from:n,to:a};return t.group&&i.group&&"function"==typeof s?s.call(null,m):d&&"sublayer"!==l?.layer?.type&&"map-image"!==n?.layer?.type&&"map-image"!==a?.layer?.type},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(d.item)));this._activeItem=v(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:o,dragEl:s,newIndex:l}=e;if(o&&i&&!(t?.newIndex===l&&t?.dragEl===s&&t?.toEl===i&&t?.fromEl===o))if(this._lastDragDetail=e,o!==i)this._moveLayerFromChildList({toEl:i,fromEl:o,dragEl:s,newIndex:l});else{const e=Array.from(o.children).filter((e=>e?.matches("calcite-list-item"))).map((e=>e.value));this._sortLayers(o,e)}}}loadDependencies(){return C({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group.js"),"action-menu":()=>import("@esri/calcite-components/dist/components/calcite-action-menu.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}destroy(){this._tooltipReferenceMap.clear()}get _dragEnabled(){return this.viewModel.totalItems>=this.minDragEnabledItems&&this.dragEnabled}get _filterEnabled(){return this.viewModel.totalItems>=this.minFilterItems&&this.visibleElements.filter}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get multipleSelectionEnabled(){return i(o.getLogger(this),"multipleSelectionEnabled",{replacement:"selectionMode",version:"4.29",warnOnce:!0}),"multiple"===this.selectionMode}set multipleSelectionEnabled(e){i(o.getLogger(this),"multipleSelectionEnabled",{replacement:"selectionMode",version:"4.29",warnOnce:!0}),this.selectionMode=e?"multiple":this.selectionEnabled?"single":"none"}get operationalItems(){return this.viewModel.operationalItems}set operationalItems(e){this.viewModel.operationalItems=e}get selectionEnabled(){return i(o.getLogger(this),"selectionEnabled",{replacement:"selectionMode, dragEnabled",version:"4.29",warnOnce:!0}),"none"!==this.selectionMode&&this.dragEnabled}set selectionEnabled(e){i(o.getLogger(this),"selectionEnabled",{replacement:"selectionMode, dragEnabled",version:"4.29",warnOnce:!0}),this.dragEnabled=e,this.selectionMode=e?this.multipleSelectionEnabled?"multiple":"single":"none"}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const e=this.viewModel?.state,t={[A.hidden]:"loading"===e,[A.disabled]:"disabled"===e},i=this.operationalItems?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)));return k("div",{class:this.classes(d.base,A.widget,A.panel,t)},i?.length?[this._renderItemTooltips(i),this._renderItems(i)]:this._renderNoItems())}_renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:i}=this;return e?k("calcite-tooltip",{key:`tooltip-${e.layer.uid}`,referenceElement:t.get(e.layer.uid)},i.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(e){return e?.toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderNoItemsMessage(){return k("div",{slot:"message"},this.messages.noItemsToDisplay)}_renderNoItems(){return k("div",{class:d.itemMessage,key:"esri-layer-list__no-items"},k("calcite-notice",{icon:"information",kind:"info",open:!0,scale:"m",width:"full"},this._renderNoItemsMessage()))}_renderPanelFlowItems(e){return e?e.flatten((e=>e.children)).filter((e=>!e.hidden)).toArray().filter((({panel:e})=>e?.open&&!e.disabled&&e.flowEnabled)).map((({title:e,panel:t})=>{const i=()=>this._handlePanelFlowItemBack(t);return k("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:e,heading:t.title,headingLevel:this.headingLevel,key:`flow-panel-${t.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),i()}},t.render(),k("calcite-button",{appearance:"transparent",onclick:i,slot:"footer-actions",width:"full"},this.messagesCommon.back))})):[]}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_renderItems(e){const{visible:t,collapsed:i,_filterEnabled:o,visibleElements:{closeButton:s,collapseButton:l,heading:n,flow:r},_dragEnabled:a,selectionMode:c,filterText:m,filterPlaceholder:p,messages:u}=this,h=[k("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:s,closed:!t,collapsed:i,collapsible:l,heading:n?u.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",onCalciteFlowItemClose:()=>this.visible=!1},k("calcite-list",{afterCreate:e=>{e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),"data-layer-type":j,dragEnabled:a,filterEnabled:o,filterPlaceholder:p,filterText:o?m:"",group:f,key:"root-list",label:u.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:c,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this.filterText=e.target?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},e?.toArray().map((e=>this._renderItem(e))),e?.length&&o?k("div",{class:d.filterNoResults,slot:"filter-no-results"},k("calcite-notice",{kind:"info",open:!0,scale:"m",width:"full"},this._renderNoItemsMessage())):null)),this._renderPanelFlowItems(e)];return t?r?k("calcite-flow",{key:"root-flow"},h):h:null}_renderChildList(e,t=[]){const{_dragEnabled:i}=this,{children:o}=e,s=_(e),l=!s&&i&&"group"===e.layer?.type;return s||l?k("calcite-list",{canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),"data-item":e,"data-layer-type":j,dragEnabled:!!i&&(e.childrenSortable&&b(e)),group:e.layer.uid},o?.filter((e=>!e.hidden)).toArray().map((i=>this._renderItem(i,e,[...t,e.title])))):null}_renderItemMessage(e){return e.error?k("div",{class:d.itemMessage,key:"esri-layer-list__error",slot:"content-bottom"},k("calcite-notice",{icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",width:"full"},k("div",{slot:"message"},this.messages.layerError))):e.incompatible?k("div",{class:d.itemMessage,key:"esri-layer-list__incompatible",slot:"content-bottom"},k("calcite-notice",{afterCreate:t=>this._setTooltipReference(t,e),afterRemoved:()=>this._removeTooltipReference(e),bind:this,icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",tabIndex:0,width:"full"},k("div",{slot:"message"},this.messages.layerIncompatible))):null}_renderItem(e,t,i){const{_activeItem:o,_selectedDragItemLayerUid:s,selectionMode:l,selectedItems:n,messages:r}=this,a=e.title||r.untitledLayer,c=e.visibleAtCurrentScale?a:`${a} (${r.layerInvisibleAtScale})`,m=this._filterActions(e.actionsSections),p=this._countActions(m);return k("calcite-list-item",{afterCreate:t=>this._focusSelectedDragEl(t,e),afterUpdate:t=>this._focusSelectedDragEl(t,e),class:this.classes(d.item,{[d.itemActive]:o===e}),"data-item":e,dragDisabled:!e.sortable,dragSelected:e.layer.uid===s,id:e.layer.uid,key:`list-item-${e.layer.uid}`,label:a,metadata:{parentTitles:i,title:a},open:e.open,selected:"none"!==l&&n.includes(e),title:c,value:e.layer.uid,onCalciteListItemDragHandleChange:t=>this._handleCalciteListItemDragHandleChange(t,e),onCalciteListItemSelect:i=>this._handleCalciteListItemSelect(i,e,t),onCalciteListItemToggle:t=>this._handleCalciteListItemToggle(t,e)},k("div",{class:this.classes({[d.itemContent]:!0,[d.itemInvisibleAtScale]:!e.visibleAtCurrentScale}),slot:"content"},a),this._renderItemStatus(e,t),this._renderItemToggle(e,t),this._renderItemTemporaryIcon(e),this._renderChildList(e,i),this._renderItemMessage(e),this._renderPanel(e.panel),this._renderPanelAction(e.panel),p>1?this._renderActionsSections(e,m):1===p?this._renderAction({item:e,action:this._getSingleActionButton(m),textEnabled:!1}):null)}_renderItemStatus(e,t){const{visibleElements:i}=this;if(!i.statusIndicators)return null;const{connectionStatus:o,publishing:s,updating:l}=e,n=l&&!t,r=!!o;return k("calcite-icon",{class:this.classes({[d.statusIndicator]:!0,[d.publishing]:s,[d.updating]:n,[d.connectionStatus]:r,[d.connectionStatusConnected]:r&&"connected"===o}),icon:I({connectionStatus:o,publishing:s}),key:"layer-item-status",scale:"s",slot:"actions-end"})}_renderItemTemporaryIcon(e){return this.visibleElements.temporaryLayerIndicators&&"persistenceEnabled"in e.layer&&!e.layer.persistenceEnabled?k("calcite-icon",{class:d.itemTemporaryIcon,icon:"temporary",key:"temporary-icon",scale:"s",slot:"actions-start",title:this.messages.temporary}):null}_renderItemToggle(e,t){const{messages:i,visibilityAppearance:o}=this,{visible:s}=e,l=t?.visibilityMode;if("inherited"===l)return null;const n=w({visible:s,exclusive:"exclusive"===l,visibilityAppearance:o}),r="checkbox"===o;return k("calcite-action",{appearance:"transparent",class:d.visibleToggle,icon:r?n:void 0,key:"visibility-toggle",onclick:()=>this._toggleVisibility(e,t),scale:"s",slot:r?"actions-start":"actions-end",text:i.layerVisibility,title:i.layerVisibility},r?null:k("calcite-icon",{class:this.classes({[d.visibleIcon]:"exclusive"!==l&&s}),icon:n,scale:"s"}))}_renderPanel(e){return!e?.open||e.disabled||e.flowEnabled?null:k("div",{class:d.itemContentBottom,key:`content-panel-${e.uid}`,slot:"content-bottom"},e.render())}_renderPanelAction(e){if(!e?.visible)return null;const{open:t,title:i,disabled:o}=e;return k("calcite-action",{active:t,appearance:"transparent",disabled:o,icon:r(e),key:`action-${e.uid}`,onclick:()=>this._togglePanel(e),scale:"s",slot:"actions-end",text:i??"",title:i??void 0},this._renderFallbackIcon(e))}_renderActionsSections(e,t){return k("calcite-action-menu",{appearance:"transparent",key:"item-action-menu",label:this.messagesCommon.menu,open:e.actionsOpen,overlayPositioning:"fixed",placement:"bottom-end",scale:"s",slot:"actions-end",onCalciteActionMenuOpen:t=>e.actionsOpen=t.target.open},k("calcite-action",{appearance:"transparent",icon:"ellipsis",scale:"s",slot:"trigger",text:this.messagesCommon.options,title:this.messagesCommon.options}),t.toArray().map(((t,i)=>this._renderActionSection(e,t,i))))}_renderActionSection(e,t,i){return k("calcite-action-group",{key:`action-section-${i}`},t.toArray().map((t=>this._renderAction({item:e,action:t,textEnabled:!0}))))}_renderFallbackIcon(e){const{className:t,icon:i}=e;if(i)return null;const o="image"in e?e.image:void 0,s={[d.itemActionIcon]:!!t,[d.itemActionImage]:!!o};return t&&(s[t]=!0),o||t?k("span",{"aria-hidden":"true",class:this.classes(d.itemActionIcon,s),key:"icon",styles:a(o)}):null}_renderAction(e){const{item:t,action:i,textEnabled:o}=e,{active:s,disabled:l,title:n,type:a,indicator:c}=i;return k("calcite-action",{active:"toggle"===a&&i.value,appearance:"transparent",disabled:l,icon:r(i),indicator:c,key:`action-${i.uid}`,loading:s,onclick:()=>this._triggerAction(t,i),scale:"s",slot:o?void 0:"actions-end",text:n??"",textEnabled:o,title:n??void 0},this._renderFallbackIcon(i))}_setTooltipReference(e,t){this._tooltipReferenceMap.set(t.layer.uid,e)}_removeTooltipReference(e){this._tooltipReferenceMap.delete(e.layer.uid)}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:o}){const s=v(i),l=v(e),n=v(t);this.viewModel.moveListItem(s,n,l,o)}_handleCalciteListDragEnd(e){const{fromEl:t,dragEl:i,oldIndex:o}=e;t.insertBefore(i,t.children[o])}_sortLayers(e,t){if(e)if(e.group===f)E(this.view?.map?.layers,t);else{const i=v(e);if(!i)return;L(i,t)}}_getSingleActionButton(e){return e.reduce((e=>e)).filter((e=>e&&"button"===e.type)).at(0)}_filterActions(e){return e.map((e=>e.filter((e=>e.visible))))}_countActions(e){return e.reduce(((e,t)=>e+t.length),0)}_triggerAction(e,t){t&&e&&("toggle"===t.type&&(t.value=!t.value),this.triggerAction(t,e))}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const o=e.target.selectedItems.map((e=>v(e))).filter(Boolean);i.removeAll(),i.addMany(o)}_handleCalciteListItemToggle(e,t){e.stopPropagation(),t.open=e.target.open}_focusSelectedDragEl(e,t){this._selectedDragItemLayerUid===t.layer.uid&&requestAnimationFrame((()=>e?.setFocus()))}_handleCalciteListItemDragHandleChange(e,t){e.stopPropagation();const i=e.target.dragSelected;this._selectedDragItemLayerUid=i?t.layer.uid:null}_handleCalciteListItemSelect(e,t,i){v(e.target)===t&&"none"===this.selectionMode&&"inherited"!==i?.visibilityMode&&this._toggleVisibility(t,i)}_togglePanel(e){e.open=!e.open,e.open&&(this._focusPanelFlowItem=!0)}_toggleVisibility(e,t){if(!e)return;const i=t?.visibilityMode;"exclusive"===i&&e.visible||(e.visible=!e.visible)}};e([l()],x.prototype,"_activeItem",void 0),e([l()],x.prototype,"_tooltipReferenceMap",void 0),e([l()],x.prototype,"_focusRootFlowItem",void 0),e([l()],x.prototype,"_focusPanelFlowItem",void 0),e([l()],x.prototype,"_dragEnabled",null),e([l()],x.prototype,"_filterEnabled",null),e([l()],x.prototype,"collapsed",void 0),e([l()],x.prototype,"dragEnabled",void 0),e([l()],x.prototype,"filterPlaceholder",void 0),e([l()],x.prototype,"filterText",void 0),e([l()],x.prototype,"headingLevel",void 0),e([l()],x.prototype,"icon",void 0),e([l()],x.prototype,"iconClass",void 0),e([l()],x.prototype,"label",null),e([l()],x.prototype,"listItemCanGiveFunction",void 0),e([l()],x.prototype,"listItemCanReceiveFunction",void 0),e([l()],x.prototype,"listItemCreatedFunction",null),e([l(),M("esri/widgets/LayerList/t9n/LayerList")],x.prototype,"messages",void 0),e([l(),M("esri/t9n/common")],x.prototype,"messagesCommon",void 0),e([l()],x.prototype,"minDragEnabledItems",void 0),e([l()],x.prototype,"minFilterItems",void 0),e([l()],x.prototype,"multipleSelectionEnabled",null),e([l()],x.prototype,"operationalItems",null),e([l()],x.prototype,"selectionEnabled",null),e([l()],x.prototype,"selectedItems",void 0),e([l()],x.prototype,"selectionMode",void 0),e([l()],x.prototype,"view",null),e([F("trigger-action"),l({type:m})],x.prototype,"viewModel",void 0),e([l()],x.prototype,"visibilityAppearance",void 0),e([l({type:p,nonNullable:!0})],x.prototype,"visibleElements",void 0),x=e([n("esri.widgets.LayerList")],x);const P=x;export{P as default};
|