@vertigis/arcgis-extensions 35.0.0 → 35.0.1
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/ItemType.js +1 -1
- package/LanguageResources.js +1 -1
- package/data/ArcGISServiceTableExtension.js +1 -1
- package/data/Attachment.js +1 -1
- package/data/Feature.js +1 -1
- package/data/FeatureList.js +1 -1
- package/data/FeatureSet.js +1 -1
- package/data/FeatureSettings.js +1 -1
- package/data/FeatureSourceBase.js +1 -1
- package/data/FeatureStream.js +1 -1
- package/data/FieldExtension.js +1 -1
- package/data/Schema.js +1 -1
- package/data/Table.js +1 -1
- package/data/_TableExtension.js +1 -1
- package/data/convert.js +1 -1
- package/data/support/attachments.js +1 -1
- package/docs/html/modules/version.html +1 -1
- package/layer-preset/LayerPreset.js +1 -1
- package/locale/language.js +1 -1
- package/mapping/ArcGISSublayerExtension.js +1 -1
- package/mapping/BasemapExtension.js +1 -1
- package/mapping/BuildingComponentSublayerExtension.js +1 -1
- package/mapping/BuildingSceneLayerExtension.js +1 -1
- package/mapping/BuildingSublayerExtension.js +1 -1
- package/mapping/CSVLayerExtension.js +1 -1
- package/mapping/FeatureCollectionLayerExtension.js +1 -1
- package/mapping/FeatureLayerExtension.js +1 -1
- package/mapping/FeatureLayerExtensionBase.js +1 -1
- package/mapping/GraphicsLayerExtension.js +1 -1
- package/mapping/GroundExtension.js +1 -1
- package/mapping/GroupLayerExtension.js +1 -1
- package/mapping/ImageryLayerExtension.js +1 -1
- package/mapping/ImageryTileLayerExtension.js +1 -1
- package/mapping/KMLLayerExtension.js +1 -1
- package/mapping/KMLSublayerExtension.js +1 -1
- package/mapping/MapExtension.js +1 -1
- package/mapping/MapImageLayerExtension.js +1 -1
- package/mapping/MapImageSublayerExtension.js +1 -1
- package/mapping/PointCloudLayerExtension.js +1 -1
- package/mapping/SceneLayerExtension.js +1 -1
- package/mapping/StreamLayerExtension.js +1 -1
- package/mapping/WMTSLayerExtension.js +1 -1
- package/mapping/WMTSSublayerExtension.js +1 -1
- package/mapping/_LayerExtension.js +1 -1
- package/mapping/_SublayerExtension.js +1 -1
- package/mapping/support/LayerListSettings.js +1 -1
- package/mapping/support/WfsCapabilities.js +1 -1
- package/mapping/support/_LayerExtensionCollection.js +1 -1
- package/mapping/support/_SublayerExtensionCollection.js +1 -1
- package/mapping/support/layers.js +1 -1
- package/mapping/support/ogc.js +1 -1
- package/menus/Menu.js +1 -1
- package/menus/MenuItem.js +1 -1
- package/package.json +1 -1
- package/portal/BaseMap.js +1 -1
- package/portal/DrawingInfo.js +1 -1
- package/portal/FeatureLayer.js +1 -1
- package/portal/IntegratedMeshLayer.js +1 -1
- package/portal/Layer.js +1 -1
- package/portal/LayerDefinition.js +1 -1
- package/portal/Lighting.js +1 -1
- package/portal/MapServiceLayer.js +1 -1
- package/portal/PointCloudLayer.js +1 -1
- package/portal/Slide.js +1 -1
- package/portal/Symbol.js +1 -1
- package/portal/Table.js +1 -1
- package/portal/TiledImageServiceLayer.js +1 -1
- package/portal/TiledMapServiceLayer.js +1 -1
- package/portal/WebMap.js +1 -1
- package/portal/WebScene.js +1 -1
- package/portal/Widgets.js +1 -1
- package/support/ArcGISRequestHelper.js +1 -1
- package/support/Cancellable.js +1 -1
- package/support/Observable.js +1 -1
- package/support/Serializable.js +1 -1
- package/support/Settings.js +1 -1
- package/support/_ArcGISRelationshipCollection.js +1 -1
- package/support/_query.js +1 -1
- package/support/utilities.js +1 -1
- package/tasks/geocoding/ArcGISGeocoder.js +1 -1
- package/tasks/geocoding/utilities.js +1 -1
- package/tasks/identify/BuildingComponentSublayerClientSideIdentifyProvider.js +1 -1
- package/tasks/identify/BuildingComponentSublayerHitTestIdentifyProvider.js +1 -1
- package/tasks/identify/CSVLayer3DHitTestIdentifyProvider.js +1 -1
- package/tasks/identify/CSVLayerClientSideQueryIdentifyProvider.js +1 -1
- package/tasks/identify/ClientSideIdentifyProvider.js +1 -1
- package/tasks/identify/FeatureLayer3DHitTestIdentifyProvider.js +1 -1
- package/tasks/identify/FeatureLayerClientSideIdentifyProvider.js +1 -1
- package/tasks/identify/FeatureLayerQueryIdentifyProvider.js +1 -1
- package/tasks/identify/HitTestIdentifyProvider.js +1 -1
- package/tasks/identify/IdentifyProviderBase.js +1 -1
- package/tasks/identify/IdentifyService.js +1 -1
- package/tasks/identify/ImageryLayerIdentifyProvider.js +1 -1
- package/tasks/identify/PointCloudLayerHitTestIdentifyProvider.js +1 -1
- package/tasks/identify/SceneLayerHitTestIdentifyProvider.js +1 -1
- package/tasks/identify/SceneLayerQueryIdentifyProvider.js +1 -1
- package/tasks/identify/StreamLayerClientSideQueryIdentifyProvider.js +1 -1
- package/tasks/identify/WMSSublayerIdentifyProvider.js +1 -1
- package/tasks/identify/_utilities.js +1 -1
- package/tasks/query/ArcGISRelationship.js +1 -1
- package/tasks/query/BuildingComponentSublayerClientSideQueryProvider.js +1 -1
- package/tasks/query/CSVLayerClientSideQueryProvider.js +1 -1
- package/tasks/query/ClientSideQueryProvider.js +1 -1
- package/tasks/query/FeatureLayerQueryProvider.js +1 -1
- package/tasks/query/ImageryLayerQueryProvider.js +1 -1
- package/tasks/query/SceneLayerClientSideQueryProvider.js +1 -1
- package/tasks/query/StreamLayerClientSideQueryProvider.js +1 -1
- package/tasks/search/ArcGISGeocoderSearchProvider.js +1 -1
- package/tasks/search/GeocoderSearchProvider.js +1 -1
- package/tasks/search/QuerySearchProvider.js +1 -1
- package/tasks/search/SearchService.js +1 -1
- package/tasks/search/_utilities.js +1 -1
- package/utilities/_layers.js +1 -1
- package/utilities/arcade.js +1 -1
- package/utilities/checkArg.js +1 -1
- package/utilities/date.js +1 -1
- package/utilities/esri.js +1 -1
- package/utilities/extensions.js +1 -1
- package/utilities/geometry.js +1 -1
- package/utilities/mapping.js +1 -1
- package/utilities/number.js +1 -1
- package/utilities/portal.js +1 -1
- package/utilities/query.js +1 -1
- package/utilities/renderers.js +1 -1
- package/utilities/scaleRanges.js +1 -1
- package/utilities/string.js +1 -1
- package/utilities/symbol.js +1 -1
- package/utilities/watch.js +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
package/ItemType.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export var ItemType;!function(e){e.ATTACHMENT="attachment",e.BASEMAP_EXTENSION="basemap-extension",e.BOOKMARK="bookmark",e.FEATURE="feature",e.FEATURE_SET="feature-set",e.FEATURE_LIST="feature-list",e.FIELD_EXTENSION="field-extension",e.GEOCODER="geocoder",e.GROUND_EXTENSION="ground-extension",e.LANGUAGE_RESOURCES="language-resources",e.LAYER="layer",e.LAYER_EXTENSION="layer-extension",e.LAYER_PRESET="layer-preset",e.MAP_EXTENSION="map-extension",e.MENU="menu",e.MENU_ITEM="menu-item",e.RELATIONSHIP="relationship",e.SUBLAYER_EXTENSION="sublayer-extension",e.TABLE_EXTENSION="table-extension"}(ItemType||(ItemType={}));export function isAttachment(e){return
|
|
1
|
+
export var ItemType;!function(e){e.ATTACHMENT="attachment",e.BASEMAP_EXTENSION="basemap-extension",e.BOOKMARK="bookmark",e.FEATURE="feature",e.FEATURE_SET="feature-set",e.FEATURE_LIST="feature-list",e.FIELD_EXTENSION="field-extension",e.GEOCODER="geocoder",e.GROUND_EXTENSION="ground-extension",e.LANGUAGE_RESOURCES="language-resources",e.LAYER="layer",e.LAYER_EXTENSION="layer-extension",e.LAYER_PRESET="layer-preset",e.MAP_EXTENSION="map-extension",e.MENU="menu",e.MENU_ITEM="menu-item",e.RELATIONSHIP="relationship",e.SUBLAYER_EXTENSION="sublayer-extension",e.TABLE_EXTENSION="table-extension"}(ItemType||(ItemType={}));export function isAttachment(e){return e?.itemType===ItemType.ATTACHMENT}export function isBookmark(e){return e?.itemType===ItemType.BOOKMARK}export function isLayerExtension(e){return e?.itemType===ItemType.LAYER_EXTENSION}export function isMapExtension(e){return e?.itemType===ItemType.MAP_EXTENSION}export function isSublayerExtension(e){return e?.itemType===ItemType.SUBLAYER_EXTENSION}export function isTableExtension(e){return e?.itemType===ItemType.TABLE_EXTENSION}export function isBasemapExtension(e){return e?.itemType===ItemType.BASEMAP_EXTENSION}export function isGroundExtension(e){return e?.itemType===ItemType.GROUND_EXTENSION}export function isFeature(e){return e?.itemType===ItemType.FEATURE}export function isFeatureSet(e){return e?.itemType===ItemType.FEATURE_SET}export function isFeatureList(e){return e?.itemType===ItemType.FEATURE_LIST}export function isFieldExtension(e){return e?.itemType===ItemType.FIELD_EXTENSION}export function isGeocoder(e){return e?.itemType===ItemType.GEOCODER}export function isRelationship(e){return e?.itemType===ItemType.RELATIONSHIP}export function isMenu(e){return e?.itemType===ItemType.MENU}export function isMenuItem(e){return e?.itemType===ItemType.MENU_ITEM}export function isLayerPreset(e){return e?.itemType===ItemType.LAYER_PRESET}export function isLanguageResources(e){return e?.itemType===ItemType.LANGUAGE_RESOURCES}
|
package/LanguageResources.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{ItemType}from"./ItemType.js";import{INVARIANT}from"./locale.js";import{serializable,SerializableBase}from"./support/Serializable.js";import{ObservableMap}from"./utilities/ObservableMap.js";import{generateUuid}from"./utilities/uuid.js";let LanguageResources=class extends SerializableBase{constructor(e){super(e),this._locale=INVARIANT,this._values=new ObservableMap,this._id=
|
|
1
|
+
import{__decorate}from"tslib";import{ItemType}from"./ItemType.js";import{INVARIANT}from"./locale.js";import{serializable,SerializableBase}from"./support/Serializable.js";import{ObservableMap}from"./utilities/ObservableMap.js";import{generateUuid}from"./utilities/uuid.js";let LanguageResources=class extends SerializableBase{constructor(e){super(e),this._locale=INVARIANT,this._values=new ObservableMap,this._id=e?.id,e?.locale&&(this._locale=e.locale)}get id(){return this._id||(this._id=generateUuid()),this._id}get locale(){return this._locale}get values(){return this._values}get itemType(){return ItemType.LANGUAGE_RESOURCES}toItemUri(){return`item://${encodeURIComponent(this.itemType)}/${encodeURIComponent(this.id)}`}_getSerializableProperties(){return{...super._getSerializableProperties(),id:{serializeModes:["initial"],deserialize:!1},locale:{serializeModes:["initial"],deserialize:!1},values:{serializeModes:["initial"],serialize:()=>{const e={};for(const[i,s]of this.values.entries())e[i]=s;return e},deserialize:e=>{this._values.clear();for(const i of Object.keys(e))this._values.set(i,e[i])}}}}};LanguageResources=__decorate([serializable],LanguageResources);export{LanguageResources};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{InvalidOperationError}from"../InvalidOperationError.js";import{toAttachment}from"../data/Attachment.js";import{FeatureSaveError}from"../data/FeatureSaveError.js";import{DefaultArcGISRequestHelper}from"../support/ArcGISRequestHelper.js";import{cancelify}from"../support/Cancellable.js";import{serializable}from"../support/Serializable.js";import{ArcGISRelationshipCollection}from"../support/_ArcGISRelationshipCollection.js";import{executeQuery}from"../support/_query.js";import{ReadOnlyCollection}from"../utilities/ReadOnlyCollection.js";import{Collection}from"../utilities/collection.js";import{isArcGISServiceTableExtension}from"../utilities/extensions.js";import{isFeatureLayer,isMapImageSublayer}from"../utilities/layers.js";import{isNumeric,parse}from"../utilities/number.js";import{toGraphic}from"./Feature.js";import{TableExtension,TableFeatureSettings,TableSchema}from"./_TableExtension.js";import{addAttachment,deleteAttachments,supportsAttachmentEditing as layerSupportsAttachmentEditing}from"./support/attachments.js";const ERR_SCHEMA_READ_ONLY="This schema property is read-only.";let ArcGISServiceTableExtension=class extends TableExtension{get requestHelper(){return this._requestHelper||(this._requestHelper=new DefaultArcGISRequestHelper),this._requestHelper}set requestHelper(e){this._requestHelper=e}get capabilities(){
|
|
1
|
+
import{__decorate}from"tslib";import{InvalidOperationError}from"../InvalidOperationError.js";import{toAttachment}from"../data/Attachment.js";import{FeatureSaveError}from"../data/FeatureSaveError.js";import{DefaultArcGISRequestHelper}from"../support/ArcGISRequestHelper.js";import{cancelify}from"../support/Cancellable.js";import{serializable}from"../support/Serializable.js";import{ArcGISRelationshipCollection}from"../support/_ArcGISRelationshipCollection.js";import{executeQuery}from"../support/_query.js";import{ReadOnlyCollection}from"../utilities/ReadOnlyCollection.js";import{Collection}from"../utilities/collection.js";import{isArcGISServiceTableExtension}from"../utilities/extensions.js";import{isFeatureLayer,isMapImageSublayer}from"../utilities/layers.js";import{isNumeric,parse}from"../utilities/number.js";import{toGraphic}from"./Feature.js";import{TableExtension,TableFeatureSettings,TableSchema}from"./_TableExtension.js";import{addAttachment,deleteAttachments,supportsAttachmentEditing as layerSupportsAttachmentEditing}from"./support/attachments.js";const ERR_SCHEMA_READ_ONLY="This schema property is read-only.";let ArcGISServiceTableExtension=class extends TableExtension{get requestHelper(){return this._requestHelper||(this._requestHelper=new DefaultArcGISRequestHelper),this._requestHelper}set requestHelper(e){this._requestHelper=e}get capabilities(){const e=layerSupportsAttachmentEditing(this.table);return this.table?.capabilities?.operations?{...this.table.capabilities.operations,supportsAttachmentEditing:e}:{...super.capabilities,supportsAttachmentEditing:e}}get table(){return super.table}async _getAttachments(e){if(!this.table?.capabilities?.data?.supportsAttachment)return[];const t=`${this._layerUrl}/${e.primaryKey}/attachments`,r=await this.requestHelper.request(t,{query:{f:"json"},ttl:0});return r?.data?.attachmentInfos?r.data.attachmentInfos.map((e=>toAttachment(e,t))):[]}async _addAttachment(e,t){return addAttachment(e,this.table,t,{attachmentTypes:this.attachmentTypes})}async _deleteAttachments(e,t){return deleteAttachments(e,this.table,t)}get _layerUrl(){return isNumeric(this.table.layerId)?`${this.table.url}/${this.table.layerId}`:this.table.url}_getFeatures(e,t){const r=this.table.createQuery();return r.objectIds=e.map((e=>parse(e))),r.where=void 0,r.outFields=t.outFields,r.returnGeometry=t.returnGeometry,executeQuery(r,this,this.table,t.cancelToken)}async _addFeatures(e,t){const r=Array.from(e);if(0===r.length)return;const a=await this._applyEdits({addFeatures:r.map(toGraphic),updateFeatures:[],deleteFeatures:[]});if(!a.addFeatureResults||a.addFeatureResults.length!==r.length)throw new FeatureSaveError("Received malformed response from server while saving feature(s).");let s;if(a.addFeatureResults.forEach(((e,t)=>{if(e.error){s=s||new FeatureSaveError("Errors encountered when adding features.");const{primaryKey:a}=r[t];s.errors.set(a,new Error(`Failed to add feature with id ${a}. ${e.error.message}`))}})),s)throw s}async _updateFeatures(e,t){const r=Array.from(e);if(0===r.length)return;const a=await this._applyEdits({addFeatures:[],updateFeatures:r.map(toGraphic),deleteFeatures:[]});if(!a.updateFeatureResults||a.updateFeatureResults.length!==r.length)throw new FeatureSaveError("Received malformed response from server while saving feature(s).");let s;if(a.updateFeatureResults.forEach(((e,t)=>{if(e.error){s=s||new FeatureSaveError("Errors encountered when updating features.");const{primaryKey:a}=r[t];s.errors.set(a,new Error(`Failed to update feature with id ${a}. ${e.error.message}`))}})),s)throw s}async _deleteFeatures(e,t){if(0===e.length)return;const r=await this._applyEdits({addFeatures:[],updateFeatures:[],deleteFeatures:e.map((e=>({globalId:e})))});if(!r.deleteFeatureResults)throw new FeatureSaveError("Received malformed response from server while saving feature(s).");let a;if(r.deleteFeatureResults.forEach(((t,r)=>{if(t.error){a=a||new FeatureSaveError("Errors encountered when deleting features.");const s=e[r];a.errors.set(s,new Error(`Failed to delete feature with id ${s}. ${t.error.message}`))}})),a)throw a}async _onInitialize(){await super._onInitialize(),await this.relationships.initialize()}_isSupportedTable(e){return!e.loaded||e.isTable}_createFeatureSettings(){return new ArcGISServiceTableFeatureSettings(this)}_createRelationships(){return new RelationshipCollection(this)}_createSchema(){return new ArcGISServiceTableSchema(this)}_getSerializableProperties(){const e=super._getSerializableProperties();return{...e,attachmentTypes:["initial"],table:{...this._toPropertyDef(e.table),default:{$tableType:"ArcGISServiceTable"}},requestHelper:{serialize:!1}}}async _applyEdits(e,t={}){const r=this.table.applyEdits(e),a=await cancelify(r,t.cancelToken);if(!a)throw new FeatureSaveError("Received malformed response from server while saving feature(s).");return a}};ArcGISServiceTableExtension=__decorate([serializable],ArcGISServiceTableExtension);export{ArcGISServiceTableExtension};class TypeCollection extends ReadOnlyCollection{constructor(e){if(super(),e.table)this._onTableResolved(e.table);else{this._collection=new Collection;const t=e.watch("table",(()=>{this._onTableResolved(e.table),t.remove()}),!0)}}_onTableResolved(e){this._collection=new Collection(e.types)}}let ArcGISServiceTableSchema=class extends TableSchema{constructor(e){super(e),this._typeCollection=new TypeCollection(e),this._bindSettingToTableProperty("displayField"),this._bindSettingToTableProperty("typeIdField")}get types(){return this._typeCollection}_setSetting(e,t){if(this._tableBindings.has(e))throw new InvalidOperationError(ERR_SCHEMA_READ_ONLY);super._setSetting(e,t)}_createFieldCollection(){return new ReadOnlyCollection(super._createFieldCollection())}};ArcGISServiceTableSchema=__decorate([serializable],ArcGISServiceTableSchema);let ArcGISServiceTableFeatureSettings=class extends TableFeatureSettings{constructor(e){if(super(),this._tableBindings=new Map,this._tableExtension=e,this._bindSettingToTableProperty("popupTemplate"),e.table)this._onTableResolved(e.table);else{const t=e.watch("table",(()=>{this._onTableResolved(e.table),t.remove()}),!0)}}_getSetting(e,t){return this._tableBindings.has(e)&&this._tableExtension.table?this._tableExtension.table[this._tableBindings.get(e)]:super._getSetting(e,t)}_setSetting(e,t){this._tableBindings.has(e)&&this._tableExtension.table?this._tableExtension.table[this._tableBindings.get(e)]=t:super._setSetting(e,t)}_bindSettingToTableProperty(e,t){const r=t??e;this._tableBindings.set(e,r),this._tableExtension.watch(`table.${r}`,(()=>this.notifyChange(e)),!0)}_onTableResolved(e){for(const t of this._tableBindings.keys())this.isModified(t)&&(e[t]=this[t],this.reset(t))}};ArcGISServiceTableFeatureSettings=__decorate([serializable],ArcGISServiceTableFeatureSettings);class RelationshipCollection extends ArcGISRelationshipCollection{get _sourceUrl(){if(this._source.table&&this._source.table.url)return isNumeric(this._source.table.layerId)?`${this._source.table.url}/${this._source.table.layerId}`:this._source.table.url}get _sourceLayerId(){return this._source.table?.layerId}_findRelatedSource(e){if(!this._source.mapExtension||!this._source.table||!this._source.table.url)return;const t=this._source.mapExtension.tableExtensions.initializedItems.find((t=>isArcGISServiceTableExtension(t)&&t.table.url===this._source.table.url&&t.table.layerId===e));if(t)return t;for(const t of this._source.mapExtension.layerExtensions.initializedItems.toArray()){const r=t.allSublayerExtensions.initializedItems.find((t=>isMapImageSublayer(t.sublayer)&&t.sublayer.layer.url===this._source.table.url&&t.sublayer.id===e));if(r)return r}return this._source.mapExtension.layerExtensions.initializedItems.find((t=>isFeatureLayer(t.layer)&&t.layer.url===this._source.table.url&&t.layer.layerId===e))}}
|
package/data/Attachment.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{EntityBase}from"../Entity.js";import{ItemType}from"../ItemType.js";import{serializable}from"../support/Serializable.js";let Attachment=class extends EntityBase{constructor(){super(...arguments),this._itemType=ItemType.ATTACHMENT}_getSerializableProperties(){return{...super._getSerializableProperties(),url:"initial",contentType:"initial",size:"initial",title:"initial"}}};Attachment=__decorate([serializable],Attachment);export{Attachment};export function toAttachment(t,e){
|
|
1
|
+
import{__decorate}from"tslib";import{EntityBase}from"../Entity.js";import{ItemType}from"../ItemType.js";import{serializable}from"../support/Serializable.js";let Attachment=class extends EntityBase{constructor(){super(...arguments),this._itemType=ItemType.ATTACHMENT}_getSerializableProperties(){return{...super._getSerializableProperties(),url:"initial",contentType:"initial",size:"initial",title:"initial"}}};Attachment=__decorate([serializable],Attachment);export{Attachment};export function toAttachment(t,e){return new Attachment({id:t.id.toString(),contentType:t.contentType,size:t.size,title:t.name,url:t.url??`${e}/${t.id}`})}
|
package/data/Feature.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import Graphic from"@arcgis/core/Graphic";import*as Arcade from"@arcgis/core/arcade/arcade";import{EntityBase}from"../Entity.js";import{Hyperlink}from"../Hyperlink.js";import{InvalidOperationError}from"../InvalidOperationError.js";import{ItemType}from"../ItemType.js";import{toEsriApiGeometry,toPortalGeometry}from"../portal/Geometry.js";import{serializable}from"../support/Serializable.js";import{MapTransformCollection}from"../utilities/MapTransformCollection.js";import{ObservableMap}from"../utilities/ObservableMap.js";import{ReadOnlyMap}from"../utilities/ReadOnlyMap.js";import{arcadeScriptUsesGeometry,isArcadeScriptAsync,runArcadeExpression,runAsyncArcadeExpression}from"../utilities/arcade.js";import{flatten,groupBy}from"../utilities/array.js";import{checkArg}from"../utilities/checkArg.js";import{Collection,compare}from"../utilities/collection.js";import{parse as parseDate,esriFormatToGeocortexFormat}from"../utilities/date.js";import{isCodedValueDomain}from"../utilities/esri.js";import{some,map as mapIterable,concat,forEach,find}from"../utilities/iterable.js";import{getLogger}from"../utilities/log.js";import{parse as parseNumber,NumberFormat}from"../utilities/number.js";import{map as promiseMap}from"../utilities/promise.js";import{format as formatString}from"../utilities/string.js";import{FeatureSettings}from"./FeatureSettings.js";import{_fieldWithArcadeXRegex,_fieldWithRelationshipRegex,Schema}from"./Schema.js";const log=getLogger("geocortex.api.data.Feature");export const SCORE_FIELD="_score";export const SCORE_FIELD_ORIGINAL="_score_original";let Feature=class extends EntityBase{constructor(e){super(e),this._itemType=ItemType.FEATURE,this._expressionFieldValues=new ObservableMap,this._expressionValuesUpdatePending=!1,this.settings=new FeatureSettings,this.settings._setFeature(this),this.schema=new Schema,this.schema._featureSettings=this.settings,this.attachments=new Collection,this.attributes=new ObservableMap,this._relatedFeatures=new ObservableMap,this.expressionFieldValues=new ExpressionFieldsValuesImpl(this._expressionFieldValues,this)}get geometry(){return this._geometry}set geometry(e){var t;this._notifyChange("geometryType"),this._geometry=toEsriApiGeometry(e),this.schema.spatialReference=null===(t=this._geometry)||void 0===t?void 0:t.spatialReference}get geometryType(){return this.geometry?this.geometry.type:void 0}get source(){return this._source}set source(e){this._source&&this.settings.parent===this._source.featureSettings&&(this.settings.parent=void 0),this._source&&this.schema.parent===this._source.schema&&(this.settings.parent=void 0),this._source=e,this.settings.parent||(this.settings.parent=e?e.featureSettings:void 0),this.schema.parent||(this.schema.parent=e?e.schema:void 0)}get primaryKey(){const e=this.attributes.get(this.schema.primaryKeyField);return null!=e?`${e}`:void 0}get presentableAttributes(){return this._presentableAttributes=this._presentableAttributes||new PresentableAttributesImpl(this),this._presentableAttributes}get title(){return this.format(this._title||"")}get description(){return this.format(this._description)}get hyperlinks(){return this._hyperlinks||(this._hyperlinks=new HyperlinksCollection(this))}get relatedFeatures(){return this._relatedFeatures}get type(){if(this.schema.typeIdField&&this.attributes.has(this.schema.typeIdField)){const e=this.attributes.get(this.schema.typeIdField);return this.schema.types.find((t=>t.id===e))}}get _hydrationStatus(){var e,t;return this._featureHydrationStatus?this._featureHydrationStatus:(null===(t=null===(e=this.source)||void 0===e?void 0:e.capabilities)||void 0===t?void 0:t.supportsQuery)&&1===this.attributes.size&&void 0!==this.primaryKey?"dehydrated":"hydrated"}set _hydrationStatus(e){this._featureHydrationStatus=e}get _title(){let e;return this.settings.popupTemplate&&(e="function"==typeof this.settings.popupTemplate.title?this.settings.popupTemplate.title():this.settings.popupTemplate.title),e||this.schema.displayField&&this.presentableAttributes.get(this.schema.displayField)||""}get _description(){var e;if(null===(e=this.settings.popupTemplate)||void 0===e?void 0:e.content){if("string"==typeof this.settings.popupTemplate.content)return this.settings.popupTemplate.content;if(Array.isArray(this.settings.popupTemplate.content)){const e=this.settings.popupTemplate.content.find((e=>"text"===e.type));if(e)return e.text}}return""}format(e,...t){let r="string"==typeof e?{format:e}:e;checkArg("options",r).isNotMissing();const{format:i}=r;checkArg("format",i).isNotMissing();let s=r.format.replace(escapedBraceRegex,escapedBracePlaceholder);return s=s.replace(fieldTokenRegex,((e,t,i,s,a)=>formatAttribute(this,t||i,s,{...r,format:a?`{0:${a}}`:"{0}"}))),s=s.replace(escapedBracePlaceholderRegex,"{{"),r={...r},r.format=s,formatString(r,...t)}clearExpressionInfos(){this._expressionFieldValues.clear()}async fetchExpressionInfos(e=!1){var t;const{expressionInfos:r}=null!==(t=this.settings.popupTemplate)&&void 0!==t?t:{};if(r)return await Promise.all(r.map((async e=>{var t,r,i,s,a;try{const o=null!==(r=null===(t=this.source)||void 0===t?void 0:t.layer)&&void 0!==r?r:null===(i=this.source)||void 0===i?void 0:i.sublayer;let n=null===(s=this.source)||void 0===s?void 0:s.mapExtension;if(!n){const e=null===(a=this.source)||void 0===a?void 0:a.layerExtension;n=null==e?void 0:e.mapExtension}this._expressionFieldValues.set(e.name,await runAsyncArcadeExpression(e.expression,{layer:o,map:null==n?void 0:n.map,feature:this,spatialReference:this.schema.spatialReference}))}catch(t){t instanceof Error&&log.error({message:"Error evaluating expression '{0}': {1}.",error:t},e.name,t.message),this._expressionFieldValues.set(e.name,invalidRelationshipOrExpression)}}))),e?this.attributes.on("change",(async e=>{this._expressionValuesUpdatePending||(this._expressionValuesUpdatePending=!0,setTimeout((async()=>{this._expressionValuesUpdatePending=!1,await this.fetchExpressionInfos()}),0))})):void 0}async fetchRelatedFeatures(e){if(!this.source)return;let t;if(e){const r="string"==typeof e?this.source.relationships.find((t=>t.id===e)):e;if(!r||!this.source.relationships.includes(r))throw new InvalidOperationError("Relationship not found in feature source.");t=[r]}else t=this.source.relationships.toArray();const r=await promiseMap(t,(async e=>[e,await e.getRelatedFeatures(this)]));for(const e of r)this._relatedFeatures.set(e[0],e[1])}async fetchAttachments(){if(this.source){const e=await this.source.getAttachments(this);compare(this.attachments,e,{equals:(e,t)=>e.id===t.id,onMissing:(e,t)=>this.attachments.remove(e),onNew:(e,t)=>this.attachments.add(e),onMatch:(e,t,r,i)=>{this.attachments.splice(r,1,t)}})}}async addAttachment(e){var t;return null===(t=this.source)||void 0===t?void 0:t.addAttachment(this,e)}async deleteAttachments(e){var t;return null===(t=this.source)||void 0===t?void 0:t.deleteAttachments(this,e)}_getSerializableProperties(){return{...super._getSerializableProperties(),attributes:{serializeModes:["project"],serialize:e=>{var t;const r={};if("project"===e&&this.primaryKey&&(null===(t=this.source)||void 0===t?void 0:t.capabilities).supportsQuery)r[this.schema.primaryKeyField]=this.primaryKey;else for(const[e,t]of this.attributes.entries())r[e]=t;return r},deserialize:e=>{if(this.attributes.clear(),e instanceof Map)e.forEach(((e,t)=>{this.attributes.set(t,e)}));else for(const[t,r]of Object.entries(e))this.attributes.set(t,r)}},geometry:{serializeModes:["project"],serialize:e=>{var t;return"project"===e&&(null===(t=this.source)||void 0===t?void 0:t.capabilities).supportsQuery?this.getDefault("geometry"):toPortalGeometry(this.geometry)},deserialize:e=>this.geometry=toEsriApiGeometry(e)},settings:{serializeModes:["project"],serialize:e=>{var t;return"project"===e&&(null===(t=this.source)||void 0===t?void 0:t.capabilities).supportsQuery?this.getDefault("settings"):this.settings.toJSON(e)}},schema:{serializeModes:["project"],serialize:e=>{var t;return"project"===e&&(null===(t=this.source)||void 0===t?void 0:t.capabilities).supportsQuery?this.getDefault("schema"):this.schema.toJSON(e)}},source:["project"]}}_watchProperty(e,t,r,i){if("title"===e||"description"===e){const s=super._watchProperty(e,t,r,i),a="title"===e?"settings.popupTemplate.title":"settings.popupTemplate.content",o=this.watch(a,(()=>{this._notifyChange(e)})),n=this.presentableAttributes.on("change",(()=>{this._notifyChange(e)}));return{remove(){s.remove(),o.remove(),n.remove()}}}return super._watchProperty(e,t,r,i)}async _onInitialize(){const e=this._findRelationshipIds(this._title,this._description),t=this.source?this.source.relationships.map((e=>e.id)).toArray():[],r=[];for(const i of e)t.includes(i)?r.push(this.fetchRelatedFeatures(i)):log.error("Could not find relationship '{0}' referenced in feature title or description.",i);await Promise.all(r)}_findRelationshipIds(...e){const t=[];for(const r of e){let e;const i=r.replace(escapedBraceRegex,escapedBracePlaceholder);for(;e=relationshipIdRegex.exec(i),null!==e;){const r=e[0];t.includes(r)||t.push(e[1])}}return t}};Feature=__decorate([serializable],Feature);export{Feature};export function toFeature(e,t){const r=new Feature(t);if(e.attributes)for(const t of Object.keys(e.attributes))r.attributes.set(t,e.attributes[t]);return r.geometry=e.geometry,e.popupTemplate&&(r.settings.popupTemplate=e.popupTemplate),r}export function toGraphic(e){var t,r;const i=new Graphic;i.attributes={};for(const t of e.attributes.keys())i.attributes[t]=e.attributes.get(t);return(null===(t=e.source)||void 0===t?void 0:t.layer)&&(i.layer=null===(r=e.source)||void 0===r?void 0:r.layer),i.geometry=e.geometry,e.settings.popupTemplate&&(i.popupTemplate=e.settings.popupTemplate),i}const ERR_PRESENTABLE_ATTRIBUTES_READONLY="Presentable attributes are read-only.",ERR_HYPERLINK_READONLY="Feature hyperlinks are read-only. Modify the feature's hyperlink templates instead.";class ExpressionFieldsValuesImpl extends ReadOnlyMap{constructor(e,t){super(e),this._feature=t}get(e){var t,r;if(!super.has(e)){const{spatialReference:i}=this._feature.schema,s=null===(r=null===(t=this._feature.settings.popupTemplate)||void 0===t?void 0:t.expressionInfos)||void 0===r?void 0:r.find((t=>t.name===e));if(!s)return;(async()=>{var t,r,a,o,n;try{if(isArcadeScriptAsync(s.expression,i)){const l=null!==(r=null===(t=this._feature.source)||void 0===t?void 0:t.layer)&&void 0!==r?r:null===(a=this._feature.source)||void 0===a?void 0:a.sublayer;let p=null===(o=this._feature.source)||void 0===o?void 0:o.mapExtension;if(!p){const e=null===(n=this._feature.source)||void 0===n?void 0:n.layerExtension;p=null==e?void 0:e.mapExtension}this._originalMap.set(e,await runAsyncArcadeExpression(s.expression,{feature:this._feature,layer:l,map:null==p?void 0:p.map,spatialReference:i}))}else arcadeScriptUsesGeometry(s.expression,i)&&await Arcade.enableGeometrySupport(),this._originalMap.set(e,runArcadeExpression(s.expression,{feature:this._feature,spatialReference:i}))}catch(t){t instanceof Error&&log.error({message:"Error evaluating expression '{0}': {1}.",error:t},e,t.message),this._originalMap.set(e,invalidRelationshipOrExpression)}})()}return super.get(e)}}class PresentableAttributesImpl extends ReadOnlyMap{constructor(e){super(new ObservableMap),this._feature=e}get size(){return this._feature.attributes.size+this._feature.schema.fields._expressionFieldsLength}clear(){throw new InvalidOperationError(ERR_PRESENTABLE_ATTRIBUTES_READONLY)}delete(e){throw new InvalidOperationError(ERR_PRESENTABLE_ATTRIBUTES_READONLY)}forEach(e,t){checkArg("callback",e).isNotMissing();for(const r of this.keys())e.call(t,this.get(r),r,this)}get(e){const t=this._getFieldExtensionFormat(e);return this._formatAttribute(e,t)}has(e){return some(this.keys(),(t=>t===e))}set(...e){throw new InvalidOperationError(ERR_PRESENTABLE_ATTRIBUTES_READONLY)}*entries(){yield*mapIterable(this.keys(),(e=>[e,this.get(e)]))}*keys(){var e;const t=this._feature.schema.fields.expressionFields.map((e=>e.name)),r=[];(null===(e=this._feature.source)||void 0===e?void 0:e.relationships)&&this._feature.source.relationships.filter((e=>"one-to-one"===e.cardinality||"many-to-one"===e.cardinality)).forEach((e=>r.push(...e.relatedSource.schema.fields.map((t=>`relationships/${e.id}/${t.name}`)).toArray()))),yield*concat(this._feature.attributes.keys(),t.toArray(),r)}*values(){yield*mapIterable(this.keys(),(e=>this.get(e)))}[(Symbol.toStringTag,Symbol.iterator)](){return this.entries()}toJSON(){return Array.from(this.entries())}on(e,t){if(checkArg("callback",t).isNotMissing(),!this._numObservers){const e=new Map,t=new Set,r=()=>{t.forEach((e=>e.remove())),t.clear()},i=()=>{const t={added:Array.from(this.entries()).filter((t=>t[1]!==e.get(t[0]))),removed:Array.from(e.entries()).filter((e=>!this.has(e[0])||e[1]!==this.get(e[0]))),target:this};(t.added.length||t.removed.length)&&(this.emit("change",t),s())},s=()=>{e.clear(),r(),forEach(this.keys(),(r=>{const s=this._getFieldExtension(r);let a="{0}";if(s){const e=s.watch("format",(()=>{i()}));t.add(e),s.format&&(a=s.format)}e.set(r,this._formatAttribute(r,a))}))};s();const a=this._feature.attributes.on("change",(()=>{i()})),o=this._feature.schema.fieldExtensions.on("change",(()=>{i()})),n=this._feature.settings.formatSettings.watch(["numberFormat","dateFormat","locale"],(()=>{i()})),l=this._feature.expressionFieldValues.on("change",(()=>{i()})),p=this._feature.schema.fields.on("change",(e=>{var t,r;((null===(t=e.added)||void 0===t?void 0:t.some((e=>null!==e.name.match(_fieldWithArcadeXRegex))))||(null===(r=e.removed)||void 0===r?void 0:r.some((e=>null!==e.name.match(_fieldWithArcadeXRegex)))))&&i()})),u=this._feature.settings.watch("popupTemplate",(()=>{i()}));this._onAllObserversRemoved=()=>{l.remove(),a.remove(),o.remove(),p.remove(),n.remove(),u.remove(),e.clear(),r()}}const r=super.on("change",t);return this._numObservers++,{remove:()=>{r.remove(),this._numObservers--,this._numObservers||this._onAllObserversRemoved()}}}watch(e,t){if("size"===e){const e=this._feature.attributes.watch("size",((e,r)=>{t(e+this._feature.schema.fields._expressionFieldsLength,r+this._feature.schema.fields._expressionFieldsLength,"size",this)})),r=this._feature.schema.fields.watch("_expressionFieldsLength",((e,r)=>{t(e+this._feature.attributes.size,r+this._feature.attributes.size,"size",this)}));return{remove:()=>{e.remove(),r.remove()}}}return super.watch(e,t)}_getFieldExtension(e){const t=this._feature.schema.findFieldByName(e);if(t)return this._feature.schema.fieldExtensions.forField(t)}_getFieldExtensionFormat(e){const t=this._getFieldExtension(e);return t?t.format:"{0}"}_formatAttribute(e,t){const r=e.match(_fieldWithArcadeXRegex),i=e.match(_fieldWithRelationshipRegex);if(r)return formatAttribute(this._feature,"expression",r[1],{format:t});if(i){const[,e,r]=i;return formatAttribute(this._feature,e,r,{format:t})}return formatAttribute(this._feature,void 0,e,{format:t})}}const fieldTokenRegex=/\{(?:relationships[\\/](\w\w*)[\\/])?(?:(expression)[\\/])?([a-zA-Z][.\w]*)(?::([^}]*))?\}/g,relationshipIdRegex=/\{relationships\/(\w\w*)[\\/]([^}]*)\}/g,escapedBraceRegex=/{{/g,escapedBracePlaceholder="\0MAGIC\0",escapedBracePlaceholderRegex=new RegExp(escapedBracePlaceholder,"g"),invalidRelationshipOrExpression="#INVALID";class HyperlinksCollection extends MapTransformCollection{constructor(e){super(e.settings.hyperlinkTemplates,(e=>this._getHyperlink(e))),this._feature=e}_getHyperlink(e){return this._hyperlinks=this._hyperlinks||new WeakMap,this._hyperlinks.has(e)||this._hyperlinks.set(e,new FeatureHyperlink(this._feature,e)),this._hyperlinks.get(e)}}let FeatureHyperlink=class extends Hyperlink{constructor(e,t){super(t.toJSON()),this._feature=e,this._template=t}get url(){return this._template.url?this._feature.format(this._template.url):this._template.url}set url(e){throw new InvalidOperationError(ERR_HYPERLINK_READONLY)}get text(){return this._template.text?this._feature.format(this._template.text):this._template.text}set text(e){throw new InvalidOperationError(ERR_HYPERLINK_READONLY)}get iconUrl(){return this._template.iconUrl?this._feature.format(this._template.iconUrl):this._template.iconUrl}set iconUrl(e){throw new InvalidOperationError(ERR_HYPERLINK_READONLY)}get target(){return this._template.target?this._feature.format(this._template.target):this._template.target}set target(e){throw new InvalidOperationError(ERR_HYPERLINK_READONLY)}get tooltip(){return this._template.tooltip?this._feature.format(this._template.tooltip):this._template.tooltip}set tooltip(e){throw new InvalidOperationError(ERR_HYPERLINK_READONLY)}_watchProperty(e,t,r,i){const s=super._watchProperty(e,t,r,i),a=this._template.watch(e,(()=>{this._notifyChange(e)})),o=this._feature.presentableAttributes.on("change",(()=>{this._notifyChange(e)}));return{remove:()=>{s.remove(),a.remove(),o.remove()}}}_getSerializableProperties(){return{}}};function formatAttribute(e,t,r,i={format:"{0}"}){var s,a,o,n;if("expression"!==t){if(t){const s=find(e.relatedFeatures.keys(),(e=>e.id===t));if(!s)return log.debug("Could not resolve related field '{0}/{1}",t,r),invalidRelationshipOrExpression;const a=Array.from(e.relatedFeatures.get(s));return"many-to-one"===s.cardinality||"one-to-one"===s.cardinality?a.length<1?(log.debug("Could not resolve related field '{0}/{1}",t,r),invalidRelationshipOrExpression):formatAttributeValue(a[0],r,i):a.map((e=>formatAttributeValue(e,r,i))).filter((e=>""!==e)).join(",")}return formatAttributeValue(e,r,i)}if(!(null===(a=null===(s=e.settings.popupTemplate)||void 0===s?void 0:s.expressionInfos)||void 0===a?void 0:a.find((e=>e.name===r))))return log.debug("Could not find expression '{0}'.",r),invalidRelationshipOrExpression;try{const t=null!==(n=null!==(o=e.expressionFieldValues.get(r))&&void 0!==o?o:i.defaultExpressionValue)&&void 0!==n?n:"",s=e.schema.findFieldByName(`expression/${r}`);let a=i;if(s){const t=e.schema.fieldExtensions.forField(s);a=formatOptionsForField(e,r,formatOptionsFromSettings(t.formatSettings),a)}return formatValue(e,t,a)}catch(e){if(e instanceof Error)return log.error({message:"Error evaluating expression '{0}': {1}.",error:e},r,e.message),invalidRelationshipOrExpression;throw e}}function formatAttributeValue(e,t,r){var i,s;let a=e.attributes.get(t);if(null==a)return"";const o=e.schema.findFieldByName(t);let n={format:"{0}"};const l=null===(s=null===(i=e.type)||void 0===i?void 0:i.domains)||void 0===s?void 0:s[t];if(t===e.schema.typeIdField)a=e.type?e.type.name:a;else if(isCodedValueDomain(l)){const e=l.codedValues.find((e=>`${e.code}`==`${a.toString()}`));a=e?e.name:a}else if(o)if(isCodedValueDomain(o.domain)){const e=o.domain.codedValues.find((e=>`${e.code}`==`${a.toString()}`));e&&(a=e.name)}else{switch(o.type){case"integer":case"small-integer":case"single":case"double":a=parseNumber(a);break;case"date":a=parseDate({timeZone:e.schema.timeZone},a);break;default:a=`${a.toString()}`}n=formatOptionsFromSettings(e.schema.fieldExtensions.forField(o).formatSettings)}return formatValue(e,a,formatOptionsForField(e,t,n,r))}function formatValue(e,t,r){let i=r;if("number"==typeof t||t instanceof Date){i={...formatOptionsFromSettings(e.settings.formatSettings),...r}}return"{0}"===i.format&&"string"==typeof t?t:formatString(i,t)}function formatOptionsFromSettings(e){return{format:"{0}",dateFormat:e.dateFormat,numberFormat:e.numberFormat,currency:e.currency,fractionalDigits:e.fractionalDigits,locale:e.locale,timeZone:e.timeZone}}function formatOptionsForField(e,t,r,i){const{popupTemplate:s}=e.settings,a=(null==s?void 0:s.fieldInfos)?s.fieldInfos.find((e=>e.fieldName===t)):void 0,o=a?a.format:void 0;let n;return o&&(n={format:"{0}",numberFormat:o.digitSeparator?NumberFormat.NUMBER:NumberFormat.FIXED_POINT,dateFormat:esriFormatToGeocortexFormat(o.dateFormat),fractionalDigits:o.places}),{...n,...r,...i}}FeatureHyperlink=__decorate([serializable],FeatureHyperlink);export async function resolveRelatedFeatures(e){const t=groupBy(e,(e=>e.source));await Promise.all(flatten([...t.keys()].map((e=>e.relationships.toArray()))).map((e=>(async e=>{[...(await e.getAllRelatedFeatures(t.get(e.source))).entries()].forEach((([t,r])=>{t.relatedFeatures.set(e,r)}))})(e))))}
|
|
1
|
+
import{__decorate}from"tslib";import Graphic from"@arcgis/core/Graphic";import*as Arcade from"@arcgis/core/arcade/arcade";import{EntityBase}from"../Entity.js";import{Hyperlink}from"../Hyperlink.js";import{InvalidOperationError}from"../InvalidOperationError.js";import{ItemType}from"../ItemType.js";import{toEsriApiGeometry,toPortalGeometry}from"../portal/Geometry.js";import{serializable}from"../support/Serializable.js";import{MapTransformCollection}from"../utilities/MapTransformCollection.js";import{ObservableMap}from"../utilities/ObservableMap.js";import{ReadOnlyMap}from"../utilities/ReadOnlyMap.js";import{arcadeScriptUsesGeometry,isArcadeScriptAsync,runArcadeExpression,runAsyncArcadeExpression}from"../utilities/arcade.js";import{flatten,groupBy}from"../utilities/array.js";import{checkArg}from"../utilities/checkArg.js";import{Collection,compare}from"../utilities/collection.js";import{parse as parseDate,esriFormatToGeocortexFormat}from"../utilities/date.js";import{isCodedValueDomain}from"../utilities/esri.js";import{some,map as mapIterable,concat,forEach,find}from"../utilities/iterable.js";import{getLogger}from"../utilities/log.js";import{parse as parseNumber,NumberFormat}from"../utilities/number.js";import{map as promiseMap}from"../utilities/promise.js";import{format as formatString}from"../utilities/string.js";import{FeatureSettings}from"./FeatureSettings.js";import{_fieldWithArcadeXRegex,_fieldWithRelationshipRegex,Schema}from"./Schema.js";const log=getLogger("geocortex.api.data.Feature");export const SCORE_FIELD="_score";export const SCORE_FIELD_ORIGINAL="_score_original";let Feature=class extends EntityBase{constructor(e){super(e),this._itemType=ItemType.FEATURE,this._expressionFieldValues=new ObservableMap,this._expressionValuesUpdatePending=!1,this.settings=new FeatureSettings,this.settings._setFeature(this),this.schema=new Schema,this.schema._featureSettings=this.settings,this.attachments=new Collection,this.attributes=new ObservableMap,this._relatedFeatures=new ObservableMap,this.expressionFieldValues=new ExpressionFieldsValuesImpl(this._expressionFieldValues,this)}get geometry(){return this._geometry}set geometry(e){this._notifyChange("geometryType"),this._geometry=toEsriApiGeometry(e),this.schema.spatialReference=this._geometry?.spatialReference}get geometryType(){return this.geometry?this.geometry.type:void 0}get source(){return this._source}set source(e){this._source&&this.settings.parent===this._source.featureSettings&&(this.settings.parent=void 0),this._source&&this.schema.parent===this._source.schema&&(this.settings.parent=void 0),this._source=e,this.settings.parent||(this.settings.parent=e?e.featureSettings:void 0),this.schema.parent||(this.schema.parent=e?e.schema:void 0)}get primaryKey(){const e=this.attributes.get(this.schema.primaryKeyField);return null!=e?`${e}`:void 0}get presentableAttributes(){return this._presentableAttributes=this._presentableAttributes||new PresentableAttributesImpl(this),this._presentableAttributes}get title(){return this.format(this._title||"")}get description(){return this.format(this._description)}get hyperlinks(){return this._hyperlinks||(this._hyperlinks=new HyperlinksCollection(this))}get relatedFeatures(){return this._relatedFeatures}get type(){if(this.schema.typeIdField&&this.attributes.has(this.schema.typeIdField)){const e=this.attributes.get(this.schema.typeIdField);return this.schema.types.find((t=>t.id===e))}}get _hydrationStatus(){return this._featureHydrationStatus?this._featureHydrationStatus:this.source?.capabilities?.supportsQuery&&1===this.attributes.size&&void 0!==this.primaryKey?"dehydrated":"hydrated"}set _hydrationStatus(e){this._featureHydrationStatus=e}get _title(){let e;return this.settings.popupTemplate&&(e="function"==typeof this.settings.popupTemplate.title?this.settings.popupTemplate.title():this.settings.popupTemplate.title),e||this.schema.displayField&&this.presentableAttributes.get(this.schema.displayField)||""}get _description(){if(this.settings.popupTemplate?.content){if("string"==typeof this.settings.popupTemplate.content)return this.settings.popupTemplate.content;if(Array.isArray(this.settings.popupTemplate.content)){const e=this.settings.popupTemplate.content.find((e=>"text"===e.type));if(e)return e.text}}return""}format(e,...t){let s="string"==typeof e?{format:e}:e;checkArg("options",s).isNotMissing();const{format:r}=s;checkArg("format",r).isNotMissing();let i=s.format.replace(escapedBraceRegex,escapedBracePlaceholder);return i=i.replace(fieldTokenRegex,((e,t,r,i,a)=>formatAttribute(this,t||r,i,{...s,format:a?`{0:${a}}`:"{0}"}))),i=i.replace(escapedBracePlaceholderRegex,"{{"),s={...s},s.format=i,formatString(s,...t)}clearExpressionInfos(){this._expressionFieldValues.clear()}async fetchExpressionInfos(e=!1){const{expressionInfos:t}=this.settings.popupTemplate??{};if(t)return await Promise.all(t.map((async e=>{try{const t=this.source?.layer??this.source?.sublayer;let s=this.source?.mapExtension;if(!s){const e=this.source?.layerExtension;s=e?.mapExtension}this._expressionFieldValues.set(e.name,await runAsyncArcadeExpression(e.expression,{layer:t,map:s?.map,feature:this,spatialReference:this.schema.spatialReference}))}catch(t){t instanceof Error&&log.error({message:"Error evaluating expression '{0}': {1}.",error:t},e.name,t.message),this._expressionFieldValues.set(e.name,invalidRelationshipOrExpression)}}))),e?this.attributes.on("change",(async e=>{this._expressionValuesUpdatePending||(this._expressionValuesUpdatePending=!0,setTimeout((async()=>{this._expressionValuesUpdatePending=!1,await this.fetchExpressionInfos()}),0))})):void 0}async fetchRelatedFeatures(e){if(!this.source)return;let t;if(e){const s="string"==typeof e?this.source.relationships.find((t=>t.id===e)):e;if(!s||!this.source.relationships.includes(s))throw new InvalidOperationError("Relationship not found in feature source.");t=[s]}else t=this.source.relationships.toArray();const s=await promiseMap(t,(async e=>[e,await e.getRelatedFeatures(this)]));for(const e of s)this._relatedFeatures.set(e[0],e[1])}async fetchAttachments(){if(this.source){const e=await this.source.getAttachments(this);compare(this.attachments,e,{equals:(e,t)=>e.id===t.id,onMissing:(e,t)=>this.attachments.remove(e),onNew:(e,t)=>this.attachments.add(e),onMatch:(e,t,s,r)=>{this.attachments.splice(s,1,t)}})}}async addAttachment(e){return this.source?.addAttachment(this,e)}async deleteAttachments(e){return this.source?.deleteAttachments(this,e)}_getSerializableProperties(){return{...super._getSerializableProperties(),attributes:{serializeModes:["project"],serialize:e=>{const t={};if("project"===e&&this.primaryKey&&this.source?.capabilities.supportsQuery)t[this.schema.primaryKeyField]=this.primaryKey;else for(const[e,s]of this.attributes.entries())t[e]=s;return t},deserialize:e=>{if(this.attributes.clear(),e instanceof Map)e.forEach(((e,t)=>{this.attributes.set(t,e)}));else for(const[t,s]of Object.entries(e))this.attributes.set(t,s)}},geometry:{serializeModes:["project"],serialize:e=>"project"===e&&this.source?.capabilities.supportsQuery?this.getDefault("geometry"):toPortalGeometry(this.geometry),deserialize:e=>this.geometry=toEsriApiGeometry(e)},settings:{serializeModes:["project"],serialize:e=>"project"===e&&this.source?.capabilities.supportsQuery?this.getDefault("settings"):this.settings.toJSON(e)},schema:{serializeModes:["project"],serialize:e=>"project"===e&&this.source?.capabilities.supportsQuery?this.getDefault("schema"):this.schema.toJSON(e)},source:["project"]}}_watchProperty(e,t,s,r){if("title"===e||"description"===e){const i=super._watchProperty(e,t,s,r),a="title"===e?"settings.popupTemplate.title":"settings.popupTemplate.content",o=this.watch(a,(()=>{this._notifyChange(e)})),n=this.presentableAttributes.on("change",(()=>{this._notifyChange(e)}));return{remove(){i.remove(),o.remove(),n.remove()}}}return super._watchProperty(e,t,s,r)}async _onInitialize(){const e=this._findRelationshipIds(this._title,this._description),t=this.source?this.source.relationships.map((e=>e.id)).toArray():[],s=[];for(const r of e)t.includes(r)?s.push(this.fetchRelatedFeatures(r)):log.error("Could not find relationship '{0}' referenced in feature title or description.",r);await Promise.all(s)}_findRelationshipIds(...e){const t=[];for(const s of e){let e;const r=s.replace(escapedBraceRegex,escapedBracePlaceholder);for(;e=relationshipIdRegex.exec(r),null!==e;){const s=e[0];t.includes(s)||t.push(e[1])}}return t}};Feature=__decorate([serializable],Feature);export{Feature};export function toFeature(e,t){const s=new Feature(t);if(e.attributes)for(const t of Object.keys(e.attributes))s.attributes.set(t,e.attributes[t]);return s.geometry=e.geometry,e.popupTemplate&&(s.settings.popupTemplate=e.popupTemplate),s}export function toGraphic(e){const t=new Graphic;t.attributes={};for(const s of e.attributes.keys())t.attributes[s]=e.attributes.get(s);return e.source?.layer&&(t.layer=e.source?.layer),t.geometry=e.geometry,e.settings.popupTemplate&&(t.popupTemplate=e.settings.popupTemplate),t}const ERR_PRESENTABLE_ATTRIBUTES_READONLY="Presentable attributes are read-only.",ERR_HYPERLINK_READONLY="Feature hyperlinks are read-only. Modify the feature's hyperlink templates instead.";class ExpressionFieldsValuesImpl extends ReadOnlyMap{constructor(e,t){super(e),this._feature=t}get(e){if(!super.has(e)){const{spatialReference:t}=this._feature.schema,s=this._feature.settings.popupTemplate?.expressionInfos?.find((t=>t.name===e));if(!s)return;(async()=>{try{if(isArcadeScriptAsync(s.expression,t)){const r=this._feature.source?.layer??this._feature.source?.sublayer;let i=this._feature.source?.mapExtension;if(!i){const e=this._feature.source?.layerExtension;i=e?.mapExtension}this._originalMap.set(e,await runAsyncArcadeExpression(s.expression,{feature:this._feature,layer:r,map:i?.map,spatialReference:t}))}else arcadeScriptUsesGeometry(s.expression,t)&&await Arcade.enableGeometrySupport(),this._originalMap.set(e,runArcadeExpression(s.expression,{feature:this._feature,spatialReference:t}))}catch(t){t instanceof Error&&log.error({message:"Error evaluating expression '{0}': {1}.",error:t},e,t.message),this._originalMap.set(e,invalidRelationshipOrExpression)}})()}return super.get(e)}}class PresentableAttributesImpl extends ReadOnlyMap{constructor(e){super(new ObservableMap),this._feature=e}get size(){return this._feature.attributes.size+this._feature.schema.fields._expressionFieldsLength}clear(){throw new InvalidOperationError(ERR_PRESENTABLE_ATTRIBUTES_READONLY)}delete(e){throw new InvalidOperationError(ERR_PRESENTABLE_ATTRIBUTES_READONLY)}forEach(e,t){checkArg("callback",e).isNotMissing();for(const s of this.keys())e.call(t,this.get(s),s,this)}get(e){const t=this._getFieldExtensionFormat(e);return this._formatAttribute(e,t)}has(e){return some(this.keys(),(t=>t===e))}set(...e){throw new InvalidOperationError(ERR_PRESENTABLE_ATTRIBUTES_READONLY)}*entries(){yield*mapIterable(this.keys(),(e=>[e,this.get(e)]))}*keys(){const e=this._feature.schema.fields.expressionFields.map((e=>e.name)),t=[];this._feature.source?.relationships&&this._feature.source.relationships.filter((e=>"one-to-one"===e.cardinality||"many-to-one"===e.cardinality)).forEach((e=>t.push(...e.relatedSource.schema.fields.map((t=>`relationships/${e.id}/${t.name}`)).toArray()))),yield*concat(this._feature.attributes.keys(),e.toArray(),t)}*values(){yield*mapIterable(this.keys(),(e=>this.get(e)))}[(Symbol.toStringTag,Symbol.iterator)](){return this.entries()}toJSON(){return Array.from(this.entries())}on(e,t){if(checkArg("callback",t).isNotMissing(),!this._numObservers){const e=new Map,t=new Set,s=()=>{t.forEach((e=>e.remove())),t.clear()},r=()=>{const t={added:Array.from(this.entries()).filter((t=>t[1]!==e.get(t[0]))),removed:Array.from(e.entries()).filter((e=>!this.has(e[0])||e[1]!==this.get(e[0]))),target:this};(t.added.length||t.removed.length)&&(this.emit("change",t),i())},i=()=>{e.clear(),s(),forEach(this.keys(),(s=>{const i=this._getFieldExtension(s);let a="{0}";if(i){const e=i.watch("format",(()=>{r()}));t.add(e),i.format&&(a=i.format)}e.set(s,this._formatAttribute(s,a))}))};i();const a=this._feature.attributes.on("change",(()=>{r()})),o=this._feature.schema.fieldExtensions.on("change",(()=>{r()})),n=this._feature.settings.formatSettings.watch(["numberFormat","dateFormat","locale"],(()=>{r()})),l=this._feature.expressionFieldValues.on("change",(()=>{r()})),p=this._feature.schema.fields.on("change",(e=>{(e.added?.some((e=>null!==e.name.match(_fieldWithArcadeXRegex)))||e.removed?.some((e=>null!==e.name.match(_fieldWithArcadeXRegex))))&&r()})),h=this._feature.settings.watch("popupTemplate",(()=>{r()}));this._onAllObserversRemoved=()=>{l.remove(),a.remove(),o.remove(),p.remove(),n.remove(),h.remove(),e.clear(),s()}}const s=super.on("change",t);return this._numObservers++,{remove:()=>{s.remove(),this._numObservers--,this._numObservers||this._onAllObserversRemoved()}}}watch(e,t){if("size"===e){const e=this._feature.attributes.watch("size",((e,s)=>{t(e+this._feature.schema.fields._expressionFieldsLength,s+this._feature.schema.fields._expressionFieldsLength,"size",this)})),s=this._feature.schema.fields.watch("_expressionFieldsLength",((e,s)=>{t(e+this._feature.attributes.size,s+this._feature.attributes.size,"size",this)}));return{remove:()=>{e.remove(),s.remove()}}}return super.watch(e,t)}_getFieldExtension(e){const t=this._feature.schema.findFieldByName(e);if(t)return this._feature.schema.fieldExtensions.forField(t)}_getFieldExtensionFormat(e){const t=this._getFieldExtension(e);return t?t.format:"{0}"}_formatAttribute(e,t){const s=e.match(_fieldWithArcadeXRegex),r=e.match(_fieldWithRelationshipRegex);if(s)return formatAttribute(this._feature,"expression",s[1],{format:t});if(r){const[,e,s]=r;return formatAttribute(this._feature,e,s,{format:t})}return formatAttribute(this._feature,void 0,e,{format:t})}}const fieldTokenRegex=/\{(?:relationships[\\/](\w\w*)[\\/])?(?:(expression)[\\/])?([a-zA-Z][.\w]*)(?::([^}]*))?\}/g,relationshipIdRegex=/\{relationships\/(\w\w*)[\\/]([^}]*)\}/g,escapedBraceRegex=/{{/g,escapedBracePlaceholder="\0MAGIC\0",escapedBracePlaceholderRegex=new RegExp(escapedBracePlaceholder,"g"),invalidRelationshipOrExpression="#INVALID";class HyperlinksCollection extends MapTransformCollection{constructor(e){super(e.settings.hyperlinkTemplates,(e=>this._getHyperlink(e))),this._feature=e}_getHyperlink(e){return this._hyperlinks=this._hyperlinks||new WeakMap,this._hyperlinks.has(e)||this._hyperlinks.set(e,new FeatureHyperlink(this._feature,e)),this._hyperlinks.get(e)}}let FeatureHyperlink=class extends Hyperlink{constructor(e,t){super(t.toJSON()),this._feature=e,this._template=t}get url(){return this._template.url?this._feature.format(this._template.url):this._template.url}set url(e){throw new InvalidOperationError(ERR_HYPERLINK_READONLY)}get text(){return this._template.text?this._feature.format(this._template.text):this._template.text}set text(e){throw new InvalidOperationError(ERR_HYPERLINK_READONLY)}get iconUrl(){return this._template.iconUrl?this._feature.format(this._template.iconUrl):this._template.iconUrl}set iconUrl(e){throw new InvalidOperationError(ERR_HYPERLINK_READONLY)}get target(){return this._template.target?this._feature.format(this._template.target):this._template.target}set target(e){throw new InvalidOperationError(ERR_HYPERLINK_READONLY)}get tooltip(){return this._template.tooltip?this._feature.format(this._template.tooltip):this._template.tooltip}set tooltip(e){throw new InvalidOperationError(ERR_HYPERLINK_READONLY)}_watchProperty(e,t,s,r){const i=super._watchProperty(e,t,s,r),a=this._template.watch(e,(()=>{this._notifyChange(e)})),o=this._feature.presentableAttributes.on("change",(()=>{this._notifyChange(e)}));return{remove:()=>{i.remove(),a.remove(),o.remove()}}}_getSerializableProperties(){return{}}};function formatAttribute(e,t,s,r={format:"{0}"}){if("expression"!==t){if(t){const i=find(e.relatedFeatures.keys(),(e=>e.id===t));if(!i)return log.debug("Could not resolve related field '{0}/{1}",t,s),invalidRelationshipOrExpression;const a=Array.from(e.relatedFeatures.get(i));return"many-to-one"===i.cardinality||"one-to-one"===i.cardinality?a.length<1?(log.debug("Could not resolve related field '{0}/{1}",t,s),invalidRelationshipOrExpression):formatAttributeValue(a[0],s,r):a.map((e=>formatAttributeValue(e,s,r))).filter((e=>""!==e)).join(",")}return formatAttributeValue(e,s,r)}if(!e.settings.popupTemplate?.expressionInfos?.find((e=>e.name===s)))return log.debug("Could not find expression '{0}'.",s),invalidRelationshipOrExpression;try{const t=e.expressionFieldValues.get(s)??r.defaultExpressionValue??"",i=e.schema.findFieldByName(`expression/${s}`);let a=r;if(i){const t=e.schema.fieldExtensions.forField(i);a=formatOptionsForField(e,s,formatOptionsFromSettings(t.formatSettings),a)}return formatValue(e,t,a)}catch(e){if(e instanceof Error)return log.error({message:"Error evaluating expression '{0}': {1}.",error:e},s,e.message),invalidRelationshipOrExpression;throw e}}function formatAttributeValue(e,t,s){let r=e.attributes.get(t);if(null==r)return"";const i=e.schema.findFieldByName(t);let a={format:"{0}"};const o=e.type?.domains?.[t];if(t===e.schema.typeIdField)r=e.type?e.type.name:r;else if(isCodedValueDomain(o)){const e=o.codedValues.find((e=>`${e.code}`==`${r.toString()}`));r=e?e.name:r}else if(i)if(isCodedValueDomain(i.domain)){const e=i.domain.codedValues.find((e=>`${e.code}`==`${r.toString()}`));e&&(r=e.name)}else{switch(i.type){case"integer":case"small-integer":case"single":case"double":r=parseNumber(r);break;case"date":r=parseDate({timeZone:e.schema.timeZone},r);break;default:r=`${r.toString()}`}a=formatOptionsFromSettings(e.schema.fieldExtensions.forField(i).formatSettings)}return formatValue(e,r,formatOptionsForField(e,t,a,s))}function formatValue(e,t,s){let r=s;if("number"==typeof t||t instanceof Date){r={...formatOptionsFromSettings(e.settings.formatSettings),...s}}return"{0}"===r.format&&"string"==typeof t?t:formatString(r,t)}function formatOptionsFromSettings(e){return{format:"{0}",dateFormat:e.dateFormat,numberFormat:e.numberFormat,currency:e.currency,fractionalDigits:e.fractionalDigits,locale:e.locale,timeZone:e.timeZone}}function formatOptionsForField(e,t,s,r){const{popupTemplate:i}=e.settings,a=i?.fieldInfos?i.fieldInfos.find((e=>e.fieldName===t)):void 0,o=a?a.format:void 0;let n;return o&&(n={format:"{0}",numberFormat:o.digitSeparator?NumberFormat.NUMBER:NumberFormat.FIXED_POINT,dateFormat:esriFormatToGeocortexFormat(o.dateFormat),fractionalDigits:o.places}),{...n,...s,...r}}FeatureHyperlink=__decorate([serializable],FeatureHyperlink);export async function resolveRelatedFeatures(e){const t=groupBy(e,(e=>e.source));await Promise.all(flatten([...t.keys()].map((e=>e.relationships.toArray()))).map((e=>(async e=>{[...(await e.getAllRelatedFeatures(t.get(e.source))).entries()].forEach((([t,s])=>{t.relatedFeatures.set(e,s)}))})(e))))}
|
package/data/FeatureList.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import Field from"@arcgis/core/layers/support/Field";import{ArgumentError}from"../ArgumentError.js";import{generateId}from"../Entity.js";import{isFeatureSet,ItemType}from"../ItemType.js";import{assignProperties,filterJSONProperties,getDefaults,getSerializableProperties,serializable}from"../support/Serializable.js";import{getSearchableValue}from"../tasks/search/_utilities.js";import{ReadOnlyCollection}from"../utilities/ReadOnlyCollection.js";import{Collection}from"../utilities/collection.js";import{parse as parseDate}from"../utilities/date.js";import{isCodedValueDomain}from"../utilities/esri.js";import{parse as parseNumber}from"../utilities/number.js";import{escapeRegExp}from"../utilities/string.js";import{FeatureSet}from"./FeatureSet.js";let FeatureList=class extends ReadOnlyCollection{constructor(e){
|
|
1
|
+
import{__decorate}from"tslib";import Field from"@arcgis/core/layers/support/Field";import{ArgumentError}from"../ArgumentError.js";import{generateId}from"../Entity.js";import{isFeatureSet,ItemType}from"../ItemType.js";import{assignProperties,filterJSONProperties,getDefaults,getSerializableProperties,serializable}from"../support/Serializable.js";import{getSearchableValue}from"../tasks/search/_utilities.js";import{ReadOnlyCollection}from"../utilities/ReadOnlyCollection.js";import{Collection}from"../utilities/collection.js";import{parse as parseDate}from"../utilities/date.js";import{isCodedValueDomain}from"../utilities/esri.js";import{parse as parseNumber}from"../utilities/number.js";import{escapeRegExp}from"../utilities/string.js";import{FeatureSet}from"./FeatureSet.js";let FeatureList=class extends ReadOnlyCollection{constructor(e){if(super(new Collection),this.id=e?.id??generateId(),isFeatureSet(e))this.featureSet=e;else if(e){const t=e;Array.isArray(t.featureSet)?this.featureSet=new FeatureSet({features:t.featureSet}):isFeatureSet(t.featureSet)?this.featureSet=t.featureSet:this.featureSet=new FeatureSet(t.featureSet)}else this.featureSet=new FeatureSet;for(const e of this.featureSet)this._collection.add(e);this.featureSet.on("change",(e=>this._onFeatureSetChange(e)))}get itemType(){return ItemType.FEATURE_LIST}toItemUri(){return`item://${encodeURIComponent(ItemType.FEATURE_LIST)}/${encodeURIComponent(this.id)}`}assignProperties(e){assignProperties(this._getSerializableProperties(),this,e)}toJSON(e="all"){return filterJSONProperties(this._getSerializableProperties(),this,e)}getDefaults(){return getDefaults(this._getSerializableProperties())}getDefault(e){return this.getDefaults()[e]}sort(e){if("function"==typeof e)this._sortFunc=e;else if(Array.isArray(e))this._sortFunc=this._createSortFunc(e);else if("object"==typeof e&&e.field)this._sortFunc=this._createSortFunc([e]);else{if("string"!=typeof e)throw new ArgumentError("criteria","Invalid sort criteria.");this._sortFunc=this._createSortFunc([{field:e}])}this._sortFunc=this._stabilizeSortFunc(this._sortFunc),this._sort(this._sortFunc),this.emit("change",{moved:this._collection.toArray(),target:this})}applyFilter(e){if(e)if("function"==typeof e)this._filterFunc=e;else if(Array.isArray(e))this._filterFunc=this._createFilterFunc(e);else if("object"==typeof e&&e.field)this._filterFunc=this._createFilterFunc([e]);else{if("string"!=typeof e)throw new ArgumentError("criteria","Invalid filter criteria.");{const t=this.featureSet.schema.fieldExtensions.initializedItems.filter((e=>e.searchable)).map((t=>({field:t.field.name,match:e}))).toArray();this._filterFunc=this._createFilterFunc(t)}}else delete this._filterFunc;const t=new Set,i=[],r=[];let s=0;for(;s<this._collection.length;){const e=this._collection.getItemAt(s);this._filterFunc&&!this._filterFunc(e)?(i.push(e),this._collection.removeAt(s)):(t.add(e),s++)}for(const e of this.featureSet)t.has(e)||this._filterFunc&&!this._filterFunc(e)||(this._collection.add(e),r.push(e));this._sortFunc&&r.length&&(r.length<=10?this._insertionSort(this._sortFunc):this._sort(this._sortFunc)),(r.length||i.length)&&this.emit("change",{added:r,removed:i,target:this})}removeFilter(){this.applyFilter(void 0)}getSerializableProperties(e="all"){return getSerializableProperties(this._getSerializableProperties(),e)}_getSerializableProperties(){return{featureSet:{serializeModes:["project"],deserialize:e=>{isFeatureSet(e)?this.featureSet.assignProperties({title:e.title,features:[...e]}):Array.isArray(e)?this.featureSet.assignProperties({features:e}):this.featureSet.assignProperties(e)}},title:["project"]}}_onFeatureSetChange(e){if(e.removed?.length&&this._collection.removeMany(e.removed),e.added?.length){const t=this._filterFunc?e.added.filter(this._filterFunc):e.added;t.length&&(this._collection.addMany(t),this._sortFunc&&(t.length<=10?this._insertionSort(this._sortFunc):this._sort(this._sortFunc)))}}_createSortFunc(e){return(t,i)=>{for(let r of e){if("string"==typeof r&&(r={field:r}),!r.field)throw new ArgumentError("criteria","Invalid sort criteria.");const e=this._getField(r.field),s=this._getSortValue(t,e),o=this._getSortValue(i,e);let a="string"==typeof s?s.localeCompare(o):s-o;if("desc"===r.direction&&(a*=-1),0!==a)return a}return 0}}_stabilizeSortFunc(e){return(t,i)=>{const r=e(t,i);return 0===r?this._collection.indexOf(t)-this._collection.indexOf(i):r}}_createFilterFunc(e){const t=new Map;for(const i of e){if(!i.field)throw new ArgumentError("criteria","Invalid sort criteria.");if(!i.match)continue;const e=this._getField(i.field),r=this._getFilterRegex(i.match,e);t.set(e.name,r)}return t.size?e=>{for(const i of t.keys()){const r=this._getField(i),s=getSearchableValue(e,r),o=t.get(i);let a=o[0];if(o.length>1&&"string"!==r.type&&isCodedValueDomain(e.type?.domains?.[r.name])&&(a=o[1]),a.exec(s))return!0}return!1}:()=>!0}_getSortValue(e,t){if(isCodedValueDomain(e.type?.domains?.[t.name])||isCodedValueDomain(t.domain))return e.presentableAttributes.get(t.name);switch(t.type){case"integer":case"small-integer":case"double":case"single":case"oid":{const i=e.attributes.get(t.name);return null==i||isNaN(i)?Number.MIN_VALUE:parseNumber(i)}case"date":{const i=parseDate(e.attributes.get(t.name)).getTime();return isNaN(i)?0:i}default:return e.presentableAttributes.get(t.name)??""}}_getFilterRegex(e,t){if(t.domain&&"coded-value"===t.domain.type)return[new RegExp(`${escapeRegExp(e)}`,"i")];switch(t.type){case"integer":case"small-integer":case"double":case"single":case"oid":{const i=new RegExp(`(^|${SEPARATOR})${escapeRegExp(e)}`,"i");return this.featureSet.schema.types.some((e=>isCodedValueDomain(e.domains?.[t.name])))?[i,new RegExp(`${escapeRegExp(e)}`,"i")]:[i]}default:return[new RegExp(`${escapeRegExp(e)}`,"i")]}}_getField(e){let t=this.featureSet.schema.findFieldByName(e);return t||(t=new Field({name:e,type:this._inferFieldType(e),editable:!1}),this.featureSet.schema.fields.add(t)),t}_inferFieldType(e){for(const t of this.featureSet.values()){const i=t.attributes.get(e);if(null!=i)return"number"==typeof i?"double":i instanceof Date?"date":"string"}return"string"}_sort(e){this._collection._items.sort(e)}_insertionSort(e){const t=this._collection._items;for(let i=1;i<this.length;i++){const r=t[i];let s=i-1;for(;s>=0&&e(t[s],r)>0;)t[s+1]=t[s],s--;t[s+1]=r}}};FeatureList=__decorate([serializable],FeatureList);export{FeatureList};const SEPARATOR="\t";
|
package/data/FeatureSet.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var FeatureSet_1;import{__decorate}from"tslib";import Collection from"@arcgis/core/core/Collection";import{generateId}from"../Entity.js";import{isFeature,ItemType}from"../ItemType.js";import{assignProperties,filterJSONProperties,getDefaults,getSerializableProperties,serializable}from"../support/Serializable.js";import{ObservableSet}from"../utilities/ObservableSet.js";import{groupBy}from"../utilities/array.js";import{toArray,from,empty}from"../utilities/asyncIterable.js";import{compare}from"../utilities/iterable.js";import{getLogger}from"../utilities/log.js";import{find}from"../utilities/set.js";import{watchEach}from"../utilities/watch.js";import{Feature}from"./Feature.js";import{FeatureSettings}from"./FeatureSettings.js";import{Schema}from"./Schema.js";const log=getLogger("feature-set");let FeatureSet=FeatureSet_1=class extends ObservableSet{constructor(e){
|
|
1
|
+
var FeatureSet_1;import{__decorate}from"tslib";import Collection from"@arcgis/core/core/Collection";import{generateId}from"../Entity.js";import{isFeature,ItemType}from"../ItemType.js";import{assignProperties,filterJSONProperties,getDefaults,getSerializableProperties,serializable}from"../support/Serializable.js";import{ObservableSet}from"../utilities/ObservableSet.js";import{groupBy}from"../utilities/array.js";import{toArray,from,empty}from"../utilities/asyncIterable.js";import{compare}from"../utilities/iterable.js";import{getLogger}from"../utilities/log.js";import{find}from"../utilities/set.js";import{watchEach}from"../utilities/watch.js";import{Feature}from"./Feature.js";import{FeatureSettings}from"./FeatureSettings.js";import{Schema}from"./Schema.js";const log=getLogger("feature-set");let FeatureSet=FeatureSet_1=class extends ObservableSet{constructor(e){super(),this.settings=new FeatureSettings,this.schema=new Schema,this._rehydratingFeatureCount=0,this._rehydratingFeatures=new Collection,this.schema._featureSettings=this.settings,this.id=e?.id??generateId(),this._originalSet=new Set,watchEach(this._rehydratingFeatures,"_featureHydrationStatus",((e,t,r,i)=>{if(this._rehydratingFeatureCount--,!this._rehydratingFeatureCount){const e=this._rehydratingFeatures.toArray();this.addMany(e),this.emit("feature-hydration-complete",e)}})),this.on("dehydrated-features-added",(async e=>{this._rehydratingFeatures.addMany(e);const t=groupBy(e,(e=>e.source)),r=groupBy(await toArray(from([...t.entries()].map((([e,t])=>{let r;try{r=e?.getFeatures(t.map((e=>e.primaryKey)).filter((e=>!!e)))??empty()}catch(t){r=empty(),log.error({error:t,message:`Failed to hydrate features from source '${e?.title??e?.id}`})}return r})))),(e=>e.source));[...t.entries()].forEach((([e,t])=>{const i=r.get(e);t.forEach((e=>{const t=i?.find((t=>t.primaryKey===e.primaryKey));t&&(e.geometry=t.geometry,[...t.attributes.entries()].forEach((([t,r])=>{e.attributes.set(t,r)}))),e._hydrationStatus=void 0}))}))})),this.assignProperties(e)}get source(){return this._source}set source(e){this._source&&this.settings.parent===this._source.featureSettings&&(this.settings.parent=void 0),this._source&&this.schema.parent===this._source.schema&&(this.settings.parent=void 0),this._source=e,this.settings.parent||(this.settings.parent=e?e.featureSettings:void 0),this.schema.parent||(this.schema.parent=e?e.schema:void 0)}get itemType(){return ItemType.FEATURE_SET}static async fromFeatureStream(e,t){const r=new FeatureSet_1(t);for await(const t of e)r.add(t);return r}on(e,t){return super.on(e,t)}assignProperties(e){assignProperties(this._getSerializableProperties(),this,e)}toJSON(e="all"){return filterJSONProperties(this._getSerializableProperties(),this,e)}toItemUri(){return`item://${encodeURIComponent(ItemType.FEATURE_SET)}/${encodeURIComponent(this.id)}`}add(e){return super.add(e),this.source&&!e.source&&(e.source=this.source),e.schema.parent||(e.schema.parent=this.schema),e.settings.parent||(e.settings.parent=this.settings),this}delete(e){const t=super.delete(e);return t&&(e.schema.parent===this.schema&&(e.schema.parent=void 0),e.settings.parent===this.settings&&(e.settings.parent=void 0)),t}findById(e){return find(this,(t=>t.id===e))}findByPrimaryKey(e){return find(this,(t=>t.primaryKey===e))}getSerializableProperties(e="all"){return getSerializableProperties(this._getSerializableProperties(),e)}getDefaults(){return getDefaults(this._getSerializableProperties())}getDefault(e){return this.getDefaults()[e]}_getSerializableProperties(){return{id:["project"],features:{serializeModes:["project"],serialize:()=>[...this],deserialize:e=>{const t=[],r=[];compare(this,e,{onNew:e=>{if(isFeature(e))"dehydrated"===e._hydrationStatus?(e._hydrationStatus="rehydrating",this._rehydratingFeatureCount++,t.push(e)):"rehydrating"===e._hydrationStatus?(this._rehydratingFeatureCount++,this._rehydratingFeatures.push(e)):(r.push(e),this.add(e));else{const t=new Feature(e);r.push(t),this.add(t)}},onMatch:(e,r)=>{isFeature(r)?"dehydrated"===e._hydrationStatus&&(e._hydrationStatus="rehydrating",this._rehydratingFeatureCount++,t.push(e)):e.assignProperties(r)},onMissing:e=>{this.delete(e)},equals:(e,t)=>isFeature(t)?t===e:e.id===t.id}),t.length?this.emit("dehydrated-features-added",t):this._rehydratingFeatureCount||this.emit("feature-hydration-complete",r)}},title:["project"],source:[],schema:[],settings:[]}}};FeatureSet=FeatureSet_1=__decorate([serializable],FeatureSet);export{FeatureSet};
|
package/data/FeatureSettings.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{Hyperlink}from"../Hyperlink.js";import{PopupInfo as PopupInfoJson}from"../portal/PopupInfo.js";import{FormatSettings}from"../support/FormatSettings.js";import{serializable}from"../support/Serializable.js";import{Settings}from"../support/Settings.js";import{getAllFieldInfos,getAllReferencedFieldNames,isPopupTemplate}from"../utilities/esri.js";import{isQueryBasedRelationship}from"../utilities/relationships.js";import{_fieldWithArcadeXRegex,_fieldWithRelationshipRegex}from"./Schema.js";let FeatureSettings=class extends Settings{get hyperlinkTemplates(){return this._getCollectionSetting("hyperlinkTemplates")}get popupTemplate(){return this._getSetting("popupTemplate")}set popupTemplate(e){this._setSetting("popupTemplate",e instanceof Object&&!isPopupTemplate(e)?PopupInfoJson.toEsriApiPopupTemplate(e):e)}get formatSettings(){return this._getNestedSettings("formatSettings",(()=>new FormatSettings))}get returnGeometry(){return this._getSetting("returnGeometry",!0)}set returnGeometry(e){this._setSetting("returnGeometry",e)}get outFields(){return this._getSetting("outFields",this._defaultOutFields)}set outFields(e){this._setSetting("outFields",e)}get outSpatialReference(){return this._getSetting("outSpatialReference")}set outSpatialReference(e){this._setSetting("outSpatialReference",e)}get maxAllowableOffset(){return this._getSetting("maxAllowableOffset")}set maxAllowableOffset(e){this._setSetting("maxAllowableOffset",e)}get zoomScale(){return this._getSetting("zoomScale")}set zoomScale(e){this._setSetting("zoomScale",e)}get zoomFactor(){
|
|
1
|
+
import{__decorate}from"tslib";import{Hyperlink}from"../Hyperlink.js";import{PopupInfo as PopupInfoJson}from"../portal/PopupInfo.js";import{FormatSettings}from"../support/FormatSettings.js";import{serializable}from"../support/Serializable.js";import{Settings}from"../support/Settings.js";import{getAllFieldInfos,getAllReferencedFieldNames,isPopupTemplate}from"../utilities/esri.js";import{isQueryBasedRelationship}from"../utilities/relationships.js";import{_fieldWithArcadeXRegex,_fieldWithRelationshipRegex}from"./Schema.js";let FeatureSettings=class extends Settings{get hyperlinkTemplates(){return this._getCollectionSetting("hyperlinkTemplates")}get popupTemplate(){return this._getSetting("popupTemplate")}set popupTemplate(e){this._setSetting("popupTemplate",e instanceof Object&&!isPopupTemplate(e)?PopupInfoJson.toEsriApiPopupTemplate(e):e)}get formatSettings(){return this._getNestedSettings("formatSettings",(()=>new FormatSettings))}get returnGeometry(){return this._getSetting("returnGeometry",!0)}set returnGeometry(e){this._setSetting("returnGeometry",e)}get outFields(){return this._getSetting("outFields",this._defaultOutFields)}set outFields(e){this._setSetting("outFields",e)}get outSpatialReference(){return this._getSetting("outSpatialReference")}set outSpatialReference(e){this._setSetting("outSpatialReference",e)}get maxAllowableOffset(){return this._getSetting("maxAllowableOffset")}set maxAllowableOffset(e){this._setSetting("maxAllowableOffset",e)}get zoomScale(){return this._getSetting("zoomScale")}set zoomScale(e){this._setSetting("zoomScale",e)}get zoomFactor(){const e=this._feature?this._feature.schema:this._featureSource?.schema,t=e&&"point"===e.geometryType?void 0:1.5;return this._getSetting("zoomFactor",t)}set zoomFactor(e){this._setSetting("zoomFactor",e)}get featureSource(){return this._featureSource}get feature(){return this._feature}get _defaultOutFields(){const e=getAllFieldInfos(this.popupTemplate),t=this.featureSource?.schema?.primaryKeyField;if(e&&t){const i=new Set;i.add(t);const r=this.featureSource.schema.fields.toArray().map((e=>e.name)),s=getAllReferencedFieldNames(this.popupTemplate),o=e.filter((e=>e.visible)).map((e=>e.fieldName)).concat(...s).filter((e=>r.includes(e)));return this._featureSource.relationships.forEach((e=>{isQueryBasedRelationship(e)&&o.push(e.keyField)})),o.filter((e=>!(e.match(_fieldWithArcadeXRegex)||e.match(_fieldWithRelationshipRegex)))).forEach((e=>i.add(e))),Array.from(i.values())}return["*"]}_setFeatureSource(e){this._featureSource=e,this.notifyChange("featureSource")}_setFeature(e){this._feature=e,this.notifyChange("feature")}_getSerializableProperties(){return{hyperlinkTemplates:{serializeModes:["initial"],deserialize:e=>{e.forEach((e=>{this.hyperlinkTemplates.find((t=>this._hyperlinksAreEquivalent(t,e)))||this.hyperlinkTemplates.add(e instanceof Hyperlink?e:new Hyperlink(e))})),this.hyperlinkTemplates.toArray().forEach((t=>{const i=this.hyperlinkTemplates.indexOf(t),r=e.findIndex((e=>this._hyperlinksAreEquivalent(e,t)));r<0?this.hyperlinkTemplates.removeAt(i):r!==i&&this.hyperlinkTemplates.reorder(t,r)}))}},popupTemplate:{serialize:!1},formatSettings:"initial",outFields:{serializeModes:["initial"],serialize:()=>this.isModified("outFields")?this.outFields:void 0},returnGeometry:{serializeModes:["initial"],default:!0},outSpatialReference:"initial",maxAllowableOffset:"initial",zoomScale:"initial",zoomFactor:{serializeModes:["initial"],isDefault:e=>{const t=this._feature?this._feature.schema:this._featureSource?.schema;return e===(t&&"point"===t.geometryType?void 0:1.5)}}}}_hyperlinksAreEquivalent(e,t){if(e===t)return!0;const i=e=>e||"";return i(e.text)===i(t.text)&&i(e.url)===i(t.url)&&i(e.iconUrl)===i(t.iconUrl)&&i(e.target)===i(t.target)&&i(e.tooltip)===i(t.tooltip)}};FeatureSettings=__decorate([serializable],FeatureSettings);export{FeatureSettings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ArgumentError}from"../ArgumentError.js";import{EntityBase}from"../Entity.js";import{Hyperlink}from"../Hyperlink.js";import{InvalidOperationError}from"../InvalidOperationError.js";import{isMenu,isRelationship}from"../ItemType.js";import{NotFoundError}from"../NotFoundError.js";import{FeatureReadOptions}from"../data/FeatureSource.js";import{Menu}from"../menus/Menu.js";import{CollectionProxy}from"../utilities/CollectionProxy.js";import{first}from"../utilities/asyncIterable.js";import{checkArg}from"../utilities/checkArg.js";import{Collection,compare}from"../utilities/collection.js";import{getLogger}from"../utilities/log.js";import{FeatureSettings}from"./FeatureSettings.js";import{Schema}from"./Schema.js";import{TaskSettings}from"./TaskSettings.js";import{Relationship}from"./_Relationship.js";const ERR_GET_FEATURES_NOT_SUPPORTED="Querying features is not supported.",ERR_ADD_FEATURES_NOT_SUPPORTED="Adding features is not supported.",ERR_ADD_ATTACHMENTS_NOT_SUPPORTED="Adding attachments is not supported.",ERR_DELETE_ATTACHMENTS_NOT_SUPPORTED="Deleting attachments is not supported.",ERR_UPDATE_FEATURES_NOT_SUPPORTED="Updating features is not supported.",ERR_DELETE_FEATURES_NOT_SUPPORTED="Deleting features is not supported.",DEFAULT_CAPABILITIES=Object.freeze({supportsAdd:!1,supportsUpdate:!1,supportsDelete:!1,supportsEditing:!1,supportsAttachmentEditing:!1}),log=getLogger("FeatureSourceBase");export class FeatureSourceBase extends EntityBase{constructor(e){super(e),this.featureSettings=this._createAndSetupFeatureSettings(),this.taskSettings=this._createTaskSettings(),this.schema=this._createAndSetupSchema(),this.relationships=this._createRelationships(),this.hyperlinks=this._createHyperlinks()}get featureActions(){return this._featureActions}set featureActions(e){this._featureActions=e,e&&this.isInitialized&&!e.isInitialized&&(async()=>{try{await e.initialize()}catch(e){e instanceof Error&&log.error({message:"An error occurred while initializing feature action menu.",error:e})}})()}get capabilities(){return this._capabilities()}getFullExtent(){}async getAttachments(e){return checkArg("feature",e).isNotMissing(),await this.initialize(),this._getAttachments(e)}async addAttachment(e,t){
|
|
1
|
+
import{ArgumentError}from"../ArgumentError.js";import{EntityBase}from"../Entity.js";import{Hyperlink}from"../Hyperlink.js";import{InvalidOperationError}from"../InvalidOperationError.js";import{isMenu,isRelationship}from"../ItemType.js";import{NotFoundError}from"../NotFoundError.js";import{FeatureReadOptions}from"../data/FeatureSource.js";import{Menu}from"../menus/Menu.js";import{CollectionProxy}from"../utilities/CollectionProxy.js";import{first}from"../utilities/asyncIterable.js";import{checkArg}from"../utilities/checkArg.js";import{Collection,compare}from"../utilities/collection.js";import{getLogger}from"../utilities/log.js";import{FeatureSettings}from"./FeatureSettings.js";import{Schema}from"./Schema.js";import{TaskSettings}from"./TaskSettings.js";import{Relationship}from"./_Relationship.js";const ERR_GET_FEATURES_NOT_SUPPORTED="Querying features is not supported.",ERR_ADD_FEATURES_NOT_SUPPORTED="Adding features is not supported.",ERR_ADD_ATTACHMENTS_NOT_SUPPORTED="Adding attachments is not supported.",ERR_DELETE_ATTACHMENTS_NOT_SUPPORTED="Deleting attachments is not supported.",ERR_UPDATE_FEATURES_NOT_SUPPORTED="Updating features is not supported.",ERR_DELETE_FEATURES_NOT_SUPPORTED="Deleting features is not supported.",DEFAULT_CAPABILITIES=Object.freeze({supportsAdd:!1,supportsUpdate:!1,supportsDelete:!1,supportsEditing:!1,supportsAttachmentEditing:!1}),log=getLogger("FeatureSourceBase");export class FeatureSourceBase extends EntityBase{constructor(e){super(e),this.featureSettings=this._createAndSetupFeatureSettings(),this.taskSettings=this._createTaskSettings(),this.schema=this._createAndSetupSchema(),this.relationships=this._createRelationships(),this.hyperlinks=this._createHyperlinks()}get featureActions(){return this._featureActions}set featureActions(e){this._featureActions=e,e&&this.isInitialized&&!e.isInitialized&&(async()=>{try{await e.initialize()}catch(e){e instanceof Error&&log.error({message:"An error occurred while initializing feature action menu.",error:e})}})()}get capabilities(){return this._capabilities()}getFullExtent(){}async getAttachments(e){return checkArg("feature",e).isNotMissing(),await this.initialize(),this._getAttachments(e)}async addAttachment(e,t){if(checkArg("feature",e).isNotMissing(),checkArg("attachment",t).isNotMissing(),e.source&&e.source!==this)throw new ArgumentError("feature",`Cannot add an attachment to a feature not of this source (${this.title??this.id})`);return await this.initialize(),this._addAttachment(e,t)}async deleteAttachments(e,t){if(checkArg("feature",e).isNotMissing(),checkArg("attachmentIds",t).isNotMissing(),e.source&&e.source!==this)throw new ArgumentError("feature",`Cannot delete attachments from a feature not of this source (${this.title??this.id})`);await this.initialize(),await this._deleteAttachments(e,t)}async getFeature(e,t){checkArg("id",e).isNotMissing();const i=this.getFeatures([e],t),s=await first(i);if(!s)throw new NotFoundError("No feature exists with ID '{0}'.",e);return s}getFeatures(e,t){checkArg("ids",e).isNotMissing();const i=this;return async function*(){await i.initialize(),yield*i._getFeatures(e,{...FeatureReadOptions.DEFAULTS,...FeatureReadOptions.fromFeatureSource(i),...t})}()}async addFeature(e,t){checkArg("feature",e).isNotMissing(),await this.addFeatures([e])}async addFeatures(e,t){if(checkArg("features",e).isNotMissing(),await this.initialize(),!this.capabilities.supportsAdd)throw new InvalidOperationError(ERR_ADD_FEATURES_NOT_SUPPORTED);await this._addFeatures(e,t)}async updateFeature(e,t){checkArg("feature",e).isNotMissing(),await this.updateFeatures([e])}async updateFeatures(e,t){if(checkArg("features",e).isNotMissing(),await this.initialize(),!this.capabilities.supportsUpdate)throw new InvalidOperationError(ERR_UPDATE_FEATURES_NOT_SUPPORTED);await this._updateFeatures(e,t)}async deleteFeature(e,t){checkArg("feature",e).isNotMissing(),await this.deleteFeatures([e])}async deleteFeatures(e,t){if(checkArg("features",e).isNotMissing(),await this.initialize(),!this.capabilities.supportsDelete)throw new InvalidOperationError(ERR_DELETE_FEATURES_NOT_SUPPORTED);const i=[];for(const t of e)i.push("string"==typeof t?t:t.primaryKey);await this._deleteFeatures(i,t)}_getSerializableProperties(){return{...super._getSerializableProperties(),featureSettings:{serializeModes:["initial"],isDefault:e=>{if(!e)return!0;if(e.constructor===Object){if(!Object.keys(e).length)return!0}return!1}},taskSettings:"initial",onAddFeature:"initial",onEditFeature:"initial",schema:"initial",relationships:{serialize:!1,deserialize:e=>{compare(this.relationships,e,{onNew:e=>{this.relationships.add(this._isRelationship(e)?e:Relationship.create(e))},onMatch:(e,t)=>{isRelationship(e)&&e.assignProperties({title:t.title})},onMissing:e=>{this.relationships.remove(e)},equals:(e,t)=>e.id===t.id})}},hyperlinks:{serialize:!1,deserialize:e=>{this.hyperlinks.removeAll(),this.hyperlinks.addMany(e.map((e=>e instanceof Hyperlink?e:new Hyperlink(e))))}},featureActions:{serializeModes:["initial"],deserialize:e=>{e?isMenu(e)?this.featureActions=e:this.featureActions?this.featureActions.assignProperties(e):this.featureActions=Menu.create(e):this.featureActions=void 0}}}}*_initializableChildCollections(){yield*super._initializableChildCollections(),yield this.schema.fieldExtensions}async _onInitialize(){await super._onInitialize(),this.featureActions&&await this.featureActions.initialize()}async _postInitialize(){await super._postInitialize(),this.featureSettings.popupTemplate||(this.featureSettings.popupTemplate=this.schema.createPopupTemplate());const{popupTemplate:e}=this.featureSettings;"function"==typeof e.content&&(e.content=e.content()),e.content=await e.content;const{content:t}=e;Array.isArray(t)&&t.some((e=>"fields"===e.type&&!e.fieldInfos?.length))&&!e.fieldInfos?.length&&(e.fieldInfos=this.schema.createAllFieldInfos()),!e.title&&this.schema.displayField&&(e.title=`{${this.schema.displayField}}`)}_createSchema(){return new Schema}_createFeatureSettings(){return new FeatureSettings}_createTaskSettings(){return new TaskSettings}_createRelationships(){return new RelationshipCollection(this)}_createHyperlinks(){return new Collection}async _getAttachments(e){return[]}async _addAttachment(e,t){throw new InvalidOperationError(ERR_ADD_ATTACHMENTS_NOT_SUPPORTED)}async _deleteAttachments(e,t){throw new InvalidOperationError(ERR_DELETE_ATTACHMENTS_NOT_SUPPORTED)}_getFeatures(e,t){const{primaryKeyField:i}=this.schema;if(this.queryService&&i){const s=e.map((e=>`${i} = ${e}`)).join(" OR ");return this.queryService.query(this,s,t)}throw new InvalidOperationError(ERR_GET_FEATURES_NOT_SUPPORTED)}_addFeatures(e,t){throw new InvalidOperationError(ERR_ADD_FEATURES_NOT_SUPPORTED)}_updateFeatures(e,t){throw new InvalidOperationError(ERR_UPDATE_FEATURES_NOT_SUPPORTED)}_deleteFeatures(e,t){throw new InvalidOperationError(ERR_DELETE_FEATURES_NOT_SUPPORTED)}_capabilities(){return DEFAULT_CAPABILITIES}_createAndSetupSchema(){const e=this._createSchema();return e._featureSettings=this.featureSettings,e}_createAndSetupFeatureSettings(){const e=this._createFeatureSettings();return e._setFeatureSource(this),e}_isRelationship(e){return"function"==typeof e.getRelatedFeatures}}export class RelationshipCollection extends CollectionProxy{constructor(e){super(new Collection),this._source=e}add(e,t){checkArg("relationship",e).isNotMissing(),e.source&&e.source.relationships.remove(e),isRelationship(e)&&e._setSource(this._source),super.add(e,t)}removeAt(e){const t=super.removeAt(e);return isRelationship(t)&&t._setSource(void 0),t}}
|
package/data/FeatureStream.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{EntityBase}from"../Entity.js";import{serializable}from"../support/Serializable.js";import{from,toArray}from"../utilities/asyncIterable.js";import{FeatureSet}from"./FeatureSet.js";let FeatureStream=class extends EntityBase{constructor(t){if(super(getEntityProperties(t)),this._itemType="feature-stream",t)if(t[Symbol.asyncIterator])this._features=t;else if(t[Symbol.iterator])this._features=from(t);else{const{features:e}=t;
|
|
1
|
+
import{__decorate}from"tslib";import{EntityBase}from"../Entity.js";import{serializable}from"../support/Serializable.js";import{from,toArray}from"../utilities/asyncIterable.js";import{FeatureSet}from"./FeatureSet.js";let FeatureStream=class extends EntityBase{constructor(t){if(super(getEntityProperties(t)),this._itemType="feature-stream",t)if(t[Symbol.asyncIterator])this._features=t;else if(t[Symbol.iterator])this._features=from(t);else{const{features:e}=t;e?.[Symbol.asyncIterator]?this._features=e:e?.[Symbol.iterator]&&(this._features=from(e))}this._features=this._features||from([])}[Symbol.asyncIterator](){return this._features[Symbol.asyncIterator]()}toArray(){return toArray(this)}async toFeatureSet(){return new FeatureSet({title:this.title,features:await toArray(this)})}_getSerializableProperties(){return{...super._getSerializableProperties(),title:"initial"}}};FeatureStream=__decorate([serializable],FeatureStream);export{FeatureStream};function getEntityProperties(t){return!t||t[Symbol.iterator]||t[Symbol.asyncIterator]?void 0:t}
|
package/data/FieldExtension.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var FieldExtension_1;import{__decorate}from"tslib";import EsriField from"@arcgis/core/layers/support/Field";import{EntityBase}from"../Entity.js";import{InvalidOperationError}from"../InvalidOperationError.js";import{isFieldExtension,ItemType}from"../ItemType.js";import{Field as PortalField}from"../portal/Field.js";import{FormatSettings}from"../support/FormatSettings.js";import{serializable}from"../support/Serializable.js";import{esriFormatToGeocortexFormat}from"../utilities/date.js";import{isField}from"../utilities/esri.js";import{NumberFormat}from"../utilities/number.js";import{deepClone}from"../utilities/object.js";import{_fieldWithArcadeXRegex}from"./Schema.js";export const _fieldExtensionMap=new WeakMap;let FieldExtension=FieldExtension_1=class extends EntityBase{constructor(e){super(e),this.format="{0}",this.formatSettings=new FieldExtensionFormatSettings(this),this.searchable=!0,this._itemType=ItemType.FIELD_EXTENSION;const{field:i}=
|
|
1
|
+
var FieldExtension_1;import{__decorate}from"tslib";import EsriField from"@arcgis/core/layers/support/Field";import{EntityBase}from"../Entity.js";import{InvalidOperationError}from"../InvalidOperationError.js";import{isFieldExtension,ItemType}from"../ItemType.js";import{Field as PortalField}from"../portal/Field.js";import{FormatSettings}from"../support/FormatSettings.js";import{serializable}from"../support/Serializable.js";import{esriFormatToGeocortexFormat}from"../utilities/date.js";import{isField}from"../utilities/esri.js";import{NumberFormat}from"../utilities/number.js";import{deepClone}from"../utilities/object.js";import{_fieldWithArcadeXRegex}from"./Schema.js";export const _fieldExtensionMap=new WeakMap;let FieldExtension=FieldExtension_1=class extends EntityBase{constructor(e){super(e),this.format="{0}",this.formatSettings=new FieldExtensionFormatSettings(this),this.searchable=!0,this._itemType=ItemType.FIELD_EXTENSION;const{field:i}=e??{};isField(i)?this._setField(i):"string"==typeof i?this._deferredFieldProperties={$ref:i}:i?i.$ref?this._deferredFieldProperties=i:this._setField(PortalField.toEsriApiField(i)):this._setField(new EsriField),this.watch("_schema.featureSource",(()=>this.notifyChange("fieldInfo"))),this.watch("_schema._featureSettings",(e=>{this.formatSettings.parent=e?e.formatSettings:void 0}),!0)}get field(){return this._field}get schema(){return this._schema}get fieldInfo(){if(this._fieldInfo)return this._fieldInfo;if(!this.field||!this.field.name)return;const e=this._schema?._featureSettings?.popupTemplate,i=e?.fieldInfos||[];return this._fieldInfo=i.find((e=>e.fieldName===this.field.name)),this._fieldInfo}static matchesRef(e,i){return isFieldExtension(e)?(e.field?.name??e._deferredFieldProperties?.$ref)===i.$ref:e.name===i.$ref}_setSchema(e){this._schema=e,this._resolveField(),this.notifyChange("schema"),this.notifyChange("fieldInfo")}_resolveField(){if(this._field||!this._deferredFieldProperties||!this._schema)return;const e=this._schema.fields.find((e=>FieldExtension_1.matchesRef(e,this._deferredFieldProperties)));e&&(this._setField(e),this.assignProperties({field:this._deferredFieldProperties}),this._originalRef=this._deferredFieldProperties.$ref,delete this._deferredFieldProperties,_fieldExtensionMap.set(e,this))}_getSerializableProperties(){return{...super._getSerializableProperties(),field:{serializeModes:["initial"],serialize:()=>this.field?this._originalRef?{$ref:this._originalRef}:this._schema?.fields.includes(this._field)&&this.field.name?{$ref:this.field.name}:PortalField.fromEsriApiField(this.field):this._deferredFieldProperties?deepClone(this._deferredFieldProperties):void 0,deserialize:e=>{if(isField(e)){if(e!==this.field)throw new Error("Property 'field' is read-only.")}else e&&this.field&&PortalField.applyToEsriApiField(e,this.field)}},searchable:{serializeModes:["initial"],isDefault:e=>e!==this._isArcadeExpressionField},format:{serializeModes:["initial"],default:"{0}"},formatSettings:"initial"}}async _onInitialize(){if(this._resolveField(),!this._field){const e=this._deferredFieldProperties.$ref;throw this._schema?new InvalidOperationError(`Field not found with name: ${e}. Field does not exist.`):new InvalidOperationError(`Field not found with name: ${e}. Field does not have a parent schema.`)}}_setField(e){this._field=e,this._isArcadeExpressionField&&(this.searchable=!1),this._notifyChange("field"),this._notifyChange("fieldInfo")}get _isArcadeExpressionField(){return!!this._field&&!!this._field.name&&!!this._field.name.match(_fieldWithArcadeXRegex)}};FieldExtension=FieldExtension_1=__decorate([serializable],FieldExtension);export{FieldExtension};let FieldExtensionFormatSettings=class extends FormatSettings{constructor(e,i){super(i),this.fieldExtension=e,e.watch("fieldInfo.format.places",(()=>this._notifyChange("fractionalDigits"))),e.watch("fieldInfo.format.digitSeparator",(()=>this._notifyChange("numberFormat"))),e.watch("fieldInfo.format.dateFormat",(()=>this._notifyChange("dateFormat")))}get fractionalDigits(){const e=this.fieldExtension.fieldInfo?.format?.places;return!this.isModified("fractionalDigits")&&this.useFieldInfo&&e?e:this._getSetting("fractionalDigits")}set fractionalDigits(e){this._setSetting("fractionalDigits",e)}get numberFormat(){const e=this.fieldExtension.fieldInfo?.format?.digitSeparator;return!this.isModified("numberFormat")&&this.useFieldInfo&&e?e?NumberFormat.NUMBER:NumberFormat.FIXED_POINT:this._getSetting("numberFormat")}set numberFormat(e){this._setSetting("numberFormat",e)}get dateFormat(){const e=this.fieldExtension.fieldInfo?.format?.dateFormat;return!this.isModified("dateFormat")&&this.useFieldInfo&&e?esriFormatToGeocortexFormat(e):this._getSetting("dateFormat")}set dateFormat(e){this._setSetting("dateFormat",e)}};FieldExtensionFormatSettings=__decorate([serializable],FieldExtensionFormatSettings);
|
package/data/Schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var Schema_1;import{__decorate}from"tslib";import PopupTemplate from"@arcgis/core/PopupTemplate";import Field from"@arcgis/core/layers/support/Field";import FieldInfo from"@arcgis/core/popup/FieldInfo";import{InvalidOperationError}from"../InvalidOperationError.js";import{isFieldExtension}from"../ItemType.js";import{Field as PortalField}from"../portal/Field.js";import{GeometryType as PortalGeometryType}from"../portal/Geometry.js";import{Type as PortalType}from"../portal/Type.js";import{InitializableCollectionProxy}from"../support/InitializableCollectionProxy.js";import{filterJSONProperties,isDefault,serializable,shouldExcludeDefaults}from"../support/Serializable.js";import{Settings}from"../support/Settings.js";import{CollectionProxy}from"../utilities/CollectionProxy.js";import{checkArg}from"../utilities/checkArg.js";import{Collection,compare}from"../utilities/collection.js";import{isValidTimeZone,ERR_TIME_ZONE_INVALID}from"../utilities/date.js";import{isFeatureType,isField}from"../utilities/esri.js";import{onCollectionPropertyChange}from"../utilities/watch.js";import{_fieldExtensionMap,FieldExtension}from"./FieldExtension.js";const esriFields=new Map;esriFields.set("objectid","oid"),esriFields.set("oid","oid"),esriFields.set("fid","oid"),esriFields.set("shape","geometry"),esriFields.set("shape_length","double"),esriFields.set("shape_area","double"),esriFields.set("area","double"),esriFields.set("perimeter","double"),esriFields.set("length","double"),esriFields.set("fnode_","double"),esriFields.set("tnode_","double"),esriFields.set("lpoly_","double"),esriFields.set("rpoly_","double"),esriFields.set("cover_","integer"),esriFields.set("cover_id","integer"),esriFields.set("idtic","integer"),esriFields.set("xtic","double"),esriFields.set("ytic","double"),esriFields.set("xmin","double"),esriFields.set("ymin","double"),esriFields.set("xmax","double"),esriFields.set("ymax","double"),esriFields.set("arc_","double"),esriFields.set("subclass_","integer"),esriFields.set("subclass_id","integer"),esriFields.set("routelink","integer"),esriFields.set("arclink","integer"),esriFields.set("f_meas","double"),esriFields.set("t_meas","double"),esriFields.set("f_pos","double"),esriFields.set("t_pos","double"),esriFields.set("f_meas","double");export const _fieldWithArcadeXRegex=/expression\/((\w|-)*)/;export const _fieldWithRelationshipRegex=/relationships\/(\d*)\/(\w*)/;const FIELD_INFO_MAP=new WeakMap;let Schema=Schema_1=class extends Settings{constructor(e){super(e),this.fieldExtensions=new FieldExtensionCollectionImpl(this),this.fields=new FieldCollectionImpl(this)}get spatialReference(){return this._getSetting("spatialReference")}set spatialReference(e){this._setSetting("spatialReference",e)}get primaryKeyField(){const e=this._getSetting("primaryKeyField");if(!e){const e=this.fields.filter((e=>"oid"===e.type));if(1===e.length)return e.getItemAt(0).name}return e}set primaryKeyField(e){this._setSetting("primaryKeyField",e)}get displayField(){return this._getSetting("displayField",this.primaryKeyField)}set displayField(e){var i;!(null===(i=this._featureSettings)||void 0===i?void 0:i.popupTemplate)||this._featureSettings.popupTemplate.title&&this._featureSettings.popupTemplate.title!==`{${this.displayField}}`||(this._featureSettings.popupTemplate.title=`{${e}}`),this._setSetting("displayField",e)}get geometryType(){return this._getSetting("geometryType")}set geometryType(e){this._setSetting("geometryType",e)}get hasGeometry(){return void 0!==this.geometryType&&null!==this.geometryType}get timeZone(){return this._getSetting("timeZone","UTC")}set timeZone(e){checkArg("timeZone",e).satisfies((e=>isValidTimeZone(e)),ERR_TIME_ZONE_INVALID(e)),this._setSetting("timeZone",e)}get typeIdField(){return this._getSetting("typeIdField")}set typeIdField(e){this._setSetting("typeIdField",e)}get types(){return this._getCollectionSetting("types")}get _fields(){return this._getCollectionSetting("_fields")}static createFieldInfoFromField(e){let i=!0;const t=e.name.toLowerCase();return("oid"===e.type||"geometry"===e.type||esriFields.has(t)&&esriFields.get(t)===e.type)&&(i=!1),new FieldInfo({visible:i,fieldName:e.name,format:void 0,label:e.alias,stringFieldOption:void 0,tooltip:void 0})}findFieldByName(e){return this.fields.find((i=>i.name===e))}toJSON(e="all"){var i;const t=filterJSONProperties(this._getSerializableProperties(),this,e)||{},s=null===(i=t.fieldExtensions)||void 0===i?void 0:i.filter((e=>{var i;const t=this.parent;return!(null===(i=null==t?void 0:t.fieldExtensions)||void 0===i?void 0:i.some((i=>i.id===e.id)))})),{fields:l}=t;if(t)for(const e of Object.keys(t))this.isModified(e)||delete t[e];if(l&&(t.fields=l),(null==s?void 0:s.length)&&(t.fieldExtensions=s),!shouldExcludeDefaults(e)||!isDefault(t))return t}createPopupTemplate(){const e=this.createAllFieldInfos();return new PopupTemplate({fieldInfos:e,content:[{type:"fields"},{type:"attachments"}]})}createAllFieldInfos(){return this.fields.toArray().filter((e=>!!e.name)).map((e=>Schema_1.createFieldInfoFromField(e)))}_getSerializableProperties(){return{geometryType:{serialize:!1,deserialize:e=>{this.geometryType=PortalGeometryType.toEsriApiGeometryType(e)}},spatialReference:{serialize:!1},primaryKeyField:{serialize:!1},displayField:{serialize:!1},typeIdField:{serialize:!1},fields:{serializeModes:["initial"],serialize:()=>this.isModified("_fields")?this.fields.toArray().map((e=>PortalField.fromEsriApiField(e))):void 0,deserialize:e=>{if(!e)return;const i=e.map((e=>isField(e)?e:PortalField.toEsriApiField(e)));compare(this.fields,i,{onNew:(e,i)=>{this.fields.add(e,i)},onMatch:(e,i,t,s)=>{e!==i&&(e.alias=i.alias,e.editable=i.editable,e.length=i.length,e.nullable=i.nullable,e.type=i.type),t!==s&&this.fields.reorder(e,s)},onMissing:e=>{this.fields.remove(e)},equals:(e,i)=>e.name===i.name})}},fieldExtensions:{serializeModes:["initial"],serialize:e=>this.fieldExtensions.map((i=>i.toJSON(e))).filter((e=>this._alwaysSerializeFieldExtensions||!(e&&2===Object.keys(e).length&&e.id&&e.field))).toArray(),deserialize:e=>{e&&compare(this.fieldExtensions,e,{onNew:(e,i)=>{this.fieldExtensions.add(isFieldExtension(e)?e:new FieldExtension(e),i)},onMatch:(e,i,t,s)=>{isFieldExtension(i)||e.assignProperties(i),t!==s&&this.fieldExtensions.reorder(e,s)},onMissing:e=>{this._alwaysSerializeFieldExtensions&&this.fieldExtensions.remove(e)},equals:(e,i)=>isFieldExtension(i)?i===e:!(!(null==i?void 0:i.field)||!FieldExtension.matchesRef(e,i.field))||e.id===i.id})}},types:{serialize:!1,deserialize:e=>{if(!e)return;const i=e.map((e=>isFeatureType(e)?e:PortalType.toEsriApiFeatureType(e)));compare(this.types,i,{onNew:(e,i)=>{this.types.add(e,i)},onMatch:(e,i,t,s)=>{e!==i&&(e.name=i.name,e.templates=i.templates?[...i.templates]:[],e.domains=i.domains),t!==s&&this.types.reorder(e,s)},onMissing:e=>{this.types.remove(e)},equals:(e,i)=>e.id===i.id})}},timeZone:{serialize:!1,deserialize:e=>{e&&(this.timeZone=e)}}}}};Schema=Schema_1=__decorate([serializable],Schema);export{Schema};class FieldCollectionImpl extends CollectionProxy{constructor(e){super(),this._schema=e,onCollectionPropertyChange(this._schema,"_fields",(e=>{this.emit("change",e)})),e.watch("_fields.length",(()=>this.notifyChange("length")))}get _expressionFieldsLength(){return this.expressionFields.length}get expressionFields(){if(!this._popupTemplate||!this._popupTemplate.fieldInfos||!this._popupTemplate.expressionInfos)return new Collection;const e=new Collection;for(const i of this._popupTemplate.fieldInfos){const t=i.fieldName.match(_fieldWithArcadeXRegex);if(t){const s=this._popupTemplate.expressionInfos.find((e=>e.name===t[1]));if(s){if(!FIELD_INFO_MAP.has(i)){const e=new Field({name:i.fieldName,alias:i.label||s.title||i.fieldName,type:"number"===s.returnType?"double":"string",editable:!1});FIELD_INFO_MAP.set(i,e)}e.add(FIELD_INFO_MAP.get(i))}}}return e}get _collection(){return this._schema._fields.concat(this.expressionFields)}get _popupTemplate(){return this._schema._featureSettings?this._schema._featureSettings.popupTemplate:void 0}clone(){return new FieldCollectionImpl(this._schema)}add(e,i){checkArg("field",e).isNotMissing();const t=e.name?e.name.match(_fieldWithArcadeXRegex):void 0;if(t){if(!this._popupTemplate)throw new InvalidOperationError("Cannot create a field that references an arcade expression without a feature source and popup template.");const i=this._popupTemplate.expressionInfos.find((e=>e.name===t[1]));if(!i)throw new InvalidOperationError("Cannot create a field that references a non-existent arcade expression.");this._popupTemplate.fieldInfos||(this._popupTemplate.fieldInfos=[]);let s=this._popupTemplate.fieldInfos.find((i=>i.fieldName===e.name));s||(s=new FieldInfo({fieldName:e.name,label:i.title}),this._popupTemplate.fieldInfos.push(s));const l=FIELD_INFO_MAP.get(s);FIELD_INFO_MAP.set(s,e);const o={added:[e],moved:[],removed:l?[l]:[],target:this};this.emit("change",o),this.notifyChange("length"),this.notifyChange("_expressionFieldsLength")}else this._schema._fields.add(e,i)}removeAt(e){checkArg("index",e).isNotMissing();const i=this.getItemAt(e);if(!i)return;if(i.name?i.name.match(_fieldWithArcadeXRegex):void 0){const e=this._popupTemplate.fieldInfos.findIndex((e=>e.fieldName===i.name));this._popupTemplate.fieldInfos.splice(e,1);const t={added:[],moved:[],removed:[i],target:this};this.emit("change",t),this.notifyChange("length"),this.notifyChange("_expressionFieldsLength")}else this._schema._fields.remove(i);return i}reorder(e,i){if(e&&this._schema._fields.includes(e))return this._schema._fields.reorder(e,i),e}sort(e){this._schema._fields.sort(e)}}class FieldExtensionCollectionImpl extends InitializableCollectionProxy{constructor(e){super(),this._uninitializedFieldExtensions=new Set,this._schema=e,onCollectionPropertyChange(this._schema,"fields",(e=>{const i={added:(e.added||[]).map((e=>this._forField(e))),moved:(e.moved||[]).map((e=>this._forField(e))),removed:(e.removed||[]).map((e=>this._forField(e))),target:this};this.emit("change",i)})),e.watch("fields.length",(()=>this.notifyChange("length")))}get _collection(){return this._schema.fields.map((e=>this._forField(e))).concat(Array.from(this._uninitializedFieldExtensions))}forField(e){if(checkArg("field",e).isNotMissing(),this._schema.fields.includes(e))return this._forField(e)}add(e,i){if(checkArg("fieldX",e).isNotMissing(),e.schema&&e.schema.fieldExtensions.remove(e),e._setSchema(this._schema),e.field){const t=_fieldExtensionMap.get(e.field);if(_fieldExtensionMap.set(e.field,e),t&&t!==e&&this._onRemoved(t),this._schema.fields.includes(e.field))if(void 0===i){const i={added:[e],moved:[],removed:t?[t]:[],target:this};this.emit("change",i)}else this._schema.fields.reorder(e.field,i);else this._schema.fields.add(e.field,i)}else{this._uninitializedFieldExtensions.add(e);const i={added:[e],moved:[],removed:[],target:this};this.emit("change",i)}this._onAdded(e)}removeAt(e){const i=this.getItemAt(e);if(void 0!==i){if(this._uninitializedFieldExtensions.has(i)){this._uninitializedFieldExtensions.delete(i);const e={added:[],moved:[],removed:[i],target:this};this.emit("change",e)}else this._schema.fields.remove(i.field);return this._onRemoved(i),i}}reorder(e,i){if(e&&this._schema.fields.includes(e.field))return this._schema.fields.reorder(e.field,i),e}sort(e){this._schema.fields.sort(((i,t)=>e(this._forField(i),this._forField(t))))}_itemIsInitialized(e){return super._itemIsInitialized(e)&&!!e.field}_onAdded(e){}_onRemoved(e){e.schema===this._schema&&e._setSchema(void 0)}_forField(e){if(this._uninitializedFieldExtensions.size)for(const e of this._uninitializedFieldExtensions)e._resolveField(),e.field&&(_fieldExtensionMap.set(e.field,e),this._uninitializedFieldExtensions.delete(e));if(!_fieldExtensionMap.has(e)){const i=new FieldExtension({field:e});_fieldExtensionMap.set(e,i),i._setSchema(this._schema),this._onAdded(i)}return _fieldExtensionMap.get(e)}}
|
|
1
|
+
var Schema_1;import{__decorate}from"tslib";import PopupTemplate from"@arcgis/core/PopupTemplate";import Field from"@arcgis/core/layers/support/Field";import FieldInfo from"@arcgis/core/popup/FieldInfo";import{InvalidOperationError}from"../InvalidOperationError.js";import{isFieldExtension}from"../ItemType.js";import{Field as PortalField}from"../portal/Field.js";import{GeometryType as PortalGeometryType}from"../portal/Geometry.js";import{Type as PortalType}from"../portal/Type.js";import{InitializableCollectionProxy}from"../support/InitializableCollectionProxy.js";import{filterJSONProperties,isDefault,serializable,shouldExcludeDefaults}from"../support/Serializable.js";import{Settings}from"../support/Settings.js";import{CollectionProxy}from"../utilities/CollectionProxy.js";import{checkArg}from"../utilities/checkArg.js";import{Collection,compare}from"../utilities/collection.js";import{isValidTimeZone,ERR_TIME_ZONE_INVALID}from"../utilities/date.js";import{isFeatureType,isField}from"../utilities/esri.js";import{onCollectionPropertyChange}from"../utilities/watch.js";import{_fieldExtensionMap,FieldExtension}from"./FieldExtension.js";const esriFields=new Map;esriFields.set("objectid","oid"),esriFields.set("oid","oid"),esriFields.set("fid","oid"),esriFields.set("shape","geometry"),esriFields.set("shape_length","double"),esriFields.set("shape_area","double"),esriFields.set("area","double"),esriFields.set("perimeter","double"),esriFields.set("length","double"),esriFields.set("fnode_","double"),esriFields.set("tnode_","double"),esriFields.set("lpoly_","double"),esriFields.set("rpoly_","double"),esriFields.set("cover_","integer"),esriFields.set("cover_id","integer"),esriFields.set("idtic","integer"),esriFields.set("xtic","double"),esriFields.set("ytic","double"),esriFields.set("xmin","double"),esriFields.set("ymin","double"),esriFields.set("xmax","double"),esriFields.set("ymax","double"),esriFields.set("arc_","double"),esriFields.set("subclass_","integer"),esriFields.set("subclass_id","integer"),esriFields.set("routelink","integer"),esriFields.set("arclink","integer"),esriFields.set("f_meas","double"),esriFields.set("t_meas","double"),esriFields.set("f_pos","double"),esriFields.set("t_pos","double"),esriFields.set("f_meas","double");export const _fieldWithArcadeXRegex=/expression\/((\w|-)*)/;export const _fieldWithRelationshipRegex=/relationships\/(\d*)\/(\w*)/;const FIELD_INFO_MAP=new WeakMap;let Schema=Schema_1=class extends Settings{constructor(e){super(e),this.fieldExtensions=new FieldExtensionCollectionImpl(this),this.fields=new FieldCollectionImpl(this)}get spatialReference(){return this._getSetting("spatialReference")}set spatialReference(e){this._setSetting("spatialReference",e)}get primaryKeyField(){const e=this._getSetting("primaryKeyField");if(!e){const e=this.fields.filter((e=>"oid"===e.type));if(1===e.length)return e.getItemAt(0).name}return e}set primaryKeyField(e){this._setSetting("primaryKeyField",e)}get displayField(){return this._getSetting("displayField",this.primaryKeyField)}set displayField(e){!this._featureSettings?.popupTemplate||this._featureSettings.popupTemplate.title&&this._featureSettings.popupTemplate.title!==`{${this.displayField}}`||(this._featureSettings.popupTemplate.title=`{${e}}`),this._setSetting("displayField",e)}get geometryType(){return this._getSetting("geometryType")}set geometryType(e){this._setSetting("geometryType",e)}get hasGeometry(){return void 0!==this.geometryType&&null!==this.geometryType}get timeZone(){return this._getSetting("timeZone","UTC")}set timeZone(e){checkArg("timeZone",e).satisfies((e=>isValidTimeZone(e)),ERR_TIME_ZONE_INVALID(e)),this._setSetting("timeZone",e)}get typeIdField(){return this._getSetting("typeIdField")}set typeIdField(e){this._setSetting("typeIdField",e)}get types(){return this._getCollectionSetting("types")}get _fields(){return this._getCollectionSetting("_fields")}static createFieldInfoFromField(e){let i=!0;const t=e.name.toLowerCase();return("oid"===e.type||"geometry"===e.type||esriFields.has(t)&&esriFields.get(t)===e.type)&&(i=!1),new FieldInfo({visible:i,fieldName:e.name,format:void 0,label:e.alias,stringFieldOption:void 0,tooltip:void 0})}findFieldByName(e){return this.fields.find((i=>i.name===e))}toJSON(e="all"){const i=filterJSONProperties(this._getSerializableProperties(),this,e)||{},t=i.fieldExtensions?.filter((e=>!this.parent?.fieldExtensions?.some((i=>i.id===e.id)))),{fields:s}=i;if(i)for(const e of Object.keys(i))this.isModified(e)||delete i[e];if(s&&(i.fields=s),t?.length&&(i.fieldExtensions=t),!shouldExcludeDefaults(e)||!isDefault(i))return i}createPopupTemplate(){const e=this.createAllFieldInfos();return new PopupTemplate({fieldInfos:e,content:[{type:"fields"},{type:"attachments"}]})}createAllFieldInfos(){return this.fields.toArray().filter((e=>!!e.name)).map((e=>Schema_1.createFieldInfoFromField(e)))}_getSerializableProperties(){return{geometryType:{serialize:!1,deserialize:e=>{this.geometryType=PortalGeometryType.toEsriApiGeometryType(e)}},spatialReference:{serialize:!1},primaryKeyField:{serialize:!1},displayField:{serialize:!1},typeIdField:{serialize:!1},fields:{serializeModes:["initial"],serialize:()=>this.isModified("_fields")?this.fields.toArray().map((e=>PortalField.fromEsriApiField(e))):void 0,deserialize:e=>{if(!e)return;const i=e.map((e=>isField(e)?e:PortalField.toEsriApiField(e)));compare(this.fields,i,{onNew:(e,i)=>{this.fields.add(e,i)},onMatch:(e,i,t,s)=>{e!==i&&(e.alias=i.alias,e.editable=i.editable,e.length=i.length,e.nullable=i.nullable,e.type=i.type),t!==s&&this.fields.reorder(e,s)},onMissing:e=>{this.fields.remove(e)},equals:(e,i)=>e.name===i.name})}},fieldExtensions:{serializeModes:["initial"],serialize:e=>this.fieldExtensions.map((i=>i.toJSON(e))).filter((e=>this._alwaysSerializeFieldExtensions||!(e&&2===Object.keys(e).length&&e.id&&e.field))).toArray(),deserialize:e=>{e&&compare(this.fieldExtensions,e,{onNew:(e,i)=>{this.fieldExtensions.add(isFieldExtension(e)?e:new FieldExtension(e),i)},onMatch:(e,i,t,s)=>{isFieldExtension(i)||e.assignProperties(i),t!==s&&this.fieldExtensions.reorder(e,s)},onMissing:e=>{this._alwaysSerializeFieldExtensions&&this.fieldExtensions.remove(e)},equals:(e,i)=>isFieldExtension(i)?i===e:!(!i?.field||!FieldExtension.matchesRef(e,i.field))||e.id===i.id})}},types:{serialize:!1,deserialize:e=>{if(!e)return;const i=e.map((e=>isFeatureType(e)?e:PortalType.toEsriApiFeatureType(e)));compare(this.types,i,{onNew:(e,i)=>{this.types.add(e,i)},onMatch:(e,i,t,s)=>{e!==i&&(e.name=i.name,e.templates=i.templates?[...i.templates]:[],e.domains=i.domains),t!==s&&this.types.reorder(e,s)},onMissing:e=>{this.types.remove(e)},equals:(e,i)=>e.id===i.id})}},timeZone:{serialize:!1,deserialize:e=>{e&&(this.timeZone=e)}}}}};Schema=Schema_1=__decorate([serializable],Schema);export{Schema};class FieldCollectionImpl extends CollectionProxy{constructor(e){super(),this._schema=e,onCollectionPropertyChange(this._schema,"_fields",(e=>{this.emit("change",e)})),e.watch("_fields.length",(()=>this.notifyChange("length")))}get _expressionFieldsLength(){return this.expressionFields.length}get expressionFields(){if(!this._popupTemplate||!this._popupTemplate.fieldInfos||!this._popupTemplate.expressionInfos)return new Collection;const e=new Collection;for(const i of this._popupTemplate.fieldInfos){const t=i.fieldName.match(_fieldWithArcadeXRegex);if(t){const s=this._popupTemplate.expressionInfos.find((e=>e.name===t[1]));if(s){if(!FIELD_INFO_MAP.has(i)){const e=new Field({name:i.fieldName,alias:i.label||s.title||i.fieldName,type:"number"===s.returnType?"double":"string",editable:!1});FIELD_INFO_MAP.set(i,e)}e.add(FIELD_INFO_MAP.get(i))}}}return e}get _collection(){return this._schema._fields.concat(this.expressionFields)}get _popupTemplate(){return this._schema._featureSettings?this._schema._featureSettings.popupTemplate:void 0}clone(){return new FieldCollectionImpl(this._schema)}add(e,i){checkArg("field",e).isNotMissing();const t=e.name?e.name.match(_fieldWithArcadeXRegex):void 0;if(t){if(!this._popupTemplate)throw new InvalidOperationError("Cannot create a field that references an arcade expression without a feature source and popup template.");const i=this._popupTemplate.expressionInfos.find((e=>e.name===t[1]));if(!i)throw new InvalidOperationError("Cannot create a field that references a non-existent arcade expression.");this._popupTemplate.fieldInfos||(this._popupTemplate.fieldInfos=[]);let s=this._popupTemplate.fieldInfos.find((i=>i.fieldName===e.name));s||(s=new FieldInfo({fieldName:e.name,label:i.title}),this._popupTemplate.fieldInfos.push(s));const l=FIELD_INFO_MAP.get(s);FIELD_INFO_MAP.set(s,e);const o={added:[e],moved:[],removed:l?[l]:[],target:this};this.emit("change",o),this.notifyChange("length"),this.notifyChange("_expressionFieldsLength")}else this._schema._fields.add(e,i)}removeAt(e){checkArg("index",e).isNotMissing();const i=this.getItemAt(e);if(!i)return;if(i.name?i.name.match(_fieldWithArcadeXRegex):void 0){const e=this._popupTemplate.fieldInfos.findIndex((e=>e.fieldName===i.name));this._popupTemplate.fieldInfos.splice(e,1);const t={added:[],moved:[],removed:[i],target:this};this.emit("change",t),this.notifyChange("length"),this.notifyChange("_expressionFieldsLength")}else this._schema._fields.remove(i);return i}reorder(e,i){if(e&&this._schema._fields.includes(e))return this._schema._fields.reorder(e,i),e}sort(e){this._schema._fields.sort(e)}}class FieldExtensionCollectionImpl extends InitializableCollectionProxy{constructor(e){super(),this._uninitializedFieldExtensions=new Set,this._schema=e,onCollectionPropertyChange(this._schema,"fields",(e=>{const i={added:(e.added||[]).map((e=>this._forField(e))),moved:(e.moved||[]).map((e=>this._forField(e))),removed:(e.removed||[]).map((e=>this._forField(e))),target:this};this.emit("change",i)})),e.watch("fields.length",(()=>this.notifyChange("length")))}get _collection(){return this._schema.fields.map((e=>this._forField(e))).concat(Array.from(this._uninitializedFieldExtensions))}forField(e){if(checkArg("field",e).isNotMissing(),this._schema.fields.includes(e))return this._forField(e)}add(e,i){if(checkArg("fieldX",e).isNotMissing(),e.schema&&e.schema.fieldExtensions.remove(e),e._setSchema(this._schema),e.field){const t=_fieldExtensionMap.get(e.field);if(_fieldExtensionMap.set(e.field,e),t&&t!==e&&this._onRemoved(t),this._schema.fields.includes(e.field))if(void 0===i){const i={added:[e],moved:[],removed:t?[t]:[],target:this};this.emit("change",i)}else this._schema.fields.reorder(e.field,i);else this._schema.fields.add(e.field,i)}else{this._uninitializedFieldExtensions.add(e);const i={added:[e],moved:[],removed:[],target:this};this.emit("change",i)}this._onAdded(e)}removeAt(e){const i=this.getItemAt(e);if(void 0!==i){if(this._uninitializedFieldExtensions.has(i)){this._uninitializedFieldExtensions.delete(i);const e={added:[],moved:[],removed:[i],target:this};this.emit("change",e)}else this._schema.fields.remove(i.field);return this._onRemoved(i),i}}reorder(e,i){if(e&&this._schema.fields.includes(e.field))return this._schema.fields.reorder(e.field,i),e}sort(e){this._schema.fields.sort(((i,t)=>e(this._forField(i),this._forField(t))))}_itemIsInitialized(e){return super._itemIsInitialized(e)&&!!e.field}_onAdded(e){}_onRemoved(e){e.schema===this._schema&&e._setSchema(void 0)}_forField(e){if(this._uninitializedFieldExtensions.size)for(const e of this._uninitializedFieldExtensions)e._resolveField(),e.field&&(_fieldExtensionMap.set(e.field,e),this._uninitializedFieldExtensions.delete(e));if(!_fieldExtensionMap.has(e)){const i=new FieldExtension({field:e});_fieldExtensionMap.set(e,i),i._setSchema(this._schema),this._onAdded(i)}return _fieldExtensionMap.get(e)}}
|
package/data/Table.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import PortalItem from"@arcgis/core/portal/PortalItem";import{LayerDefinition}from"../portal/LayerDefinition.js";import{PopupInfo}from"../portal/PopupInfo.js";import{checkArg}from"../utilities/checkArg.js";export async function toEsriApiTable(e){const i=new((await import("@arcgis/core/layers/FeatureLayer")).default);return await applyToEsriTable(e,i),i}export async function applyToEsriTable(e,i){checkArg("tableJson",e).isNotMissing(),checkArg("table",i).isNotMissing(),checkArg("tableJson.$tableType",e.$tableType).satisfies((e=>"ArcGISServiceTable"===e||void 0===e)),e.hasOwnProperty("id")&&(i.id=e.id),e.hasOwnProperty("title")&&(i.title=e.title),e.hasOwnProperty("url")&&(i.url=e.url),e.hasOwnProperty("itemId")&&(i.portalItem=new PortalItem({id:e.itemId})),e.hasOwnProperty("popupInfo")&&(i.popupTemplate=PopupInfo.toEsriApiPopupTemplate(e.popupInfo)),e.hasOwnProperty("layerDefinition")&&await LayerDefinition.applyToEsriApiLayer(e.layerDefinition,i)}export function fromEsriTable(e){
|
|
1
|
+
import PortalItem from"@arcgis/core/portal/PortalItem";import{LayerDefinition}from"../portal/LayerDefinition.js";import{PopupInfo}from"../portal/PopupInfo.js";import{checkArg}from"../utilities/checkArg.js";export async function toEsriApiTable(e){const i=new((await import("@arcgis/core/layers/FeatureLayer")).default);return await applyToEsriTable(e,i),i}export async function applyToEsriTable(e,i){checkArg("tableJson",e).isNotMissing(),checkArg("table",i).isNotMissing(),checkArg("tableJson.$tableType",e.$tableType).satisfies((e=>"ArcGISServiceTable"===e||void 0===e)),e.hasOwnProperty("id")&&(i.id=e.id),e.hasOwnProperty("title")&&(i.title=e.title),e.hasOwnProperty("url")&&(i.url=e.url),e.hasOwnProperty("itemId")&&(i.portalItem=new PortalItem({id:e.itemId})),e.hasOwnProperty("popupInfo")&&(i.popupTemplate=PopupInfo.toEsriApiPopupTemplate(e.popupInfo)),e.hasOwnProperty("layerDefinition")&&await LayerDefinition.applyToEsriApiLayer(e.layerDefinition,i)}export function fromEsriTable(e){checkArg("table",e).isNotMissing();const i={layerDefinition:LayerDefinition.fromEsriApiLayer(e)};return i.id=e.id,i.$tableType="ArcGISServiceTable",e.title&&(i.title=e.title),e.url&&(i.url=e.url),e.portalItem?.id&&(i.itemId=e.portalItem.id),e.popupTemplate&&(i.popupInfo=PopupInfo.fromEsriApiPopupTemplate(e.popupTemplate)),e.objectIdField&&(i.layerDefinition.objectIdField=e.objectIdField),i}
|
package/data/_TableExtension.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import Collection from"@arcgis/core/core/Collection";import{InvalidOperationError}from"../InvalidOperationError.js";import{ItemType}from"../ItemType.js";import{applyToEsriTable,fromEsriTable,toEsriApiTable}from"../portal/Table.js";import{serializable}from"../support/Serializable.js";import{CollectionProxy}from"../utilities/CollectionProxy.js";import{isFeatureLayer,isLayer}from"../utilities/_layers.js";import{checkArg}from"../utilities/checkArg.js";import{deepClone}from"../utilities/object.js";import{FeatureSettings}from"./FeatureSettings.js";import{FeatureSourceBase}from"./FeatureSourceBase.js";import{Schema}from"./Schema.js";const ERR_INVALID_TABLE_TYPE="Invalid type of table for this type of table extension.",ERR_SPATIAL_SETTINGS_NOT_SUPPORTED="Spatial settings are not supported for tables.",DEFAULT_CAPABILITIES=Object.freeze({supportsAdd:!1,supportsUpdate:!1,supportsDelete:!1,supportsEditing:!1,supportsQuery:!1,supportsAttachmentEditing:!1});export class TableExtension extends FeatureSourceBase{constructor(e){super(e),this._itemType=ItemType.TABLE_EXTENSION;const{table:t}={...this.getDefaults(),...e};if(isLayer(t))checkArg("properties.table",t).satisfies((e=>isFeatureLayer(e)),ERR_INVALID_TABLE_TYPE),this._setTable(t);else{if(!t)throw new Error("Missing 'table' property.");this._deferredTableProperties=t}}get mapExtension(){return this._mapExtension}get table(){return this._table}get capabilities(){return DEFAULT_CAPABILITIES}get title(){
|
|
1
|
+
import{__decorate}from"tslib";import Collection from"@arcgis/core/core/Collection";import{InvalidOperationError}from"../InvalidOperationError.js";import{ItemType}from"../ItemType.js";import{applyToEsriTable,fromEsriTable,toEsriApiTable}from"../portal/Table.js";import{serializable}from"../support/Serializable.js";import{CollectionProxy}from"../utilities/CollectionProxy.js";import{isFeatureLayer,isLayer}from"../utilities/_layers.js";import{checkArg}from"../utilities/checkArg.js";import{deepClone}from"../utilities/object.js";import{FeatureSettings}from"./FeatureSettings.js";import{FeatureSourceBase}from"./FeatureSourceBase.js";import{Schema}from"./Schema.js";const ERR_INVALID_TABLE_TYPE="Invalid type of table for this type of table extension.",ERR_SPATIAL_SETTINGS_NOT_SUPPORTED="Spatial settings are not supported for tables.",DEFAULT_CAPABILITIES=Object.freeze({supportsAdd:!1,supportsUpdate:!1,supportsDelete:!1,supportsEditing:!1,supportsQuery:!1,supportsAttachmentEditing:!1});export class TableExtension extends FeatureSourceBase{constructor(e){super(e),this._itemType=ItemType.TABLE_EXTENSION;const{table:t}={...this.getDefaults(),...e};if(isLayer(t))checkArg("properties.table",t).satisfies((e=>isFeatureLayer(e)),ERR_INVALID_TABLE_TYPE),this._setTable(t);else{if(!t)throw new Error("Missing 'table' property.");this._deferredTableProperties=t}}get mapExtension(){return this._mapExtension}get table(){return this._table}get capabilities(){return DEFAULT_CAPABILITIES}get title(){return this.table?.title??this._deferredTableProperties?.title??("string"==typeof this._deferredTableProperties?.$ref?this._deferredTableProperties?.$ref:this._deferredTableProperties?.$ref?.title??this._deferredTableProperties?.$ref?.id)??"Table"}static create(e){if(!TableExtension.factory)throw new InvalidOperationError("Cannot create table extension: no table extension factory has been registered.");return TableExtension.factory.create(e)}static _matchesRef(e,t){if(!e||!t)return!1;const i=e.table?.id??e._deferredTableProperties.id,r=e.table?.title??e._deferredTableProperties.title,s=t.$ref;return"string"==typeof s?i===s||r===s:!!s&&(i===s.id||r===s.title)}async _createBackingTable(){this.table||this._deferredTableProperties&&this._deferredTableProperties.$ref||(this._setTable(await toEsriApiTable(this._deferredTableProperties)),await this.table.load(),checkArg("properties.table",this.table).satisfies((e=>this._isSupportedTable(e)),ERR_INVALID_TABLE_TYPE),this._deferredTableProperties=void 0)}_setMapExtension(e){const t=this.mapExtension;this._mapExtension=e,t&&this.featureSettings.formatSettings.parent===t.formatSettings&&(this.featureSettings.formatSettings.parent=void 0),e&&(this.featureSettings.formatSettings.parent||(this.featureSettings.formatSettings.parent=e.formatSettings)),this._resolveTable(),this.notifyChange("mapExtension")}_resolveTable(){if(this._table||!this._deferredTableProperties||!this.mapExtension)return;let e;e="string"==typeof this._deferredTableProperties.$ref?{id:this._deferredTableProperties.$ref,title:this._deferredTableProperties.$ref}:this._deferredTableProperties.$ref;let t=this._mapExtension.map?.tables.find((t=>t.id===e.id));if(t||(t=this._mapExtension.map?.tables.find((t=>t.title===e.title))),t&&this._isSupportedTable(t)){this._setTable(t);const e={table:this._deferredTableProperties};this.assignProperties(e),this._originalRef=this._deferredTableProperties.$ref,this._deferredTableProperties=void 0}}_getSerializableProperties(){return{...super._getSerializableProperties(),table:{serializeModes:["initial","project"],serialize:()=>this.table?this._mapExtension&&(this.table.id||this.table.title)?this._originalRef?{$ref:this._originalRef}:{$ref:{id:this.table.id,title:this.table.title}}:fromEsriTable(this.table):this._deferredTableProperties?deepClone(this._deferredTableProperties):void 0,deserialize:e=>{if(isLayer(e)){if(e!==this.table)throw new Error("Property 'table' is read-only.")}else this.table?applyToEsriTable(e,this.table):this._deferredTableProperties&&(this._deferredTableProperties={...this._deferredTableProperties,...e})}}}}async _onInitialize(){if(await super._onInitialize(),await this._createBackingTable(),this._resolveTable(),!this.table){const e=this._deferredTableProperties.$ref;throw this._mapExtension?new InvalidOperationError(`No table found matching reference "${e?.toString()}".`):new InvalidOperationError("Cannot resolve table reference: missing parent map extension.")}await this.table.load()}_createSchema(){return new TableSchema(this)}_createFeatureSettings(){return new TableFeatureSettings}_setTable(e){this._table=e,this.notifyChange("table"),this.notifyChange("title"),this.notifyChange("capabilities")}}let TableSchema=class extends Schema{constructor(e){if(super(),this._tableBindings=new Map,this._tableExtension=e,this._bindSettingToTableProperty("primaryKeyField","objectIdField"),this._fieldCollection=this._createFieldCollection(),e.table)this._onTableResolved(e.table);else{const t=e.watch("table",(()=>{this._onTableResolved(e.table),t.remove()}),!0)}}get _fields(){return this._fieldCollection}get geometryType(){}set geometryType(e){throw new InvalidOperationError("Tables do not support a geometry type.")}get spatialReference(){}set spatialReference(e){throw new InvalidOperationError("Tables do not support a spatial reference.")}_getSetting(e,t){return this._tableBindings.has(e)&&this._tableExtension.table?this._tableExtension.table[this._tableBindings.get(e)]:super._getSetting(e,t)}_setSetting(e,t){this._tableBindings.has(e)&&this._tableExtension.table?this._tableExtension.table[this._tableBindings.get(e)]=t:super._setSetting(e,t)}_bindSettingToTableProperty(e,t){const i=t??e;this._tableBindings.set(e,i),this._tableExtension.watch(`table.${i}`,(()=>this.notifyChange(e)),!0)}_onTableResolved(e){for(const t of this._tableBindings.keys())this.isModified(t)&&(e[t]=this[t],this.reset(t))}_createFieldCollection(){return new FieldCollection(this._tableExtension)}};TableSchema=__decorate([serializable],TableSchema);export{TableSchema};class FieldCollection extends CollectionProxy{constructor(e){super(),this._tableResolved=!1;if(e.table?.fields)this._onTableResolved(e.table);else{this._collection=new Collection;const t=e.watch(["table","table.loaded"],(()=>{e.table?.fields&&(this._onTableResolved(e.table),t.remove())}),!0)}}_onTableResolved(e){if(!this._tableResolved){this._tableResolved=!0;const t=e;this.length&&(t.fields.length=0,t.fields.push(...this.toArray())),t.fields||(t.fields=[]),this._collection=wrapArrayWithCollection(t.fields)}}}function wrapArrayWithCollection(e){const t=new Collection;return Object.defineProperty(t,"_items",{get:()=>e}),Object.defineProperty(t,"length",{get:()=>e.length,set:t=>e.length=t}),t}let TableFeatureSettings=class extends FeatureSettings{get returnGeometry(){}set returnGeometry(e){throw new InvalidOperationError(ERR_SPATIAL_SETTINGS_NOT_SUPPORTED)}get outSpatialReference(){}set outSpatialReference(e){throw new InvalidOperationError(ERR_SPATIAL_SETTINGS_NOT_SUPPORTED)}get maxAllowableOffset(){}set maxAllowableOffset(e){throw new InvalidOperationError(ERR_SPATIAL_SETTINGS_NOT_SUPPORTED)}get zoomScale(){}set zoomScale(e){throw new InvalidOperationError(ERR_SPATIAL_SETTINGS_NOT_SUPPORTED)}get zoomFactor(){}set zoomFactor(e){throw new InvalidOperationError(ERR_SPATIAL_SETTINGS_NOT_SUPPORTED)}};TableFeatureSettings=__decorate([serializable],TableFeatureSettings);export{TableFeatureSettings};
|