@vertigis/arcgis-extensions 40.3.1 → 40.3.3

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.
@@ -32,7 +32,7 @@
32
32
  <div class="tsd-accordion-details">
33
33
  <section class="tsd-index-section">
34
34
  <h3 class="tsd-index-heading">Constructors</h3>
35
- <div class="tsd-index-list"><a href="mapping_SubtypeGroupLayerExtension.SubtypeGroupLayerExtension.html#constructor" class="tsd-index-link tsd-is-inherited"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="#4D7FFF" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12" id="icon-512-path"></rect><path d="M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z" fill="var(--color-text)" id="icon-512-text"></path></svg><span>constructor</span></a>
35
+ <div class="tsd-index-list"><a href="mapping_SubtypeGroupLayerExtension.SubtypeGroupLayerExtension.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="#4D7FFF" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12" id="icon-512-path"></rect><path d="M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z" fill="var(--color-text)" id="icon-512-text"></path></svg><span>constructor</span></a>
36
36
  </div></section>
37
37
  <section class="tsd-index-section">
38
38
  <h3 class="tsd-index-heading">Properties</h3>
@@ -156,22 +156,18 @@
156
156
  </div></section></div></details></section></section>
157
157
  <section class="tsd-panel-group tsd-member-group">
158
158
  <h2>Constructors</h2>
159
- <section class="tsd-panel tsd-member tsd-is-inherited"><a id="constructor" class="tsd-anchor"></a>
159
+ <section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a>
160
160
  <h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none" id="icon-anchor-a"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5" id="icon-anchor-b"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5" id="icon-anchor-c"></path></svg></a></h3>
161
- <ul class="tsd-signatures tsd-is-inherited">
161
+ <ul class="tsd-signatures">
162
162
  <li class="tsd-signature tsd-anchor-link" id="constructor.new_SubtypeGroupLayerExtension"><span class="tsd-kind-constructor-signature">new <wbr/>Subtype<wbr/>Group<wbr/>Layer<wbr/>Extension</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">properties</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="mapping_SubtypeGroupLayerExtension.SubtypeGroupLayerExtension.html" class="tsd-signature-type tsd-kind-class">SubtypeGroupLayerExtension</a><a href="#constructor.new_SubtypeGroupLayerExtension" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></li>
163
163
  <li class="tsd-description">
164
- <div class="tsd-comment tsd-typography"><p>Creates a new instance of <a href="mapping__LayerExtension.LayerExtension.html" class="tsd-kind-class">LayerExtension</a>.</p>
165
- </div>
166
164
  <div class="tsd-parameters">
167
165
  <h4 class="tsd-parameters-title">Parameters</h4>
168
166
  <ul class="tsd-parameter-list">
169
167
  <li>
170
- <h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">properties</span>: <a href="../interfaces/mapping_SubtypeGroupLayerExtension.SubtypeGroupLayerExtensionProperties.html" class="tsd-signature-type tsd-kind-interface">SubtypeGroupLayerExtensionProperties</a></h5>
171
- <div class="tsd-comment tsd-typography"><p>An object containing initial property values to set.</p>
172
- </div></li></ul></div>
168
+ <h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">properties</span>: <a href="../interfaces/mapping_SubtypeGroupLayerExtension.SubtypeGroupLayerExtensionProperties.html" class="tsd-signature-type tsd-kind-interface">SubtypeGroupLayerExtensionProperties</a></h5></li></ul></div>
173
169
  <h4 class="tsd-returns-title">Returns <a href="mapping_SubtypeGroupLayerExtension.SubtypeGroupLayerExtension.html" class="tsd-signature-type tsd-kind-class">SubtypeGroupLayerExtension</a></h4><aside class="tsd-sources">
174
- <p>Inherited from <a href="mapping__LayerExtension.LayerExtension.html">LayerExtension</a>.<a href="mapping__LayerExtension.LayerExtension.html#constructor">constructor</a></p></aside></li></ul></section></section>
170
+ <p>Overrides <a href="mapping__LayerExtension.LayerExtension.html">LayerExtension</a>.<a href="mapping__LayerExtension.LayerExtension.html#constructor">constructor</a></p></aside></li></ul></section></section>
175
171
  <section class="tsd-panel-group tsd-member-group">
176
172
  <h2>Properties</h2>
177
173
  <section class="tsd-panel tsd-member tsd-is-protected tsd-is-inherited"><a id="_id" class="tsd-anchor"></a>
@@ -1751,7 +1747,7 @@ supplied portal item.</p>
1751
1747
  <h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-text)"></path></svg>On This Page</h3></summary>
1752
1748
  <div class="tsd-accordion-details">
1753
1749
  <ul>
1754
- <li><a href="#constructor" class="tsd-is-inherited"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-512-path"></use><use href="#icon-512-text"></use></svg><span>constructor</span></a></li>
1750
+ <li><a href="#constructor" class=""><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-512-path"></use><use href="#icon-512-text"></use></svg><span>constructor</span></a></li>
1755
1751
  <li><a href="#_id" class="tsd-is-protected tsd-is-inherited"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg><span>_id</span></a></li>
1756
1752
  <li><a href="#_itemType" class="tsd-is-protected tsd-is-inherited"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg><span>_item<wbr/>Type</span></a></li>
1757
1753
  <li><a href="#_watchHandles" class="tsd-is-protected tsd-is-inherited"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg><span>_watch<wbr/>Handles</span></a></li>
@@ -16,7 +16,7 @@
16
16
  <li><a href="../modules/version.html">version</a></li>
17
17
  <li><a href="version.version.html">version</a></li></ul>
18
18
  <h1>Variable version<code class="tsd-tag ts-flagConst">Const</code> </h1></div>
19
- <div class="tsd-signature"><span class="tsd-kind-variable">version</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">&quot;40.3.1&quot;</span><span class="tsd-signature-symbol"> = &quot;40.3.1&quot;</span></div>
19
+ <div class="tsd-signature"><span class="tsd-kind-variable">version</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">&quot;40.3.3&quot;</span><span class="tsd-signature-symbol"> = &quot;40.3.3&quot;</span></div>
20
20
  <div class="tsd-comment tsd-typography"><p>The current version of the Geocortex ArcGIS Extensions API.</p>
21
21
  </div></div>
22
22
  <div class="col-sidebar">
@@ -84,6 +84,7 @@ export declare class SubtypeGroupLayerExtension extends LayerExtension<SubtypeGr
84
84
  get hasFeatures(): boolean;
85
85
  get canChangeDefinitionExpression(): boolean;
86
86
  private _enableClientSideData;
87
+ constructor(properties?: SubtypeGroupLayerExtensionProperties);
87
88
  /**
88
89
  * @inheritDoc
89
90
  */
@@ -148,8 +149,10 @@ export declare class SubtypeGroupLayerExtension extends LayerExtension<SubtypeGr
148
149
  * @inheritDoc
149
150
  */
150
151
  protected _deleteFeatures(ids: string[], options?: FeatureWriteOptions): Promise<void>;
152
+ private readonly _onSubtypeSublayersChange;
151
153
  private _applyEdits;
152
154
  private _updateClientSideFields;
155
+ private _addTemplatesForSublayers;
153
156
  }
154
157
  /**
155
158
  * An implementation of Schema that directly mirrors the spatial reference on
@@ -1 +1 @@
1
- import{__decorate as e}from"tslib";import t from"@arcgis/core/layers/support/FeatureType.js";import r from"@arcgis/core/rest/support/AttachmentQuery";import{toAttachment as s}from"../data/Attachment.js";import{toGraphic as a}from"../data/Feature.js";import{FeatureSaveError as i}from"../data/FeatureSaveError.js";import{addAttachment as l,deleteAttachments as o,supportsAttachmentEditing as n}from"../data/support/attachments.js";import{SubtypeGroupLayer as p}from"../portal/SubtypeGroupLayer.js";import{SubtypeSublayer as u}from"../portal/SubtypeSublayer.js";import{Template as y}from"../portal/Template.js";import{cancelify as d}from"../support/Cancellable.js";import{serializable as c}from"../support/Serializable.js";import{ArcGISRelationshipCollection as m}from"../support/_ArcGISRelationshipCollection.js";import{executeQuery as h}from"../support/_query.js";import{ReadOnlyCollection as f}from"../utilities/ReadOnlyCollection.js";import{isFeatureLayer as b,isSubtypeGroupLayer as _}from"../utilities/_layers.js";import{parse as g}from"../utilities/number.js";import{caseInsensitiveEquals as w}from"../utilities/string.js";import{SubtypeSublayerExtension as F}from"./SubtypeSublayerExtension.js";import{LayerExtension as E,LayerExtensionReadOnlySchema as S}from"./_LayerExtension.js";import{ArrayWrappedCollection as C}from"./support/ArrayWrappedCollection.js";import{addOutFields as j,getGlobalIdField as x,isGlobalIdUsed as A}from"./support/layers.js";let I=class extends E{get enableClientSideData(){return this._enableClientSideData}set enableClientSideData(e){this._enableClientSideData=e,this._updateClientSideFields()}get layer(){return super.layer}get sublayerExtensions(){return super.sublayerExtensions}get supportsSublayers(){return!0}get sublayersAreReadOnly(){return!1}get hasFeatures(){return!0}get canChangeDefinitionExpression(){return!0}get _layerView(){return this.layer&&this.mapExtension?._allLayerViews.find((e=>e.layer===this.layer))}_getProjectWebmapJSON(){const e=super._getProjectWebmapJSON();return!e||this.dynamicallyAddedLayer||(e.layers=this.sublayerExtensions.toArray().map((e=>{const{layerDefinition:t,visibility:r,subtypeCode:s,layerType:a}=u.fromEsriApiSubtypeSublayer(e.sublayer),i={layerType:a,visibility:r,subtypeCode:s};return t?.drawingInfo&&(i.layerDefinition={drawingInfo:t.drawingInfo}),i}))),e}_createRelationships(){return new SubtypeGroupLayerRelationshipCollection(this)}async _onInitialize(){await super._onInitialize(),await this.relationships.initialize();const e=this.layer.sourceJSON?.templates?.map((e=>y.toEsriApiFeatureTemplate(e)));if(this.sublayerExtensions.filter((e=>!!e.sublayer)).forEach((t=>{const r=this.layer.sourceJSON?.types.filter((e=>e.name===t.title))[0]?.templates;r?t.sublayer.templates=r.map((e=>y.toEsriApiFeatureTemplate(e))):1!==e.length||1===this.sublayerExtensions.length||t.sublayer.templates?function(e){return 1===e.sublayer.templates.length&&"New Feature"===e.sublayer.templates[0].name}(t)&&(t.sublayer.templates[0].name=t.sublayer.title):t.sublayer.templates=e.map((e=>{const r=y.toEsriApiFeatureTemplate(y.fromEsriApiFeatureTemplate(e));r.name=t.title;const s=r.prototype?.attributes;return"number"==typeof s?.[this.layer.subtypeField]&&(s[this.layer.subtypeField]=t.sublayer.subtypeCode),r}))})),this.layer.subtypes){this._subtypes=this.layer.subtypes.map((e=>new t({id:e.code,name:e.name,domains:e.domains??{},templates:this.sublayerExtensions.map((e=>e.sublayer)).find((t=>t.subtypeCode===e.code)).templates})));for(const e of this._subtypes)for(const[t,r]of Object.entries(e.domains)){const e=this.layer.fields.find((e=>w(e.name,t)));e&&!e.domain&&(e.domain=r)}}}async _postInitialize(){await super._postInitialize(),this._updateClientSideFields(),this._watchHandles.push(this.watch("layer",(()=>{this._updateClientSideFields()}),!0))}_capabilities(){const e=n(this.layer);return this.layer?.capabilities?.operations?{...this.layer.capabilities.operations,supportsAttachmentEditing:e,supportsStandardizedQueries:this.layer.capabilities?.query?.supportsStandardizedQueriesOnly}:{...super._capabilities(),supportsAttachmentEditing:e}}_createSublayerExtension(e){return new F(e)}_getSerializableProperties(){const e=super._getSerializableProperties();return{...e,layer:{...this._toPropertyDef(e.layer),default:{layerType:"SubtypeGroupLayer"}},enableClientSideData:{serializeModes:["initial"],default:!1},attachmentTypes:["initial"]}}_isSupportedLayer(e){return _(e)}_createSchema(){return new R(this)}async _getAttachments(e){if(!this.layer?.capabilities?.data?.supportsAttachment)return[];const t=+e.primaryKey,a=new r({objectIds:[t]}),i=await this.layer.queryAttachments(a);return i?.[t]?.length?i[t].map((e=>s(e,e.url))):[]}async _addAttachment(e,t){return l(e,this.layer,t,{attachmentTypes:this.attachmentTypes})}async _deleteAttachments(e,t){return o(e,this.layer,t)}async _applyPortalItemProperties(e){if("Feature Service"!==e.type)throw new Error(`Cannot create SubtypeGroupLayer from Portal item that has type: ${e.type}`);const t={layerType:"SubtypeGroupLayer"};let{url:r}=e;r.match(".*MapServer/\\d{1,}/?$")||r.match(".*FeatureServer/\\d{1,}/?$")||(r=`${r}/0`),t.url=r,await p.applyToEsriApiLayer(t,this.layer);const s=await e.fetchData();s&&await p.applyToEsriApiLayer(s,this.layer)}_getFeatures(e,t){if(!this.layer)return super._getFeatures(e,t);const r=this.layer.createQuery();return r.objectIds=e.map((e=>g(e))),r.where=void 0,r.outFields=t.outFields,r.returnGeometry=t.returnGeometry,h(r,this,this.layer,t.cancelToken)}async _addFeatures(e,t){const r=Array.from(e);if(0===r.length||!this.layer)return;const s=await this._applyEdits({addFeatures:r.map(a)},t);if(!s.addFeatureResults||s.addFeatureResults.length!==r.length)throw new i("Received malformed response from server while saving feature(s).");let l;if(s.addFeatureResults.forEach(((e,t)=>{const{objectId:s,globalId:a,error:o}=e,n=r[t];if(o){l=l||new i("Errors encountered when adding features.");const{title:r}=n;l.errors.set(`${r}-${t}`,new Error(`Failed to add feature '${r}'. ${e.error.name} : ${e.error.message}`))}else{const{primaryKeyField:e}=n.schema;n.attributes.set(e,s);const t=x(this.layer);t&&a&&n.attributes.set(t,a)}})),l)throw l}async _updateFeatures(e,t){const r=Array.from(e);if(0===r.length)return;const s=await this._applyEdits({updateFeatures:Array.from(e).map(a)},t);if(!s.updateFeatureResults||s.updateFeatureResults.length!==r.length)throw new i("Received malformed response from server while saving feature(s).");let l;if(s.updateFeatureResults.forEach(((e,t)=>{if(e.error){l=l||new i("Errors encountered when updating features.");const{primaryKey:s}=r[t];l.errors.set(s,new Error(`Failed to update feature with id ${s}. ${e.error.name} : ${e.error.message}`))}})),l)throw l}async _deleteFeatures(e,t){if(0===e.length)return;const r=await this._applyEdits({deleteFeatures:e.map((e=>({objectId:e})))},t);if(!r.deleteFeatureResults)throw new i("Received malformed response from server while saving feature(s).");let s;if(r.deleteFeatureResults.forEach(((t,r)=>{if(t.error){s=s||new i("Errors encountered when deleting features.");const a=e[r];s.errors.set(a,new Error(`Failed to delete feature with id ${a}. ${t.error.name} : ${t.error.message}`))}})),s)throw s}async _applyEdits(e,t={}){const r=A(this.layer,e),s=this.layer.applyEdits(e,{globalIdUsed:r}),a=await d(s,t.cancelToken);if(!a)throw new i("Received malformed response from server while saving feature(s).");return a}_updateClientSideFields(){this.layer&&this._enableClientSideData&&(j(this.layer,this.featureSettings.outFields),this.allSublayerExtensions.forEach((e=>j(this.layer,e.featureSettings.outFields))))}};I=e([c],I);export{I as SubtypeGroupLayerExtension};let R=class extends S{constructor(e){super(e),this._fieldCollection=this._createFieldCollection(),this._typesCollection=this._createTypesCollection()}get types(){return this._typesCollection}get _types(){return this._typesCollection}get _fields(){return this._fieldCollection}_createFieldCollection(){return new f(new C({parent:this._layerExtension,targetProperty:"layer",arrayProperty:"fields"}))}_createTypesCollection(){return new f(new C({parent:this._layerExtension,arrayProperty:"_subtypes"}))}_getPropertyBindings(){return{primaryKeyField:"objectIdField",geometryType:"geometryType",spatialReference:"spatialReference",displayField:"displayField",typeIdField:"subtypeField"}}};R=e([c],R);export{R as SubtypeGroupLayerSchema};export class SubtypeGroupLayerRelationshipCollection extends m{get _sourceUrl(){const e=this._source.layer;if(e)return`${e.url}/${e.layerId}`}get _sourceLayerId(){const e=this._source.layer;return e?.layerId}_findRelatedSource(e){if(!this._source.mapExtension||!this._source.layer||!this._sourceUrl)return;const t=this._sourceUrl.slice(0,this._sourceUrl.length-`${this._sourceLayerId}`.length-1),r=this._source.mapExtension.allLayerExtensions.initializedItems.find((r=>(b(r.layer)||_(r.layer))&&r.layer.url===t&&r.layer.layerId===e));return r||this._source.mapExtension.tableExtensions.initializedItems.find((r=>b(r.table)&&r.table.url===t&&r.table.layerId===e))}}
1
+ import{__decorate as e}from"tslib";import t from"@arcgis/core/layers/support/FeatureType.js";import r from"@arcgis/core/rest/support/AttachmentQuery";import{toAttachment as s}from"../data/Attachment.js";import{toGraphic as a}from"../data/Feature.js";import{FeatureSaveError as i}from"../data/FeatureSaveError.js";import{addAttachment as l,deleteAttachments as o,supportsAttachmentEditing as n}from"../data/support/attachments.js";import{SubtypeGroupLayer as u}from"../portal/SubtypeGroupLayer.js";import{SubtypeSublayer as p}from"../portal/SubtypeSublayer.js";import{Template as y}from"../portal/Template.js";import{cancelify as d}from"../support/Cancellable.js";import{serializable as c}from"../support/Serializable.js";import{ArcGISRelationshipCollection as h}from"../support/_ArcGISRelationshipCollection.js";import{executeQuery as m}from"../support/_query.js";import{ReadOnlyCollection as f}from"../utilities/ReadOnlyCollection.js";import{isFeatureLayer as b,isSubtypeGroupLayer as _}from"../utilities/_layers.js";import{parse as g}from"../utilities/number.js";import{caseInsensitiveEquals as w}from"../utilities/string.js";import{onCollectionPropertyChange as S}from"../utilities/watch.js";import{SubtypeSublayerExtension as F}from"./SubtypeSublayerExtension.js";import{LayerExtension as E,LayerExtensionReadOnlySchema as C}from"./_LayerExtension.js";import{ArrayWrappedCollection as j}from"./support/ArrayWrappedCollection.js";import{addOutFields as x,getGlobalIdField as A,isGlobalIdUsed as I}from"./support/layers.js";let T=class extends E{get enableClientSideData(){return this._enableClientSideData}set enableClientSideData(e){this._enableClientSideData=e,this._updateClientSideFields()}get layer(){return super.layer}get sublayerExtensions(){return super.sublayerExtensions}get supportsSublayers(){return!0}get sublayersAreReadOnly(){return!1}get hasFeatures(){return!0}get canChangeDefinitionExpression(){return!0}get _layerView(){return this.layer&&this.mapExtension?._allLayerViews.find((e=>e.layer===this.layer))}constructor(e){super(e),this._onSubtypeSublayersChange=e=>{e.removed?.length&&(this.sublayerExtensions.removeMany(this.sublayerExtensions.filter((e=>!e.sublayer))),this._addTemplatesForSublayers())},S(this,"layer.sublayers",this._onSubtypeSublayersChange)}_getProjectWebmapJSON(){const e=super._getProjectWebmapJSON();return!e||this.dynamicallyAddedLayer||(e.layers=this.sublayerExtensions.toArray().map((e=>{const{layerDefinition:t,visibility:r,subtypeCode:s,layerType:a}=p.fromEsriApiSubtypeSublayer(e.sublayer),i={layerType:a,visibility:r,subtypeCode:s};return t?.drawingInfo&&(i.layerDefinition={drawingInfo:t.drawingInfo}),i}))),e}_createRelationships(){return new SubtypeGroupLayerRelationshipCollection(this)}async _onInitialize(){await super._onInitialize(),await this.relationships.initialize();const e=this.layer.sourceJSON?.templates?.map((e=>y.toEsriApiFeatureTemplate(e)));this.sublayerExtensions.forEach((t=>{const r=this.layer.sourceJSON?.types.filter((e=>e.name===t.title))[0]?.templates;r?t.sublayer.templates=r.map((e=>y.toEsriApiFeatureTemplate(e))):1!==e.length||1===this.sublayerExtensions.length||t.sublayer.templates?function(e){return 1===e.sublayer.templates.length&&"New Feature"===e.sublayer.templates[0].name}(t)&&(t.sublayer.templates[0].name=t.sublayer.title):t.sublayer.templates=e.map((e=>{const r=y.toEsriApiFeatureTemplate(y.fromEsriApiFeatureTemplate(e));r.name=t.title;const s=r.prototype?.attributes;return"number"==typeof s?.[this.layer.subtypeField]&&(s[this.layer.subtypeField]=t.sublayer.subtypeCode),r}))})),this._addTemplatesForSublayers()}async _postInitialize(){await super._postInitialize(),this._updateClientSideFields(),this._watchHandles.push(this.watch("layer",(()=>{this._updateClientSideFields()}),!0))}_capabilities(){const e=n(this.layer);return this.layer?.capabilities?.operations?{...this.layer.capabilities.operations,supportsAttachmentEditing:e,supportsStandardizedQueries:this.layer.capabilities?.query?.supportsStandardizedQueriesOnly}:{...super._capabilities(),supportsAttachmentEditing:e}}_createSublayerExtension(e){return new F(e)}_getSerializableProperties(){const e=super._getSerializableProperties();return{...e,layer:{...this._toPropertyDef(e.layer),default:{layerType:"SubtypeGroupLayer"}},enableClientSideData:{serializeModes:["initial"],default:!1},attachmentTypes:["initial"]}}_isSupportedLayer(e){return _(e)}_createSchema(){return new v(this)}async _getAttachments(e){if(!this.layer?.capabilities?.data?.supportsAttachment)return[];const t=+e.primaryKey,a=new r({objectIds:[t]}),i=await this.layer.queryAttachments(a);return i?.[t]?.length?i[t].map((e=>s(e,e.url))):[]}async _addAttachment(e,t){return l(e,this.layer,t,{attachmentTypes:this.attachmentTypes})}async _deleteAttachments(e,t){return o(e,this.layer,t)}async _applyPortalItemProperties(e){if("Feature Service"!==e.type)throw new Error(`Cannot create SubtypeGroupLayer from Portal item that has type: ${e.type}`);const t={layerType:"SubtypeGroupLayer"};let{url:r}=e;r.match(".*MapServer/\\d{1,}/?$")||r.match(".*FeatureServer/\\d{1,}/?$")||(r=`${r}/0`),t.url=r,await u.applyToEsriApiLayer(t,this.layer);const s=await e.fetchData();s&&await u.applyToEsriApiLayer(s,this.layer)}_getFeatures(e,t){if(!this.layer)return super._getFeatures(e,t);const r=this.layer.createQuery();return r.objectIds=e.map((e=>g(e))),r.where=void 0,r.outFields=t.outFields,r.returnGeometry=t.returnGeometry,m(r,this,this.layer,t.cancelToken)}async _addFeatures(e,t){const r=Array.from(e);if(0===r.length||!this.layer)return;const s=await this._applyEdits({addFeatures:r.map(a)},t);if(!s.addFeatureResults||s.addFeatureResults.length!==r.length)throw new i("Received malformed response from server while saving feature(s).");let l;if(s.addFeatureResults.forEach(((e,t)=>{const{objectId:s,globalId:a,error:o}=e,n=r[t];if(o){l=l||new i("Errors encountered when adding features.");const{title:r}=n;l.errors.set(`${r}-${t}`,new Error(`Failed to add feature '${r}'. ${e.error.name} : ${e.error.message}`))}else{const{primaryKeyField:e}=n.schema;n.attributes.set(e,s);const t=A(this.layer);t&&a&&n.attributes.set(t,a)}})),l)throw l}async _updateFeatures(e,t){const r=Array.from(e);if(0===r.length)return;const s=await this._applyEdits({updateFeatures:Array.from(e).map(a)},t);if(!s.updateFeatureResults||s.updateFeatureResults.length!==r.length)throw new i("Received malformed response from server while saving feature(s).");let l;if(s.updateFeatureResults.forEach(((e,t)=>{if(e.error){l=l||new i("Errors encountered when updating features.");const{primaryKey:s}=r[t];l.errors.set(s,new Error(`Failed to update feature with id ${s}. ${e.error.name} : ${e.error.message}`))}})),l)throw l}async _deleteFeatures(e,t){if(0===e.length)return;const r=await this._applyEdits({deleteFeatures:e.map((e=>({objectId:e})))},t);if(!r.deleteFeatureResults)throw new i("Received malformed response from server while saving feature(s).");let s;if(r.deleteFeatureResults.forEach(((t,r)=>{if(t.error){s=s||new i("Errors encountered when deleting features.");const a=e[r];s.errors.set(a,new Error(`Failed to delete feature with id ${a}. ${t.error.name} : ${t.error.message}`))}})),s)throw s}async _applyEdits(e,t={}){const r=I(this.layer,e),s=this.layer.applyEdits(e,{globalIdUsed:r}),a=await d(s,t.cancelToken);if(!a)throw new i("Received malformed response from server while saving feature(s).");return a}_updateClientSideFields(){this.layer&&this._enableClientSideData&&(x(this.layer,this.featureSettings.outFields),this.allSublayerExtensions.forEach((e=>x(this.layer,e.featureSettings.outFields))))}_addTemplatesForSublayers(){if(this.layer.subtypes){this._subtypes=this.layer.sublayers.toArray().map((e=>{const r=this.layer.subtypes.find((t=>t.code===e.subtypeCode));return r?new t({id:r.code,name:r.name,domains:r.domains??{},templates:e.templates}):void 0})).filter((e=>!!e));for(const e of this._subtypes)for(const[t,r]of Object.entries(e.domains)){const e=this.layer.fields.find((e=>w(e.name,t)));e&&!e.domain&&(e.domain=r)}}}};T=e([c],T);export{T as SubtypeGroupLayerExtension};let v=class extends C{constructor(e){super(e),this._fieldCollection=this._createFieldCollection(),this._typesCollection=this._createTypesCollection()}get types(){return this._typesCollection}get _types(){return this._typesCollection}get _fields(){return this._fieldCollection}_createFieldCollection(){return new f(new j({parent:this._layerExtension,targetProperty:"layer",arrayProperty:"fields"}))}_createTypesCollection(){return new f(new j({parent:this._layerExtension,arrayProperty:"_subtypes"}))}_getPropertyBindings(){return{primaryKeyField:"objectIdField",geometryType:"geometryType",spatialReference:"spatialReference",displayField:"displayField",typeIdField:"subtypeField"}}};v=e([c],v);export{v as SubtypeGroupLayerSchema};export class SubtypeGroupLayerRelationshipCollection extends h{get _sourceUrl(){const e=this._source.layer;if(e)return`${e.url}/${e.layerId}`}get _sourceLayerId(){const e=this._source.layer;return e?.layerId}_findRelatedSource(e){if(!this._source.mapExtension||!this._source.layer||!this._sourceUrl)return;const t=this._sourceUrl.slice(0,this._sourceUrl.length-`${this._sourceLayerId}`.length-1),r=this._source.mapExtension.allLayerExtensions.initializedItems.find((r=>(b(r.layer)||_(r.layer))&&r.layer.url===t&&r.layer.layerId===e));return r||this._source.mapExtension.tableExtensions.initializedItems.find((r=>b(r.table)&&r.table.url===t&&r.table.layerId===e))}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vertigis/arcgis-extensions",
3
3
  "license": "SEE LICENSE IN LICENSE",
4
- "version": "40.3.1",
4
+ "version": "40.3.3",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://dev.azure.com/vertigis/Studio/_git/arcgis-extensions-ts"
@@ -1 +1 @@
1
- import{whenOnce as r}from"@arcgis/core/core/reactiveUtils.js";import{isSubtypeGroupLayer as e}from"../utilities/_layers.js";import{checkArg as a}from"../utilities/checkArg.js";import{LayerDefinition as s}from"./LayerDefinition.js";import{SubtypeSublayer as i}from"./SubtypeSublayer.js";import{ERR_LAYER_TYPE_MISMATCH as t,applyLayerBaseToEsriApiLayer as o,applyOperationalLayerToEsriApiLayer as y,fromEsriApiLayerToLayerBase as p,fromEsriApiLayerToOperationalLayer as n}from"./_layerHelper.js";export var SubtypeGroupLayer;!function(u){async function l(p,n){a("layerJson",p).isNotMissing();const u=p.layerType||p.type;if(a("layerJson.layerType",u).satisfies((r=>!r||"SubtypeGroupLayer"===r),t),a("layer",n).isNotMissing().satisfies(e,t),o(p,n),y(p,n),p.hasOwnProperty("url")&&(n.url=p.url),p.hasOwnProperty("customParameters")&&(n.customParameters={...p.customParameters},p.customParameters.hasOwnProperty("gdbVersion")&&(n.gdbVersion=p.customParameters.gdbVersion)),p.hasOwnProperty("layerDefinition")&&await s.applyToEsriApiLayer(p.layerDefinition,n),p.hasOwnProperty("layers")){const e=async()=>{await Promise.all(n.sublayers.map((r=>{const e=p.layers.find((e=>+e.subtypeCode===r.subtypeCode));if(e)return i.applyToEsriApiLayer(e,r)})))};n.loaded?await e():(async()=>{await r((()=>n.loaded)),await e()})()}}u.toEsriApiLayer=async function(r){a("layerJson",r).isNotMissing();const e=r.layerType||r.type;a("layerJson.layerType",e).satisfies((r=>!r||"SubtypeGroupLayer"===r),t);const s=new((await import("@arcgis/core/layers/SubtypeGroupLayer")).default);return await l(r,s),s},u.applyToEsriApiLayer=l,u.fromEsriApiSubtypeGroupLayer=function(r){a("subtypeGroupLayer",r).isNotMissing();const e={...p(r),...n(r),layerType:"SubtypeGroupLayer",url:r.url,customParameters:{...r.customParameters,gdbVersion:r.gdbVersion},layerDefinition:s.fromEsriApiLayer(r),layers:[]};return r.sublayers.forEach((r=>{e.layers.push(i.fromEsriApiSubtypeSublayer(r))})),e}}(SubtypeGroupLayer||(SubtypeGroupLayer={}));
1
+ import{whenOnce as e}from"@arcgis/core/core/reactiveUtils.js";import{isSubtypeGroupLayer as r}from"../utilities/_layers.js";import{checkArg as s}from"../utilities/checkArg.js";import{LayerDefinition as a}from"./LayerDefinition.js";import{SubtypeSublayer as t}from"./SubtypeSublayer.js";import{ERR_LAYER_TYPE_MISMATCH as o,applyLayerBaseToEsriApiLayer as i,applyOperationalLayerToEsriApiLayer as y,fromEsriApiLayerToLayerBase as p,fromEsriApiLayerToOperationalLayer as u}from"./_layerHelper.js";export var SubtypeGroupLayer;!function(n){async function l(p,u){s("layerJson",p).isNotMissing();const n=p.layerType||p.type;if(s("layerJson.layerType",n).satisfies((e=>!e||"SubtypeGroupLayer"===e),o),s("layer",u).isNotMissing().satisfies(r,o),i(p,u),y(p,u),p.hasOwnProperty("url")&&(u.url=p.url),p.hasOwnProperty("customParameters")&&(u.customParameters={...p.customParameters},p.customParameters.hasOwnProperty("gdbVersion")&&(u.gdbVersion=p.customParameters.gdbVersion)),p.hasOwnProperty("layerDefinition")&&await a.applyToEsriApiLayer(p.layerDefinition,u),p.hasOwnProperty("layers")){const r=async()=>{p.layers.length>0&&p.layers.some((e=>u.sublayers.map((e=>e.subtypeCode)).includes(+e.subtypeCode)))&&(u.sublayers=u.sublayers.filter((e=>p.layers.some((r=>+r.subtypeCode===e.subtypeCode))))),await Promise.all(u.sublayers.map((e=>{const r=p.layers.find((r=>+r.subtypeCode===e.subtypeCode));if(r)return t.applyToEsriApiLayer(r,e)})))};u.loaded?await r():(async()=>{await e((()=>u.loaded)),await r()})()}}n.toEsriApiLayer=async function(e){s("layerJson",e).isNotMissing();const r=e.layerType||e.type;s("layerJson.layerType",r).satisfies((e=>!e||"SubtypeGroupLayer"===e),o);const a=new((await import("@arcgis/core/layers/SubtypeGroupLayer")).default);return await l(e,a),a},n.applyToEsriApiLayer=l,n.fromEsriApiSubtypeGroupLayer=function(e){s("subtypeGroupLayer",e).isNotMissing();const r={...p(e),...u(e),layerType:"SubtypeGroupLayer",url:e.url,customParameters:{...e.customParameters,gdbVersion:e.gdbVersion},layerDefinition:a.fromEsriApiLayer(e),layers:[]};return e.sublayers.forEach((e=>{r.layers.push(t.fromEsriApiSubtypeSublayer(e))})),r}}(SubtypeGroupLayer||(SubtypeGroupLayer={}));
package/version.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * The current version of the Geocortex ArcGIS Extensions API.
3
3
  */
4
- export declare const version = "40.3.1";
4
+ export declare const version = "40.3.3";
package/version.js CHANGED
@@ -1 +1 @@
1
- export const version="40.3.1";
1
+ export const version="40.3.3";