@vertigis/arcgis-extensions 39.4.3 → 39.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Hyperlink.d.ts CHANGED
@@ -65,6 +65,11 @@ export declare class Hyperlink extends SerializableBase<HyperlinkProperties> {
65
65
  * @param properties The properties to set.
66
66
  */
67
67
  constructor(properties: HyperlinkProperties);
68
+ /**
69
+ * Returns a list of fields references contained in the hyperlink
70
+ * properties.
71
+ */
72
+ getReferencedFields(): string[];
68
73
  /**
69
74
  * @inheritDoc
70
75
  */
package/Hyperlink.js CHANGED
@@ -1 +1 @@
1
- import{__decorate as t}from"tslib";import{serializable as i,SerializableBase as r}from"./support/Serializable.js";import{checkArg as e}from"./utilities/checkArg.js";let s=class extends r{get url(){return this._url}set url(t){this._url=t}get text(){return this._text}set text(t){this._text=t}get iconUrl(){return this._iconUrl}set iconUrl(t){this._iconUrl=t}get target(){return this._target}set target(t){this._target=t}get tooltip(){return this._tooltip}set tooltip(t){this._tooltip=t}constructor(t){e("properties",t).isNotMissing(),e("properties.url",t.url).isNotMissing(),e("properties.text",t.text).isNotMissing(),super(t)}_getSerializableProperties(){return{...super._getSerializableProperties(),url:"initial",text:"initial",iconUrl:"initial",target:"initial",tooltip:"initial"}}};s=t([i],s);export{s as Hyperlink};
1
+ import{__decorate as t}from"tslib";import{serializable as i,SerializableBase as e}from"./support/Serializable.js";import{checkArg as r}from"./utilities/checkArg.js";import{getAllReferencedFieldNames as s}from"./utilities/esri.js";let o=class extends e{get url(){return this._url}set url(t){this._url=t}get text(){return this._text}set text(t){this._text=t}get iconUrl(){return this._iconUrl}set iconUrl(t){this._iconUrl=t}get target(){return this._target}set target(t){this._target=t}get tooltip(){return this._tooltip}set tooltip(t){this._tooltip=t}constructor(t){r("properties",t).isNotMissing(),r("properties.url",t.url).isNotMissing(),r("properties.text",t.text).isNotMissing(),super(t)}getReferencedFields(){return s({content:[].concat(this.text,this.url,this.iconUrl,this.tooltip).join()})}_getSerializableProperties(){return{...super._getSerializableProperties(),url:"initial",text:"initial",iconUrl:"initial",target:"initial",tooltip:"initial"}}};o=t([i],o);export{o as Hyperlink};
@@ -1 +1 @@
1
- import{__decorate as t}from"tslib";import e from"@arcgis/core/PopupTemplate";import{Hyperlink as i}from"../Hyperlink.js";import{isPopupContentExtension as n}from"../ItemType.js";import{ArrayWrappedCollection as o}from"../mapping/support/ArrayWrappedCollection.js";import{PopupInfo as s}from"../portal/PopupInfo.js";import{FormatSettings as r}from"../support/FormatSettings.js";import{InitializableCollectionProxy as p}from"../support/InitializableCollectionProxy.js";import{filterJSONProperties as a,isDefault as u,serializable as l,shouldExcludeDefaults as h}from"../support/Serializable.js";import{Settings as f}from"../support/Settings.js";import{compare as m}from"../utilities/array.js";import{checkArg as d}from"../utilities/checkArg.js";import{getAllFieldInfos as c,getAllReferencedFieldNames as _,isPopupTemplate as g}from"../utilities/esri.js";import{fieldWithArcadeXRegex as S,fieldWithRelationshipRegex as C}from"../utilities/field.js";import{isQueryBasedRelationship as y}from"../utilities/relationships.js";import{onCollectionPropertyChange as T}from"../utilities/watch.js";import{PopupContentExtension as x,_popupContentExtensionMap as z}from"./PopupContentExtension.js";let E=class extends f{get _popupContent(){return this._popupContentCollection}get hyperlinkTemplates(){return this._getCollectionSetting("hyperlinkTemplates")}get popupTemplate(){return this._getSetting("popupTemplate")}set popupTemplate(t){let e;e=t instanceof Object&&!g(t)?s.toEsriApiPopupTemplate(t):t;const i=this?._feature?.schema?.createPopupTemplate()??this?._featureSource?.schema?.createPopupTemplate();e&&i&&(e.content=e.content??i.content,e.fieldInfos=e.fieldInfos??i.fieldInfos),this._setSetting("popupTemplate",e),this._isDefaultPopupTemplate=!1}get formatSettings(){return this._getNestedSettings("formatSettings",(()=>new r))}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}constructor(t){super(t),this._isDefaultPopupTemplate=!1,this._popupContentCollection=this._createPopupContentCollection(),this.popupContentExtensions=new v(this)}get _defaultOutFields(){const t=c(this.popupTemplate),e=this.featureSource?.schema?.primaryKeyField;if(t&&e){const i=new Set;i.add(e);const n=this.featureSource.schema.fields.toArray().map((t=>t.name)),o=_(this.popupTemplate),s=t.filter((t=>t.visible||t.isEditable&&this.featureSource.capabilities.supportsEditing)).map((t=>t.fieldName)).concat(...o).filter((t=>n.includes(t)));return this._featureSource.relationships.forEach((t=>{y(t)&&s.push(t.keyField)})),s.filter((t=>!(t.match(S)||t.match(C)))).forEach((t=>i.add(t))),Array.from(i.values())}return["*"]}_setFeatureSource(t){this._featureSource=t,this.notifyChange("featureSource")}_setFeature(t){this._feature=t,this.notifyChange("feature")}toJSON(t="all"){const e=a(this._getSerializableProperties(),this,t)||{},i=e.popupContentExtensions?.filter((t=>!this.parent?.popupContentExtensions?.some((e=>e.id===t.id))));if(e)for(const t of Object.keys(e))this.isModified(t)||delete e[t];if(i?.length&&(e.popupContentExtensions=i),!h(t)||!u(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 i?t:new i(t))})),this.hyperlinkTemplates.toArray().forEach((e=>{const i=this.hyperlinkTemplates.indexOf(e),n=t.findIndex((t=>this._hyperlinksAreEquivalent(t,e)));n<0?this.hyperlinkTemplates.removeAt(i):n!==i&&this.hyperlinkTemplates.reorder(e,n)}))}},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: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&&m(this.popupContentExtensions,t,{onNew:(t,e)=>{this.popupContentExtensions.add(n(t)?t:new x(t),e)},onMatch:(t,e,i,o)=>{n(e)||t.assignProperties(e),i!==o&&this.popupContentExtensions.reorder(t,o)},onMissing:t=>{this.popupContentExtensions.remove(t)},equals:(t,e)=>n(e)?e===t||e.id===t.id:!(!e?.content||!x.matchesRef(this.popupContentExtensions.toArray(),this.popupContentExtensions.indexOf(t),e.content))||t.id===e.id})}}}}_hyperlinksAreEquivalent(t,e){if(t===e)return!0;const i=t=>t||"";return i(t.text)===i(e.text)&&i(t.url)===i(e.url)&&i(t.iconUrl)===i(e.iconUrl)&&i(t.target)===i(e.target)&&i(t.tooltip)===i(e.tooltip)}};E=t([l],E);export{E as FeatureSettings};class v extends p{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}constructor(t){super(),this._uninitializedPopupContentExtensions=new Set,this._featureSettings=t,T(this._featureSettings,"_popupContent",(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)})),t.watch("_popupContent.length",(()=>this.notifyChange("length")))}forContent(t){if(d("content",t).isNotMissing(),this._featureSettings._popupContent.includes(t))return this._forContent(t)}add(t,i){if(d("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=z.get(t.content);if(z.set(t.content,t),e&&e!==t&&this._onRemoved(e),this._featureSettings._popupContent.includes(t.content))if(void 0===i){const i={added:[t],moved:[],removed:e?[e]:[],target:this};this.emit("change",i)}else this._featureSettings._popupContent.reorder(t.content,i);else this._featureSettings._popupContent.add(t.content,i)}else{this._uninitializedPopupContentExtensions.add(t);const e={added:[t],moved:[],removed:[],target:this};this.emit("change",e)}return this._onAdded(t),this}removeAt(t){const i=this.getItemAt(t);if(void 0!==i){if(this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new e({content:this._featureSettings._popupContent.toArray()})),this._uninitializedPopupContentExtensions.has(i)){this._uninitializedPopupContentExtensions.delete(i);const t={added:[],moved:[],removed:[i],target:this};this.emit("change",t)}else this._featureSettings._popupContent.remove(i.content);return this._onRemoved(i),i}}reorder(t,i){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,i),t}sort(t){return this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new e({content:this._featureSettings._popupContent.toArray()})),this._featureSettings._popupContent.sort(((e,i)=>t(this._forContent(e),this._forContent(i)))),this}_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&&(z.set(t.content,t),this._uninitializedPopupContentExtensions.delete(t));if(!z.has(t)){const e=new x({content:t});z.set(t,e),e._setFeatureSettings(this._featureSettings),this._onAdded(e)}return z.get(t)}}
1
+ import{__decorate as t}from"tslib";import e from"@arcgis/core/PopupTemplate";import{Hyperlink as i}from"../Hyperlink.js";import{isPopupContentExtension as n}from"../ItemType.js";import{ArrayWrappedCollection as o}from"../mapping/support/ArrayWrappedCollection.js";import{PopupInfo as s}from"../portal/PopupInfo.js";import{FormatSettings as r}from"../support/FormatSettings.js";import{InitializableCollectionProxy as p}from"../support/InitializableCollectionProxy.js";import{filterJSONProperties as a,isDefault as u,serializable as l,shouldExcludeDefaults as h}from"../support/Serializable.js";import{Settings as f}from"../support/Settings.js";import{compare as m}from"../utilities/array.js";import{checkArg as d}from"../utilities/checkArg.js";import{getAllFieldInfos as c,getAllReferencedFieldNames as _,isPopupTemplate as g}from"../utilities/esri.js";import{fieldWithArcadeXRegex as S,fieldWithRelationshipRegex as C}from"../utilities/field.js";import{isQueryBasedRelationship as y}from"../utilities/relationships.js";import{onCollectionPropertyChange as T}from"../utilities/watch.js";import{PopupContentExtension as x,_popupContentExtensionMap as z}from"./PopupContentExtension.js";let E=class extends f{get _popupContent(){return this._popupContentCollection}get hyperlinkTemplates(){return this._getCollectionSetting("hyperlinkTemplates")}get popupTemplate(){return this._getSetting("popupTemplate")}set popupTemplate(t){let e;e=t instanceof Object&&!g(t)?s.toEsriApiPopupTemplate(t):t;const i=this?._feature?.schema?.createPopupTemplate()??this?._featureSource?.schema?.createPopupTemplate();e&&i&&(e.content=e.content??i.content,e.fieldInfos=e.fieldInfos??i.fieldInfos),this._setSetting("popupTemplate",e),this._isDefaultPopupTemplate=!1}get formatSettings(){return this._getNestedSettings("formatSettings",(()=>new r))}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}constructor(t){super(t),this._isDefaultPopupTemplate=!1,this._popupContentCollection=this._createPopupContentCollection(),this.popupContentExtensions=new v(this)}get _defaultOutFields(){const t=c(this.popupTemplate),e=this.featureSource?.schema?.primaryKeyField;if(t&&e){const i=new Set;i.add(e);const n=this.featureSource.schema.fields.toArray().map((t=>t.name)),o=new Set([..._(this.popupTemplate),...this.hyperlinkTemplates.toArray().flatMap((t=>t.getReferencedFields()))]),s=t.filter((t=>t.visible||t.isEditable&&this.featureSource.capabilities.supportsEditing)).map((t=>t.fieldName)).concat(...o).filter((t=>n.includes(t)));return this._featureSource.relationships.forEach((t=>{y(t)&&s.push(t.keyField)})),s.filter((t=>!(t.match(S)||t.match(C)))).forEach((t=>i.add(t))),Array.from(i.values())}return["*"]}_setFeatureSource(t){this._featureSource=t,this.notifyChange("featureSource")}_setFeature(t){this._feature=t,this.notifyChange("feature")}toJSON(t="all"){const e=a(this._getSerializableProperties(),this,t)||{},i=e.popupContentExtensions?.filter((t=>!this.parent?.popupContentExtensions?.some((e=>e.id===t.id))));if(e)for(const t of Object.keys(e))this.isModified(t)||delete e[t];if(i?.length&&(e.popupContentExtensions=i),!h(t)||!u(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 i?t:new i(t))})),this.hyperlinkTemplates.toArray().forEach((e=>{const i=this.hyperlinkTemplates.indexOf(e),n=t.findIndex((t=>this._hyperlinksAreEquivalent(t,e)));n<0?this.hyperlinkTemplates.removeAt(i):n!==i&&this.hyperlinkTemplates.reorder(e,n)}))}},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: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&&m(this.popupContentExtensions,t,{onNew:(t,e)=>{this.popupContentExtensions.add(n(t)?t:new x(t),e)},onMatch:(t,e,i,o)=>{n(e)||t.assignProperties(e),i!==o&&this.popupContentExtensions.reorder(t,o)},onMissing:t=>{this.popupContentExtensions.remove(t)},equals:(t,e)=>n(e)?e===t||e.id===t.id:!(!e?.content||!x.matchesRef(this.popupContentExtensions.toArray(),this.popupContentExtensions.indexOf(t),e.content))||t.id===e.id})}}}}_hyperlinksAreEquivalent(t,e){if(t===e)return!0;const i=t=>t||"";return i(t.text)===i(e.text)&&i(t.url)===i(e.url)&&i(t.iconUrl)===i(e.iconUrl)&&i(t.target)===i(e.target)&&i(t.tooltip)===i(e.tooltip)}};E=t([l],E);export{E as FeatureSettings};class v extends p{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}constructor(t){super(),this._uninitializedPopupContentExtensions=new Set,this._featureSettings=t,T(this._featureSettings,"_popupContent",(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)})),t.watch("_popupContent.length",(()=>this.notifyChange("length")))}forContent(t){if(d("content",t).isNotMissing(),this._featureSettings._popupContent.includes(t))return this._forContent(t)}add(t,i){if(d("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=z.get(t.content);if(z.set(t.content,t),e&&e!==t&&this._onRemoved(e),this._featureSettings._popupContent.includes(t.content))if(void 0===i){const i={added:[t],moved:[],removed:e?[e]:[],target:this};this.emit("change",i)}else this._featureSettings._popupContent.reorder(t.content,i);else this._featureSettings._popupContent.add(t.content,i)}else{this._uninitializedPopupContentExtensions.add(t);const e={added:[t],moved:[],removed:[],target:this};this.emit("change",e)}return this._onAdded(t),this}removeAt(t){const i=this.getItemAt(t);if(void 0!==i){if(this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new e({content:this._featureSettings._popupContent.toArray()})),this._uninitializedPopupContentExtensions.has(i)){this._uninitializedPopupContentExtensions.delete(i);const t={added:[],moved:[],removed:[i],target:this};this.emit("change",t)}else this._featureSettings._popupContent.remove(i.content);return this._onRemoved(i),i}}reorder(t,i){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,i),t}sort(t){return this._popupTemplateIsInherited&&(this._featureSettings.popupTemplate=new e({content:this._featureSettings._popupContent.toArray()})),this._featureSettings._popupContent.sort(((e,i)=>t(this._forContent(e),this._forContent(i)))),this}_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&&(z.set(t.content,t),this._uninitializedPopupContentExtensions.delete(t));if(!z.has(t)){const e=new x({content:t});z.set(t,e),e._setFeatureSettings(this._featureSettings),this._onAdded(e)}return z.get(t)}}