@vertigis/arcgis-extensions 51.13.2 → 51.14.0

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.
Files changed (39) hide show
  1. package/data/FeatureSettings.d.ts +1 -0
  2. package/data/FeatureSettings.js +1 -1
  3. package/data/_TableExtension.d.ts +1 -0
  4. package/data/_TableExtension.js +1 -1
  5. package/docs/html/assets/search.js +1 -1
  6. package/docs/html/classes/data_FeatureSettings.FeatureSettings.html +10 -6
  7. package/docs/html/classes/data_Schema.Schema.html +10 -6
  8. package/docs/html/classes/data_TaskSettings.TaskSettings.html +10 -6
  9. package/docs/html/classes/data__TableExtension.TableFeatureSettings.html +10 -6
  10. package/docs/html/classes/data__TableExtension.TableSchema.html +10 -6
  11. package/docs/html/classes/mapping_BuildingComponentSublayerExtension.BuildingComponentSublayerSchema.html +10 -6
  12. package/docs/html/classes/mapping_BuildingGroupSublayerExtension.BuildingGroupSublayerSchema.html +10 -6
  13. package/docs/html/classes/mapping_BuildingSceneLayerExtension.BuildingSceneLayerReadOnlySchema.html +10 -6
  14. package/docs/html/classes/mapping_BuildingSublayerExtension.BuildingSublayerFeatureSettings.html +7 -6
  15. package/docs/html/classes/mapping_BuildingSublayerExtension.BuildingSublayerSchema.html +10 -6
  16. package/docs/html/classes/mapping_FeatureLayerExtensionBase.FeatureLayerReadOnlySchema.html +10 -6
  17. package/docs/html/classes/mapping_FeatureLayerExtensionBase.FeatureLayerSchema.html +10 -6
  18. package/docs/html/classes/mapping_MapConstraints.MapConstraints.html +10 -6
  19. package/docs/html/classes/mapping_MapNotesSublayerExtension.MapNotesSublayerExtensionSchema.html +10 -6
  20. package/docs/html/classes/mapping_RouteLayerExtension.RouteLayerExtensionSchema.html +10 -6
  21. package/docs/html/classes/mapping_StreamLayerExtension.StreamLayerSchema.html +10 -6
  22. package/docs/html/classes/mapping_SubtypeGroupLayerExtension.SubtypeGroupLayerSchema.html +10 -6
  23. package/docs/html/classes/mapping_SubtypeSublayerExtension.SubtypeSublayerSchema.html +10 -6
  24. package/docs/html/classes/mapping__LayerExtension.LayerExtensionReadOnlySchema.html +10 -6
  25. package/docs/html/classes/mapping__LayerExtension.LayerExtensionSchema.html +10 -6
  26. package/docs/html/classes/mapping__SublayerExtension.SublayerSchema.html +10 -6
  27. package/docs/html/classes/support_FormatSettings.FormatSettings.html +10 -6
  28. package/docs/html/classes/support_Settings.Settings.html +10 -6
  29. package/docs/html/variables/version.version.html +1 -1
  30. package/mapping/_LayerExtension.d.ts +1 -0
  31. package/mapping/_LayerExtension.js +1 -1
  32. package/mapping/support/PopupTemplateFeatureSettings.js +1 -1
  33. package/package.json +1 -1
  34. package/support/FormatSettings.d.ts +1 -0
  35. package/support/FormatSettings.js +1 -1
  36. package/support/Settings.d.ts +7 -0
  37. package/support/Settings.js +1 -1
  38. package/version.d.ts +1 -1
  39. package/version.js +1 -1
@@ -152,6 +152,7 @@ export declare class FeatureSettings extends Settings<FeatureSettingsProperties>
152
152
  */
153
153
  protected get _defaultOutFields(): string[];
154
154
  toJSON(serializeMode?: SerializeMode): FeatureSettingsProperties;
155
+ protected _hasSettingIncludingAncestor<K extends keyof this>(setting: K): boolean;
155
156
  /**
156
157
  * Creates the backing collection for popup content.
157
158
  */
@@ -1 +1 @@
1
- import{__decorate as t}from"tslib";import e from"@arcgis/core/PopupTemplate";import{Hyperlink as n}from"../Hyperlink.js";import{isPopupContentExtension as i}from"../ItemType.js";import{ArrayWrappedCollection as o}from"../mapping/support/ArrayWrappedCollection.js";import{FormatSettings as s}from"../support/FormatSettings.js";import{InitializableCollectionProxy as r}from"../support/InitializableCollectionProxy.js";import{filterJSONProperties as p,isDefault as a,serializable as u,shouldExcludeDefaults as h}from"../support/Serializable.js";import{Settings as l}from"../support/Settings.js";import{createIHandle as f,notifyChange as d,onWatch as m,watch as c}from"../support/observableUtils.js";import _ from"../utilities/_ReferenceCountedHandle.js";import{compare as g}from"../utilities/array.js";import{checkArg as C}from"../utilities/checkArg.js";import{getAllFieldInfos as S,getAllReferencedFieldNames as y,isPopupTemplate as v}from"../utilities/esri.js";import{isArcadeExpressionField as T,isRelationshipField as x}from"../utilities/field.js";import{objectKeys as A}from"../utilities/object.js";import{isQueryBasedRelationship as P}from"../utilities/relationships.js";import{PopupContentExtension as z,_popupContentExtensionMap as w}from"./PopupContentExtension.js";let E=class extends l{popupContentExtensions;_isDefaultPopupTemplate=!1;_popupContentCollection;get _popupContent(){return null==this._popupContentCollection&&(this._popupContentCollection=this._createPopupContentCollection()),this._popupContentCollection}get hyperlinkTemplates(){return this._getCollectionSetting("hyperlinkTemplates")}get popupTemplate(){return this._getSetting("popupTemplate")}set popupTemplate(t){let n;n=t instanceof Object&&!v(t)?e.fromJSON(t):t;const i=this?._feature?.schema?.createPopupTemplate()??this?._featureSource?.schema?.createPopupTemplate();n&&i&&(n.content=n.content??i.content,n.fieldInfos=n.fieldInfos??i.fieldInfos),this._setSetting("popupTemplate",n),this._isDefaultPopupTemplate=!1,this.featureSource?.schema?.fieldExtensions.toArray().forEach((t=>{t._clearFieldInfoCache()}))}get showRelatedRecordsWhenUnconfigured(){return this._getSetting("showRelatedRecordsWhenUnconfigured",!0)}set showRelatedRecordsWhenUnconfigured(t){this._setSetting("showRelatedRecordsWhenUnconfigured",t)}get formatSettings(){return this._getNestedSettings("formatSettings",(()=>new s))}get returnGeometry(){return this._getSetting("returnGeometry",!0)}set returnGeometry(t){this._setSetting("returnGeometry",t)}get outFields(){return this._getSetting("outFields",this._defaultOutFields)}set outFields(t){this._setSetting("outFields",t)}get outSpatialReference(){return this._getSetting("outSpatialReference")}set outSpatialReference(t){this._setSetting("outSpatialReference",t)}get maxAllowableOffset(){return this._getSetting("maxAllowableOffset")}set maxAllowableOffset(t){this._setSetting("maxAllowableOffset",t)}get zoomScale(){return this._getSetting("zoomScale")}set zoomScale(t){this._setSetting("zoomScale",t)}get zoomFactor(){const t=this._feature?this._feature.schema:this._featureSource?.schema,e=t&&"point"===t.geometryType?void 0:1.5;return this._getSetting("zoomFactor",e)}set zoomFactor(t){this._setSetting("zoomFactor",t)}get featureSource(){return this._featureSource}get feature(){return this._feature}_featureSource;_feature;constructor(t){super(t),this.popupContentExtensions=new b(this)}get _defaultOutFields(){if(null==this.popupTemplate)return["*"];const t=S(this.popupTemplate),e=this.featureSource?.schema?.primaryKeyField;if(!t||!e)return["*"];const n=new Set([e]),i=new Map;this.featureSource.schema.fields.forEach((t=>{i.set(t.name.toLowerCase(),t.name)}));const o=new Set([...y(this.popupTemplate),...this.hyperlinkTemplates.toArray().flatMap((t=>t.getReferencedFields()))]);this._featureSource.relationships.forEach((t=>{P(t)&&o.add(t.keyField)}));const s=this.featureSource?.schema?.typeIdField;s&&o.add(s);const r=t.reduce(((t,e)=>((e.visible||e.isEditable&&this.featureSource.capabilities.supportsEditing)&&t.push(e.fieldName),t)),[]),p=new Set([...r,...o]);for(const t of p){if(T(t)||x(t))continue;const e=i.get(t.toLowerCase());e&&n.add(e)}return Array.from(n)}_setFeatureSource(t){this._featureSource=t,d(this,"featureSource")}_setFeature(t){this._feature=t,d(this,"feature")}toJSON(t="all"){const e=p(this._getSerializableProperties(),this,t)||{},n=e.popupContentExtensions?.filter((t=>{const e=this.parent;return!e?.popupContentExtensions?.some((e=>e.id===t.id))}));if(e)for(const t of A(e))this.isModified(t)||delete e[t];if(n?.length&&(e.popupContentExtensions=n),!h(t)||!a(e))return e}_createPopupContentCollection(){return new o({parent:this,targetProperty:"popupTemplate",arrayProperty:"content"})}_getSerializableProperties(){return{hyperlinkTemplates:{serializeModes:["initial"],deserialize:t=>{t.forEach((t=>{this.hyperlinkTemplates.find((e=>this._hyperlinksAreEquivalent(e,t)))||this.hyperlinkTemplates.add(t instanceof n?t:new n(t))})),this.hyperlinkTemplates.toArray().forEach((e=>{const n=this.hyperlinkTemplates.indexOf(e),i=t.findIndex((t=>this._hyperlinksAreEquivalent(t,e)));i<0?this.hyperlinkTemplates.removeAt(n):i!==n&&this.hyperlinkTemplates.reorder(e,i)}))}},popupTemplate:{serializeModes:["project"],isDefault:()=>!this._isDefaultPopupTemplate},showRelatedRecordsWhenUnconfigured:{serializeModes:["initial"],default:!0},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:t=>{const e=this._feature?this._feature.schema:this._featureSource?.schema;return t===(e&&"point"===e.geometryType?void 0:1.5)}},popupContentExtensions:{serializeModes:["initial"],serialize:t=>this.popupContentExtensions.map((e=>e.toJSON(t))).filter((t=>!(t&&2===Object.keys(t).length&&t.id&&t.content))).toArray(),deserialize:t=>{t&&g(this.popupContentExtensions,t,{onNew:(t,e)=>{this.popupContentExtensions.add(i(t)?t:new z(t),e)},onMatch:(t,e,n,o)=>{i(e)||t.assignProperties(e),n!==o&&this.popupContentExtensions.reorder(t,o)},onMissing:t=>{this.popupContentExtensions.remove(t)},equals:(t,e)=>{if(!e)return!1;if(i(e))return e===t||e.id===t.id;const n=this.popupContentExtensions.indexOf(t);if(e.content&&n>-1){const t=this.popupContentExtensions.toArray();return z.matchesRef(t,n,e.content)}return t.id===e.id}})}}}}_hyperlinksAreEquivalent(t,e){if(t===e)return!0;const n=t=>t||"";return n(t.text)===n(e.text)&&n(t.url)===n(e.url)&&n(t.iconUrl)===n(e.iconUrl)&&n(t.target)===n(e.target)&&n(t.tooltip)===n(e.tooltip)}};E=t([u],E);export{E as FeatureSettings};class b extends r{get _collection(){return this._featureSettings._popupContent.map((t=>this._forContent(t))).concat(Array.from(this._uninitializedPopupContentExtensions))}get _popupTemplateIsInherited(){return this._featureSettings.parent&&this._featureSettings.popupTemplate===this._featureSettings.parent.popupTemplate}_featureSettings;_uninitializedPopupContentExtensions=new Set;_onChangePopupContentHandle=new _((()=>this._featureSettings._popupContent.on("change",(t=>{const e={added:(t.added||[]).map((t=>this._forContent(t))),moved:(t.moved||[]).map((t=>this._forContent(t))),removed:(t.removed||[]).map((t=>this._forContent(t))),target:this};this.emit("change",e)}))));_onBeforeAddPopupContentHandle=new _((()=>this._featureSettings._popupContent.on("before-add",(t=>{this.emit("before-add",{...t,item:this._forContent(t.item),target:this})}))));_onBeforeRemovePopupContentHandle=new _((()=>this._featureSettings._popupContent.on("before-remove",(t=>{this.emit("before-remove",{...t,item:this._forContent(t.item),target:this})}))));_onBeforeChangesPopupContentHandle=new _((()=>this._featureSettings._popupContent.on("before-changes",(t=>{this.emit("before-changes",{...t,target:this})}))));_onAfterAddPopupContentHandle=new _((()=>this._featureSettings._popupContent.on("after-add",(t=>{this.emit("after-add",{...t,item:this._forContent(t.item),target:this})}))));_onAfterRemovePopupContentHandle=new _((()=>this._featureSettings._popupContent.on("after-remove",(t=>{this.emit("after-remove",{...t,item:this._forContent(t.item),target:this})}))));_onAfterChangesPopupContentHandle=new _((()=>this._featureSettings._popupContent.on("after-changes",(t=>{this.emit("after-changes",{...t,target:this})}))));constructor(t){super(),this._featureSettings=t,m(this,"length",(()=>c(this._featureSettings,"_popupContent.length",(()=>d(this,"length")),{sync:!0})))}forContent(t){if(C("content",t).isNotMissing(),this._featureSettings._popupContent.includes(t))return this._forContent(t)}add(t,n){if(C("contentX",t).isNotMissing(),this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new e({content:this._featureSettings._popupContent.toArray()})),t.featureSettings&&t.featureSettings.popupContentExtensions.remove(t),t._setFeatureSettings(this._featureSettings),t.content){const e=w.get(t.content);if(w.set(t.content,t),e&&e!==t&&this._onRemoved(e),this._featureSettings._popupContent.includes(t.content))if(void 0===n){const n={added:[t],moved:[],removed:e?[e]:[],target:this};this.emit("change",n),this.emit("after-add",{item:t,target:this}),this.emit("after-changes",{target:this}),d(this,"length")}else this._featureSettings._popupContent.reorder(t.content,n);else this._featureSettings._popupContent.add(t.content,n)}else{this._uninitializedPopupContentExtensions.add(t);const e={added:[t],moved:[],removed:[],target:this};this.emit("change",e),this.emit("after-add",{item:t,target:this}),this.emit("after-changes",{target:this}),d(this,"length")}return this._onAdded(t),this}removeAt(t){const n=this.getItemAt(t);if(void 0!==n){if(this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new e({content:this._featureSettings._popupContent.toArray()})),this._uninitializedPopupContentExtensions.has(n)){this._uninitializedPopupContentExtensions.delete(n);const t={added:[],moved:[],removed:[n],target:this};this.emit("change",t),this.emit("after-remove",{item:n,target:this}),this.emit("after-changes",{target:this}),d(this,"length")}else this._featureSettings._popupContent.remove(n.content);return this._onRemoved(n),n}}reorder(t,n){if(t&&this._featureSettings._popupContent.includes(t.content))return this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new e({content:this._featureSettings._popupContent.toArray()})),this._featureSettings._popupContent.reorder(t.content,n),t}sort(t){return this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new e({content:this._featureSettings._popupContent.toArray()})),this._featureSettings._popupContent.sort(((e,n)=>t(this._forContent(e),this._forContent(n)))),this}on(t,e){const n=[];return"change"===t?n.push(this._onChangePopupContentHandle.add()):"before-add"===t?n.push(this._onBeforeAddPopupContentHandle.add()):"before-remove"===t?n.push(this._onBeforeRemovePopupContentHandle.add()):"before-changes"===t?n.push(this._onBeforeChangesPopupContentHandle.add()):"after-add"===t?n.push(this._onAfterAddPopupContentHandle.add()):"after-remove"===t?n.push(this._onAfterRemovePopupContentHandle.add()):"after-changes"===t&&n.push(this._onAfterChangesPopupContentHandle.add()),n.push(super.on(t,e)),f(n)}_itemIsInitialized(t){return super._itemIsInitialized(t)&&!!t.content}_onAdded(t){}_onRemoved(t){t.featureSettings===this._featureSettings&&t._setFeatureSettings(void 0)}_forContent(t){if(this._uninitializedPopupContentExtensions.size)for(const t of this._uninitializedPopupContentExtensions)t._resolveContent(),t.content&&(w.set(t.content,t),this._uninitializedPopupContentExtensions.delete(t));if(!w.has(t)){const e=new z({content:t});w.set(t,e),e._setFeatureSettings(this._featureSettings),this._onAdded(e)}return w.get(t)}}
1
+ import{__decorate as t}from"tslib";import e from"@arcgis/core/PopupTemplate";import{Hyperlink as n}from"../Hyperlink.js";import{isPopupContentExtension as i}from"../ItemType.js";import{ArrayWrappedCollection as o}from"../mapping/support/ArrayWrappedCollection.js";import{FormatSettings as s}from"../support/FormatSettings.js";import{InitializableCollectionProxy as r}from"../support/InitializableCollectionProxy.js";import{filterJSONProperties as p,isDefault as a,serializable as u,shouldExcludeDefaults as h}from"../support/Serializable.js";import{Settings as l}from"../support/Settings.js";import{createIHandle as d,notifyChange as f,onWatch as m,watch as c}from"../support/observableUtils.js";import g from"../utilities/_ReferenceCountedHandle.js";import{compare as _}from"../utilities/array.js";import{checkArg as S}from"../utilities/checkArg.js";import{getAllFieldInfos as C,getAllReferencedFieldNames as y,isPopupTemplate as v}from"../utilities/esri.js";import{isArcadeExpressionField as A,isRelationshipField as T}from"../utilities/field.js";import{objectKeys as x}from"../utilities/object.js";import{isQueryBasedRelationship as P}from"../utilities/relationships.js";import{PopupContentExtension as z,_popupContentExtensionMap as w}from"./PopupContentExtension.js";let E=class extends l{popupContentExtensions;_isDefaultPopupTemplate=!1;_popupContentCollection;get _popupContent(){return null==this._popupContentCollection&&(this._popupContentCollection=this._createPopupContentCollection()),this._popupContentCollection}get hyperlinkTemplates(){return this._getCollectionSetting("hyperlinkTemplates")}get popupTemplate(){return this._getSetting("popupTemplate")}set popupTemplate(t){let n;n=t instanceof Object&&!v(t)?e.fromJSON(t):t;const i=this?._feature?.schema?.createPopupTemplate()??this?._featureSource?.schema?.createPopupTemplate();n&&i&&(n.content=n.content??i.content,n.fieldInfos=n.fieldInfos??i.fieldInfos),this._setSetting("popupTemplate",n),this._isDefaultPopupTemplate=!1,this.featureSource?.schema?.fieldExtensions.toArray().forEach((t=>{t._clearFieldInfoCache()}))}get showRelatedRecordsWhenUnconfigured(){return this._getSetting("showRelatedRecordsWhenUnconfigured",!0)}set showRelatedRecordsWhenUnconfigured(t){this._setSetting("showRelatedRecordsWhenUnconfigured",t)}get formatSettings(){return this._getNestedSettings("formatSettings",(()=>new s))}get returnGeometry(){return this._getSetting("returnGeometry",!0)}set returnGeometry(t){this._setSetting("returnGeometry",t)}get outFields(){return this._getSetting("outFields",this._defaultOutFields)}set outFields(t){this._setSetting("outFields",t)}get outSpatialReference(){return this._getSetting("outSpatialReference")}set outSpatialReference(t){this._setSetting("outSpatialReference",t)}get maxAllowableOffset(){return this._getSetting("maxAllowableOffset")}set maxAllowableOffset(t){this._setSetting("maxAllowableOffset",t)}get zoomScale(){return this._getSetting("zoomScale")}set zoomScale(t){this._setSetting("zoomScale",t)}get zoomFactor(){const t=this._feature?this._feature.schema:this._featureSource?.schema,e=t&&"point"===t.geometryType?void 0:1.5;return this._getSetting("zoomFactor",e)}set zoomFactor(t){this._setSetting("zoomFactor",t)}get featureSource(){return this._featureSource}get feature(){return this._feature}_featureSource;_feature;constructor(t){super(t),this.popupContentExtensions=new b(this)}get _defaultOutFields(){if(null==this.popupTemplate)return["*"];const t=C(this.popupTemplate),e=this.featureSource?.schema?.primaryKeyField;if(!t||!e)return["*"];const n=new Set([e]),i=new Map;this.featureSource.schema.fields.forEach((t=>{i.set(t.name.toLowerCase(),t.name)}));const o=new Set([...y(this.popupTemplate),...this.hyperlinkTemplates.toArray().flatMap((t=>t.getReferencedFields()))]);this._featureSource.relationships.forEach((t=>{P(t)&&o.add(t.keyField)}));const s=this.featureSource?.schema?.typeIdField;s&&o.add(s);const r=t.reduce(((t,e)=>((e.visible||e.isEditable&&this.featureSource.capabilities.supportsEditing)&&t.push(e.fieldName),t)),[]),p=new Set([...r,...o]);for(const t of p){if(A(t)||T(t))continue;const e=i.get(t.toLowerCase());e&&n.add(e)}return Array.from(n)}_setFeatureSource(t){this._featureSource=t,f(this,"featureSource")}_setFeature(t){this._feature=t,f(this,"feature")}toJSON(t="all"){const e=p(this._getSerializableProperties(),this,t)||{},n=e.popupContentExtensions?.filter((t=>{const e=this.parent;return!e?.popupContentExtensions?.some((e=>e.id===t.id))}));if(e)for(const t of x(e))this.isModified(t)||delete e[t];if(n?.length&&(e.popupContentExtensions=n),!h(t)||!a(e))return e}_hasSettingIncludingAncestor(t){return"outFields"===t||super._hasSettingIncludingAncestor(t)}_createPopupContentCollection(){return new o({parent:this,targetProperty:"popupTemplate",arrayProperty:"content"})}_getSerializableProperties(){return{hyperlinkTemplates:{serializeModes:["initial"],deserialize:t=>{t.forEach((t=>{this.hyperlinkTemplates.find((e=>this._hyperlinksAreEquivalent(e,t)))||this.hyperlinkTemplates.add(t instanceof n?t:new n(t))})),this.hyperlinkTemplates.toArray().forEach((e=>{const n=this.hyperlinkTemplates.indexOf(e),i=t.findIndex((t=>this._hyperlinksAreEquivalent(t,e)));i<0?this.hyperlinkTemplates.removeAt(n):i!==n&&this.hyperlinkTemplates.reorder(e,i)}))}},popupTemplate:{serializeModes:["project"],isDefault:()=>!this._isDefaultPopupTemplate},showRelatedRecordsWhenUnconfigured:{serializeModes:["initial"],default:!0},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:t=>{const e=this._feature?this._feature.schema:this._featureSource?.schema;return t===(e&&"point"===e.geometryType?void 0:1.5)}},popupContentExtensions:{serializeModes:["initial"],serialize:t=>this.popupContentExtensions.map((e=>e.toJSON(t))).filter((t=>!(t&&2===Object.keys(t).length&&t.id&&t.content))).toArray(),deserialize:t=>{t&&_(this.popupContentExtensions,t,{onNew:(t,e)=>{this.popupContentExtensions.add(i(t)?t:new z(t),e)},onMatch:(t,e,n,o)=>{i(e)||t.assignProperties(e),n!==o&&this.popupContentExtensions.reorder(t,o)},onMissing:t=>{this.popupContentExtensions.remove(t)},equals:(t,e)=>{if(!e)return!1;if(i(e))return e===t||e.id===t.id;const n=this.popupContentExtensions.indexOf(t);if(e.content&&n>-1){const t=this.popupContentExtensions.toArray();return z.matchesRef(t,n,e.content)}return t.id===e.id}})}}}}_hyperlinksAreEquivalent(t,e){if(t===e)return!0;const n=t=>t||"";return n(t.text)===n(e.text)&&n(t.url)===n(e.url)&&n(t.iconUrl)===n(e.iconUrl)&&n(t.target)===n(e.target)&&n(t.tooltip)===n(e.tooltip)}};E=t([u],E);export{E as FeatureSettings};class b extends r{get _collection(){return this._featureSettings._popupContent.map((t=>this._forContent(t))).concat(Array.from(this._uninitializedPopupContentExtensions))}get _popupTemplateIsInherited(){return this._featureSettings.parent&&this._featureSettings.popupTemplate===this._featureSettings.parent.popupTemplate}_featureSettings;_uninitializedPopupContentExtensions=new Set;_onChangePopupContentHandle=new g((()=>this._featureSettings._popupContent.on("change",(t=>{const e={added:(t.added||[]).map((t=>this._forContent(t))),moved:(t.moved||[]).map((t=>this._forContent(t))),removed:(t.removed||[]).map((t=>this._forContent(t))),target:this};this.emit("change",e)}))));_onBeforeAddPopupContentHandle=new g((()=>this._featureSettings._popupContent.on("before-add",(t=>{this.emit("before-add",{...t,item:this._forContent(t.item),target:this})}))));_onBeforeRemovePopupContentHandle=new g((()=>this._featureSettings._popupContent.on("before-remove",(t=>{this.emit("before-remove",{...t,item:this._forContent(t.item),target:this})}))));_onBeforeChangesPopupContentHandle=new g((()=>this._featureSettings._popupContent.on("before-changes",(t=>{this.emit("before-changes",{...t,target:this})}))));_onAfterAddPopupContentHandle=new g((()=>this._featureSettings._popupContent.on("after-add",(t=>{this.emit("after-add",{...t,item:this._forContent(t.item),target:this})}))));_onAfterRemovePopupContentHandle=new g((()=>this._featureSettings._popupContent.on("after-remove",(t=>{this.emit("after-remove",{...t,item:this._forContent(t.item),target:this})}))));_onAfterChangesPopupContentHandle=new g((()=>this._featureSettings._popupContent.on("after-changes",(t=>{this.emit("after-changes",{...t,target:this})}))));constructor(t){super(),this._featureSettings=t,m(this,"length",(()=>c(this._featureSettings,"_popupContent.length",(()=>f(this,"length")),{sync:!0})))}forContent(t){if(S("content",t).isNotMissing(),this._featureSettings._popupContent.includes(t))return this._forContent(t)}add(t,n){if(S("contentX",t).isNotMissing(),this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new e({content:this._featureSettings._popupContent.toArray()})),t.featureSettings&&t.featureSettings.popupContentExtensions.remove(t),t._setFeatureSettings(this._featureSettings),t.content){const e=w.get(t.content);if(w.set(t.content,t),e&&e!==t&&this._onRemoved(e),this._featureSettings._popupContent.includes(t.content))if(void 0===n){const n={added:[t],moved:[],removed:e?[e]:[],target:this};this.emit("change",n),this.emit("after-add",{item:t,target:this}),this.emit("after-changes",{target:this}),f(this,"length")}else this._featureSettings._popupContent.reorder(t.content,n);else this._featureSettings._popupContent.add(t.content,n)}else{this._uninitializedPopupContentExtensions.add(t);const e={added:[t],moved:[],removed:[],target:this};this.emit("change",e),this.emit("after-add",{item:t,target:this}),this.emit("after-changes",{target:this}),f(this,"length")}return this._onAdded(t),this}removeAt(t){const n=this.getItemAt(t);if(void 0!==n){if(this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new e({content:this._featureSettings._popupContent.toArray()})),this._uninitializedPopupContentExtensions.has(n)){this._uninitializedPopupContentExtensions.delete(n);const t={added:[],moved:[],removed:[n],target:this};this.emit("change",t),this.emit("after-remove",{item:n,target:this}),this.emit("after-changes",{target:this}),f(this,"length")}else this._featureSettings._popupContent.remove(n.content);return this._onRemoved(n),n}}reorder(t,n){if(t&&this._featureSettings._popupContent.includes(t.content))return this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new e({content:this._featureSettings._popupContent.toArray()})),this._featureSettings._popupContent.reorder(t.content,n),t}sort(t){return this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new e({content:this._featureSettings._popupContent.toArray()})),this._featureSettings._popupContent.sort(((e,n)=>t(this._forContent(e),this._forContent(n)))),this}on(t,e){const n=[];return"change"===t?n.push(this._onChangePopupContentHandle.add()):"before-add"===t?n.push(this._onBeforeAddPopupContentHandle.add()):"before-remove"===t?n.push(this._onBeforeRemovePopupContentHandle.add()):"before-changes"===t?n.push(this._onBeforeChangesPopupContentHandle.add()):"after-add"===t?n.push(this._onAfterAddPopupContentHandle.add()):"after-remove"===t?n.push(this._onAfterRemovePopupContentHandle.add()):"after-changes"===t&&n.push(this._onAfterChangesPopupContentHandle.add()),n.push(super.on(t,e)),d(n)}_itemIsInitialized(t){return super._itemIsInitialized(t)&&!!t.content}_onAdded(t){}_onRemoved(t){t.featureSettings===this._featureSettings&&t._setFeatureSettings(void 0)}_forContent(t){if(this._uninitializedPopupContentExtensions.size)for(const t of this._uninitializedPopupContentExtensions)t._resolveContent(),t.content&&(w.set(t.content,t),this._uninitializedPopupContentExtensions.delete(t));if(!w.has(t)){const e=new z({content:t});w.set(t,e),e._setFeatureSettings(this._featureSettings),this._onAdded(e)}return w.get(t)}}
@@ -135,6 +135,7 @@ export declare class TableSchema extends Schema {
135
135
  set geometryType(value: GeometryType);
136
136
  get spatialReference(): SpatialReference;
137
137
  set spatialReference(value: SpatialReference);
138
+ protected _hasSettingIncludingAncestor<K extends keyof this>(setting: K): boolean;
138
139
  protected _getSetting<K extends keyof this>(setting: K, defaultValue?: this[K]): this[K];
139
140
  protected _setSetting<K extends keyof this>(setting: K, value: this[K]): void;
140
141
  /**
@@ -1 +1 @@
1
- import{__decorate as e}from"tslib";import t from"@arcgis/core/core/Collection";import{InvalidOperationError as i}from"../InvalidOperationError.js";import{ItemType as s}from"../ItemType.js";import{applyJsonToTable as r,jsonToTable as a,tableToJson as l}from"../json/TableJson.js";import{serializable as o}from"../support/Serializable.js";import{notifyChange as n,onWatch as b,watch as h}from"../support/observableUtils.js";import{CollectionProxy as d}from"../utilities/CollectionProxy.js";import{isFeatureLayer as p,isLayer as f}from"../utilities/_layers.js";import{checkArg as _}from"../utilities/checkArg.js";import{deepClone as c}from"../utilities/object.js";import{FeatureSettings as g}from"./FeatureSettings.js";import{FeatureSourceBase as m}from"./FeatureSourceBase.js";import{FieldExtension as u}from"./FieldExtension.js";import{Schema as T}from"./Schema.js";const y="Invalid type of table for this type of table extension.",w="Spatial settings are not supported for tables.",x=Object.freeze({supportsAdd:!1,supportsUpdate:!1,supportsDelete:!1,supportsEditing:!1,supportsQuery:!1,supportsAttachmentEditing:!1,supportsStandardizedQueries:!1});export class TableExtension extends m{static factory;get mapExtension(){return this._mapExtension}get table(){return this._table}get capabilities(){return x}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"}get canChangeDefinitionExpression(){return!1}get _tableId(){return this.table?.id??this._deferredTableProperties?.$ref?.id}_itemType=s.TABLE_EXTENSION;_table;_mapExtension;_deferredTableProperties;_originalRef;constructor(e){super(e);const{table:t}={...this.getDefaults(),...e};if(f(t))_("properties.table",t).satisfies((e=>p(e)),y),this._setTable(t);else{if(!t)throw new Error("Missing 'table' property.");this._deferredTableProperties=t}}static create(e){if(!TableExtension.factory)throw new i("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,s=e.table?.title??e._deferredTableProperties.title,r=t.$ref;return"string"==typeof r?i===r||s===r:!!r&&(i===r.id||s===r.title)}async _createBackingTable(){this.table||this._deferredTableProperties?.$ref||(this._setTable(await a(this._deferredTableProperties)),await this.table.load(),_("properties.table",this.table).satisfies((e=>this._isSupportedTable(e)),y),this._deferredTableProperties=void 0)}async _switchTable(e){if(e===this.table)return;_("newTable",e).isNotMissing().satisfies((e=>this._isSupportedTable(e)),y),this.isInitialized&&await e.load(),e.visible=this.table.visible,e.opacity=this.table.opacity,e.listMode=this.table.listMode,e.hasOwnProperty("labelsVisible")&&this.table.hasOwnProperty("labelsVisible")&&(e.labelsVisible=this.table.labelsVisible);const t=this.schema.fieldExtensions.toArray();this._setTable(e),t.forEach((e=>{const t=this.schema.fields.find((t=>u.matchesRef(e,{$ref:t.name})));t&&e._switchField(t)})),this.isInitialized&&await this._initializeChildren()}_setMapExtension(e){if(this.mapExtension===e)return;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(),n(this,"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}}:l(this.table):this._deferredTableProperties?c(this._deferredTableProperties):void 0,deserialize:e=>{if(f(e)){if(e!==this.table)throw new Error("Property 'table' is read-only.")}else{if(this.table)return r(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 i(`No table found matching reference "${"string"==typeof e?e:JSON.stringify(e)}".`):new i("Cannot resolve table reference: missing parent map extension.")}await this.table.load()}_createSchema(){return new P(this)}_createFeatureSettings(){return new S}_setTable(e){this._table=e,n(this,"table"),n(this,"title"),n(this,"capabilities")}}let P=class extends T{_tableExtension;_tableBindings=new Map;_fieldCollection;constructor(e){super(),this._tableExtension=e,this._bindSettingToTableProperty("primaryKeyField","objectIdField"),this._fieldCollection=this._createFieldCollection(),e.table?this._onTableResolved(e.table):h(e,"table",(()=>{this._onTableResolved(e.table)}),{sync:!0,once:!0}),n(this,"_fields")}get _fields(){return this._fieldCollection}get geometryType(){}set geometryType(e){throw new i("Tables do not support a geometry type.")}get spatialReference(){}set spatialReference(e){throw new i("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),b(this,e,(()=>h(this._tableExtension,`table.${i}`,(()=>n(this,e)),{sync:!0})))}_onTableResolved(e){for(const[t,i]of this._tableBindings.entries())this.isModified(t)&&(e[i]=this[t],this.reset(t))}_createFieldCollection(){return new E(this._tableExtension)}};P=e([o],P);export{P as TableSchema};class E extends d{_tableResolved=!1;constructor(e){super(new t);const i=[],s=()=>{if(e.table?.fields){this._onTableResolved(e.table);for(const e of i)e.remove();i.length=0}};e.table?.fields?s():i.push(h(e,"table.fields",(()=>{s()}),{sync:!0}),h(e,"table.loaded",(()=>{s()}),{sync:!0}))}_onTableResolved(e){this._tableResolved||(this._tableResolved=!0,this.length&&(e.fields.length=0,e.fields.push(...this.toArray())),e.fields||(e.fields=[]),this._collection=function(e){const i=new t;return Object.defineProperty(i,"_items",{get:()=>e}),Object.defineProperty(i,"length",{get:()=>e.length,set:t=>e.length=t}),i}(e.fields))}}let S=class extends g{get returnGeometry(){}set returnGeometry(e){throw new i(w)}get outSpatialReference(){}set outSpatialReference(e){throw new i(w)}get maxAllowableOffset(){}set maxAllowableOffset(e){throw new i(w)}get zoomScale(){}set zoomScale(e){throw new i(w)}get zoomFactor(){}set zoomFactor(e){throw new i(w)}};S=e([o],S);export{S as TableFeatureSettings};
1
+ import{__decorate as e}from"tslib";import t from"@arcgis/core/core/Collection";import{InvalidOperationError as i}from"../InvalidOperationError.js";import{ItemType as s}from"../ItemType.js";import{applyJsonToTable as r,jsonToTable as a,tableToJson as l}from"../json/TableJson.js";import{serializable as o}from"../support/Serializable.js";import{notifyChange as n,onWatch as b,watch as h}from"../support/observableUtils.js";import{CollectionProxy as d}from"../utilities/CollectionProxy.js";import{isFeatureLayer as p,isLayer as f}from"../utilities/_layers.js";import{checkArg as _}from"../utilities/checkArg.js";import{deepClone as c}from"../utilities/object.js";import{FeatureSettings as g}from"./FeatureSettings.js";import{FeatureSourceBase as m}from"./FeatureSourceBase.js";import{FieldExtension as u}from"./FieldExtension.js";import{Schema as T}from"./Schema.js";const y="Invalid type of table for this type of table extension.",w="Spatial settings are not supported for tables.",x=Object.freeze({supportsAdd:!1,supportsUpdate:!1,supportsDelete:!1,supportsEditing:!1,supportsQuery:!1,supportsAttachmentEditing:!1,supportsStandardizedQueries:!1});export class TableExtension extends m{static factory;get mapExtension(){return this._mapExtension}get table(){return this._table}get capabilities(){return x}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"}get canChangeDefinitionExpression(){return!1}get _tableId(){return this.table?.id??this._deferredTableProperties?.$ref?.id}_itemType=s.TABLE_EXTENSION;_table;_mapExtension;_deferredTableProperties;_originalRef;constructor(e){super(e);const{table:t}={...this.getDefaults(),...e};if(f(t))_("properties.table",t).satisfies((e=>p(e)),y),this._setTable(t);else{if(!t)throw new Error("Missing 'table' property.");this._deferredTableProperties=t}}static create(e){if(!TableExtension.factory)throw new i("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,s=e.table?.title??e._deferredTableProperties.title,r=t.$ref;return"string"==typeof r?i===r||s===r:!!r&&(i===r.id||s===r.title)}async _createBackingTable(){this.table||this._deferredTableProperties?.$ref||(this._setTable(await a(this._deferredTableProperties)),await this.table.load(),_("properties.table",this.table).satisfies((e=>this._isSupportedTable(e)),y),this._deferredTableProperties=void 0)}async _switchTable(e){if(e===this.table)return;_("newTable",e).isNotMissing().satisfies((e=>this._isSupportedTable(e)),y),this.isInitialized&&await e.load(),e.visible=this.table.visible,e.opacity=this.table.opacity,e.listMode=this.table.listMode,e.hasOwnProperty("labelsVisible")&&this.table.hasOwnProperty("labelsVisible")&&(e.labelsVisible=this.table.labelsVisible);const t=this.schema.fieldExtensions.toArray();this._setTable(e),t.forEach((e=>{const t=this.schema.fields.find((t=>u.matchesRef(e,{$ref:t.name})));t&&e._switchField(t)})),this.isInitialized&&await this._initializeChildren()}_setMapExtension(e){if(this.mapExtension===e)return;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(),n(this,"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}}:l(this.table):this._deferredTableProperties?c(this._deferredTableProperties):void 0,deserialize:e=>{if(f(e)){if(e!==this.table)throw new Error("Property 'table' is read-only.")}else{if(this.table)return r(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 i(`No table found matching reference "${"string"==typeof e?e:JSON.stringify(e)}".`):new i("Cannot resolve table reference: missing parent map extension.")}await this.table.load()}_createSchema(){return new P(this)}_createFeatureSettings(){return new S}_setTable(e){this._table=e,n(this,"table"),n(this,"title"),n(this,"capabilities")}}let P=class extends T{_tableExtension;_tableBindings=new Map;_fieldCollection;constructor(e){super(),this._tableExtension=e,this._bindSettingToTableProperty("primaryKeyField","objectIdField"),this._fieldCollection=this._createFieldCollection(),e.table?this._onTableResolved(e.table):h(e,"table",(()=>{this._onTableResolved(e.table)}),{sync:!0,once:!0}),n(this,"_fields")}get _fields(){return this._fieldCollection}get geometryType(){}set geometryType(e){throw new i("Tables do not support a geometry type.")}get spatialReference(){}set spatialReference(e){throw new i("Tables do not support a spatial reference.")}_hasSettingIncludingAncestor(e){return!(!this._tableBindings.has(e)||!this._tableExtension.table)||super._hasSettingIncludingAncestor(e)}_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),b(this,e,(()=>h(this._tableExtension,`table.${i}`,(()=>n(this,e)),{sync:!0})))}_onTableResolved(e){for(const[t,i]of this._tableBindings.entries())this.isModified(t)&&(e[i]=this[t],this.reset(t))}_createFieldCollection(){return new E(this._tableExtension)}};P=e([o],P);export{P as TableSchema};class E extends d{_tableResolved=!1;constructor(e){super(new t);const i=[],s=()=>{if(e.table?.fields){this._onTableResolved(e.table);for(const e of i)e.remove();i.length=0}};e.table?.fields?s():i.push(h(e,"table.fields",(()=>{s()}),{sync:!0}),h(e,"table.loaded",(()=>{s()}),{sync:!0}))}_onTableResolved(e){this._tableResolved||(this._tableResolved=!0,this.length&&(e.fields.length=0,e.fields.push(...this.toArray())),e.fields||(e.fields=[]),this._collection=function(e){const i=new t;return Object.defineProperty(i,"_items",{get:()=>e}),Object.defineProperty(i,"length",{get:()=>e.length,set:t=>e.length=t}),i}(e.fields))}}let S=class extends g{get returnGeometry(){}set returnGeometry(e){throw new i(w)}get outSpatialReference(){}set outSpatialReference(e){throw new i(w)}get maxAllowableOffset(){}set maxAllowableOffset(e){throw new i(w)}get zoomScale(){}set zoomScale(e){throw new i(w)}get zoomFactor(){}set zoomFactor(e){throw new i(w)}};S=e([o],S);export{S as TableFeatureSettings};