UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

3 lines (2 loc) 3.11 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import{property as r,subclass as i}from"../../core/accessorSupport/decorators.js";import{getEffectiveEditingEnabled as s,getEffectiveLayerCapabilities as a}from"./layerUtils.js";let p=class extends t{constructor(e){super(e),this.layer=null}get attachments(){return{enabled:this._effectiveEnabled&&!!this._effectiveCapabilities?.data.supportsAttachment}}get create(){const{_effectiveCapabilities:e,layer:t}=this,r=this._createEnabled,i=r,s=t.capabilities?.operations.supportsAdd,a=!!e?.operations.supportsAdd;return{attachments:{enabled:r&&this.attachments.enabled},attributes:r,enabled:r,geometry:i,reliesOnOwnerAdminPrivileges:!s&&a}}get delete(){const{_effectiveCapabilities:e,layer:t}=this,r=t.capabilities?.operations.supportsDelete,i=!!e?.operations.supportsDelete;return{enabled:this._effectiveEnabled&&!!e?.operations.supportsDelete,reliesOnOwnerAdminPrivileges:!r&&i}}get reliesOnOwnerAdminPrivileges(){return this._effectiveEnabled&&!this.layer.editingEnabled||this.create.reliesOnOwnerAdminPrivileges||this.update.reliesOnOwnerAdminPrivileges||this.delete.reliesOnOwnerAdminPrivileges}get supportedCurveTypes(){const e=this._effectiveCapabilities;return e&&"supportedCurveTypes"in e.data?e.data.supportedCurveTypes:[]}get supportsTrueCurve(){const e=this._effectiveCapabilities;return!!(e&&"supportsTrueCurve"in e.data&&e.data.supportsTrueCurve)}get supportsTrueCurveUpdate(){const e=this._effectiveCapabilities;return!!(e&&"supportsTrueCurveUpdate"in e.editing&&e.editing.supportsTrueCurveUpdate)}get update(){const{_effectiveCapabilities:e,layer:t}=this,r=this._updateEnabled,i=!(!r||!e?.editing.supportsGeometryUpdate),s=t.capabilities?.operations.supportsUpdate,a=!!e?.operations.supportsUpdate,p=this.attachments.enabled,n=p&&this._canCreateOrUpdate;return{attachments:{enabled:p,create:n,update:n},attributes:r,enabled:r,geometry:i,reliesOnOwnerAdminPrivileges:!s&&a}}get _createEnabled(){return this._effectiveEnabled&&!!this._effectiveCapabilities?.operations.supportsAdd}get _updateEnabled(){return this._effectiveEnabled&&!!this._effectiveCapabilities?.operations.supportsUpdate}get _canCreateOrUpdate(){return!(!this._createEnabled&&!this._updateEnabled)}get _effectiveEnabled(){return s(this.layer)}get _effectiveCapabilities(){return a(this.layer)}};e([r()],p.prototype,"attachments",null),e([r()],p.prototype,"create",null),e([r()],p.prototype,"delete",null),e([r()],p.prototype,"layer",void 0),e([r()],p.prototype,"reliesOnOwnerAdminPrivileges",null),e([r()],p.prototype,"supportedCurveTypes",null),e([r()],p.prototype,"supportsTrueCurve",null),e([r()],p.prototype,"supportsTrueCurveUpdate",null),e([r()],p.prototype,"update",null),e([r()],p.prototype,"_createEnabled",null),e([r()],p.prototype,"_updateEnabled",null),e([r()],p.prototype,"_canCreateOrUpdate",null),e([r()],p.prototype,"_effectiveEnabled",null),e([r()],p.prototype,"_effectiveCapabilities",null),p=e([i("esri.layers.support.EditingCapabilities")],p);const n=p;export{n as default};