@arcgis/core 4.28.0-next.20230729 → 4.28.0-next.20230731
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/6a7fb6f95bcc5953a581.js +1 -0
- package/interfaces.d.ts +1 -1
- package/layers/SubtypeGroupLayer.js +1 -1
- package/layers/support/Subtype.js +1 -1
- package/layers/support/SubtypeSublayer.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/FeatureForm/FieldInput.js +1 -1
- package/widgets/FeatureForm/featureFormUtils.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable/FieldColumn.js +1 -1
- package/widgets/support/dateUtils.js +5 -0
- package/assets/esri/core/workers/chunks/a2a403b24f6a9618f619.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[2637],{22862:(e,t,r)=>{r.d(t,{Hg:()=>h,V7:()=>y,uD:()=>c});var s=r(92036),i=r(46791),o=r(1153);const n=["esri.Color","esri.portal.Portal","esri.symbols.support.Symbol3DAnchorPosition2D","esri.symbols.support.Symbol3DAnchorPosition3D"];function l(e){return e instanceof s.Z}function a(e){return e instanceof i.Z?Object.keys(e.items):l(e)?(0,o.vw)(e).keys():e?Object.keys(e):[]}function u(e,t){return e instanceof i.Z?e.items[t]:e[t]}function p(e){return e?e.declaredClass:null}function d(e,t){const r=e.diff;if(r&&"function"==typeof r)return r(e,t);const s=a(e),i=a(t);if(0===s.length&&0===i.length)return;if(!s.length||!i.length||function(e,t){return!(!Array.isArray(e)||!Array.isArray(t))&&e.length!==t.length}(e,t))return{type:"complete",oldValue:e,newValue:t};const o=i.filter((e=>!s.includes(e))),c=s.filter((e=>!i.includes(e))),y=s.filter((r=>i.includes(r)&&u(e,r)!==u(t,r))).concat(o,c).sort(),h=p(e);if(h&&n.includes(h)&&y.length)return{type:"complete",oldValue:e,newValue:t};let f;const b=l(e)&&l(t);for(const s of y){const i=u(e,s),o=u(t,s);let n;if((b||"function"!=typeof i&&"function"!=typeof o)&&i!==o&&(null!=i||null!=o)){if(r&&r[s]&&"function"==typeof r[s])n=r[s]?.(i,o);else if(i instanceof Date&&o instanceof Date){if(i.getTime()===o.getTime())continue;n={type:"complete",oldValue:i,newValue:o}}else n="object"==typeof i&&"object"==typeof o&&p(i)===p(o)?d(i,o):{type:"complete",oldValue:i,newValue:o};null!=n&&(null!=f?f.diff[s]=n:f={type:"partial",diff:{[s]:n}})}}return f}function c(e,t){if(null==e)return!1;const r=t.split(".");let s=e;for(const e of r){if("complete"===s.type)return!0;if("partial"!==s.type)return!1;{const t=s.diff[e];if(!t)return!1;s=t}}return!0}function y(e,t){for(const r of t)if(c(e,r))return!0;return!1}function h(e,t){if("function"!=typeof e&&"function"!=typeof t&&(null!=e||null!=t))return null==e||null==t||"object"==typeof e&&"object"==typeof t&&p(e)!==p(t)?{type:"complete",oldValue:e,newValue:t}:d(e,t)}},68668:(e,t,r)=>{r.d(t,{G:()=>n,w:()=>l});var s=r(66643),i=r(46791),o=r(83379);async function n(e,t){return await e.load(),l(e,t)}async function l(e,t){const r=[],n=(...e)=>{for(const t of e)null!=t&&(Array.isArray(t)?n(...t):i.Z.isCollection(t)?t.forEach((e=>n(e))):o.Z.isLoadable(t)&&r.push(t))};t(n);let l=null;if(await(0,s.UI)(r,(async e=>{const t=await(0,s.q6)(function(e){return"loadAll"in e&&"function"==typeof e.loadAll}(e)?e.loadAll():e.load());!1!==t.ok||l||(l=t)})),l)throw l.error;return e}},30359:(e,t,r)=>{r.r(t),r.d(t,{default:()=>_e});var s=r(43697),i=r(2368),o=r(46791),n=r(20102),l=r(68668),a=r(16453),u=r(95330),p=r(17445),d=r(42033),c=r(17452),y=r(5600),h=(r(75215),r(67676),r(80442),r(71715)),f=r(52011),b=r(31263),m=r(87085),g=r(54295),v=r(17287),w=r(71612),C=r(17017),S=r(54253),_=r(53713),F=r(38009),I=r(16859),E=r(34760),A=r(72965),T=r(28294),P=r(66677),O=r(21506),j=r(50957),x=r(53518),L=r(35671),R=r(96674),Z=r(30556),D=r(72729);let Q=class extends((0,i.J)(R.wq)){constructor(){super(...arguments),this.code=null,this.defaultValues={},this.domains=null,this.name=null}readDomains(e){if(!e)return null;const t={};for(const r of Object.keys(e))t[r]=(0,D.im)(e[r]);return t}writeDomains(e,t){if(!e)return;const r={};for(const t of Object.keys(e))e[t]&&(r[t]=e[t]?.toJSON());t.domains=r}};(0,s._)([(0,y.Cb)({type:Number,json:{write:!0}})],Q.prototype,"code",void 0),(0,s._)([(0,y.Cb)({type:Object,json:{write:!0}})],Q.prototype,"defaultValues",void 0),(0,s._)([(0,y.Cb)({json:{write:!0}})],Q.prototype,"domains",void 0),(0,s._)([(0,h.r)("domains")],Q.prototype,"readDomains",null),(0,s._)([(0,Z.c)("domains")],Q.prototype,"writeDomains",null),(0,s._)([(0,y.Cb)({type:String,json:{write:!0}})],Q.prototype,"name",void 0),Q=(0,s._)([(0,f.j)("esri.layers.support.Subtype")],Q);const U=Q;var M=r(51773),G=r(16050),q=(r(12501),r(28756),r(92271),r(72529),r(5499)),V=r(84382),k=r(81571),H=(r(91423),r(92604)),$=r(10699),N=r(22974),z=r(83379),B=r(78286),K=r(63213),J=r(55343),W=r(70082),Y=r(54306),X=r(30707),ee=r(14165),te=r(32163),re=r(28412);const se=["charts","editingEnabled","formTemplate","labelsVisible","labelingInfo","legendEnabled","minScale","maxScale","opacity","popupEnabled","popupTemplate","renderer","subtypeCode","templates","title","visible"],ie={key:"type",base:q.Z,errorContext:"renderer",typeMap:{simple:V.Z,"unique-value":k.Z,"class-breaks":G.Z}},oe=(0,x.v)(),ne=(0,K.d)({types:ie});let le=0;function ae(e){const t=e.json.write;return"object"==typeof t?t.ignoreOrigin=!0:e.json.write={ignoreOrigin:!0},e}function ue(e){switch(e){case"point":case"multipoint":return re.xA.clone();case"polyline":return re.CJ.clone();case"polygon":case"multipatch":return re.z3.clone();default:return null}}function pe(e,t){return null==e?null:t.subtypes?.find((t=>t.code===e))}function de(e,t){let r=null;switch(t.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":r="point";break;case"esriGeometryPolyline":r="line";break;case"esriGeometryPolygon":case"esriGeometryMultiPatch":r="polygon";break;default:t.type,r=null}const s={},i=pe(e,t);if(null!=i){const{defaultValues:e}=i;for(const t in e)s[t]=e[t]}return s[t.subtypeField]=e,new W.Z({name:"New Feature",drawingTool:r,prototype:{attributes:s}})}const ce="esri.layers.support.SubtypeSublayer";let ye=class extends((0,a.R)((0,i.J)((0,$.IG)(z.Z)))){constructor(e){super(e),this.charts=null,this.editingEnabled=!0,this.fieldOverrides=null,this.fieldsIndex=null,this.formTemplate=null,this.id=`${Date.now().toString(16)}-subtype-sublayer-${le++}`,this.type="subtype-sublayer",this.labelsVisible=!0,this.labelingInfo=null,this.layerType="ArcGISFeatureLayer",this.legendEnabled=!0,this.listMode="show",this.minScale=0,this.maxScale=0,this.opacity=1,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.subtypeCode=null,this.templates=null,this.title=null,this.visible=!0}get capabilities(){return this.parent?.capabilities}get effectiveCapabilities(){return this.parent?.effectiveCapabilities}get effectiveEditingEnabled(){const{parent:e}=this;return e?e.effectiveEditingEnabled&&this.editingEnabled:this.editingEnabled}get elevationInfo(){return this.parent?.elevationInfo}writeFieldOverrides(e,t,r){const{fields:s,parent:i}=this;let o;if(s){o=[];let e=0;s.forEach((({name:t,alias:r,editable:s,visible:n})=>{if(!n)return;const l=i?.fields?.find((e=>e.name===t));if(!l)return;const a={name:t};let u=!1;r!==l.alias&&(a.alias=r,u=!0),s!==l.editable&&(a.editable=s,u=!0),o.push(a),u&&e++})),0===e&&o.length===s.length&&(o=null)}else o=(0,N.d9)(e);o?.length&&(0,B.RB)(r,o,t)}get fields(){const{parent:e,fieldOverrides:t,subtypeCode:r}=this,s=e?.fields;if(!e||!s?.length)return null;const{subtypes:i,subtypeField:o}=e,n=i?.find((e=>e.code===r)),l=n?.defaultValues,a=n?.domains,u=[];for(const e of s){const s=e.clone(),{name:i}=s,n=t?.find((e=>e.name===i));if(s.visible=!t||!!n,n){const{alias:e,editable:t}=n;e&&(s.alias=e),!1===t&&(s.editable=!1)}const p=l?.[i]??null;s.defaultValue=i===o?r:p;const d=a?.[i]??null;s.domain=i===o?null:d?"inherited"===d.type?s.domain:d.clone():null,u.push(s)}return u}get floorInfo(){return this.parent?.floorInfo}get geometryType(){return this.parent?.geometryType}get effectiveScaleRange(){const{minScale:e,maxScale:t}=this;return{minScale:e,maxScale:t}}get objectIdField(){return this.parent||H.Z.getLogger(ce).error(fe("objectIdField")),this.parent?.objectIdField}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){(0,L.YN)(e,this.fieldsIndex),this._override("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const{parent:e}=this;return e&&!e.isTable&&"mesh"!==e.geometryType?function(e){return new V.Z({symbol:ue(e)})}(e.geometryType):null}readRendererFromService(e,t,r){if("Table"===t.type)return null;const s=t.drawingInfo?.renderer,i=ne(s,t,r);let o;const{subtypeCode:n}=this;if(null!=n&&function(e,t){return!(!t||"unique-value"!==e?.type||"string"!=typeof e.field||e.field.toLowerCase()!==t.toLowerCase()||e.field2||e.field3||e.valueExpression)}(i,t.subtypeField)){const e=i.uniqueValueInfos?.find((({value:e})=>(e="number"==typeof e?String(e):e)===String(n)));e&&(o=new V.Z({symbol:e.symbol}))}else"simple"!==i?.type||i.visualVariables?.length||(o=i);return o}readRenderer(e,t,r){const s=t?.layerDefinition?.drawingInfo?.renderer;if(!s)return;const i=s.visualVariables?.some((e=>"rotationInfo"!==e.type));return i?void 0:ne(s,t,r)||void 0}get spatialReference(){return this.parent?.spatialReference}readTemplatesFromService(e,t){return[de(this.subtypeCode,t)]}readTitleFromService(e,t){const r=pe(this.subtypeCode,t);return null!=r?r.name:null}get url(){return this.parent?.url}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}async addAttachment(e,t){const{parent:r}=this;if(!r)throw fe("addAttachment");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new n.Z("subtype-sublayer:addAttachment","The feature provided does not belong to this SubtypeSublayer");return r.addAttachment(e,t)}async updateAttachment(e,t,r){const{parent:s}=this;if(!s)throw fe("updateAttachment");if(e.getAttribute(s.subtypeField)!==this.subtypeCode)throw new n.Z("subtype-sublayer:updateAttachment","The feature provided does not belong to this SubtypeSublayer");return s.updateAttachment(e,t,r)}async deleteAttachments(e,t){const{parent:r}=this;if(!r)throw fe("deleteAttachments");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new n.Z("subtype-sublayer:deleteAttachments","The feature provided does not belong to this SubtypeSublayer");return r.deleteAttachments(e,t)}async applyEdits(e,t){if(!this.parent)throw fe("applyEdits");return this.parent.applyEdits(e,t)}createPopupTemplate(e){let t=this;const{parent:r,fields:s,title:i}=this;if(r){const{displayField:e,editFieldsInfo:o,objectIdField:n}=r;t={displayField:e,editFieldsInfo:o,fields:s,objectIdField:n,title:i}}return(0,te.eZ)(t,e)}createQuery(){if(!this.parent)throw fe("createQuery");const e=(0,j.rP)(this.parent),t=`${this.parent.subtypeField}=${this.subtypeCode}`;return e.where=(0,d._)(t,this.parent.definitionExpression),e}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e){return this._getLayerDomain(e)}hasUserOverrides(){return se.some((e=>this.originIdOf(e)===b.s3.USER))}async queryAttachments(e,t){const r=await this.load();if(!r.parent)throw fe("queryAttachments");const s=e.clone();return s.where=he(s.where,r.parent.subtypeField,r.subtypeCode),r.parent.queryAttachments(e,t)}async queryFeatures(e,t){const r=await this.load();if(!r.parent)throw fe("queryFeatures");const s=ee.Z.from(e)??r.createQuery();return null!=e&&(s.where=he(s.where,r.parent.subtypeField,r.subtypeCode)),r.parent.queryFeatures(s,t)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}};(0,s._)([(0,y.Cb)({readOnly:!0,json:{read:!1}})],ye.prototype,"capabilities",null),(0,s._)([(0,y.Cb)({readOnly:!0,json:{read:!1}})],ye.prototype,"effectiveCapabilities",null),(0,s._)([(0,y.Cb)({json:{write:{ignoreOrigin:!0}}})],ye.prototype,"charts",void 0),(0,s._)([(0,y.Cb)({type:Boolean,nonNullable:!0,json:{name:"enableEditing",write:{ignoreOrigin:!0}}})],ye.prototype,"editingEnabled",void 0),(0,s._)([(0,y.Cb)({type:Boolean,readOnly:!0})],ye.prototype,"effectiveEditingEnabled",null),(0,s._)([(0,y.Cb)({readOnly:!0,json:{read:!1}})],ye.prototype,"elevationInfo",null),(0,s._)([(0,y.Cb)({json:{name:"layerDefinition.fieldOverrides",origins:{service:{read:!1}},write:{ignoreOrigin:!0,allowNull:!0}}})],ye.prototype,"fieldOverrides",void 0),(0,s._)([(0,Z.c)("fieldOverrides")],ye.prototype,"writeFieldOverrides",null),(0,s._)([(0,y.Cb)({...oe.fields,readOnly:!0,json:{read:!1}})],ye.prototype,"fields",null),(0,s._)([(0,y.Cb)(oe.fieldsIndex)],ye.prototype,"fieldsIndex",void 0),(0,s._)([(0,y.Cb)({readOnly:!0,json:{read:!1}})],ye.prototype,"floorInfo",null),(0,s._)([(0,y.Cb)({type:J.Z,json:{name:"formInfo",write:{ignoreOrigin:!0}}})],ye.prototype,"formTemplate",void 0),(0,s._)([(0,y.Cb)({type:String,clonable:!1,readOnly:!0,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],ye.prototype,"id",void 0),(0,s._)([(0,y.Cb)({readOnly:!0,json:{read:!1}})],ye.prototype,"geometryType",null),(0,s._)([(0,y.Cb)({readOnly:!0,json:{read:!1}})],ye.prototype,"type",void 0),(0,s._)([(0,y.Cb)(ae((0,N.d9)(O.iR)))],ye.prototype,"labelsVisible",void 0),(0,s._)([(0,y.Cb)({type:[Y.Z],json:{name:"layerDefinition.drawingInfo.labelingInfo",origins:{service:{read:!1}},read:{reader:X.r},write:{ignoreOrigin:!0}}})],ye.prototype,"labelingInfo",void 0),(0,s._)([(0,y.Cb)({type:["ArcGISFeatureLayer"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0}}})],ye.prototype,"layerType",void 0),(0,s._)([(0,y.Cb)(ae((0,N.d9)(O.rn)))],ye.prototype,"legendEnabled",void 0),(0,s._)([(0,y.Cb)({type:["show","hide"]})],ye.prototype,"listMode",void 0),(0,s._)([(0,y.Cb)((()=>{const e=(0,N.d9)(O.rO);return e.json.origins.service.read=!1,ae(e)})())],ye.prototype,"minScale",void 0),(0,s._)([(0,y.Cb)((()=>{const e=(0,N.d9)(O.u1);return e.json.origins.service.read=!1,ae(e)})())],ye.prototype,"maxScale",void 0),(0,s._)([(0,y.Cb)({readOnly:!0})],ye.prototype,"effectiveScaleRange",null),(0,s._)([(0,y.Cb)({readOnly:!0,json:{read:!1}})],ye.prototype,"objectIdField",null),(0,s._)([(0,y.Cb)({type:Number,range:{min:0,max:1},nonNullable:!0,json:{write:{ignoreOrigin:!0}}})],ye.prototype,"opacity",void 0),(0,s._)([(0,y.Cb)({clonable:!1})],ye.prototype,"parent",void 0),(0,s._)([(0,y.Cb)(ae((0,N.d9)(O.C_)))],ye.prototype,"popupEnabled",void 0),(0,s._)([(0,y.Cb)({type:M.Z,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],ye.prototype,"popupTemplate",void 0),(0,s._)([(0,y.Cb)({readOnly:!0})],ye.prototype,"defaultPopupTemplate",null),(0,s._)([(0,y.Cb)({types:ie,json:{write:{target:"layerDefinition.drawingInfo.renderer",ignoreOrigin:!0}}})],ye.prototype,"renderer",null),(0,s._)([(0,h.r)("service","renderer",["drawingInfo.renderer","subtypeField","type"])],ye.prototype,"readRendererFromService",null),(0,s._)([(0,h.r)("renderer",["layerDefinition.drawingInfo.renderer"])],ye.prototype,"readRenderer",null),(0,s._)([(0,y.Cb)({readOnly:!0,json:{read:!1}})],ye.prototype,"spatialReference",null),(0,s._)([(0,y.Cb)({type:Number,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],ye.prototype,"subtypeCode",void 0),(0,s._)([(0,y.Cb)({type:[W.Z],json:{name:"layerDefinition.templates",write:{ignoreOrigin:!0}}})],ye.prototype,"templates",void 0),(0,s._)([(0,h.r)("service","templates",["geometryType","subtypeField","subtypes","type"])],ye.prototype,"readTemplatesFromService",null),(0,s._)([(0,y.Cb)({type:String,json:{write:{ignoreOrigin:!0}}})],ye.prototype,"title",void 0),(0,s._)([(0,h.r)("service","title",["subtypes"])],ye.prototype,"readTitleFromService",null),(0,s._)([(0,y.Cb)({readOnly:!0,json:{read:!1}})],ye.prototype,"url",null),(0,s._)([(0,y.Cb)({readOnly:!0})],ye.prototype,"userHasUpdateItemPrivileges",null),(0,s._)([(0,y.Cb)({type:Boolean,nonNullable:!0,json:{name:"visibility",write:{ignoreOrigin:!0}}})],ye.prototype,"visible",void 0),ye=(0,s._)([(0,f.j)(ce)],ye);const he=(e,t,r)=>{const s=new RegExp(`${t}\\s*=\\s*\\d+`),i=`${t}=${r}`,o=e??"";return s.test(o)?o.replace(s,i):(0,d._)(i,o)},fe=e=>new n.Z(`This sublayer must have a parent SubtypeGroupLayer in order to use ${e}`),be=ye;var me=r(76259),ge=r(60199);const ve="SubtypeGroupLayer";function we(e,t){return new n.Z("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${t}`,{layer:e})}const Ce=(0,x.v)();let Se=class extends((0,_.B)((0,S.o1)((0,w.h)((0,T.n)((0,A.M)((0,E.Q)((0,v.Y)((0,F.q)((0,I.I)((0,a.R)((0,C.N)((0,g.V)((0,i.J)(m.Z)))))))))))))){constructor(...e){super(...e),this._sublayersCollectionChanged=!1,this._sublayerLookup=new Map,this.fields=null,this.fieldsIndex=null,this.outFields=null,this.subtypes=null,this.sublayers=new(o.Z.ofType(be)),this.timeInfo=null,this.title="Layer",this.type="subtype-group",this.addHandles((0,p.YP)((()=>this.sublayers),((e,t)=>this._handleSublayersChange(e,t)),p.Z_))}destroy(){this.source?.destroy()}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null,r=this.loadFromPortal({supportedTypes:["Feature Service"]},e).catch(u.r9).then((async()=>{if(!this.url)throw new n.Z("subtype-grouplayer:missing-url-or-source","SubtypeGroupLayer must be created with either a url or a portal item");if(null==this.layerId)throw new n.Z("subtype-grouplayer:missing-layerid","layerId is required for a SubtypeGroupLayer created with url");return this._initLayerProperties(await this.createGraphicsSource(t))})).then((()=>(0,j.nU)(this,"load",e)));return this.addResolvingPromise(r),Promise.resolve(this)}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return this.loaded&&null!=this.capabilities&&this.capabilities.operations.supportsEditing&&this.userHasEditingPrivileges}get effectiveEditingEnabled(){return(0,j.sX)(this)}get parsedUrl(){const e=(0,c.mN)(this.url);return null!=e&&null!=this.layerId&&(e.path=(0,c.v_)(e.path,this.layerId.toString())),e}set source(e){this._get("source")!==e&&this._set("source",e)}readTitleFromService(e,{name:t}){return this.url?(0,P.a7)(this.url,t):t}async addAttachment(e,t){return(0,j.JD)(this,e,t,ve)}async updateAttachment(e,t,r){return(0,j.Y5)(this,e,t,r,ve)}async applyEdits(e,t){return(0,j.Jj)(this,e,t)}on(e,t){return super.on(e,t)}async createGraphicsSource(e){const{default:t}=await(0,u.Hl)(Promise.all([r.e(4599),r.e(3919),r.e(8949)]).then(r.bind(r,73919)),e);return new t({layer:this}).load({signal:e})}createQuery(){const e=(0,j.rP)(this),t=this.sublayers.map((e=>e.subtypeCode));return e.where=(0,d._)(`${this.subtypeField} IN (${t.join(",")})`,this.definitionExpression),e}async deleteAttachments(e,t){return(0,j.FV)(this,e,t,ve)}async fetchRecomputedExtents(e){return(0,j.Ci)(this,e,ve)}findSublayerForFeature(e){const t=this.fieldsIndex.get(this.subtypeField),r=e.attributes[t.name];return this.findSublayerForSubtypeCode(r)}findSublayerForSubtypeCode(e){return this._sublayerLookup.get(e)}getFieldDomain(e,t){return this._getLayerDomain(e)}getField(e){return this.fieldsIndex.get(e)}loadAll(){return(0,l.G)(this,(e=>{e(this.sublayers)}))}async queryAttachments(e,t){return(0,j.SU)(this,e,t,ve)}async queryFeatures(e,t){const r=await this.load(),s=ee.Z.from(e)??r.createQuery(),i=s.outFields??[];i.includes(this.subtypeField)||(i.push(this.subtypeField),s.outFields=i);const o=await r.source.queryFeatures(s,t);if(o?.features)for(const e of o.features)e.layer=e.sourceLayer=this.findSublayerForFeature(e);return o}async queryObjectIds(e,t){return(0,j.tD)(this,e,t,ve)}async queryFeatureCount(e,t){return(0,j.VG)(this,e,t,ve)}async queryExtent(e,t){return(0,j.KE)(this,e,t,ve)}async queryRelatedFeatures(e,t){return(0,j.kp)(this,e,t,ve)}async queryRelatedFeaturesCount(e,t){return(0,j.C9)(this,e,t,ve)}async save(e){const{save:t}=await Promise.all([r.e(6569),r.e(6404),r.e(9238),r.e(3831)]).then(r.bind(r,32664));return t(this,e)}async saveAs(e,t){const{saveAs:s}=await Promise.all([r.e(6569),r.e(6404),r.e(9238),r.e(3831)]).then(r.bind(r,32664));return s(this,e,t)}write(e,t){const{origin:r,layerContainerType:s,messages:i}=t;if(this.isTable){if("web-scene"===r||"web-map"===r&&"tables"!==s)return i?.push(we(this,"using a table source cannot be written to web scenes and web maps")),null}else if(this.loaded&&"web-map"===r&&"tables"===s)return i?.push(we(this,"using a non-table source cannot be written to tables in web maps")),null;return this.sublayers?.length?super.write(e,t):(i?.push(new n.Z("web-document-write:invalid-property",`Layer (${this.title}, ${this.id}) of type '${this.declaredClass}' has invalid value for 'sublayers' property. 'sublayers' collection should contain at least one sublayer`,{layer:this})),null)}serviceSupportsSpatialReference(e){return!!this.loaded&&(0,ge.D)(this,e)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}async _initLayerProperties(e){this._set("source",e);const{sourceJSON:t}=e;if(t&&(this.sourceJSON=t,this.read(t,{origin:"service",url:this.parsedUrl})),this.isTable)throw new n.Z("subtype-grouplayer:unsupported-source","SubtypeGroupLayer cannot be created using a layer with table source");if(!this.subtypes?.length)throw new n.Z("subtype-grouplayer:missing-subtypes","SubtypeGroupLayer must be created using a layer with subtypes");this._verifyFields(),(0,L.UF)(this.timeInfo,this.fieldsIndex)}async hasDataChanged(){return(0,j.gG)(this)}_verifyFields(){const e=this.parsedUrl?.path??"undefined";this.objectIdField||console.log("SubtypeGroupLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||-1!==e.search(/\/FeatureServer\//i)||this.fields?.some((e=>"geometry"===e.type))||console.log("SubtypeGroupLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_handleSublayersChange(e,t){t&&(t.forEach((e=>{e.parent=null})),this.removeHandles("sublayers-owner"),this._sublayerLookup.clear()),e&&(e.forEach((e=>{e.parent=this,this._sublayerLookup.set(e.subtypeCode,e)})),this._sublayersCollectionChanged=!1,this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this,this._sublayerLookup.set(e.subtypeCode,e)})),e.on("after-remove",(({item:e})=>{e.parent=null,this._sublayerLookup.delete(e.subtypeCode)})),e.on("after-changes",(()=>{this._sublayersCollectionChanged=!0}))],"sublayers-owner"))}};(0,s._)([(0,y.Cb)({readOnly:!0})],Se.prototype,"createQueryVersion",null),(0,s._)([(0,y.Cb)({readOnly:!0})],Se.prototype,"editingEnabled",null),(0,s._)([(0,y.Cb)({readOnly:!0})],Se.prototype,"effectiveEditingEnabled",null),(0,s._)([(0,y.Cb)({...Ce.fields,readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],Se.prototype,"fields",void 0),(0,s._)([(0,y.Cb)(Ce.fieldsIndex)],Se.prototype,"fieldsIndex",void 0),(0,s._)([(0,y.Cb)(O.id)],Se.prototype,"id",void 0),(0,s._)([(0,y.Cb)({type:["show","hide","hide-children"]})],Se.prototype,"listMode",void 0),(0,s._)([(0,y.Cb)({value:"SubtypeGroupLayer",type:["SubtypeGroupLayer"],json:{origins:{"portal-item":{name:"layerType",write:{enabled:!0,ignoreOrigin:!0}}}}})],Se.prototype,"operationalLayerType",void 0),(0,s._)([(0,y.Cb)(Ce.outFields)],Se.prototype,"outFields",void 0),(0,s._)([(0,y.Cb)({readOnly:!0})],Se.prototype,"parsedUrl",null),(0,s._)([(0,y.Cb)({clonable:!1})],Se.prototype,"source",null),(0,s._)([(0,y.Cb)({type:[U],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Se.prototype,"subtypes",void 0),(0,s._)([(0,y.Cb)({type:o.Z.ofType(be),json:{origins:{service:{read:{source:"subtypes",reader:(e,t,r)=>{const s=e.map((({code:e})=>{const s=new be({subtypeCode:e});return s.read(t,r),s}));return new(o.Z.ofType(be))(s)}}}},name:"layers",write:{overridePolicy(e,t,r){const s=this.originOf("sublayers"),i=b.s3.PORTAL_ITEM;let o=!0;if((0,b.M9)(s)===i&&(0,b.M9)(r.origin)>i){const t=e.some((e=>e.hasUserOverrides()));o=this._sublayersCollectionChanged||t}return{enabled:o,ignoreOrigin:!0}}}}})],Se.prototype,"sublayers",void 0),(0,s._)([(0,y.Cb)({type:me.Z})],Se.prototype,"timeInfo",void 0),(0,s._)([(0,y.Cb)({json:{origins:{"portal-item":{write:{enabled:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}}}})],Se.prototype,"title",void 0),(0,s._)([(0,h.r)("service","title",["name"])],Se.prototype,"readTitleFromService",null),(0,s._)([(0,y.Cb)({json:{read:!1}})],Se.prototype,"type",void 0),Se=(0,s._)([(0,f.j)("esri.layers.SubtypeGroupLayer")],Se);const _e=Se},54295:(e,t,r)=>{r.d(t,{V:()=>n});var s=r(43697),i=r(5600),o=(r(75215),r(67676),r(80442),r(52011));const n=e=>{let t=class extends e{get apiKey(){return this._isOverridden("apiKey")?this._get("apiKey"):"portalItem"in this?this.portalItem?.apiKey:null}set apiKey(e){null!=e?this._override("apiKey",e):(this._clearOverride("apiKey"),this.clear("apiKey","user"))}};return(0,s._)([(0,i.Cb)({type:String})],t.prototype,"apiKey",null),t=(0,s._)([(0,o.j)("esri.layers.mixins.APIKeyMixin")],t),t}},17287:(e,t,r)=>{r.d(t,{Y:()=>a});var s=r(43697),i=r(92604),o=r(5600),n=(r(75215),r(67676),r(80442),r(52011)),l=r(66677);const a=e=>{let t=class extends e{get title(){if(this._get("title")&&"defaults"!==this.originOf("title"))return this._get("title");if(this.url){const e=(0,l.Qc)(this.url);if(null!=e&&e.title)return e.title}return this._get("title")||""}set title(e){this._set("title",e)}set url(e){this._set("url",(0,l.Nm)(e,i.Z.getLogger(this)))}};return(0,s._)([(0,o.Cb)()],t.prototype,"title",null),(0,s._)([(0,o.Cb)({type:String})],t.prototype,"url",null),t=(0,s._)([(0,n.j)("esri.layers.mixins.ArcGISService")],t),t}},17017:(e,t,r)=>{r.d(t,{N:()=>n});var s=r(43697),i=r(5600),o=(r(75215),r(67676),r(80442),r(52011));const n=e=>{let t=class extends e{constructor(){super(...arguments),this.customParameters=null}};return(0,s._)([(0,i.Cb)({type:Object,json:{write:{overridePolicy:e=>({enabled:!!(e&&Object.keys(e).length>0)})}}})],t.prototype,"customParameters",void 0),t=(0,s._)([(0,o.j)("esri.layers.mixins.CustomParametersMixin")],t),t}},16859:(e,t,r)=>{r.d(t,{I:()=>C});var s=r(43697),i=r(68773),o=r(40330),n=r(3172),l=r(66643),a=r(20102),u=r(92604),p=r(95330),d=r(17452),c=r(5600),y=(r(75215),r(67676),r(80442),r(71715)),h=r(52011),f=r(30556),b=r(84230),m=r(48522),g=r(15235),v=r(86082),w=r(14661);const C=e=>{let t=class extends e{constructor(){super(...arguments),this.resourceReferences={portalItem:null,paths:[]},this.userHasEditingPrivileges=!0,this.userHasFullEditingPrivileges=!1,this.userHasUpdateItemPrivileges=!1}destroy(){this.portalItem=null,this.resourceReferences.portalItem=null,this.resourceReferences.paths.length=0}set portalItem(e){e!==this._get("portalItem")&&(this.removeOrigin("portal-item"),this._set("portalItem",e))}readPortalItem(e,t,r){if(t.itemId)return new g.default({id:t.itemId,portal:r&&r.portal})}writePortalItem(e,t){e&&e.id&&(t.itemId=e.id)}async loadFromPortal(e,t){if(this.portalItem&&this.portalItem.id)try{const{load:s}=await r.e(8062).then(r.bind(r,18062));return(0,p.k_)(t),await s({instance:this,supportedTypes:e.supportedTypes,validateItem:e.validateItem,supportsData:e.supportsData,layerModuleTypeMap:e.layerModuleTypeMap},t)}catch(e){throw(0,p.D_)(e)||u.Z.getLogger(this).warn(`Failed to load layer (${this.title}, ${this.id}) portal item (${this.portalItem.id})\n ${e}`),e}}async finishLoadEditablePortalLayer(e){this._set("userHasEditingPrivileges",await this._fetchUserHasEditingPrivileges(e).catch((e=>((0,p.r9)(e),!0))))}async setUserPrivileges(e,t){if(!i.default.userPrivilegesApplied)return this.finishLoadEditablePortalLayer(t);if(this.url)try{const{features:{edit:r,fullEdit:s},content:{updateItem:i}}=await this._fetchUserPrivileges(e,t);this._set("userHasEditingPrivileges",r),this._set("userHasFullEditingPrivileges",s),this._set("userHasUpdateItemPrivileges",i)}catch(e){(0,p.r9)(e)}}async _fetchUserPrivileges(e,t){let r=this.portalItem;if(!e||!r||!r.loaded||r.sourceUrl)return this._fetchFallbackUserPrivileges(t);const s=e===r.id;if(s&&r.portal.user)return(0,w.Ss)(r);let i,n;if(s)i=r.portal.url;else try{i=await(0,b.oP)(this.url,t)}catch(e){(0,p.r9)(e)}if(!i||!(0,d.Zo)(i,r.portal.url))return this._fetchFallbackUserPrivileges(t);try{const e=null!=t?t.signal:null;n=await(o.id?.getCredential(`${i}/sharing`,{prompt:!1,signal:e}))}catch(e){(0,p.r9)(e)}if(!n)return{features:{edit:!0,fullEdit:!1},content:{updateItem:!1}};try{if(s?await r.reload():(r=new g.default({id:e,portal:{url:i}}),await r.load(t)),r.portal.user)return(0,w.Ss)(r)}catch(e){(0,p.r9)(e)}return{features:{edit:!0,fullEdit:!1},content:{updateItem:!1}}}async _fetchFallbackUserPrivileges(e){let t=!0;try{t=await this._fetchUserHasEditingPrivileges(e)}catch(e){(0,p.r9)(e)}return{features:{edit:t,fullEdit:!1},content:{updateItem:!1}}}async _fetchUserHasEditingPrivileges(e){const t=this.url?o.id?.findCredential(this.url):null;if(!t)return!0;const r=S.credential===t?S.user:await this._fetchEditingUser(e);return S.credential=t,S.user=r,null==r||null==r.privileges||r.privileges.includes("features:user:edit")}async _fetchEditingUser(e){const t=this.portalItem?.portal?.user;if(t)return t;const r=o.id.findServerInfo(this.url??"");if(!r?.owningSystemUrl)return null;const s=`${r.owningSystemUrl}/sharing/rest`,i=m.Z.getDefault();if(i&&i.loaded&&(0,d.Fv)(i.restUrl)===(0,d.Fv)(s))return i.user;const a=`${s}/community/self`,u=null!=e?e.signal:null,p=await(0,l.q6)((0,n.Z)(a,{authMode:"no-prompt",query:{f:"json"},signal:u}));return p.ok?v.Z.fromJSON(p.value.data):null}read(e,t){t&&(t.layer=this),super.read(e,t)}write(e,t){const r=t&&t.portal,s=this.portalItem&&this.portalItem.id&&(this.portalItem.portal||m.Z.getDefault());return r&&s&&!(0,d.tm)(s.restUrl,r.restUrl)?(t.messages&&t.messages.push(new a.Z("layer:cross-portal",`The layer '${this.title} (${this.id})' cannot be persisted because it refers to an item on a different portal than the one being saved to. To save, set layer.portalItem to null or save to the same portal as the item associated with the layer`,{layer:this})),null):super.write(e,{...t,layer:this})}};return(0,s._)([(0,c.Cb)({type:g.default})],t.prototype,"portalItem",null),(0,s._)([(0,y.r)("web-document","portalItem",["itemId"])],t.prototype,"readPortalItem",null),(0,s._)([(0,f.c)("web-document","portalItem",{itemId:{type:String}})],t.prototype,"writePortalItem",null),(0,s._)([(0,c.Cb)({clonable:!1})],t.prototype,"resourceReferences",void 0),(0,s._)([(0,c.Cb)({type:Boolean,readOnly:!0})],t.prototype,"userHasEditingPrivileges",void 0),(0,s._)([(0,c.Cb)({type:Boolean,readOnly:!0})],t.prototype,"userHasFullEditingPrivileges",void 0),(0,s._)([(0,c.Cb)({type:Boolean,readOnly:!0})],t.prototype,"userHasUpdateItemPrivileges",void 0),t=(0,s._)([(0,h.j)("esri.layers.mixins.PortalLayer")],t),t},S={credential:null,user:null}},70082:(e,t,r)=>{r.d(t,{Z:()=>d});var s=r(43697),i=r(2368),o=r(35454),n=r(96674),l=r(5600),a=(r(75215),r(67676),r(80442),r(52011));const u=new o.X({esriFeatureEditToolAutoCompletePolygon:"auto-complete-polygon",esriFeatureEditToolCircle:"circle",esriFeatureEditToolEllipse:"ellipse",esriFeatureEditToolFreehand:"freehand",esriFeatureEditToolLine:"line",esriFeatureEditToolNone:"none",esriFeatureEditToolPoint:"point",esriFeatureEditToolPolygon:"polygon",esriFeatureEditToolRectangle:"rectangle",esriFeatureEditToolArrow:"arrow",esriFeatureEditToolTriangle:"triangle",esriFeatureEditToolLeftArrow:"left-arrow",esriFeatureEditToolRightArrow:"right-arrow",esriFeatureEditToolUpArrow:"up-arrow",esriFeatureEditToolDownArrow:"down-arrow"});let p=class extends((0,i.J)(n.wq)){constructor(e){super(e),this.name=null,this.description=null,this.drawingTool=null,this.prototype=null,this.thumbnail=null}};(0,s._)([(0,l.Cb)({json:{write:!0}})],p.prototype,"name",void 0),(0,s._)([(0,l.Cb)({json:{write:!0}})],p.prototype,"description",void 0),(0,s._)([(0,l.Cb)({json:{read:u.read,write:u.write}})],p.prototype,"drawingTool",void 0),(0,s._)([(0,l.Cb)({json:{write:!0}})],p.prototype,"prototype",void 0),(0,s._)([(0,l.Cb)({json:{write:!0}})],p.prototype,"thumbnail",void 0),p=(0,s._)([(0,a.j)("esri.layers.support.FeatureTemplate")],p);const d=p},56765:(e,t,r)=>{r.d(t,{Z:()=>p});var s,i=r(43697),o=r(46791),n=r(96674),l=r(5600),a=(r(75215),r(67676),r(80442),r(52011));let u=s=class extends n.wq{constructor(e){super(e),this.floorField=null,this.viewAllMode=!1,this.viewAllLevelIds=new o.Z}clone(){return new s({floorField:this.floorField,viewAllMode:this.viewAllMode,viewAllLevelIds:this.viewAllLevelIds})}};(0,i._)([(0,l.Cb)({type:String,json:{write:!0}})],u.prototype,"floorField",void 0),(0,i._)([(0,l.Cb)({json:{read:!1,write:!1}})],u.prototype,"viewAllMode",void 0),(0,i._)([(0,l.Cb)({json:{read:!1,write:!1}})],u.prototype,"viewAllLevelIds",void 0),u=s=(0,i._)([(0,a.j)("esri.layers.support.LayerFloorInfo")],u);const p=u},30707:(e,t,r)=>{r.d(t,{a:()=>d,r:()=>u});var s=r(20102),i=r(22974),o=r(92604),n=r(54306);const l=o.Z.getLogger("esri.layers.support.labelingInfo"),a=/\[([^\[\]]+)\]/gi;function u(e,t,r){return e?e.map((e=>{const s=new n.Z;if(s.read(e,r),s.labelExpression){const e=t.fields||t.layerDefinition&&t.layerDefinition.fields||this.fields;s.labelExpression=s.labelExpression.replaceAll(a,((t,r)=>`[${function(e,t){if(!t)return e;const r=e.toLowerCase();for(let e=0;e<t.length;e++){const s=t[e].name;if(s.toLowerCase()===r)return s}return e}(r,e)}]`))}return s})):null}const p={esriGeometryPoint:["above-right","above-center","above-left","center-center","center-left","center-right","below-center","below-left","below-right"],esriGeometryPolygon:["always-horizontal"],esriGeometryPolyline:["center-along"],esriGeometryMultipoint:null};function d(e,t){const r=(0,i.d9)(e);return r.some((e=>function(e,t){const r=e.labelPlacement,i=p[t];if(!e.symbol)return l.warn("No ILabelClass symbol specified."),!0;if(!i)return l.error(new s.Z("labeling:unsupported-geometry-type",`Unable to create labels for layer, geometry type '${t}' is not supported`)),!0;if(!i.includes(r)){const s=i[0];r&&l.warn(`Found invalid label placement type ${r} for ${t}. Defaulting to ${s}`),e.labelPlacement=s}return!1}(e,t)))?[]:r}},72064:(e,t,r)=>{r.d(t,{h:()=>d});var s=r(80442),i=r(66677);const o={name:"supportsName",size:"supportsSize",contentType:"supportsContentType",keywords:"supportsKeywords",exifInfo:"supportsExifInfo"};function n(e,t,r){return!!a(e,t,r)}function l(e,t,r){return a(e,t,r)}function a(e,t,r){return e&&e.hasOwnProperty(t)?e[t]:r}function u(e){const t=e?.supportedSpatialAggregationStatistics?.map((e=>e.toLowerCase()));return{envelope:!!t?.includes("envelopeaggregate"),centroid:!!t?.includes("centroidaggregate"),convexHull:!!t?.includes("convexhullaggregate")}}function p(e,t){const r=e?.supportedOperationsWithCacheHint?.map((e=>e.toLowerCase()));return!!r?.includes(t.toLowerCase())}function d(e,t){return{analytics:c(e),attachment:y(e),data:h(e),metadata:f(e),operations:b(e.capabilities,e,t),query:m(e,t),queryRelated:g(e),queryTopFeatures:v(e),editing:w(e)}}function c(e){return{supportsCacheHint:p(e.advancedQueryCapabilities,"queryAnalytics")}}function y(e){const t=e.attachmentProperties,r={supportsName:!1,supportsSize:!1,supportsContentType:!1,supportsKeywords:!1,supportsExifInfo:!1,supportsCacheHint:p(e.advancedQueryCapabilities,"queryAttachments"),supportsResize:n(e,"supportsAttachmentsResizing",!1)};return t&&Array.isArray(t)&&t.forEach((e=>{const t=o[e.name];t&&(r[t]=!!e.isEnabled)})),r}function h(e){return{isVersioned:n(e,"isDataVersioned",!1),supportsAttachment:n(e,"hasAttachments",!1),supportsM:n(e,"hasM",!1),supportsZ:n(e,"hasZ",!1)}}function f(e){return{supportsAdvancedFieldProperties:n(e,"supportsFieldDescriptionProperty",!1)}}function b(e,t,r){const s=e?e.toLowerCase().split(",").map((e=>e.trim())):[],o=r?(0,i.Qc)(r):null,l=s.includes(null!=o&&"MapServer"===o.serverType?"data":"query"),a=s.includes("editing")&&!t.datesInUnknownTimezone;let u=a&&s.includes("create"),p=a&&s.includes("delete"),d=a&&s.includes("update");const c=s.includes("changetracking"),y=t.advancedQueryCapabilities;return a&&!(u||p||d)&&(u=p=d=!0),{supportsCalculate:n(t,"supportsCalculate",!1),supportsTruncate:n(t,"supportsTruncate",!1),supportsValidateSql:n(t,"supportsValidateSql",!1),supportsAdd:u,supportsDelete:p,supportsEditing:a,supportsChangeTracking:c,supportsQuery:l,supportsQueryAnalytics:n(y,"supportsQueryAnalytic",!1),supportsQueryAttachments:n(y,"supportsQueryAttachments",!1),supportsQueryTopFeatures:n(y,"supportsTopFeaturesQuery",!1),supportsResizeAttachments:n(t,"supportsAttachmentsResizing",!1),supportsSync:s.includes("sync"),supportsUpdate:d,supportsExceedsLimitStatistics:n(t,"supportsExceedsLimitStatistics",!1),supportsAsyncConvert3D:n(t,"supportsAsyncConvert3D",!1)}}function m(e,t){const r=e.advancedQueryCapabilities,o=e.ownershipBasedAccessControlForFeatures,a=e.archivingInfo,d=e.currentVersion,c=t?.includes("MapServer"),y=!c||d>=(0,s.Z)("mapserver-pbf-version-support"),h=(0,i.M8)(t),f=new Set((e.supportedQueryFormats??"").split(",").map((e=>e.toLowerCase().trim())));return{supportsStatistics:n(r,"supportsStatistics",e.supportsStatistics),supportsPercentileStatistics:n(r,"supportsPercentileStatistics",!1),supportsSpatialAggregationStatistics:n(r,"supportsSpatialAggregationStatistics",!1),supportedSpatialAggregationStatistics:u(r),supportsCentroid:n(r,"supportsReturningGeometryCentroid",!1),supportsDistance:n(r,"supportsQueryWithDistance",!1),supportsDistinct:n(r,"supportsDistinct",e.supportsAdvancedQueries),supportsExtent:n(r,"supportsReturningQueryExtent",!1),supportsGeometryProperties:n(r,"supportsReturningGeometryProperties",!1),supportsHavingClause:n(r,"supportsHavingClause",!1),supportsOrderBy:n(r,"supportsOrderBy",e.supportsAdvancedQueries),supportsPagination:n(r,"supportsPagination",!1),supportsQuantization:n(e,"supportsCoordinatesQuantization",!1),supportsQuantizationEditMode:n(e,"supportsQuantizationEditMode",!1),supportsQueryGeometry:n(e,"supportsReturningQueryGeometry",!1),supportsResultType:n(r,"supportsQueryWithResultType",!1),supportsMaxRecordCountFactor:n(r,"supportsMaxRecordCountFactor",!1),supportsSqlExpression:n(r,"supportsSqlExpression",!1),supportsStandardizedQueriesOnly:n(e,"useStandardizedQueries",!1),supportsTopFeaturesQuery:n(r,"supportsTopFeaturesQuery",!1),supportsQueryByAnonymous:n(o,"allowAnonymousToQuery",!0),supportsQueryByOthers:n(o,"allowOthersToQuery",!0),supportsHistoricMoment:n(a,"supportsQueryWithHistoricMoment",!1),supportsFormatPBF:y&&f.has("pbf"),supportsDisjointSpatialRelationship:n(r,"supportsDisjointSpatialRel",!1),supportsCacheHint:n(r,"supportsQueryWithCacheHint",!1)||p(r,"query"),supportsDefaultSpatialReference:n(r,"supportsDefaultSR",!1),supportsCompactGeometry:h,supportsFullTextSearch:n(r,"supportsFullTextSearch",!1),maxRecordCountFactor:l(e,"maxRecordCountFactor",void 0),maxRecordCount:l(e,"maxRecordCount",void 0),standardMaxRecordCount:l(e,"standardMaxRecordCount",void 0),tileMaxRecordCount:l(e,"tileMaxRecordCount",void 0)}}function g(e){const t=e.advancedQueryCapabilities,r=n(t,"supportsAdvancedQueryRelated",!1);return{supportsPagination:n(t,"supportsQueryRelatedPagination",!1),supportsCount:r,supportsOrderBy:r,supportsCacheHint:p(t,"queryRelated")}}function v(e){return{supportsCacheHint:p(e.advancedQueryCapabilities,"queryTopFilter")}}function w(e){const t=e.ownershipBasedAccessControlForFeatures,r=e?e.advancedEditingCapabilities:void 0;return{supportsGeometryUpdate:n(e,"allowGeometryUpdates",!0),supportsGlobalId:n(e,"supportsApplyEditsWithGlobalIds",!1),supportsReturnServiceEditsInSourceSpatialReference:n(e,"supportsReturnServiceEditsInSourceSR",!1),supportsRollbackOnFailure:n(e,"supportsRollbackOnFailureParameter",!1),supportsUpdateWithoutM:n(e,"allowUpdateWithoutMValues",!1),supportsUploadWithItemId:n(e,"supportsAttachmentsByUploadId",!1),supportsDeleteByAnonymous:n(t,"allowAnonymousToDelete",!0),supportsDeleteByOthers:n(t,"allowOthersToDelete",!0),supportsUpdateByAnonymous:n(t,"allowAnonymousToUpdate",!0),supportsUpdateByOthers:n(t,"allowOthersToUpdate",!0),supportsAsyncApplyEdits:n(r,"supportsAsyncApplyEdits",!1)}}},58333:(e,t,r)=>{r.d(t,{ET:()=>o,I4:()=>i,eG:()=>a,lF:()=>n,lj:()=>p,qP:()=>l,wW:()=>u});const s=[252,146,31,255],i={type:"esriSMS",style:"esriSMSCircle",size:6,color:s,outline:{type:"esriSLS",style:"esriSLSSolid",width:.75,color:[153,153,153,255]}},o={type:"esriSLS",style:"esriSLSSolid",width:.75,color:s},n={type:"esriSFS",style:"esriSFSSolid",color:[252,146,31,196],outline:{type:"esriSLS",style:"esriSLSSolid",width:.75,color:[255,255,255,191]}},l={type:"esriTS",color:[255,255,255,255],font:{family:"arial-unicode-ms",size:10,weight:"bold"},horizontalAlignment:"center",kerning:!0,haloColor:[0,0,0,255],haloSize:1,rotated:!1,text:"",xoffset:0,yoffset:0,angle:0},a={type:"esriSMS",style:"esriSMSCircle",color:[0,0,0,255],outline:null,size:10.5},u={type:"esriSLS",style:"esriSLSSolid",color:[0,0,0,255],width:1.5},p={type:"esriSFS",style:"esriSFSSolid",color:[0,0,0,255],outline:null}}}]);
|
package/interfaces.d.ts
CHANGED
|
@@ -20108,7 +20108,7 @@ declare namespace __esri {
|
|
|
20108
20108
|
maxObservations?: number;
|
|
20109
20109
|
}
|
|
20110
20110
|
|
|
20111
|
-
export interface SubtypeGroupLayer extends Layer, PortalLayer, ScaleRangeLayer, RefreshableLayer, TemporalLayer, BlendLayer, CustomParametersMixin, FeatureLayerBase {
|
|
20111
|
+
export interface SubtypeGroupLayer extends Layer, PortalLayer, ScaleRangeLayer, RefreshableLayer, TemporalLayer, BlendLayer, CustomParametersMixin, FeatureLayerBase, Clonable {
|
|
20112
20112
|
}
|
|
20113
20113
|
|
|
20114
20114
|
export class SubtypeGroupLayer {
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import r from"../core/Collection.js";import t from"../core/Error.js";import{loadAll as s}from"../core/loadAll.js";import{MultiOriginJSONMixin as i}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as o,whenOrAbort as a}from"../core/promiseUtils.js";import{watch as n,sync as u}from"../core/reactiveUtils.js";import{sqlAnd as l}from"../core/sql.js";import{urlToObject as p,join as y}from"../core/urlUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{reader as c}from"../core/accessorSupport/decorators/reader.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as m,nameToId as f}from"../core/accessorSupport/PropertyOrigin.js";import b from"./Layer.js";import{APIKeyMixin as g}from"./mixins/APIKeyMixin.js";import{ArcGISService as j}from"./mixins/ArcGISService.js";import{BlendLayer as v}from"./mixins/BlendLayer.js";import{CustomParametersMixin as w}from"./mixins/CustomParametersMixin.js";import{EditBusLayer as S}from"./mixins/EditBusLayer.js";import{FeatureLayerBase as L}from"./mixins/FeatureLayerBase.js";import{OperationalLayer as F}from"./mixins/OperationalLayer.js";import{PortalLayer as x}from"./mixins/PortalLayer.js";import{RefreshableLayer as C}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as _}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as I}from"./mixins/TemporalLayer.js";import{titleFromUrlAndName as P}from"./support/arcgisLayerUrl.js";import{id as E}from"./support/commonProperties.js";import{ensureLayerCredential as O,computeEffectiveEditingEnabled as T,addAttachment as U,updateAttachment as G,applyEdits as A,createQuery as q,deleteAttachments as $,fetchRecomputedExtents as M,queryAttachments as R,queryObjectIds as k,queryFeatureCount as N,queryExtent as Q,queryRelatedFeatures as D,queryRelatedFeaturesCount as H,hasDataChanged as V}from"./support/featureLayerUtils.js";import{defineFieldProperties as B}from"./support/fieldProperties.js";import{fixTimeInfoFields as J}from"./support/fieldUtils.js";import z from"./support/Subtype.js";import K from"./support/SubtypeSublayer.js";import Z from"./support/TimeInfo.js";import{serviceSupportsSpatialReference as W}from"./support/versionUtils.js";import X from"../rest/support/Query.js";const Y="SubtypeGroupLayer",ee="esri.layers.SubtypeGroupLayer";function re(e,r){return new t("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${r}`,{layer:e})}const te=B();let se=class extends(L(S(v(I(_(C(j(F(x(i(w(g(b))))))))))))){constructor(...e){super(...e),this._sublayersCollectionChanged=!1,this._sublayerLookup=new Map,this.fields=null,this.fieldsIndex=null,this.outFields=null,this.subtypes=null,this.sublayers=new(r.ofType(K)),this.timeInfo=null,this.title="Layer",this.type="subtype-group",this.addHandles(n((()=>this.sublayers),((e,r)=>this._handleSublayersChange(e,r)),u))}destroy(){this.source?.destroy()}normalizeCtorArgs(e,r){return"string"==typeof e?{url:e,...r}:e}load(e){const r=null!=e?e.signal:null,s=this.loadFromPortal({supportedTypes:["Feature Service"]},e).catch(o).then((async()=>{if(!this.url)throw new t("subtype-grouplayer:missing-url-or-source","SubtypeGroupLayer must be created with either a url or a portal item");if(null==this.layerId)throw new t("subtype-grouplayer:missing-layerid","layerId is required for a SubtypeGroupLayer created with url");return this._initLayerProperties(await this.createGraphicsSource(r))})).then((()=>O(this,"load",e)));return this.addResolvingPromise(s),Promise.resolve(this)}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return this.loaded&&null!=this.capabilities&&this.capabilities.operations.supportsEditing&&this.userHasEditingPrivileges}get effectiveEditingEnabled(){return T(this)}get parsedUrl(){const e=p(this.url);return null!=e&&null!=this.layerId&&(e.path=y(e.path,this.layerId.toString())),e}set source(e){this._get("source")!==e&&this._set("source",e)}readTitleFromService(e,{name:r}){return this.url?P(this.url,r):r}async addAttachment(e,r){return U(this,e,r,Y)}async updateAttachment(e,r,t){return G(this,e,r,t,Y)}async applyEdits(e,r){return A(this,e,r)}on(e,r){return super.on(e,r)}async createGraphicsSource(e){const{default:r}=await a(import("./graphics/sources/FeatureLayerSource.js"),e);return new r({layer:this}).load({signal:e})}createQuery(){const e=q(this),r=this.sublayers.map((e=>e.subtypeCode));return e.where=l(`${this.subtypeField} IN (${r.join(",")})`,this.definitionExpression),e}async deleteAttachments(e,r){return $(this,e,r,Y)}async fetchRecomputedExtents(e){return M(this,e,Y)}findSublayerForFeature(e){const r=this.fieldsIndex.get(this.subtypeField),t=e.attributes[r.name];return this.findSublayerForSubtypeCode(t)}findSublayerForSubtypeCode(e){return this._sublayerLookup.get(e)}getFieldDomain(e,r){return this._getLayerDomain(e)}getField(e){return this.fieldsIndex.get(e)}loadAll(){return s(this,(e=>{e(this.sublayers)}))}async queryAttachments(e,r){return R(this,e,r,Y)}async queryFeatures(e,r){const t=await this.load(),s=X.from(e)??t.createQuery(),i=s.outFields??[];i.includes(this.subtypeField)||(i.push(this.subtypeField),s.outFields=i);const o=await t.source.queryFeatures(s,r);if(o?.features)for(const a of o.features)a.layer=a.sourceLayer=this.findSublayerForFeature(a);return o}async queryObjectIds(e,r){return k(this,e,r,Y)}async queryFeatureCount(e,r){return N(this,e,r,Y)}async queryExtent(e,r){return Q(this,e,r,Y)}async queryRelatedFeatures(e,r){return D(this,e,r,Y)}async queryRelatedFeaturesCount(e,r){return H(this,e,r,Y)}async save(e){const{save:r}=await import("./save/featureLayerUtils.js");return r(this,e)}async saveAs(e,r){const{saveAs:t}=await import("./save/featureLayerUtils.js");return t(this,e,r)}write(e,r){const{origin:s,layerContainerType:i,messages:o}=r;if(this.isTable){if("web-scene"===s||"web-map"===s&&"tables"!==i)return o?.push(re(this,"using a table source cannot be written to web scenes and web maps")),null}else if(this.loaded&&"web-map"===s&&"tables"===i)return o?.push(re(this,"using a non-table source cannot be written to tables in web maps")),null;return this.sublayers?.length?super.write(e,r):(o?.push(new t("web-document-write:invalid-property",`Layer (${this.title}, ${this.id}) of type '${this.declaredClass}' has invalid value for 'sublayers' property. 'sublayers' collection should contain at least one sublayer`,{layer:this})),null)}serviceSupportsSpatialReference(e){return!!this.loaded&&W(this,e)}_getLayerDomain(e){const r=this.fieldsIndex.get(e);return r?r.domain:null}async _initLayerProperties(e){this._set("source",e);const{sourceJSON:r}=e;if(r&&(this.sourceJSON=r,this.read(r,{origin:"service",url:this.parsedUrl})),this.isTable)throw new t("subtype-grouplayer:unsupported-source","SubtypeGroupLayer cannot be created using a layer with table source");if(!this.subtypes?.length)throw new t("subtype-grouplayer:missing-subtypes","SubtypeGroupLayer must be created using a layer with subtypes");this._verifyFields(),J(this.timeInfo,this.fieldsIndex)}async hasDataChanged(){return V(this)}_verifyFields(){const e=this.parsedUrl?.path??"undefined";this.objectIdField||console.log("SubtypeGroupLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||-1!==e.search(/\/FeatureServer\//i)||this.fields?.some((e=>"geometry"===e.type))||console.log("SubtypeGroupLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_handleSublayersChange(e,r){r&&(r.forEach((e=>{e.parent=null})),this.removeHandles("sublayers-owner"),this._sublayerLookup.clear()),e&&(e.forEach((e=>{e.parent=this,this._sublayerLookup.set(e.subtypeCode,e)})),this._sublayersCollectionChanged=!1,this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this,this._sublayerLookup.set(e.subtypeCode,e)})),e.on("after-remove",(({item:e})=>{e.parent=null,this._sublayerLookup.delete(e.subtypeCode)})),e.on("after-changes",(()=>{this._sublayersCollectionChanged=!0}))],"sublayers-owner"))}};e([d({readOnly:!0})],se.prototype,"createQueryVersion",null),e([d({readOnly:!0})],se.prototype,"editingEnabled",null),e([d({readOnly:!0})],se.prototype,"effectiveEditingEnabled",null),e([d({...te.fields,readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],se.prototype,"fields",void 0),e([d(te.fieldsIndex)],se.prototype,"fieldsIndex",void 0),e([d(E)],se.prototype,"id",void 0),e([d({type:["show","hide","hide-children"]})],se.prototype,"listMode",void 0),e([d({value:"SubtypeGroupLayer",type:["SubtypeGroupLayer"],json:{origins:{"portal-item":{name:"layerType",write:{enabled:!0,ignoreOrigin:!0}}}}})],se.prototype,"operationalLayerType",void 0),e([d(te.outFields)],se.prototype,"outFields",void 0),e([d({readOnly:!0})],se.prototype,"parsedUrl",null),e([d()],se.prototype,"source",null),e([d({type:[z],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],se.prototype,"subtypes",void 0),e([d({type:r.ofType(K),json:{origins:{service:{read:{source:"subtypes",reader:(e,t,s)=>{const i=e.map((({code:e})=>{const r=new K({subtypeCode:e});return r.read(t,s),r}));return new(r.ofType(K))(i)}}}},name:"layers",write:{overridePolicy(e,r,t){const s=this.originOf("sublayers"),i=m.PORTAL_ITEM;let o=!0;if(f(s)===i&&f(t.origin)>i){const r=e.some((e=>e.hasUserOverrides()));o=this._sublayersCollectionChanged||r}return{enabled:o,ignoreOrigin:!0}}}}})],se.prototype,"sublayers",void 0),e([d({type:Z})],se.prototype,"timeInfo",void 0),e([d({json:{origins:{"portal-item":{write:{enabled:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}}}})],se.prototype,"title",void 0),e([c("service","title",["name"])],se.prototype,"readTitleFromService",null),e([d({json:{read:!1}})],se.prototype,"type",void 0),se=e([h(ee)],se);const ie=se;export{ie as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import{ClonableMixin as r}from"../core/Clonable.js";import t from"../core/Collection.js";import s from"../core/Error.js";import{loadAll as i}from"../core/loadAll.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as a,whenOrAbort as n}from"../core/promiseUtils.js";import{watch as u,sync as l}from"../core/reactiveUtils.js";import{sqlAnd as p}from"../core/sql.js";import{urlToObject as y,join as d}from"../core/urlUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{reader as h}from"../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as f,nameToId as b}from"../core/accessorSupport/PropertyOrigin.js";import g from"./Layer.js";import{APIKeyMixin as j}from"./mixins/APIKeyMixin.js";import{ArcGISService as v}from"./mixins/ArcGISService.js";import{BlendLayer as w}from"./mixins/BlendLayer.js";import{CustomParametersMixin as S}from"./mixins/CustomParametersMixin.js";import{EditBusLayer as L}from"./mixins/EditBusLayer.js";import{FeatureLayerBase as F}from"./mixins/FeatureLayerBase.js";import{OperationalLayer as x}from"./mixins/OperationalLayer.js";import{PortalLayer as C}from"./mixins/PortalLayer.js";import{RefreshableLayer as _}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as I}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as P}from"./mixins/TemporalLayer.js";import{titleFromUrlAndName as E}from"./support/arcgisLayerUrl.js";import{id as O}from"./support/commonProperties.js";import{ensureLayerCredential as T,computeEffectiveEditingEnabled as U,addAttachment as G,updateAttachment as A,applyEdits as q,createQuery as $,deleteAttachments as M,fetchRecomputedExtents as R,queryAttachments as k,queryObjectIds as N,queryFeatureCount as Q,queryExtent as D,queryRelatedFeatures as H,queryRelatedFeaturesCount as V,hasDataChanged as B}from"./support/featureLayerUtils.js";import{defineFieldProperties as J}from"./support/fieldProperties.js";import{fixTimeInfoFields as z}from"./support/fieldUtils.js";import K from"./support/Subtype.js";import Z from"./support/SubtypeSublayer.js";import W from"./support/TimeInfo.js";import{serviceSupportsSpatialReference as X}from"./support/versionUtils.js";import Y from"../rest/support/Query.js";const ee="SubtypeGroupLayer",re="esri.layers.SubtypeGroupLayer";function te(e,r){return new s("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${r}`,{layer:e})}const se=J();let ie=class extends(F(L(w(P(I(_(v(x(C(o(S(j(r(g)))))))))))))){constructor(...e){super(...e),this._sublayersCollectionChanged=!1,this._sublayerLookup=new Map,this.fields=null,this.fieldsIndex=null,this.outFields=null,this.subtypes=null,this.sublayers=new(t.ofType(Z)),this.timeInfo=null,this.title="Layer",this.type="subtype-group",this.addHandles(u((()=>this.sublayers),((e,r)=>this._handleSublayersChange(e,r)),l))}destroy(){this.source?.destroy()}normalizeCtorArgs(e,r){return"string"==typeof e?{url:e,...r}:e}load(e){const r=null!=e?e.signal:null,t=this.loadFromPortal({supportedTypes:["Feature Service"]},e).catch(a).then((async()=>{if(!this.url)throw new s("subtype-grouplayer:missing-url-or-source","SubtypeGroupLayer must be created with either a url or a portal item");if(null==this.layerId)throw new s("subtype-grouplayer:missing-layerid","layerId is required for a SubtypeGroupLayer created with url");return this._initLayerProperties(await this.createGraphicsSource(r))})).then((()=>T(this,"load",e)));return this.addResolvingPromise(t),Promise.resolve(this)}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return this.loaded&&null!=this.capabilities&&this.capabilities.operations.supportsEditing&&this.userHasEditingPrivileges}get effectiveEditingEnabled(){return U(this)}get parsedUrl(){const e=y(this.url);return null!=e&&null!=this.layerId&&(e.path=d(e.path,this.layerId.toString())),e}set source(e){this._get("source")!==e&&this._set("source",e)}readTitleFromService(e,{name:r}){return this.url?E(this.url,r):r}async addAttachment(e,r){return G(this,e,r,ee)}async updateAttachment(e,r,t){return A(this,e,r,t,ee)}async applyEdits(e,r){return q(this,e,r)}on(e,r){return super.on(e,r)}async createGraphicsSource(e){const{default:r}=await n(import("./graphics/sources/FeatureLayerSource.js"),e);return new r({layer:this}).load({signal:e})}createQuery(){const e=$(this),r=this.sublayers.map((e=>e.subtypeCode));return e.where=p(`${this.subtypeField} IN (${r.join(",")})`,this.definitionExpression),e}async deleteAttachments(e,r){return M(this,e,r,ee)}async fetchRecomputedExtents(e){return R(this,e,ee)}findSublayerForFeature(e){const r=this.fieldsIndex.get(this.subtypeField),t=e.attributes[r.name];return this.findSublayerForSubtypeCode(t)}findSublayerForSubtypeCode(e){return this._sublayerLookup.get(e)}getFieldDomain(e,r){return this._getLayerDomain(e)}getField(e){return this.fieldsIndex.get(e)}loadAll(){return i(this,(e=>{e(this.sublayers)}))}async queryAttachments(e,r){return k(this,e,r,ee)}async queryFeatures(e,r){const t=await this.load(),s=Y.from(e)??t.createQuery(),i=s.outFields??[];i.includes(this.subtypeField)||(i.push(this.subtypeField),s.outFields=i);const o=await t.source.queryFeatures(s,r);if(o?.features)for(const a of o.features)a.layer=a.sourceLayer=this.findSublayerForFeature(a);return o}async queryObjectIds(e,r){return N(this,e,r,ee)}async queryFeatureCount(e,r){return Q(this,e,r,ee)}async queryExtent(e,r){return D(this,e,r,ee)}async queryRelatedFeatures(e,r){return H(this,e,r,ee)}async queryRelatedFeaturesCount(e,r){return V(this,e,r,ee)}async save(e){const{save:r}=await import("./save/featureLayerUtils.js");return r(this,e)}async saveAs(e,r){const{saveAs:t}=await import("./save/featureLayerUtils.js");return t(this,e,r)}write(e,r){const{origin:t,layerContainerType:i,messages:o}=r;if(this.isTable){if("web-scene"===t||"web-map"===t&&"tables"!==i)return o?.push(te(this,"using a table source cannot be written to web scenes and web maps")),null}else if(this.loaded&&"web-map"===t&&"tables"===i)return o?.push(te(this,"using a non-table source cannot be written to tables in web maps")),null;return this.sublayers?.length?super.write(e,r):(o?.push(new s("web-document-write:invalid-property",`Layer (${this.title}, ${this.id}) of type '${this.declaredClass}' has invalid value for 'sublayers' property. 'sublayers' collection should contain at least one sublayer`,{layer:this})),null)}serviceSupportsSpatialReference(e){return!!this.loaded&&X(this,e)}_getLayerDomain(e){const r=this.fieldsIndex.get(e);return r?r.domain:null}async _initLayerProperties(e){this._set("source",e);const{sourceJSON:r}=e;if(r&&(this.sourceJSON=r,this.read(r,{origin:"service",url:this.parsedUrl})),this.isTable)throw new s("subtype-grouplayer:unsupported-source","SubtypeGroupLayer cannot be created using a layer with table source");if(!this.subtypes?.length)throw new s("subtype-grouplayer:missing-subtypes","SubtypeGroupLayer must be created using a layer with subtypes");this._verifyFields(),z(this.timeInfo,this.fieldsIndex)}async hasDataChanged(){return B(this)}_verifyFields(){const e=this.parsedUrl?.path??"undefined";this.objectIdField||console.log("SubtypeGroupLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||-1!==e.search(/\/FeatureServer\//i)||this.fields?.some((e=>"geometry"===e.type))||console.log("SubtypeGroupLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_handleSublayersChange(e,r){r&&(r.forEach((e=>{e.parent=null})),this.removeHandles("sublayers-owner"),this._sublayerLookup.clear()),e&&(e.forEach((e=>{e.parent=this,this._sublayerLookup.set(e.subtypeCode,e)})),this._sublayersCollectionChanged=!1,this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this,this._sublayerLookup.set(e.subtypeCode,e)})),e.on("after-remove",(({item:e})=>{e.parent=null,this._sublayerLookup.delete(e.subtypeCode)})),e.on("after-changes",(()=>{this._sublayersCollectionChanged=!0}))],"sublayers-owner"))}};e([c({readOnly:!0})],ie.prototype,"createQueryVersion",null),e([c({readOnly:!0})],ie.prototype,"editingEnabled",null),e([c({readOnly:!0})],ie.prototype,"effectiveEditingEnabled",null),e([c({...se.fields,readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],ie.prototype,"fields",void 0),e([c(se.fieldsIndex)],ie.prototype,"fieldsIndex",void 0),e([c(O)],ie.prototype,"id",void 0),e([c({type:["show","hide","hide-children"]})],ie.prototype,"listMode",void 0),e([c({value:"SubtypeGroupLayer",type:["SubtypeGroupLayer"],json:{origins:{"portal-item":{name:"layerType",write:{enabled:!0,ignoreOrigin:!0}}}}})],ie.prototype,"operationalLayerType",void 0),e([c(se.outFields)],ie.prototype,"outFields",void 0),e([c({readOnly:!0})],ie.prototype,"parsedUrl",null),e([c({clonable:!1})],ie.prototype,"source",null),e([c({type:[K],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],ie.prototype,"subtypes",void 0),e([c({type:t.ofType(Z),json:{origins:{service:{read:{source:"subtypes",reader:(e,r,s)=>{const i=e.map((({code:e})=>{const t=new Z({subtypeCode:e});return t.read(r,s),t}));return new(t.ofType(Z))(i)}}}},name:"layers",write:{overridePolicy(e,r,t){const s=this.originOf("sublayers"),i=f.PORTAL_ITEM;let o=!0;if(b(s)===i&&b(t.origin)>i){const r=e.some((e=>e.hasUserOverrides()));o=this._sublayersCollectionChanged||r}return{enabled:o,ignoreOrigin:!0}}}}})],ie.prototype,"sublayers",void 0),e([c({type:W})],ie.prototype,"timeInfo",void 0),e([c({json:{origins:{"portal-item":{write:{enabled:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}}}})],ie.prototype,"title",void 0),e([h("service","title",["name"])],ie.prototype,"readTitleFromService",null),e([c({json:{read:!1}})],ie.prototype,"type",void 0),ie=e([m(re)],ie);const oe=ie;export{oe as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as o}from"../../chunks/tslib.es6.js";import{
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import{ClonableMixin as r}from"../../core/Clonable.js";import{JSONSupport as t}from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{reader as e}from"../../core/accessorSupport/decorators/reader.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{writer as i}from"../../core/accessorSupport/decorators/writer.js";import{fromJSON as a}from"./domains.js";let c=class extends(r(t)){constructor(){super(...arguments),this.code=null,this.defaultValues={},this.domains=null,this.name=null}readDomains(o){if(!o)return null;const r={};for(const t of Object.keys(o))r[t]=a(o[t]);return r}writeDomains(o,r){if(!o)return;const t={};for(const s of Object.keys(o))o[s]&&(t[s]=o[s]?.toJSON());r.domains=t}};o([s({type:Number,json:{write:!0}})],c.prototype,"code",void 0),o([s({type:Object,json:{write:!0}})],c.prototype,"defaultValues",void 0),o([s({json:{write:!0}})],c.prototype,"domains",void 0),o([e("domains")],c.prototype,"readDomains",null),o([i("domains")],c.prototype,"writeDomains",null),o([s({type:String,json:{write:!0}})],c.prototype,"name",void 0),c=o([p("esri.layers.support.Subtype")],c);const n=c;export{n as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../PopupTemplate.js";import r from"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import i from"../../renderers/Renderer.js";import o from"../../renderers/SimpleRenderer.js";import n from"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import s from"../../core/Logger.js";import"../../core/has.js";import l from"../../core/Error.js";import{IdentifiableMixin as a}from"../../core/Identifiable.js";import{clone as p}from"../../core/lang.js";import d from"../../core/Loadable.js";import{MultiOriginJSONMixin as u}from"../../core/MultiOriginJSONSupport.js";import{setDeepValue as y}from"../../core/object.js";import{sqlAnd as c}from"../../core/sql.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{reader as f}from"../../core/accessorSupport/decorators/reader.js";import{subclass as b}from"../../core/accessorSupport/decorators/subclass.js";import{writer as h}from"../../core/accessorSupport/decorators/writer.js";import{OriginId as g}from"../../core/accessorSupport/PropertyOrigin.js";import{createTypeReader as v}from"../../core/accessorSupport/extensions/serializableProperty/reader.js";import j from"../../form/FormTemplate.js";import{labelsVisible as w,legendEnabled as O,minScale as S,maxScale as I,popupEnabled as F}from"./commonProperties.js";import{createQuery as T}from"./featureLayerUtils.js";import E from"./FeatureTemplate.js";import{defineFieldProperties as C}from"./fieldProperties.js";import{fixRendererFields as A}from"./fieldUtils.js";import x from"./LabelClass.js";import{reader as R}from"./labelingInfo.js";import P from"../../rest/support/Query.js";import{createPopupTemplate as D}from"../../support/popupUtils.js";import{defaultPolygonSymbol2D as L,defaultPolylineSymbol2D as q,defaultPointSymbol2D as U}from"../../symbols/support/defaults.js";const V=["charts","editingEnabled","formTemplate","labelsVisible","labelingInfo","legendEnabled","minScale","maxScale","opacity","popupEnabled","popupTemplate","renderer","subtypeCode","templates","title","visible"],G={key:"type",base:i,errorContext:"renderer",typeMap:{simple:o,"unique-value":n,"class-breaks":r}},N=C(),$=v({types:G});let k=0;function M(e){const t=e.json.write;return"object"==typeof t?t.ignoreOrigin=!0:e.json.write={ignoreOrigin:!0},e}function _(e){return new o({symbol:B(e)})}function B(e){switch(e){case"point":case"multipoint":return U.clone();case"polyline":return q.clone();case"polygon":case"multipatch":return L.clone();default:return null}}function H(e,t){return!!t&&("unique-value"===e?.type&&"string"==typeof e.field&&e.field.toLowerCase()===t.toLowerCase()&&!e.field2&&!e.field3&&!e.valueExpression)}function Q(e,t){return null==e?null:t.subtypes?.find((t=>t.code===e))}function z(e,t){let r=null;switch(t.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":r="point";break;case"esriGeometryPolyline":r="line";break;case"esriGeometryPolygon":case"esriGeometryMultiPatch":r="polygon";break;default:t.type,r=null}const i={},o=Q(e,t);if(null!=o){const{defaultValues:e}=o;for(const t in e)i[t]=e[t]}return i[t.subtypeField]=e,new E({name:"New Feature",drawingTool:r,prototype:{attributes:i}})}const J="esri.layers.support.SubtypeSublayer";let K=class extends(u(a(d))){constructor(e){super(e),this.charts=null,this.editingEnabled=!0,this.fieldOverrides=null,this.fieldsIndex=null,this.formTemplate=null,this.id=`${Date.now().toString(16)}-subtype-sublayer-${k++}`,this.type="subtype-sublayer",this.labelsVisible=!0,this.labelingInfo=null,this.layerType="ArcGISFeatureLayer",this.legendEnabled=!0,this.listMode="show",this.minScale=0,this.maxScale=0,this.opacity=1,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.subtypeCode=null,this.templates=null,this.title=null,this.visible=!0}get capabilities(){return this.parent?.capabilities}get effectiveCapabilities(){return this.parent?.effectiveCapabilities}get effectiveEditingEnabled(){const{parent:e}=this;return e?e.effectiveEditingEnabled&&this.editingEnabled:this.editingEnabled}get elevationInfo(){return this.parent?.elevationInfo}writeFieldOverrides(e,t,r){const{fields:i,parent:o}=this;let n;if(i){n=[];let e=0;i.forEach((({name:t,alias:r,editable:i,visible:s})=>{if(!s)return;const l=o?.fields?.find((e=>e.name===t));if(!l)return;const a={name:t};let p=!1;r!==l.alias&&(a.alias=r,p=!0),i!==l.editable&&(a.editable=i,p=!0),n.push(a),p&&e++})),0===e&&n.length===i.length&&(n=null)}else n=p(e);n?.length&&y(r,n,t)}get fields(){const{parent:e,fieldOverrides:t,subtypeCode:r}=this,i=e?.fields;if(!e||!i?.length)return null;const{subtypes:o,subtypeField:n}=e,s=o?.find((e=>e.code===r)),l=s?.defaultValues,a=s?.domains,p=[];for(const d of i){const e=d.clone(),{name:i}=e,o=t?.find((e=>e.name===i));if(e.visible=!t||!!o,o){const{alias:t,editable:r}=o;t&&(e.alias=t),!1===r&&(e.editable=!1)}const s=l?.[i]??null;e.defaultValue=i===n?r:s;const u=a?.[i]??null;e.domain=i===n?null:u?"inherited"===u.type?e.domain:u.clone():null,p.push(e)}return p}get floorInfo(){return this.parent?.floorInfo}get geometryType(){return this.parent?.geometryType}get effectiveScaleRange(){const{minScale:e,maxScale:t}=this;return{minScale:e,maxScale:t}}get objectIdField(){return this.parent||s.getLogger(J).error(X("objectIdField")),this.parent?.objectIdField}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){A(e,this.fieldsIndex),this._override("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const{parent:e}=this;return e&&!e.isTable&&"mesh"!==e.geometryType?_(e.geometryType):null}readRendererFromService(e,t,r){if("Table"===t.type)return null;const i=t.drawingInfo?.renderer,n=$(i,t,r);let s;const{subtypeCode:l}=this;if(null!=l&&H(n,t.subtypeField)){const e=n.uniqueValueInfos?.find((({value:e})=>(e="number"==typeof e?String(e):e)===String(l)));e&&(s=new o({symbol:e.symbol}))}else"simple"!==n?.type||n.visualVariables?.length||(s=n);return s}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer;if(!i)return;const o=i.visualVariables?.some((e=>"rotationInfo"!==e.type));return o?void 0:$(i,t,r)||void 0}get spatialReference(){return this.parent?.spatialReference}readTemplatesFromService(e,t){return[z(this.subtypeCode,t)]}readTitleFromService(e,t){const r=Q(this.subtypeCode,t);return null!=r?r.name:null}get url(){return this.parent?.url}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}async addAttachment(e,t){const{parent:r}=this;if(!r)throw X("addAttachment");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new l("subtype-sublayer:addAttachment","The feature provided does not belong to this SubtypeSublayer");return r.addAttachment(e,t)}async updateAttachment(e,t,r){const{parent:i}=this;if(!i)throw X("updateAttachment");if(e.getAttribute(i.subtypeField)!==this.subtypeCode)throw new l("subtype-sublayer:updateAttachment","The feature provided does not belong to this SubtypeSublayer");return i.updateAttachment(e,t,r)}async deleteAttachments(e,t){const{parent:r}=this;if(!r)throw X("deleteAttachments");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new l("subtype-sublayer:deleteAttachments","The feature provided does not belong to this SubtypeSublayer");return r.deleteAttachments(e,t)}async applyEdits(e,t){if(!this.parent)throw X("applyEdits");return this.parent.applyEdits(e,t)}createPopupTemplate(e){let t=this;const{parent:r,fields:i,title:o}=this;if(r){const{displayField:e,editFieldsInfo:n,objectIdField:s}=r;t={displayField:e,editFieldsInfo:n,fields:i,objectIdField:s,title:o}}return D(t,e)}createQuery(){if(!this.parent)throw X("createQuery");const e=T(this.parent),t=`${this.parent.subtypeField}=${this.subtypeCode}`;return e.where=c(t,this.parent.definitionExpression),e}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e){return this._getLayerDomain(e)}hasUserOverrides(){return V.some((e=>this.originIdOf(e)===g.USER))}async queryAttachments(e,t){const r=await this.load();if(!r.parent)throw X("queryAttachments");const i=e.clone();return i.where=W(i.where,r.parent.subtypeField,r.subtypeCode),r.parent.queryAttachments(e,t)}async queryFeatures(e,t){const r=await this.load();if(!r.parent)throw X("queryFeatures");const i=P.from(e)??r.createQuery();return null!=e&&(i.where=W(i.where,r.parent.subtypeField,r.subtypeCode)),r.parent.queryFeatures(i,t)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}};e([m({readOnly:!0,json:{read:!1}})],K.prototype,"capabilities",null),e([m({readOnly:!0,json:{read:!1}})],K.prototype,"effectiveCapabilities",null),e([m({json:{write:{ignoreOrigin:!0}}})],K.prototype,"charts",void 0),e([m({type:Boolean,nonNullable:!0,json:{name:"enableEditing",write:{ignoreOrigin:!0}}})],K.prototype,"editingEnabled",void 0),e([m({type:Boolean,readOnly:!0})],K.prototype,"effectiveEditingEnabled",null),e([m({readOnly:!0,json:{read:!1}})],K.prototype,"elevationInfo",null),e([m({readOnly:!0,json:{name:"layerDefinition.fieldOverrides",origins:{service:{read:!1}},write:{ignoreOrigin:!0,allowNull:!0}}})],K.prototype,"fieldOverrides",void 0),e([h("fieldOverrides")],K.prototype,"writeFieldOverrides",null),e([m({...N.fields,readOnly:!0,json:{read:!1}})],K.prototype,"fields",null),e([m(N.fieldsIndex)],K.prototype,"fieldsIndex",void 0),e([m({readOnly:!0,json:{read:!1}})],K.prototype,"floorInfo",null),e([m({type:j,json:{name:"formInfo",write:{ignoreOrigin:!0}}})],K.prototype,"formTemplate",void 0),e([m({type:String,readOnly:!0,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],K.prototype,"id",void 0),e([m({readOnly:!0,json:{read:!1}})],K.prototype,"geometryType",null),e([m({readOnly:!0,json:{read:!1}})],K.prototype,"type",void 0),e([m(M(p(w)))],K.prototype,"labelsVisible",void 0),e([m({type:[x],json:{name:"layerDefinition.drawingInfo.labelingInfo",origins:{service:{read:!1}},read:{reader:R},write:{ignoreOrigin:!0}}})],K.prototype,"labelingInfo",void 0),e([m({type:["ArcGISFeatureLayer"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0}}})],K.prototype,"layerType",void 0),e([m(M(p(O)))],K.prototype,"legendEnabled",void 0),e([m({type:["show","hide"]})],K.prototype,"listMode",void 0),e([m((()=>{const e=p(S);return e.json.origins.service.read=!1,M(e)})())],K.prototype,"minScale",void 0),e([m((()=>{const e=p(I);return e.json.origins.service.read=!1,M(e)})())],K.prototype,"maxScale",void 0),e([m({readOnly:!0})],K.prototype,"effectiveScaleRange",null),e([m({readOnly:!0,json:{read:!1}})],K.prototype,"objectIdField",null),e([m({type:Number,range:{min:0,max:1},nonNullable:!0,json:{write:{ignoreOrigin:!0}}})],K.prototype,"opacity",void 0),e([m()],K.prototype,"parent",void 0),e([m(M(p(F)))],K.prototype,"popupEnabled",void 0),e([m({type:t,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],K.prototype,"popupTemplate",void 0),e([m({readOnly:!0})],K.prototype,"defaultPopupTemplate",null),e([m({types:G,json:{write:{target:"layerDefinition.drawingInfo.renderer",ignoreOrigin:!0}}})],K.prototype,"renderer",null),e([f("service","renderer",["drawingInfo.renderer","subtypeField","type"])],K.prototype,"readRendererFromService",null),e([f("renderer",["layerDefinition.drawingInfo.renderer"])],K.prototype,"readRenderer",null),e([m({readOnly:!0,json:{read:!1}})],K.prototype,"spatialReference",null),e([m({type:Number,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],K.prototype,"subtypeCode",void 0),e([m({type:[E],json:{name:"layerDefinition.templates",write:{ignoreOrigin:!0}}})],K.prototype,"templates",void 0),e([f("service","templates",["geometryType","subtypeField","subtypes","type"])],K.prototype,"readTemplatesFromService",null),e([m({type:String,json:{write:{ignoreOrigin:!0}}})],K.prototype,"title",void 0),e([f("service","title",["subtypes"])],K.prototype,"readTitleFromService",null),e([m({readOnly:!0,json:{read:!1}})],K.prototype,"url",null),e([m({readOnly:!0})],K.prototype,"userHasUpdateItemPrivileges",null),e([m({type:Boolean,nonNullable:!0,json:{name:"visibility",write:{ignoreOrigin:!0}}})],K.prototype,"visible",void 0),K=e([b(J)],K);const W=(e,t,r)=>{const i=new RegExp(`${t}\\s*=\\s*\\d+`),o=`${t}=${r}`,n=e??"";return i.test(n)?n.replace(i,o):c(o,n)},X=e=>new l(`This sublayer must have a parent SubtypeGroupLayer in order to use ${e}`),Y=K;export{Y as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../PopupTemplate.js";import r from"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import i from"../../renderers/Renderer.js";import o from"../../renderers/SimpleRenderer.js";import n from"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import s from"../../core/Logger.js";import{ClonableMixin as l}from"../../core/Clonable.js";import"../../core/has.js";import a from"../../core/Error.js";import{IdentifiableMixin as p}from"../../core/Identifiable.js";import{clone as d}from"../../core/lang.js";import u from"../../core/Loadable.js";import{MultiOriginJSONMixin as y}from"../../core/MultiOriginJSONSupport.js";import{setDeepValue as c}from"../../core/object.js";import{sqlAnd as m}from"../../core/sql.js";import{property as f}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{reader as b}from"../../core/accessorSupport/decorators/reader.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{writer as g}from"../../core/accessorSupport/decorators/writer.js";import{OriginId as v}from"../../core/accessorSupport/PropertyOrigin.js";import{createTypeReader as j}from"../../core/accessorSupport/extensions/serializableProperty/reader.js";import w from"../../form/FormTemplate.js";import{labelsVisible as O,legendEnabled as S,minScale as I,maxScale as F,popupEnabled as T}from"./commonProperties.js";import{createQuery as E}from"./featureLayerUtils.js";import C from"./FeatureTemplate.js";import{defineFieldProperties as A}from"./fieldProperties.js";import{fixRendererFields as x}from"./fieldUtils.js";import R from"./LabelClass.js";import{reader as P}from"./labelingInfo.js";import D from"../../rest/support/Query.js";import{createPopupTemplate as L}from"../../support/popupUtils.js";import{defaultPolygonSymbol2D as q,defaultPolylineSymbol2D as U,defaultPointSymbol2D as V}from"../../symbols/support/defaults.js";const G=["charts","editingEnabled","formTemplate","labelsVisible","labelingInfo","legendEnabled","minScale","maxScale","opacity","popupEnabled","popupTemplate","renderer","subtypeCode","templates","title","visible"],N={key:"type",base:i,errorContext:"renderer",typeMap:{simple:o,"unique-value":n,"class-breaks":r}},$=A(),k=j({types:N});let M=0;function _(e){const t=e.json.write;return"object"==typeof t?t.ignoreOrigin=!0:e.json.write={ignoreOrigin:!0},e}function B(e){return new o({symbol:H(e)})}function H(e){switch(e){case"point":case"multipoint":return V.clone();case"polyline":return U.clone();case"polygon":case"multipatch":return q.clone();default:return null}}function Q(e,t){return!!t&&("unique-value"===e?.type&&"string"==typeof e.field&&e.field.toLowerCase()===t.toLowerCase()&&!e.field2&&!e.field3&&!e.valueExpression)}function z(e,t){return null==e?null:t.subtypes?.find((t=>t.code===e))}function J(e,t){let r=null;switch(t.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":r="point";break;case"esriGeometryPolyline":r="line";break;case"esriGeometryPolygon":case"esriGeometryMultiPatch":r="polygon";break;default:t.type,r=null}const i={},o=z(e,t);if(null!=o){const{defaultValues:e}=o;for(const t in e)i[t]=e[t]}return i[t.subtypeField]=e,new C({name:"New Feature",drawingTool:r,prototype:{attributes:i}})}const K="esri.layers.support.SubtypeSublayer";let W=class extends(y(l(p(u)))){constructor(e){super(e),this.charts=null,this.editingEnabled=!0,this.fieldOverrides=null,this.fieldsIndex=null,this.formTemplate=null,this.id=`${Date.now().toString(16)}-subtype-sublayer-${M++}`,this.type="subtype-sublayer",this.labelsVisible=!0,this.labelingInfo=null,this.layerType="ArcGISFeatureLayer",this.legendEnabled=!0,this.listMode="show",this.minScale=0,this.maxScale=0,this.opacity=1,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.subtypeCode=null,this.templates=null,this.title=null,this.visible=!0}get capabilities(){return this.parent?.capabilities}get effectiveCapabilities(){return this.parent?.effectiveCapabilities}get effectiveEditingEnabled(){const{parent:e}=this;return e?e.effectiveEditingEnabled&&this.editingEnabled:this.editingEnabled}get elevationInfo(){return this.parent?.elevationInfo}writeFieldOverrides(e,t,r){const{fields:i,parent:o}=this;let n;if(i){n=[];let e=0;i.forEach((({name:t,alias:r,editable:i,visible:s})=>{if(!s)return;const l=o?.fields?.find((e=>e.name===t));if(!l)return;const a={name:t};let p=!1;r!==l.alias&&(a.alias=r,p=!0),i!==l.editable&&(a.editable=i,p=!0),n.push(a),p&&e++})),0===e&&n.length===i.length&&(n=null)}else n=d(e);n?.length&&c(r,n,t)}get fields(){const{parent:e,fieldOverrides:t,subtypeCode:r}=this,i=e?.fields;if(!e||!i?.length)return null;const{subtypes:o,subtypeField:n}=e,s=o?.find((e=>e.code===r)),l=s?.defaultValues,a=s?.domains,p=[];for(const d of i){const e=d.clone(),{name:i}=e,o=t?.find((e=>e.name===i));if(e.visible=!t||!!o,o){const{alias:t,editable:r}=o;t&&(e.alias=t),!1===r&&(e.editable=!1)}const s=l?.[i]??null;e.defaultValue=i===n?r:s;const u=a?.[i]??null;e.domain=i===n?null:u?"inherited"===u.type?e.domain:u.clone():null,p.push(e)}return p}get floorInfo(){return this.parent?.floorInfo}get geometryType(){return this.parent?.geometryType}get effectiveScaleRange(){const{minScale:e,maxScale:t}=this;return{minScale:e,maxScale:t}}get objectIdField(){return this.parent||s.getLogger(K).error(Y("objectIdField")),this.parent?.objectIdField}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){x(e,this.fieldsIndex),this._override("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const{parent:e}=this;return e&&!e.isTable&&"mesh"!==e.geometryType?B(e.geometryType):null}readRendererFromService(e,t,r){if("Table"===t.type)return null;const i=t.drawingInfo?.renderer,n=k(i,t,r);let s;const{subtypeCode:l}=this;if(null!=l&&Q(n,t.subtypeField)){const e=n.uniqueValueInfos?.find((({value:e})=>(e="number"==typeof e?String(e):e)===String(l)));e&&(s=new o({symbol:e.symbol}))}else"simple"!==n?.type||n.visualVariables?.length||(s=n);return s}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer;if(!i)return;const o=i.visualVariables?.some((e=>"rotationInfo"!==e.type));return o?void 0:k(i,t,r)||void 0}get spatialReference(){return this.parent?.spatialReference}readTemplatesFromService(e,t){return[J(this.subtypeCode,t)]}readTitleFromService(e,t){const r=z(this.subtypeCode,t);return null!=r?r.name:null}get url(){return this.parent?.url}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}async addAttachment(e,t){const{parent:r}=this;if(!r)throw Y("addAttachment");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new a("subtype-sublayer:addAttachment","The feature provided does not belong to this SubtypeSublayer");return r.addAttachment(e,t)}async updateAttachment(e,t,r){const{parent:i}=this;if(!i)throw Y("updateAttachment");if(e.getAttribute(i.subtypeField)!==this.subtypeCode)throw new a("subtype-sublayer:updateAttachment","The feature provided does not belong to this SubtypeSublayer");return i.updateAttachment(e,t,r)}async deleteAttachments(e,t){const{parent:r}=this;if(!r)throw Y("deleteAttachments");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new a("subtype-sublayer:deleteAttachments","The feature provided does not belong to this SubtypeSublayer");return r.deleteAttachments(e,t)}async applyEdits(e,t){if(!this.parent)throw Y("applyEdits");return this.parent.applyEdits(e,t)}createPopupTemplate(e){let t=this;const{parent:r,fields:i,title:o}=this;if(r){const{displayField:e,editFieldsInfo:n,objectIdField:s}=r;t={displayField:e,editFieldsInfo:n,fields:i,objectIdField:s,title:o}}return L(t,e)}createQuery(){if(!this.parent)throw Y("createQuery");const e=E(this.parent),t=`${this.parent.subtypeField}=${this.subtypeCode}`;return e.where=m(t,this.parent.definitionExpression),e}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e){return this._getLayerDomain(e)}hasUserOverrides(){return G.some((e=>this.originIdOf(e)===v.USER))}async queryAttachments(e,t){const r=await this.load();if(!r.parent)throw Y("queryAttachments");const i=e.clone();return i.where=X(i.where,r.parent.subtypeField,r.subtypeCode),r.parent.queryAttachments(e,t)}async queryFeatures(e,t){const r=await this.load();if(!r.parent)throw Y("queryFeatures");const i=D.from(e)??r.createQuery();return null!=e&&(i.where=X(i.where,r.parent.subtypeField,r.subtypeCode)),r.parent.queryFeatures(i,t)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}};e([f({readOnly:!0,json:{read:!1}})],W.prototype,"capabilities",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"effectiveCapabilities",null),e([f({json:{write:{ignoreOrigin:!0}}})],W.prototype,"charts",void 0),e([f({type:Boolean,nonNullable:!0,json:{name:"enableEditing",write:{ignoreOrigin:!0}}})],W.prototype,"editingEnabled",void 0),e([f({type:Boolean,readOnly:!0})],W.prototype,"effectiveEditingEnabled",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"elevationInfo",null),e([f({json:{name:"layerDefinition.fieldOverrides",origins:{service:{read:!1}},write:{ignoreOrigin:!0,allowNull:!0}}})],W.prototype,"fieldOverrides",void 0),e([g("fieldOverrides")],W.prototype,"writeFieldOverrides",null),e([f({...$.fields,readOnly:!0,json:{read:!1}})],W.prototype,"fields",null),e([f($.fieldsIndex)],W.prototype,"fieldsIndex",void 0),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"floorInfo",null),e([f({type:w,json:{name:"formInfo",write:{ignoreOrigin:!0}}})],W.prototype,"formTemplate",void 0),e([f({type:String,clonable:!1,readOnly:!0,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],W.prototype,"id",void 0),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"geometryType",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"type",void 0),e([f(_(d(O)))],W.prototype,"labelsVisible",void 0),e([f({type:[R],json:{name:"layerDefinition.drawingInfo.labelingInfo",origins:{service:{read:!1}},read:{reader:P},write:{ignoreOrigin:!0}}})],W.prototype,"labelingInfo",void 0),e([f({type:["ArcGISFeatureLayer"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0}}})],W.prototype,"layerType",void 0),e([f(_(d(S)))],W.prototype,"legendEnabled",void 0),e([f({type:["show","hide"]})],W.prototype,"listMode",void 0),e([f((()=>{const e=d(I);return e.json.origins.service.read=!1,_(e)})())],W.prototype,"minScale",void 0),e([f((()=>{const e=d(F);return e.json.origins.service.read=!1,_(e)})())],W.prototype,"maxScale",void 0),e([f({readOnly:!0})],W.prototype,"effectiveScaleRange",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"objectIdField",null),e([f({type:Number,range:{min:0,max:1},nonNullable:!0,json:{write:{ignoreOrigin:!0}}})],W.prototype,"opacity",void 0),e([f({clonable:!1})],W.prototype,"parent",void 0),e([f(_(d(T)))],W.prototype,"popupEnabled",void 0),e([f({type:t,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],W.prototype,"popupTemplate",void 0),e([f({readOnly:!0})],W.prototype,"defaultPopupTemplate",null),e([f({types:N,json:{write:{target:"layerDefinition.drawingInfo.renderer",ignoreOrigin:!0}}})],W.prototype,"renderer",null),e([b("service","renderer",["drawingInfo.renderer","subtypeField","type"])],W.prototype,"readRendererFromService",null),e([b("renderer",["layerDefinition.drawingInfo.renderer"])],W.prototype,"readRenderer",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"spatialReference",null),e([f({type:Number,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],W.prototype,"subtypeCode",void 0),e([f({type:[C],json:{name:"layerDefinition.templates",write:{ignoreOrigin:!0}}})],W.prototype,"templates",void 0),e([b("service","templates",["geometryType","subtypeField","subtypes","type"])],W.prototype,"readTemplatesFromService",null),e([f({type:String,json:{write:{ignoreOrigin:!0}}})],W.prototype,"title",void 0),e([b("service","title",["subtypes"])],W.prototype,"readTitleFromService",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"url",null),e([f({readOnly:!0})],W.prototype,"userHasUpdateItemPrivileges",null),e([f({type:Boolean,nonNullable:!0,json:{name:"visibility",write:{ignoreOrigin:!0}}})],W.prototype,"visible",void 0),W=e([h(K)],W);const X=(e,t,r)=>{const i=new RegExp(`${t}\\s*=\\s*\\d+`),o=`${t}=${r}`,n=e??"";return i.test(n)?n.replace(i,o):m(o,n)},Y=e=>new a(`This sublayer must have a parent SubtypeGroupLayer in order to use ${e}`),Z=W;export{Z as default};
|
package/package.json
CHANGED
package/support/revision.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const b="20230731",c="5335bf7c41ecfe0f82aca81b060b82bdbb62c5ad";export{b as buildDate,c as commitHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import{createTask as e}from"../../core/asyncUtils.js";import a from"../../core/Collection.js";import{deprecated as r}from"../../core/deprecate.js";import i from"../../core/Error.js";import s from"../../core/Evented.js";import o from"../../core/Logger.js";import{abortMaybe as n}from"../../core/maybe.js";import{throwIfAborted as l}from"../../core/promiseUtils.js";import{watch as d,on as p,when as c,whenOnce as u,syncAndInitial as h,initial as w}from"../../core/reactiveUtils.js";import{property as f}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as y}from"../../core/support/UpdatingHandles.js";import k from"../../layers/GraphicsLayer.js";import{isEditableLayer as g}from"../../layers/support/editableLayers.js";import{isTable as v,getOwningPortalUrl as W,getEffectiveLayerCapabilities as b,isFeatureLayer as _}from"../../layers/support/layerUtils.js";import{parseKnownArcGISOnlineDomain as F}from"../../portal/support/urlUtils.js";import C from"../Attachments/AttachmentsViewModel.js";import E from"./CreateFeaturesWorkflow.js";import I from"./CreateWorkflow.js";import{workflowDeprecation as U}from"./deprecationUtils.js";import A from"./UpdateWorkflow.js";import{whenEditorLayerView as O}from"./workflowUtils.js";import{formTemplateHasInvalidFields as V,unsupportedDateFieldTypes as M}from"../FeatureForm/featureFormUtils.js";import j from"../FeatureForm/FeatureFormViewModel.js";import T from"../FeatureTemplates/FeatureTemplatesViewModel.js";import S from"../Sketch/SketchViewModel.js";import L from"../Spinner/SpinnerViewModel.js";const P="esri.widgets.Editor.EditorViewModel",D=o.getLogger(P),G=["create","create-features","update"];function H(t,e,a){D.error(new i(t,e,a))}function x(t,e){return t?t.find((t=>t.layer===e)):void 0}let B=class extends s.EventedAccessor{constructor(t){super(t),this._editableItems=new a,this._sketchGraphicsLayer=new k({listMode:"hide",internal:!0}),this._updateEditableItemsTask=null,this._updatingHandles=new y,this.activeWorkflow=null,this._activityQueue=[],this.failures=[],this.attachmentsViewModel=new C({capabilities:{editing:!0}}),this.featureFormViewModel=new j,this.featureTemplatesViewModel=new T,this.sketchViewModel=new S({layer:this._sketchGraphicsLayer}),this.spinnerViewModel=new L,this.pageStack=[],this.showDiscardEditsPrompt=()=>Promise.resolve(!0),this._candidateCommitted=!1,this.useDeprecatedCreateWorkflow=!1,this.back=async()=>{this.canGoBack&&(this.activeWorkflow?.hasPreviousStep?await this.activeWorkflow.back(this.showDiscardEditsPrompt):await this._cancelWorkflow({force:!this.hasPendingEdits}))},this.saveWorkflow=async()=>{const{featureFormViewModel:t}=this;if(t.submit(),!t.submittable)return;const e=t.getValues();t.validateContingencyConstraints(e,{includeIncompleteViolations:!0}).length>0||await(this.activeWorkflow?.save())},this.selectFeature=(t,e=!1)=>{const a=this.activeWorkflow;this._candidateCommitted||"update"!==a?.type||(a.data.rootFeature=t,e&&(a.next(),this._candidateCommitted=!0))}}initialize(){this.addHandles([d((()=>{const t=this.view?.map?.editableLayers.filter((({parent:t,visible:e})=>t&&"visible"in t?e&&t.visible:e)),e=this.view?.allLayerViews,a=e?.filter((e=>!!t?.includes(e.layer)&&!e.suspended));return[t,a,this.layerInfos,this.allowedWorkflows]}),(()=>this._updateEditableItems()),h),p((()=>this.activeWorkflow),"cancel",(()=>this.emit("workflow-cancel"))),p((()=>this.activeWorkflow),"commit",(()=>this.emit("workflow-commit"))),p((()=>this.activeWorkflow),"complete",(()=>{this.emit("workflow-commit"),this._set("activeWorkflow",null)})),c((()=>this.view?.map),(t=>t.add(this._sketchGraphicsLayer)),w),d((()=>this._editableItems.toArray()),(()=>{const{activeWorkflow:t}=this;if(this.refreshCreationTemplates(),!t)return;const{stepId:e}=t;"create"!==t.type?"update"===t.type&&("awaiting-feature-to-update"===e&&!this.canUpdate||"awaiting-update-feature-candidate"===e&&!t.data.candidates.some((t=>{const e=this._editableItems.find((e=>e.layer===t.layer));return e&&e.supports.includes("update")})))&&this._cancelWorkflow():"awaiting-feature-creation-info"!==e||this.canCreate||this._cancelWorkflow()})),d((()=>this.page),((t,e)=>{const a=this.pageStack.slice(),r=a.indexOf(t);-1===r&&e?a.push(e):a.splice(r),this.pageStack=a})),c((()=>"awaiting-update-feature-candidate"===this.state),(()=>this._candidateCommitted=!1)),p((()=>this.featureTemplatesViewModel),"select",(async({item:t,oldItem:e})=>{const{activeWorkflow:a}=this,r=!!t&&t.id===e?.id,i="create-features"===a?.type&&a.data.upload?.error;if(a)try{await this.cancelWorkflow({force:!this.hasPendingEdits})}catch{return this.featureTemplatesViewModel.select(e,{emit:!1})}if(!t||r&&!i)return;const s={layer:t.layer,template:t.template};if(t.supportsUpload)return this.startCreateFeaturesWorkflow(s);this.useDeprecatedCreateWorkflow?this.startCreateWorkflowAtFeatureCreation(s):this.startCreateFeaturesWorkflowAtFeatureCreation(s)})),p((()=>this.view),"key-down",(t=>{"Escape"===t.key&&this.activeWorkflow?.keyboardCancellationEnabled&&this.back()}))])}destroy(){this._cancelWorkflow().then((()=>{this.view?.map&&this.view.map.remove(this._sketchGraphicsLayer),this.view=null})),this._updateEditableItemsTask=n(this._updateEditableItemsTask),this._updatingHandles.destroy()}get allowedWorkflows(){return this._get("allowedWorkflows")}set allowedWorkflows(t){t&&0!==t.length||(t=[...G]),this._set("allowedWorkflows",t)}get canCreate(){return this._editableItems.some((t=>t.supports.includes("create")))}get canUpdate(){return this._editableItems.some((({attachmentsOnUpdateEnabled:t,layer:e,supports:a})=>{const r=a.includes("update")||a.includes("delete")||t,i=e.parent,s=!(i&&"visible"in i)||!!i.visible;return e.visible&&s&&r}))}get editableItems(){return this._editableItems}get labelOptions(){return this.sketchViewModel.labelOptions}set labelOptions(t){this.sketchViewModel.labelOptions=t}set layerInfos(t){t?.some((t=>("allowAttachments"in t&&r(D,"Property: layerInfo.allowAttachments",{replacement:"layerInfo.attachmentsOnCreateEnabled or layerInfo.attachmentsOnUpdateEnabled",version:"4.26"}),!0))),this._set("layerInfos",t)}get snappingOptions(){return this.sketchViewModel.snappingOptions}set snappingOptions(t){this.sketchViewModel.snappingOptions=t}get state(){if(!this.view?.ready||0===this._editableItems.length)return"disabled";const t=this.attachmentsViewModel.mode;if("add"===t)return"adding-attachment";if("edit"===t)return"editing-attachment";const{activeWorkflow:e}=this;return e?e.stepId:"ready"}get syncing(){return this._activityQueue.length>0}get updating(){return this._updatingHandles.updating||!0===this.activeWorkflow?.updating}get tooltipOptions(){return this.sketchViewModel.tooltipOptions}set tooltipOptions(t){this.sketchViewModel.tooltipOptions=t}set view(t){this.sketchViewModel.view=t,this.spinnerViewModel.view=t,this._set("view",t)}get page(){const{activeWorkflow:t,state:e}=this;return"awaiting-feature-to-update"===e||"awaiting-feature-to-create"===e||"create-features"===t?.type&&0===t.numPendingFeatures?"ready":e??"disabled"}get selectedTemplateItem(){const{activeWorkflow:t}=this;if("create-features"===t?.type&&0===t.numPendingFeatures){const e=t.data.creationInfo?.template;if(!e)return;for(const t of this.featureTemplatesViewModel.items)if("findByTemplate"in t){const a=t.findByTemplate(e);if(a)return a}else if(t.template===e)return t}}get featureFormDisabled(){const{activeWorkflow:t}=this;return"update"===t?.type&&!1===t.activeEditableItem?.attributeUpdatesEnabled}get canGoBack(){return null!=this.activeWorkflow&&!this.syncing}get shouldShowDeleteButton(){const{activeWorkflow:t}=this;return!!t&&"update"===t.type&&!!t.activeEditableItem?.supports.includes("delete")}get hasPendingEdits(){return this.activeWorkflow?.hasPendingEdits??!1}async startCreateWorkflowAtFeatureTypeSelection(){if(U(D,"startCreateWorkflowAtFeatureTypeSelection","startCreateFeaturesWorkflowAtFeatureTypeSelection"),await u((()=>!this.updating)),!this.canCreate)return void H("editing:unsupported-workflow","Create workflow is unsupported or disabled.");await this._cancelWorkflow();const t=this._createCreateWorkflow();await t.start(),this._set("activeWorkflow",t)}async startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.startCreateFeaturesWorkflow()}async startCreateWorkflowAtFeatureCreation(t){if(U(D,"startCreateWorkflowAtFeatureCreation","startCreateFeaturesWorkflowAtFeatureCreation"),await u((()=>!this.updating)),!this.canCreate)return void H("editing:unsupported-workflow","Create workflow is unsupported or disabled.");await this._cancelWorkflow();const e=this._createCreateWorkflow("awaiting-feature-to-create");e.data.creationInfo=t,await e.start(),this._set("activeWorkflow",e)}async startCreateFeaturesWorkflowAtFeatureCreation(t){return this.startCreateFeaturesWorkflow(t,"creating-features")}async startCreateFeaturesWorkflow(t,e="awaiting-feature-creation-info"){if(await u((()=>!this.updating)),!this.canCreate)throw new i("editing:unsupported-workflow","Creating features is unsupported or disabled.");await this._cancelWorkflow();const a=this._createCreateFeaturesWorkflow(t,e);await a.start(),this._set("activeWorkflow",a)}async startCreateWorkflowAtFeatureEdit(t){if(U(D,"startCreateWorkflowAtFeatureEdit"),await u((()=>!this.updating)),!this.canCreate)return void H("editing:unsupported-workflow","Create workflow is unsupported or disabled.");await this._cancelWorkflow();const e=this._createCreateWorkflow("editing-new-feature");e.data.edits.feature=t,await e.start(),this._set("activeWorkflow",e)}async startUpdateWorkflowAtFeatureSelection(){if(await u((()=>!this.updating)),!this.canUpdate)return void H("editing:unsupported-workflow","Update workflow is unsupported or disabled.");await this._cancelWorkflow();const t=this._createUpdateWorkflow();await t.start(),this._set("activeWorkflow",t)}async startUpdateWorkflowAtMultipleFeatureSelection(t){if(await u((()=>!this.updating)),!this.canUpdate)return void H("editing:unsupported-workflow","Update workflow is unsupported or disabled.");await this._cancelWorkflow();const e=this._createUpdateWorkflow("awaiting-update-feature-candidate");e.data.candidates=t,await e.start(),this._set("activeWorkflow",e)}async startUpdateWorkflowAtFeatureEdit(t){if(await u((()=>!this.updating)),!this.canUpdate)return void H("editing:unsupported-workflow","Update workflow is unsupported or disabled.");await this._cancelWorkflow();const e=this._createUpdateWorkflow("editing-existing-feature");e.data.rootFeature=t,await e.start(),this._set("activeWorkflow",e)}async deleteFeatureFromWorkflow(){const{activeWorkflow:t}=this;t&&"update"===t.type?await t.deleteActiveFeature():H("editing:unsupported-workflow","Deleting requires an active update workflow.")}async cancelWorkflow(t){return this._cancelWorkflow({warn:!0,...t})}findEditableItemForLayer(t){const e="subtype-sublayer"===t.type?t.parent:t;return this._editableItems.find((t=>t.layer===e))}itemHasInvalidFormTemplate(t){return!!t&&(this.findEditableItemForLayer(t.layer)?.hasInvalidFormTemplate??!1)}itemHasUnsupportedFields(t){return!!t&&(this.findEditableItemForLayer(t.layer)?.hasUnsupportedFields??!1)}refreshCreationTemplates(){const t=[];for(const{layer:e,supports:a}of this._editableItems)e.loaded&&a.includes("create")&&!v(e)&&t.push(e);this.featureTemplatesViewModel.layers=t}async toggleUpdateWorkflow(){this.canUpdate&&(this.hasPendingEdits&&!await this.showDiscardEditsPrompt()||(this.activeWorkflow&&"awaiting-feature-to-update"===this.state?await this.cancelWorkflow({force:!0}):await this.startUpdateWorkflowAtFeatureSelection()))}async _updateEditableItems(){n(this._updateEditableItemsTask);const t=e((async t=>{const e=this.view?.allLayerViews,r=this.view?.map,i=r?.editableLayers.toArray()??[],s=r?.allTables.toArray().filter(_)??[];await Promise.all(s.map((t=>t.load())));const o=s.filter((t=>g(t))),n=[...i.reverse(),...o.reverse()].filter((t=>"mesh"!==t.geometryType||"3d"===this.view?.type));if(!e||!i)return;const d=[],p=[];for(const a of n){const r=e.find((t=>t.layer===a)),i=r?d:p;if("subtype-group"===a.type){await a.loadAll(),l(t);for(let t=a.sublayers.length-1;t>=0;--t)i.push(this._makeEditableItemForLayer(a.sublayers.at(t),!!r?.suspended))}else i.push(this._makeEditableItemForLayer(a,!!r?.suspended))}if(t.aborted)return;const c=this._editableItems;this._editableItems=new a(d.concat(p)),c.destroy()}));this._updatingHandles.addPromise(t.promise),this._updateEditableItemsTask=t}async _cancelWorkflow(t){const e=this.activeWorkflow;if(!e)return void(t&&t.warn&&H("editing:no-active-workflow","There is no active workflow to cancel."));if(!t||!1!==t.force)return this.emit("workflow-cancel"),this._set("activeWorkflow",null),void await e.cancel(t);await e.cancel(t),this._set("activeWorkflow",null)}_createCreateFeaturesWorkflow(t,e){return E.create({viewModel:this,creationInfo:t,startAt:e,applyEditsCallback:(t,e,a)=>this._applyEdits(t,e,a),addAttachmentsCallback:(t,e)=>this._addAttachments(t,e)})}_createCreateWorkflow(t){return I.create(this,t,((t,e,a)=>this._applyEdits(t,e,a)))}_createUpdateWorkflow(t){return A.create(this,t,((t,e)=>this._applyEdits(t,e)))}_addAttachments(t,e){const a=e.map((e=>this._addAttachment(t,e.feature,e.attachment)))??[];return Promise.all(a)}async _addAttachment(t,e,a){let r=null;if("geojson"===t.type||"scene"===t.type||"oriented-imagery"===t.type)throw new i("editor:attachments-not-supported","Adding attachments is not supported for this layer type");return await this._queueOperation((async()=>(r=await(t.addAttachment?.(e,a).catch((t=>{throw t?.error||t})))??null,r))),r}async _applyEdits(t,e,a){let r=null;const i=t.url?await W(t.url):null,s={returnServiceEditsOption:(!i||!F(i))&&!RegExp("/hosted/","i").test(t.url)?"original-and-current-features":void 0,...a};return await this._queueOperation((async()=>{const a=await O(this.view,t).catch((()=>null));return r=await t.applyEdits(e,s),a&&await u((()=>!a.updating)),r})),r}_queueOperation(t){this._activityQueue.push(t),this.notifyChange("syncing");const e=(t,e)=>{const a=e.indexOf(t);a>-1&&e.splice(a,1)};return t().then((t=>{if("error"in t&&t.error)throw t.error;if("addFeatureResults"in t){const{addFeatureResults:e,deleteFeatureResults:a,updateFeatureResults:r}=t,i=e.find((t=>!!t.error))||r.find((t=>!!t.error))||a.find((t=>!!t.error));if(i)throw i.error}return t})).catch((a=>{H("editing:operation-error","An error occurred.",{error:a});const r={error:a,retry:()=>(e(r,this.failures),this._queueOperation(t)),cancel:()=>{e(r,this.failures)}};this._set("failures",[...this.failures,r])})).then((()=>{e(t,this._activityQueue),this.notifyChange("syncing")}))}_makeEditableItemForLayer(t,e=!0){const a=b(t),r=a?.operations,i=x(this.layerInfos,t),s=V(t),o=t.fields.some((({type:t})=>M.has(t))),n=s||o,{allowedWorkflows:l}=this,d=l.includes("create")||l.includes("create-features"),p=l.includes("update"),c=t=>!i||!1!==i.enabled&&!1!==i[t],u=d&&!!r?.supportsAdd&&c("addEnabled"),h=p&&!!r?.supportsUpdate&&c("updateEnabled"),w=!n&&p&&!!r?.supportsDelete&&c("deleteEnabled"),f=[];e||(u&&f.push("create"),h&&f.push("update"),w&&f.push("delete"));const m=h&&!n&&(!i||!1!==i.attributeUpdatesEnabled),y=h&&!n&&!!a?.editing?.supportsGeometryUpdate&&(!i||!1!==i.geometryUpdatesEnabled),k=!(!a?.data?.supportsAttachment||i&&!1===i.allowAttachments);return{layer:t,supports:f,attributeUpdatesEnabled:m,geometryUpdatesEnabled:y,hasAttachments:k,attachmentsOnCreateEnabled:k&&d&&(!i||!1!==i.attachmentsOnCreateEnabled),attachmentsOnUpdateEnabled:!n&&k&&(!i||!1!==i.attachmentsOnUpdateEnabled),hasInvalidFormTemplate:s,hasUnsupportedFields:o}}};t([f()],B.prototype,"_editableItems",void 0),t([f({readOnly:!0})],B.prototype,"activeWorkflow",void 0),t([f({readOnly:!0})],B.prototype,"_activityQueue",void 0),t([f({value:[...G]})],B.prototype,"allowedWorkflows",null),t([f({readOnly:!0})],B.prototype,"canCreate",null),t([f({readOnly:!0})],B.prototype,"canUpdate",null),t([f()],B.prototype,"editableItems",null),t([f({readOnly:!0})],B.prototype,"failures",void 0),t([f()],B.prototype,"attachmentsViewModel",void 0),t([f()],B.prototype,"featureFormViewModel",void 0),t([f()],B.prototype,"featureTemplatesViewModel",void 0),t([f()],B.prototype,"labelOptions",null),t([f()],B.prototype,"layerInfos",null),t([f()],B.prototype,"sketchViewModel",void 0),t([f()],B.prototype,"snappingOptions",null),t([f()],B.prototype,"spinnerViewModel",void 0),t([f()],B.prototype,"state",null),t([f({readOnly:!0})],B.prototype,"syncing",null),t([f()],B.prototype,"updating",null),t([f()],B.prototype,"tooltipOptions",null),t([f()],B.prototype,"view",null),t([f()],B.prototype,"pageStack",void 0),t([f()],B.prototype,"showDiscardEditsPrompt",void 0),t([f()],B.prototype,"_candidateCommitted",void 0),t([f()],B.prototype,"page",null),t([f()],B.prototype,"selectedTemplateItem",null),t([f()],B.prototype,"featureFormDisabled",null),t([f()],B.prototype,"canGoBack",null),t([f()],B.prototype,"shouldShowDeleteButton",null),t([f()],B.prototype,"hasPendingEdits",null),t([f()],B.prototype,"useDeprecatedCreateWorkflow",void 0),B=t([m(P)],B);const q=B;export{q as default};
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import{createTask as e}from"../../core/asyncUtils.js";import a from"../../core/Collection.js";import{deprecated as r}from"../../core/deprecate.js";import i from"../../core/Error.js";import s from"../../core/Evented.js";import o from"../../core/Logger.js";import{abortMaybe as n}from"../../core/maybe.js";import{throwIfAborted as l}from"../../core/promiseUtils.js";import{watch as d,on as p,when as c,whenOnce as u,syncAndInitial as h,initial as w}from"../../core/reactiveUtils.js";import{property as f}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as y}from"../../core/support/UpdatingHandles.js";import k from"../../layers/GraphicsLayer.js";import{isEditableLayer as g}from"../../layers/support/editableLayers.js";import{isTable as v,getOwningPortalUrl as W,getEffectiveLayerCapabilities as b,isFeatureLayer as _}from"../../layers/support/layerUtils.js";import{parseKnownArcGISOnlineDomain as F}from"../../portal/support/urlUtils.js";import C from"../Attachments/AttachmentsViewModel.js";import E from"./CreateFeaturesWorkflow.js";import I from"./CreateWorkflow.js";import{workflowDeprecation as U}from"./deprecationUtils.js";import A from"./UpdateWorkflow.js";import{whenEditorLayerView as O}from"./workflowUtils.js";import{formTemplateHasInvalidFields as V}from"../FeatureForm/featureFormUtils.js";import j from"../FeatureForm/FeatureFormViewModel.js";import M from"../FeatureTemplates/FeatureTemplatesViewModel.js";import T from"../Sketch/SketchViewModel.js";import S from"../Spinner/SpinnerViewModel.js";import{UNSUPPORTED_DATE_FIELD_TYPES as L}from"../support/dateUtils.js";const P="esri.widgets.Editor.EditorViewModel",D=o.getLogger(P),G=["create","create-features","update"];function H(t,e,a){D.error(new i(t,e,a))}function x(t,e){return t?t.find((t=>t.layer===e)):void 0}let B=class extends s.EventedAccessor{constructor(t){super(t),this._editableItems=new a,this._sketchGraphicsLayer=new k({listMode:"hide",internal:!0}),this._updateEditableItemsTask=null,this._updatingHandles=new y,this.activeWorkflow=null,this._activityQueue=[],this.failures=[],this.attachmentsViewModel=new C({capabilities:{editing:!0}}),this.featureFormViewModel=new j,this.featureTemplatesViewModel=new M,this.sketchViewModel=new T({layer:this._sketchGraphicsLayer}),this.spinnerViewModel=new S,this.pageStack=[],this.showDiscardEditsPrompt=()=>Promise.resolve(!0),this._candidateCommitted=!1,this.useDeprecatedCreateWorkflow=!1,this.back=async()=>{this.canGoBack&&(this.activeWorkflow?.hasPreviousStep?await this.activeWorkflow.back(this.showDiscardEditsPrompt):await this._cancelWorkflow({force:!this.hasPendingEdits}))},this.saveWorkflow=async()=>{const{featureFormViewModel:t}=this;if(t.submit(),!t.submittable)return;const e=t.getValues();t.validateContingencyConstraints(e,{includeIncompleteViolations:!0}).length>0||await(this.activeWorkflow?.save())},this.selectFeature=(t,e=!1)=>{const a=this.activeWorkflow;this._candidateCommitted||"update"!==a?.type||(a.data.rootFeature=t,e&&(a.next(),this._candidateCommitted=!0))}}initialize(){this.addHandles([d((()=>{const t=this.view?.map?.editableLayers.filter((({parent:t,visible:e})=>t&&"visible"in t?e&&t.visible:e)),e=this.view?.allLayerViews,a=e?.filter((e=>!!t?.includes(e.layer)&&!e.suspended));return[t,a,this.layerInfos,this.allowedWorkflows]}),(()=>this._updateEditableItems()),h),p((()=>this.activeWorkflow),"cancel",(()=>this.emit("workflow-cancel"))),p((()=>this.activeWorkflow),"commit",(()=>this.emit("workflow-commit"))),p((()=>this.activeWorkflow),"complete",(()=>{this.emit("workflow-commit"),this._set("activeWorkflow",null)})),c((()=>this.view?.map),(t=>t.add(this._sketchGraphicsLayer)),w),d((()=>this._editableItems.toArray()),(()=>{const{activeWorkflow:t}=this;if(this.refreshCreationTemplates(),!t)return;const{stepId:e}=t;"create"!==t.type?"update"===t.type&&("awaiting-feature-to-update"===e&&!this.canUpdate||"awaiting-update-feature-candidate"===e&&!t.data.candidates.some((t=>{const e=this._editableItems.find((e=>e.layer===t.layer));return e&&e.supports.includes("update")})))&&this._cancelWorkflow():"awaiting-feature-creation-info"!==e||this.canCreate||this._cancelWorkflow()})),d((()=>this.page),((t,e)=>{const a=this.pageStack.slice(),r=a.indexOf(t);-1===r&&e?a.push(e):a.splice(r),this.pageStack=a})),c((()=>"awaiting-update-feature-candidate"===this.state),(()=>this._candidateCommitted=!1)),p((()=>this.featureTemplatesViewModel),"select",(async({item:t,oldItem:e})=>{const{activeWorkflow:a}=this,r=!!t&&t.id===e?.id,i="create-features"===a?.type&&a.data.upload?.error;if(a)try{await this.cancelWorkflow({force:!this.hasPendingEdits})}catch{return this.featureTemplatesViewModel.select(e,{emit:!1})}if(!t||r&&!i)return;const s={layer:t.layer,template:t.template};if(t.supportsUpload)return this.startCreateFeaturesWorkflow(s);this.useDeprecatedCreateWorkflow?this.startCreateWorkflowAtFeatureCreation(s):this.startCreateFeaturesWorkflowAtFeatureCreation(s)})),p((()=>this.view),"key-down",(t=>{"Escape"===t.key&&this.activeWorkflow?.keyboardCancellationEnabled&&this.back()}))])}destroy(){this._cancelWorkflow().then((()=>{this.view?.map&&this.view.map.remove(this._sketchGraphicsLayer),this.view=null})),this._updateEditableItemsTask=n(this._updateEditableItemsTask),this._updatingHandles.destroy()}get allowedWorkflows(){return this._get("allowedWorkflows")}set allowedWorkflows(t){t&&0!==t.length||(t=[...G]),this._set("allowedWorkflows",t)}get canCreate(){return this._editableItems.some((t=>t.supports.includes("create")))}get canUpdate(){return this._editableItems.some((({attachmentsOnUpdateEnabled:t,layer:e,supports:a})=>{const r=a.includes("update")||a.includes("delete")||t,i=e.parent,s=!(i&&"visible"in i)||!!i.visible;return e.visible&&s&&r}))}get editableItems(){return this._editableItems}get labelOptions(){return this.sketchViewModel.labelOptions}set labelOptions(t){this.sketchViewModel.labelOptions=t}set layerInfos(t){t?.some((t=>("allowAttachments"in t&&r(D,"Property: layerInfo.allowAttachments",{replacement:"layerInfo.attachmentsOnCreateEnabled or layerInfo.attachmentsOnUpdateEnabled",version:"4.26"}),!0))),this._set("layerInfos",t)}get snappingOptions(){return this.sketchViewModel.snappingOptions}set snappingOptions(t){this.sketchViewModel.snappingOptions=t}get state(){if(!this.view?.ready||0===this._editableItems.length)return"disabled";const t=this.attachmentsViewModel.mode;if("add"===t)return"adding-attachment";if("edit"===t)return"editing-attachment";const{activeWorkflow:e}=this;return e?e.stepId:"ready"}get syncing(){return this._activityQueue.length>0}get updating(){return this._updatingHandles.updating||!0===this.activeWorkflow?.updating}get tooltipOptions(){return this.sketchViewModel.tooltipOptions}set tooltipOptions(t){this.sketchViewModel.tooltipOptions=t}set view(t){this.sketchViewModel.view=t,this.spinnerViewModel.view=t,this._set("view",t)}get page(){const{activeWorkflow:t,state:e}=this;return"awaiting-feature-to-update"===e||"awaiting-feature-to-create"===e||"create-features"===t?.type&&0===t.numPendingFeatures?"ready":e??"disabled"}get selectedTemplateItem(){const{activeWorkflow:t}=this;if("create-features"===t?.type&&0===t.numPendingFeatures){const e=t.data.creationInfo?.template;if(!e)return;for(const t of this.featureTemplatesViewModel.items)if("findByTemplate"in t){const a=t.findByTemplate(e);if(a)return a}else if(t.template===e)return t}}get featureFormDisabled(){const{activeWorkflow:t}=this;return"update"===t?.type&&!1===t.activeEditableItem?.attributeUpdatesEnabled}get canGoBack(){return null!=this.activeWorkflow&&!this.syncing}get shouldShowDeleteButton(){const{activeWorkflow:t}=this;return!!t&&"update"===t.type&&!!t.activeEditableItem?.supports.includes("delete")}get hasPendingEdits(){return this.activeWorkflow?.hasPendingEdits??!1}async startCreateWorkflowAtFeatureTypeSelection(){if(U(D,"startCreateWorkflowAtFeatureTypeSelection","startCreateFeaturesWorkflowAtFeatureTypeSelection"),await u((()=>!this.updating)),!this.canCreate)return void H("editing:unsupported-workflow","Create workflow is unsupported or disabled.");await this._cancelWorkflow();const t=this._createCreateWorkflow();await t.start(),this._set("activeWorkflow",t)}async startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.startCreateFeaturesWorkflow()}async startCreateWorkflowAtFeatureCreation(t){if(U(D,"startCreateWorkflowAtFeatureCreation","startCreateFeaturesWorkflowAtFeatureCreation"),await u((()=>!this.updating)),!this.canCreate)return void H("editing:unsupported-workflow","Create workflow is unsupported or disabled.");await this._cancelWorkflow();const e=this._createCreateWorkflow("awaiting-feature-to-create");e.data.creationInfo=t,await e.start(),this._set("activeWorkflow",e)}async startCreateFeaturesWorkflowAtFeatureCreation(t){return this.startCreateFeaturesWorkflow(t,"creating-features")}async startCreateFeaturesWorkflow(t,e="awaiting-feature-creation-info"){if(await u((()=>!this.updating)),!this.canCreate)throw new i("editing:unsupported-workflow","Creating features is unsupported or disabled.");await this._cancelWorkflow();const a=this._createCreateFeaturesWorkflow(t,e);await a.start(),this._set("activeWorkflow",a)}async startCreateWorkflowAtFeatureEdit(t){if(U(D,"startCreateWorkflowAtFeatureEdit"),await u((()=>!this.updating)),!this.canCreate)return void H("editing:unsupported-workflow","Create workflow is unsupported or disabled.");await this._cancelWorkflow();const e=this._createCreateWorkflow("editing-new-feature");e.data.edits.feature=t,await e.start(),this._set("activeWorkflow",e)}async startUpdateWorkflowAtFeatureSelection(){if(await u((()=>!this.updating)),!this.canUpdate)return void H("editing:unsupported-workflow","Update workflow is unsupported or disabled.");await this._cancelWorkflow();const t=this._createUpdateWorkflow();await t.start(),this._set("activeWorkflow",t)}async startUpdateWorkflowAtMultipleFeatureSelection(t){if(await u((()=>!this.updating)),!this.canUpdate)return void H("editing:unsupported-workflow","Update workflow is unsupported or disabled.");await this._cancelWorkflow();const e=this._createUpdateWorkflow("awaiting-update-feature-candidate");e.data.candidates=t,await e.start(),this._set("activeWorkflow",e)}async startUpdateWorkflowAtFeatureEdit(t){if(await u((()=>!this.updating)),!this.canUpdate)return void H("editing:unsupported-workflow","Update workflow is unsupported or disabled.");await this._cancelWorkflow();const e=this._createUpdateWorkflow("editing-existing-feature");e.data.rootFeature=t,await e.start(),this._set("activeWorkflow",e)}async deleteFeatureFromWorkflow(){const{activeWorkflow:t}=this;t&&"update"===t.type?await t.deleteActiveFeature():H("editing:unsupported-workflow","Deleting requires an active update workflow.")}async cancelWorkflow(t){return this._cancelWorkflow({warn:!0,...t})}findEditableItemForLayer(t){const e="subtype-sublayer"===t.type?t.parent:t;return this._editableItems.find((t=>t.layer===e))}itemHasInvalidFormTemplate(t){return!!t&&(this.findEditableItemForLayer(t.layer)?.hasInvalidFormTemplate??!1)}itemHasUnsupportedFields(t){return!!t&&(this.findEditableItemForLayer(t.layer)?.hasUnsupportedFields??!1)}refreshCreationTemplates(){const t=[];for(const{layer:e,supports:a}of this._editableItems)e.loaded&&a.includes("create")&&!v(e)&&t.push(e);this.featureTemplatesViewModel.layers=t}async toggleUpdateWorkflow(){this.canUpdate&&(this.hasPendingEdits&&!await this.showDiscardEditsPrompt()||(this.activeWorkflow&&"awaiting-feature-to-update"===this.state?await this.cancelWorkflow({force:!0}):await this.startUpdateWorkflowAtFeatureSelection()))}async _updateEditableItems(){n(this._updateEditableItemsTask);const t=e((async t=>{const e=this.view?.allLayerViews,r=this.view?.map,i=r?.editableLayers.toArray()??[],s=r?.allTables.toArray().filter(_)??[];await Promise.all(s.map((t=>t.load())));const o=s.filter((t=>g(t))),n=[...i.reverse(),...o.reverse()].filter((t=>"mesh"!==t.geometryType||"3d"===this.view?.type));if(!e||!i)return;const d=[],p=[];for(const a of n){const r=e.find((t=>t.layer===a)),i=r?d:p;if("subtype-group"===a.type){await a.loadAll(),l(t);for(let t=a.sublayers.length-1;t>=0;--t)i.push(this._makeEditableItemForLayer(a.sublayers.at(t),!!r?.suspended))}else i.push(this._makeEditableItemForLayer(a,!!r?.suspended))}if(t.aborted)return;const c=this._editableItems;this._editableItems=new a(d.concat(p)),c.destroy()}));this._updatingHandles.addPromise(t.promise),this._updateEditableItemsTask=t}async _cancelWorkflow(t){const e=this.activeWorkflow;if(!e)return void(t&&t.warn&&H("editing:no-active-workflow","There is no active workflow to cancel."));if(!t||!1!==t.force)return this.emit("workflow-cancel"),this._set("activeWorkflow",null),void await e.cancel(t);await e.cancel(t),this._set("activeWorkflow",null)}_createCreateFeaturesWorkflow(t,e){return E.create({viewModel:this,creationInfo:t,startAt:e,applyEditsCallback:(t,e,a)=>this._applyEdits(t,e,a),addAttachmentsCallback:(t,e)=>this._addAttachments(t,e)})}_createCreateWorkflow(t){return I.create(this,t,((t,e,a)=>this._applyEdits(t,e,a)))}_createUpdateWorkflow(t){return A.create(this,t,((t,e)=>this._applyEdits(t,e)))}_addAttachments(t,e){const a=e.map((e=>this._addAttachment(t,e.feature,e.attachment)))??[];return Promise.all(a)}async _addAttachment(t,e,a){let r=null;if("geojson"===t.type||"scene"===t.type||"oriented-imagery"===t.type)throw new i("editor:attachments-not-supported","Adding attachments is not supported for this layer type");return await this._queueOperation((async()=>(r=await(t.addAttachment?.(e,a).catch((t=>{throw t?.error||t})))??null,r))),r}async _applyEdits(t,e,a){let r=null;const i=t.url?await W(t.url):null,s={returnServiceEditsOption:(!i||!F(i))&&!RegExp("/hosted/","i").test(t.url)?"original-and-current-features":void 0,...a};return await this._queueOperation((async()=>{const a=await O(this.view,t).catch((()=>null));return r=await t.applyEdits(e,s),a&&await u((()=>!a.updating)),r})),r}_queueOperation(t){this._activityQueue.push(t),this.notifyChange("syncing");const e=(t,e)=>{const a=e.indexOf(t);a>-1&&e.splice(a,1)};return t().then((t=>{if("error"in t&&t.error)throw t.error;if("addFeatureResults"in t){const{addFeatureResults:e,deleteFeatureResults:a,updateFeatureResults:r}=t,i=e.find((t=>!!t.error))||r.find((t=>!!t.error))||a.find((t=>!!t.error));if(i)throw i.error}return t})).catch((a=>{H("editing:operation-error","An error occurred.",{error:a});const r={error:a,retry:()=>(e(r,this.failures),this._queueOperation(t)),cancel:()=>{e(r,this.failures)}};this._set("failures",[...this.failures,r])})).then((()=>{e(t,this._activityQueue),this.notifyChange("syncing")}))}_makeEditableItemForLayer(t,e=!0){const a=b(t),r=a?.operations,i=x(this.layerInfos,t),s=V(t),o=t.fields.some((({type:t})=>L.has(t))),n=s||o,{allowedWorkflows:l}=this,d=l.includes("create")||l.includes("create-features"),p=l.includes("update"),c=t=>!i||!1!==i.enabled&&!1!==i[t],u=d&&!!r?.supportsAdd&&c("addEnabled"),h=p&&!!r?.supportsUpdate&&c("updateEnabled"),w=!n&&p&&!!r?.supportsDelete&&c("deleteEnabled"),f=[];e||(u&&f.push("create"),h&&f.push("update"),w&&f.push("delete"));const m=h&&!n&&(!i||!1!==i.attributeUpdatesEnabled),y=h&&!n&&!!a?.editing?.supportsGeometryUpdate&&(!i||!1!==i.geometryUpdatesEnabled),k=!(!a?.data?.supportsAttachment||i&&!1===i.allowAttachments);return{layer:t,supports:f,attributeUpdatesEnabled:m,geometryUpdatesEnabled:y,hasAttachments:k,attachmentsOnCreateEnabled:k&&d&&(!i||!1!==i.attachmentsOnCreateEnabled),attachmentsOnUpdateEnabled:!n&&k&&(!i||!1!==i.attachmentsOnUpdateEnabled),hasInvalidFormTemplate:s,hasUnsupportedFields:o}}};t([f()],B.prototype,"_editableItems",void 0),t([f({readOnly:!0})],B.prototype,"activeWorkflow",void 0),t([f({readOnly:!0})],B.prototype,"_activityQueue",void 0),t([f({value:[...G]})],B.prototype,"allowedWorkflows",null),t([f({readOnly:!0})],B.prototype,"canCreate",null),t([f({readOnly:!0})],B.prototype,"canUpdate",null),t([f()],B.prototype,"editableItems",null),t([f({readOnly:!0})],B.prototype,"failures",void 0),t([f()],B.prototype,"attachmentsViewModel",void 0),t([f()],B.prototype,"featureFormViewModel",void 0),t([f()],B.prototype,"featureTemplatesViewModel",void 0),t([f()],B.prototype,"labelOptions",null),t([f()],B.prototype,"layerInfos",null),t([f()],B.prototype,"sketchViewModel",void 0),t([f()],B.prototype,"snappingOptions",null),t([f()],B.prototype,"spinnerViewModel",void 0),t([f()],B.prototype,"state",null),t([f({readOnly:!0})],B.prototype,"syncing",null),t([f()],B.prototype,"updating",null),t([f()],B.prototype,"tooltipOptions",null),t([f()],B.prototype,"view",null),t([f()],B.prototype,"pageStack",void 0),t([f()],B.prototype,"showDiscardEditsPrompt",void 0),t([f()],B.prototype,"_candidateCommitted",void 0),t([f()],B.prototype,"page",null),t([f()],B.prototype,"selectedTemplateItem",null),t([f()],B.prototype,"featureFormDisabled",null),t([f()],B.prototype,"canGoBack",null),t([f()],B.prototype,"shouldShowDeleteButton",null),t([f()],B.prototype,"hasPendingEdits",null),t([f()],B.prototype,"useDeprecatedCreateWorkflow",void 0),B=t([m(P)],B);const q=B;export{q as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{CodedValue as l}from"../../layers/support/CodedValue.js";import
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{CodedValue as l}from"../../layers/support/CodedValue.js";import n from"../../layers/support/CodedValueDomain.js";import"../../layers/support/Domain.js";import"../../layers/support/InheritedDomain.js";import"../../layers/support/RangeDomain.js";import{getDomainRange as r,validateDomainValue as s}from"../../layers/support/domainUtils.js";import{isFieldVisibleByDefault as o,getLowerCaseEditTrackingFields as u,isNumericField as a,isStringField as p,isDateField as d,getFieldRange as m,TypeValidationError as y,validateFieldValue as h}from"../../layers/support/fieldUtils.js";import{isRelatableFeatureSupportedLayer as c}from"../Feature/support/featureUtils.js";import g from"./EditableInput.js";import{getNormalizedFeatureTypeInfo as f,isFieldElementWithTextInput as E,isFieldElementWithShowNoValueOptionInput as v,LengthValidationError as x}from"./featureFormUtils.js";var b;!function(e){e.Text="text",e.Number="number",e.Date="date",e.Unsupported="unsupported"}(b||(b={}));const _="__internal-type-based-coded-value-domain__";let T=class extends g{constructor(e){super(e),this._storedValue=null,this._valueOriginIsExpression=!1,this.error=null,this.field=null,this.group=null,this.requiredExpressionExecutor=null,this.type="field",this.valueExpressionExecutor=null}get _dateRange(){const{element:e}=this;if("datetime-picker"===e?.input?.type){const{max:t,min:i}=e.input;return{max:t,min:i}}return{min:null,max:null}}get _configAllowsEdits(){const{element:e,layer:t,name:i}=this;if(null!=e)return e.editableExpression?!!this.evaluatedEditableExpression:!1!==e.editable;if(t?.userHasUpdateItemPrivileges)return!0;const l=t&&"popupTemplate"in t?t?.popupTemplate?.fieldInfos?.find((({fieldName:e})=>e===i)):null;return l?.isEditable??!0}get _layerAndFieldAllowEdits(){return this.layerAllowsEdits&&this.field?.editable}get _isVisibleByDefault(){const{field:e,layer:t}=this;return!!e?.visible&&o(e,t)}get _isEditTrackingField(){return u(this.layer).includes(this.name?.toLowerCase())}get _shouldUseValueExpression(){return this._layerAndFieldAllowEdits&&!this._configAllowsEdits&&null!=this.valueExpressionExecutor}get dataType(){const{field:e}=this;return a(e)?b.Number:p(e)?b.Text:d(e)?b.Date:b.Unsupported}get dateDataType(){if(this.dataType===b.Date)return"date"!==this.field.type?"string":"number"}get domain(){const{layer:e}=this,{typeFieldName:t,types:i}=f(e);if(t===this.name&&null==this.field.domain)return new n({name:_,codedValues:i.map((({code:e,name:t})=>new l({code:e,name:t})))});const{feature:r}=this,s=e?.getFieldDomain(this.name,{feature:r}),o=this.element?.domain;return null!=o&&this._isDomainCompatible(o)?o:s}get editable(){return!!this._layerAndFieldAllowEdits&&(this.evaluatedEditableExpression??this._configAllowsEdits)}get evaluatedRequiredExpression(){const{requiredExpressionExecutor:e}=this;return null!=e?!!e.lastEvaluatedValue:null}get evaluatedValueExpression(){const{valueExpressionExecutor:e}=this;return null!=e?e.lastEvaluatedValue:null}get hint(){return this.element?.hint}get includeDate(){return!(this.dataType!==b.Date||"time-only"===this.field.type)}get includeTime(){const{element:e,field:t}=this;if(this.dataType!==b.Date)return!1;if("time-only"===t.type)return!0;if("date-only"===t.type)return!1;const i="datetime-picker"===e?.input?.type?e.input.includeTime:void 0;return void 0===i||i}get includeTimestamp(){return"timestamp-offset"===this.field.type}set initialFeature(e){this._set("initialFeature",e),this.notifyChange("valid")}get inputType(){return this.element?.input?.type}get isRelationshipKeyField(){const{field:e,layer:t}=this;return c(t)&&!!t.relationships?.some((t=>t.keyField===e.name))}get label(){return this.element?.label||this.field.alias||this.field.name}get maxLength(){const e=-1;if(this.dataType===b.Date)return e;const{field:t,element:i}=this,l=t?.length,n=E(i)?i.input.maxLength:NaN;return null!=n&&!isNaN(n)&&n>=e&&(l===e||n<=l)?n:l}get minLength(){const e=-1;if(this.dataType===b.Date)return e;const{field:t,element:i}=this,l=t?.length,n=E(i)?i.input.minLength:NaN;return null!=n&&!isNaN(n)&&n>=e&&(l===e||n<=l)?n:e}get name(){return this.field?.name}get range(){const{_dateRange:e,domain:t,field:i}=this,{max:l,min:n}=e,s=null!=l&&V(l)?l.getTime():null,o=null!=n&&V(n)?n.getTime():null,u=r(t)||m(i);if(!u)return{max:s,min:o};const a=u.max===Number.MAX_VALUE?null:u.max,p=u.min===Number.MIN_VALUE?null:u.min;return{max:null!=s&&(null===a||null!=a&&s<a)?s:a,min:null!=o&&(null===p||null!=p&&o>p)?o:p}}get required(){const{editable:e,evaluatedRequiredExpression:t,field:i,visible:l}=this;return!!e&&(!1===i?.nullable||!(!l||null==t)&&t)}set required(e){this._overrideIfSome("required",e)}get showNoValueOptionEnabled(){const{element:e}=this;return!this.required&&(!v(e)||e.input.showNoValueOption)}get showNoValueLabel(){const{element:e}=this;return v(e)?e.input.noValueOptionLabel:null}get submittable(){const{field:e,required:t,valid:i,value:l}=this;return(!t||null!=l)&&(!!i||this.initialFeature.getAttribute(e.name)===l)}get updating(){const{editableExpressionExecutor:e,valueExpressionExecutor:t}=this;return null!=t&&t.updating||null!=e&&e.updating}get valid(){const e=this.editable?this._validate():null;return this._set("error",e),null===e}get value(){if(this._shouldUseValueExpression){this._valueOriginIsExpression=!0;const e=this.evaluatedValueExpression;if(this.dataType===b.Date){if(e instanceof Date)return e.getTime();if("number"!=typeof e)return parseInt(e,10)}return null!=e&&"object"==typeof e?e.toString():e}return this._valueOriginIsExpression=!1,this._storedValue}set value(e){this.notifyChange("evaluatedVisibilityExpression"),this.set("_storedValue",e)}get valueOriginIsExpression(){return this._valueOriginIsExpression}get visible(){return!this._isEditTrackingField&&(null!=this.evaluatedVisibilityExpression?this.evaluatedVisibilityExpression:null!=this.element||this._isVisibleByDefault)}_isDomainCompatible(e){const{field:t}=this;if("coded-value"===e?.type){const i=typeof e.codedValues[0].code;if("string"===i&&p(t)||"number"===i&&a(t))return!0}return!!("range"===e?.type&&a(t)||d(t))}_validate(){const{dataType:e,domain:t,field:i,initialFeature:l,minLength:n,required:r,valid:o,value:u}=this,a=r&&null==u,p=void 0!==o;return!a&&l.getAttribute(i.name)===u&&p?null:a?y.INVALID_TYPE:"text"===e&&n>-1&&"string"==typeof u&&u.length<n?x.TOO_SHORT:t?null!==u||r?s(t,u):null:h(i,u)}};e([t()],T.prototype,"_storedValue",void 0),e([t()],T.prototype,"_configAllowsEdits",null),e([t()],T.prototype,"_layerAndFieldAllowEdits",null),e([t()],T.prototype,"_isVisibleByDefault",null),e([t()],T.prototype,"_isEditTrackingField",null),e([t()],T.prototype,"_shouldUseValueExpression",null),e([t()],T.prototype,"_valueOriginIsExpression",void 0),e([t()],T.prototype,"dataType",null),e([t()],T.prototype,"dateDataType",null),e([t()],T.prototype,"domain",null),e([t()],T.prototype,"editable",null),e([t({readOnly:!0})],T.prototype,"error",void 0),e([t()],T.prototype,"evaluatedRequiredExpression",null),e([t()],T.prototype,"evaluatedValueExpression",null),e([t()],T.prototype,"field",void 0),e([t()],T.prototype,"group",void 0),e([t({readOnly:!0})],T.prototype,"hint",null),e([t()],T.prototype,"includeDate",null),e([t()],T.prototype,"includeTime",null),e([t()],T.prototype,"includeTimestamp",null),e([t()],T.prototype,"initialFeature",null),e([t({readOnly:!0})],T.prototype,"inputType",null),e([t()],T.prototype,"label",null),e([t()],T.prototype,"maxLength",null),e([t()],T.prototype,"minLength",null),e([t({readOnly:!0})],T.prototype,"name",null),e([t()],T.prototype,"range",null),e([t()],T.prototype,"required",null),e([t()],T.prototype,"requiredExpressionExecutor",void 0),e([t()],T.prototype,"showNoValueOptionEnabled",null),e([t()],T.prototype,"submittable",null),e([t({readOnly:!0})],T.prototype,"type",void 0),e([t()],T.prototype,"updating",null),e([t()],T.prototype,"valid",null),e([t({value:null})],T.prototype,"value",null),e([t()],T.prototype,"valueExpressionExecutor",void 0),e([t()],T.prototype,"valueOriginIsExpression",null),e([t()],T.prototype,"visible",null),T=e([i("esri.widgets.FeatureForm.FieldInput")],T);const V=e=>e&&!Number.isNaN(e.valueOf()),D=T;export{D as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../intl.js";import{isSome as e}from"../../core/arrayUtils.js";import{
|
|
5
|
+
import"../../intl.js";import{isSome as e}from"../../core/arrayUtils.js";import{neverReached as t}from"../../core/compilerUtils.js";import{templateHasKey as r,replace as n}from"../../core/string.js";import{DomainValidationError as o,getDomainRange as i}from"../../layers/support/domainUtils.js";import{isDateField as a,NumericRangeValidationError as l,getFieldRange as u,TypeValidationError as s}from"../../layers/support/fieldUtils.js";import{getLabelForDateFieldValue as p}from"../support/dateUtils.js";import{substitute as m}from"../../intl/substitute.js";const d=e=>"field"===e?.type,c=e=>"group"===e?.type,f=e=>"relationship"===e?.type,y=e=>!c(e)&&null!=e.group,T=e=>"field"===e.type,b=e=>"group"===e.type,E=e=>"relationship"===e.type,O=e=>e.reduce(((e,t)=>c(t)?[...e,...t.inputs]:[...e,t]),[]),g=e=>O(e).filter(d),j=e=>O(e).filter(f),x=e=>null!=e&&(v(e,"combo-box")||v(e,"radio-buttons")),v=(e,t)=>null!=e&&e.input?.type===t,V=e=>null!=e&&(v(e,"text-box")||v(e,"text-area")),h=({domain:e,inputType:t="text-box",dataType:r})=>"number"===r&&"text-box"===t&&(!e||"coded-value"!==e.type),U=e=>"items"in e,N={typeFieldName:null,types:[]};function _(t,n,o){const i=Object.keys(n).filter((e=>r(t,e))),a=i.map((e=>n[e])),l=i.map((e=>o.get(e))).filter(e);return L(t,A(a,l))}function A(e,t){const r=t.map(((t,r)=>{let n=e[r];if(t.domain&&"coded-value"===t.domain.type){const e=t.domain.codedValues.find((e=>e.code===n));e?.name&&(n=e.name)}return a(t)&&(n=p(t,n)),[t.name,n]}));return Object.fromEntries(r)}function L(e,t){return n(n(e,(e=>`{${e.toLowerCase()}}`)),Object.fromEntries(Object.entries(t).map((([e,t])=>[e.toLowerCase(),t]))))}const F=e=>e?"subtype-sublayer"===e.type?{typeFieldName:e.parent?.subtypeField,types:e.parent?.subtypes??[]}:"types"in e&&e.types?{typeFieldName:e.typeIdField,types:e.types.map((({id:e,name:t,domains:r})=>({code:e,name:t,domains:r})))}:N:N,I=(e,t)=>{if(!e)return!0;const{operations:r}=e;switch(t){case"INSERT":return r.supportsAdd;case"UPDATE":case"DELETE":return r.supportsUpdate;default:return!0}};var D;!function(e){e.TOO_SHORT="length-validation-error::too-short"}(D||(D={}));const R={type:"number"},w={type:"number",intlOptions:{notation:"scientific"}},C={type:"date",intlOptions:{day:"2-digit",month:"2-digit",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}};function S(e){return e>=1e7||e<=-1e7}const G=(e,t)=>{const{dataType:r,domain:n,error:a,field:p,minLength:d,value:c,required:f}=e;if(!t||!a)return null;if(f&&null===c)return t.validationErrors.cannotBeNull;if(a===o.VALUE_OUT_OF_RANGE||a===l.OUT_OF_RANGE){const e=i(n)||u(p);return m(t.validationErrors.outsideRange,e,{format:{max:"date"===r?C:S(e.max)?w:R,min:"date"===r?C:S(e.min)?w:R}})}return a===o.INVALID_CODED_VALUE?t.validationErrors.invalidCodedValue:a===s.INVALID_TYPE?t.validationErrors.invalidType:a===D.TOO_SHORT?m(t.validationErrors.tooShort,{min:d}):null},H=e=>{if(!e)return;const t=e.layer,r=t&&"geometryType"in t?t.geometryType:void 0,n=e.geometry?.type;return"polyline"===n||"polyline"===r?"line":n||r||"table"},P=e=>{const t=[];if(e.formTemplate){const{description:n,title:o}=e.formTemplate;e.fields?.forEach((e=>{const i=o&&r(o,e.name),a=n&&r(n,e.name);(i||a)&&t.push(e.name)}))}return t};function k(e){if("formTemplate"in e&&e.formTemplate){return(e.formTemplate.elements?.filter(T)??[]).some((({fieldName:t})=>!e.fieldsIndex.get(t)))}return!1}function q(e,t){return null==e||t.onValue!==e&&t.offValue!==e}function B(e,r){switch(r.objectType){case"any":return!0;case"null":return null==e;case"code":return e===r.codedValue?.code;case"range":return null!=e&&null!=r.minValue&&null!=r.maxValue&&+e>=r.minValue&&+e<=r.maxValue;default:return t(r.objectType),!1}}export{D as LengthValidationError,I as capabilitiesAllowEditType,g as flattenFieldInputs,O as flattenInputs,j as flattenRelationshipInputs,k as formTemplateHasInvalidFields,A as getComputedAttributes,G as getErrorMessageForFieldInput,P as getFieldsInTitleAndDesc,H as getIconForFeature,F as getNormalizedFeatureTypeInfo,T as isFieldElement,v as isFieldElementWithInputType,x as isFieldElementWithShowNoValueOptionInput,V as isFieldElementWithTextInput,d as isFieldInput,b as isGroupElement,c as isGroupInput,y as isInputInGroupInput,h as isNumberFieldInput,E as isRelationshipElement,f as isRelationshipInput,U as isTemplateItemGroup,_ as parseFormTemplateString,L as substituteFieldTemplatesInString,q as valueIsInvalidSwitchValue,B as valueIsValidContingentValue};
|