@arcgis/core 4.33.8 → 4.33.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/arcade/featureset/actions/GroupBy.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/11587332ed09d46fa368.js +1 -0
  4. package/assets/esri/core/workers/chunks/5f42b7315d8330401410.js +1 -0
  5. package/assets/esri/core/workers/chunks/{4c3eda84081c47d2cdd4.js → 710ee12aa955e3eea371.js} +1 -1
  6. package/assets/esri/core/workers/chunks/7d49219adc68b91abf00.js +1 -0
  7. package/assets/esri/core/workers/chunks/822e554d7c985c0181b9.js +1 -0
  8. package/assets/esri/core/workers/chunks/c3dfa739d109aa9c99a5.js +1 -0
  9. package/kernel.js +1 -1
  10. package/layers/mixins/ArcGISImageService.js +1 -1
  11. package/layers/save/featureLayerUtils.js +1 -1
  12. package/package.json +1 -1
  13. package/rest/knowledgeGraphService.js +1 -1
  14. package/support/revision.js +1 -1
  15. package/views/2d/engine/vectorTiles/decluttering/CollisionJob.js +1 -1
  16. package/views/2d/engine/webgl/FeatureDisplayList.js +1 -1
  17. package/views/2d/engine/webgl/Painter.js +1 -1
  18. package/views/2d/engine/webgl/collisions/LabelMetric.js +1 -1
  19. package/views/2d/engine/webgl/cpuMapped/MappedMesh.js +1 -1
  20. package/views/2d/engine/webgl/mesh/templates/segmentUtils.js +1 -1
  21. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  22. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
  23. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/projection.js +1 -1
  24. package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
  25. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  26. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
  27. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
  28. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
  29. package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
  30. package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
  31. package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
  32. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
  33. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  34. package/views/2d/layers/features/schema/processor/LabelMatcherSchema.js +1 -1
  35. package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
  36. package/views/2d/layers/features/schema/processor/SubtypeProcessorSchema.js +1 -1
  37. package/views/SelectionManager.js +1 -1
  38. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  39. package/assets/esri/core/workers/chunks/58f093b776b160a7d1b8.js +0 -1
  40. package/assets/esri/core/workers/chunks/606782a94adcce6975af.js +0 -1
  41. package/assets/esri/core/workers/chunks/68e432a80bf6fa7b17fb.js +0 -1
  42. package/assets/esri/core/workers/chunks/abc4922d9e5186f1866e.js +0 -1
  43. package/assets/esri/core/workers/chunks/d45a4e5806a80b69ceec.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{createLabelMatcherSchema as e}from"./LabelMatcherSchema.js";import{createMatcherSchema as r}from"./MatcherSchema.js";import{createVVBindings as t}from"./StorageSchema.js";import{createVisualVariableUniforms as s}from"./VisualVariablesSchema.js";import{getWebGLCapabilities as a}from"../../../../../webgl/capabilities.js";async function i(e,{subtypeField:t,sublayers:s}){const a=await Promise.all(s.map((({renderer:t})=>r(e,t))));return{type:"subtype",subtypeField:t,renderers:s.reduce(((e,{subtypeCode:r},t)=>({...e,[r]:a[t]})),{})}}function n(e,r){const s=a();return{type:"multi",filters:e.filters,capabilities:{maxTextureSize:s.maxTextureSize},keyField:r.subtypeField,target:"feature",bindings:r.sublayers.reduce(((e,{renderer:r,subtypeCode:s})=>{const a=t(r);return{...e,[s]:a}}),{})}}async function o(r,{subtypeField:t,sublayers:a,layerId:i}){const n=await Promise.all(a.map((t=>{const a=s(t.renderer),n={...t,geometryType:t.geometryType??null,layerId:i};return e(r,n,a)})));return{type:"subtype",subtypeField:t,renderers:a.reduce(((e,{subtypeCode:r},t)=>({...e,[r]:n[t]})),{})}}async function u(e,r,t,s){return{storage:n(r,t),mesh:{properties:{timeZone:r.timeZone,displayRefreshVersion:s,returnMeshObjectId:!1,sortKey:null,currentUser:r.currentUser},strategy:{type:"feature"},factory:{symbology:await i(e,t),labels:await o(e,t)}},expressionProperties:{timeExtent:r.timeExtent?.toJSON()}}}export{u as createSubtypeProcessorSchema};
5
+ import{createLabelMatcherSchema as e}from"./LabelMatcherSchema.js";import{createMatcherSchema as r}from"./MatcherSchema.js";import{createVVBindings as t}from"./StorageSchema.js";import{createVisualVariableUniforms as s}from"./VisualVariablesSchema.js";import{getWebGLCapabilities as i}from"../../../../../webgl/capabilities.js";async function a(e,{subtypeField:t,sublayers:s}){const i=await Promise.all(s.map((({renderer:t})=>r(e,t))));return{type:"subtype",subtypeField:t,renderers:s.reduce(((e,{subtypeCode:r},t)=>({...e,[r]:i[t]})),{})}}function n(e,r){const s=i();return{type:"multi",filters:e.filters,capabilities:{maxTextureSize:s.maxTextureSize},keyField:r.subtypeField,target:"feature",bindings:r.sublayers.reduce(((e,{renderer:r,subtypeCode:s})=>{const i=t(r);return{...e,[s]:i}}),{})}}async function o(r,{subtypeField:t,sublayers:i,labelingInfoSource:a}){const n=await Promise.all(i.map((t=>{const i=s(t.renderer),n={...t,geometryType:t.geometryType??null,labelingInfoSource:a};return e(r,n,i)})));return{type:"subtype",subtypeField:t,renderers:i.reduce(((e,{subtypeCode:r},t)=>({...e,[r]:n[t]})),{})}}async function u(e,r,t,s){return{storage:n(r,t),mesh:{properties:{timeZone:r.timeZone,displayRefreshVersion:s,returnMeshObjectId:!1,sortKey:null,currentUser:r.currentUser},strategy:{type:"feature"},factory:{symbology:await a(e,t),labels:await o(e,t)}},expressionProperties:{timeExtent:r.timeExtent?.toJSON()}}}export{u as createSubtypeProcessorSchema};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{difference as t}from"../core/arrayUtils.js";import s from"../core/Collection.js";import{referenceSetter as o}from"../core/collectionUtils.js";import i from"../core/Evented.js";import n from"../core/Logger.js";import{getOrCreateMapValue as r}from"../core/MapUtils.js";import{removeMaybe as l}from"../core/maybe.js";import c from"../core/ReactiveMap.js";import{watch as a,on as h,initial as u}from"../core/reactiveUtils.js";import{symmetricDifference as d}from"../core/SetUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import{isSubtypeSublayer as g,isSubtypeGroupLayer as y,isKnowledgeGraphLayer as m,isMapImageLayer as _}from"../layers/support/layerUtils.js";import v from"../rest/support/Query.js";import{isSelectableLayer as w}from"./support/selectionUtils.js";let S=class extends i.EventedAccessor{constructor(e){super(e),this._selectionMap=new c,this._sources=new s,this._trashCan=[],this._layerEditHandles=new s,this._vizTaskId=0,this.view=null,this.showHighlight=!0,this.highlightName="default"}initialize(){this.addHandles([a((()=>[this.view,this.showHighlight]),(()=>this._refreshVisualization())),a((()=>this.view),(e=>{e?.when().then((()=>this.syncSources()))}),u),h((()=>this.sources),"change",(e=>{const t=this._selectionMap,s=[];for(const o of e.removed){const e=t.get(o);e&&(t.delete(o),e.highlightHandle?.remove(),s.push({layer:o,selection:[],added:[],removed:[...e.selection]}))}this._refreshListeners(),s.length&&this._onSelectionChange(s)}),{onListenerAdd:()=>this._refreshListeners()})])}destroy(){this.clear(),this._layerEditHandles.drain(l)}get selections(){return Array.from(this._selectionMap.entries()).map((e=>{const[t,s]=e;return{layer:t,selection:[...s.selection]}}))}get count(){let e=0;for(const t of this._selectionMap.values())e+=t.selection.length;return e}get hasSelection(){return this.count>0}get sources(){return this._sources}set sources(e){o(e,this._sources)}syncSources(){const e=new Set,t=this.view?.map;if(!t)return;const s=t=>{m(t)?(t.layers?.forEach(s),t.tables?.forEach(s)):_(t)?(t.sublayers?.forEach(s),t.subtables?.forEach(s)):y(t)?t.sublayers?.forEach(s):w(t)&&e.add(t)};t.allLayers.forEach(s),t.allTables.forEach(s),this.sources=[...e]}async getSelectedFeatures(e,t={},s="layerView"){const{view:o,selections:i}=this;if(!o&&"layerView"===s)return n.getLogger(this).warn("Cannot query layer views without a view."),[];const r=e?.length?i.filter((t=>e.includes(t.layer))):i,l=[];return r.forEach((async e=>{const{layer:i,selection:n}=e;if(!n.length)return;const r=g(i)?i.parent:i;if(null==r)return;if("layer"===s)return void l.push(F(r,n,t));if(b(r)||!o||!E(r))return;const c=await o.whenLayerView(r).catch((()=>null));c&&l.push(F(c,n,t))})),(await Promise.all(l)).filter((e=>null!=e))}updateSelection(e){const s=new Map;for(const[t,n]of this._selectionMap)s.set(t,[...n.selection]);let o=!1;const i=e.current.concat(e.added);for(const t of i){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(w(e)||g(e))&&null!==i){const t=r(s,e,(()=>[]));t.includes(i)||(t.push(i),o=!0)}}for(const t of e.removed){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(w(e)||g(e))&&null!==i){const t=s.get(e),n=t?.indexOf(i);void 0!==n&&n>=0&&(t?.splice(n,1),o=!0)}}if(o){const{_selectionMap:e,_trashCan:o}=this,i=[];for(const[n,r]of s){const s=e.get(n);void 0!==s&&o.push(s),e.set(n,{selection:r}),i.push({layer:n,selection:r,...t(void 0!==s?s.selection:[],r)})}this._onSelectionChange(i)}}setSelection(e,t){this._setSelection(e,t)}getSelection(e){const t=this._selectionMap.get(e);return t?.selection}appendToSelection(e,t){const s=this._selectionMap.get(e),o=void 0!==s?[...s.selection]:[];for(const i of t)o.includes(i)||o.push(i);this._setSelection(e,o)}removeFromSelection(e,t){const s=this._selectionMap.get(e);if(!s)return;const o=[];for(const i of s.selection)t.includes(i)||o.push(i);this._setSelection(e,o)}toggleInSelection(e,t){const s=this._selectionMap.get(e);if(!s||0===s.selection.length)return void this._setSelection(e,t);const o=new Set(s.selection),i=new Set(t),n=d(o,i);this._setSelection(e,Array.from(n))}clear(){const e=this._selectionMap.values();this._trashCan.push(...e);const t=[];for(const[s,o]of this._selectionMap.entries())t.push({layer:s,added:[],removed:[...o.selection],selection:[]});this._selectionMap.clear(),this._onSelectionChange(t)}_onSelectionChange(e){this._refreshVisualization(),this.emit("selection-change",{view:this.view,changes:e})}_refreshVisualization(){for(this._vizTaskId++;this._trashCan.length>0;){const e=this._trashCan.pop();e?.highlightHandle?.remove()}if(null==this.view)return;const{sources:e,view:t,_selectionMap:s,showHighlight:o}=this,i=this._vizTaskId;for(const n of e){const e=s.get(n),r=g(n)?n.parent:n;if(null!=r&&E(r)){if(b(r))continue;t.whenLayerView(r).then((t=>{e?.highlightHandle?.remove(),null!=e&&o&&i===this._vizTaskId&&"highlight"in t&&"function"==typeof t.highlight&&e.selection.length>0&&(e.highlightHandle=t.highlight(e.selection,this.highlightName))})).catch((()=>{e?.highlightHandle?.remove()}))}}}_refreshListeners(){this._layerEditHandles.drain(l);const e=new Set(this.sources.map((e=>g(e)?e.parent:e)));for(const t of e)w(t)&&"on"in t&&t.on&&this._layerEditHandles.push(t.on("edits",(e=>this._onLayerEdit(e,t))))}_onLayerEdit(e,t){if(y(t))this._onParentLayerEdit(e,t);else if(e.deletedFeatures.length&&this._selectionMap.has(t)){const s=[];e.deletedFeatures.forEach((({error:e,objectId:t})=>{null!=t&&null==e&&s.push(t)})),this.removeFromSelection(t,s)}}_onParentLayerEdit(e,t){const{deletedFeatures:s,edits:o,updatedFeatures:i}=e;if(o?.updateFeatures?.forEach((e=>{const s=e.getObjectId()??e.attributes[t.objectIdField];if(null==s)return;if(i.find((e=>e.objectId===s))?.error)return;const o=t.findSublayerForFeature(e);if(!w(o))return;const n=t.sublayers.find((e=>!(!w(e)||!this.getSelection(e)?.includes(s))));w(n)&&n!==o&&(this.removeFromSelection(n,[s]),this.appendToSelection(o,[s]))})),s.length){const e=[];s.forEach((({error:t,objectId:s})=>{null!=s&&null==t&&e.push(s)})),t.sublayers.forEach((t=>{w(t)&&this._selectionMap.has(t)&&this.removeFromSelection(t,e)}))}}_setSelection(e,s){if(!this.sources.includes(e))throw new Error(`Cannot set selection on layer ${e.title} because it is not in 'sources'`);const o=this._selectionMap.get(e);if(void 0===o||!M(o,{selection:s})){void 0!==o&&this._trashCan.push(o),this._selectionMap.set(e,{selection:[...s]});const i={layer:e,selection:[...s],...t(void 0!==o?o.selection:[],s)};this._onSelectionChange([i])}}};e([p()],S.prototype,"_selectionMap",void 0),e([p()],S.prototype,"_sources",void 0),e([p({readOnly:!0,nonNullable:!0})],S.prototype,"selections",null),e([p({readOnly:!0,nonNullable:!0})],S.prototype,"count",null),e([p()],S.prototype,"view",void 0),e([p({readOnly:!0,nonNullable:!0})],S.prototype,"hasSelection",null),e([p()],S.prototype,"showHighlight",void 0),e([p()],S.prototype,"sources",null),e([p()],S.prototype,"highlightName",void 0),S=e([f("esri.views.SelectionManager")],S);const b=e=>g(e)?!0===e.parent?.isTable:e.isTable,j=e=>void 0!==e.layer,E=e=>void 0!==e?.when,M=(e,t)=>{if(null==e&&null==t)return!0;if(null!=e&&null==t||null==e&&null!=t)return!1;if(null!=e&&null!=t&&null!=e.selection&&null!=t.selection){const s=[...e.selection],o=[...t.selection];if(s.length!==o.length)return!1;s.sort(),o.sort();for(let e=0;e<s.length;e++)if(s[e]!==o[e])return!1}return!0},F=async(e,t,s={})=>{let o;if(j(e)){const i=e;o=void 0===i?null:await i.queryFeatures(new v({...s,objectIds:t})).then((t=>({data:t,layer:e.layer})))}else{const i=e;o=void 0===i?null:await i.queryFeatures(new v({...s,objectIds:t})).then((e=>({data:e,layer:i})))}return o},L=S;export{L as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{isSome as t,difference as s}from"../core/arrayUtils.js";import o from"../core/Collection.js";import{referenceSetter as i}from"../core/collectionUtils.js";import n from"../core/Evented.js";import r from"../core/Logger.js";import{getOrCreateMapValue as l}from"../core/MapUtils.js";import{removeMaybe as c}from"../core/maybe.js";import a from"../core/ReactiveMap.js";import{watch as h,on as u,initial as d}from"../core/reactiveUtils.js";import{symmetricDifference as p}from"../core/SetUtils.js";import{property as f}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import{subclass as g}from"../core/accessorSupport/decorators/subclass.js";import{isSubtypeSublayer as y,isSubtypeGroupLayer as m,isKnowledgeGraphLayer as _,isMapImageLayer as v}from"../layers/support/layerUtils.js";import w from"../rest/support/Query.js";import{isSelectableLayer as S}from"./support/selectionUtils.js";let b=class extends n.EventedAccessor{constructor(e){super(e),this._selectionMap=new a,this._sources=new o,this._trashCan=[],this._layerEditHandles=new o,this._vizTaskId=0,this.view=null,this.showHighlight=!0,this.highlightName="default"}initialize(){this.addHandles([h((()=>[this.view,this.showHighlight]),(()=>this._refreshVisualization())),h((()=>this.view),(e=>{e?.when().then((()=>this.syncSources()))}),d),u((()=>this.sources),"change",(e=>{const t=this._selectionMap,s=[];for(const o of e.removed){const e=t.get(o);e&&(t.delete(o),e.highlightHandle?.remove(),s.push({layer:o,selection:[],added:[],removed:[...e.selection]}))}this._refreshListeners(),s.length&&this._onSelectionChange(s)}),{onListenerAdd:()=>this._refreshListeners()})])}destroy(){this.clear(),this._layerEditHandles.drain(c)}get selections(){return Array.from(this._selectionMap.entries()).map((e=>{const[t,s]=e;return{layer:t,selection:[...s.selection]}}))}get count(){let e=0;for(const t of this._selectionMap.values())e+=t.selection.length;return e}get hasSelection(){return this.count>0}get sources(){return this._sources}set sources(e){i(e,this._sources)}syncSources(){const e=new Set,t=this.view?.map;if(!t)return;const s=t=>{_(t)?(t.layers?.forEach(s),t.tables?.forEach(s)):v(t)?(t.sublayers?.forEach(s),t.subtables?.forEach(s)):m(t)?t.sublayers?.forEach(s):S(t)&&e.add(t)};t.allLayers.forEach(s),t.allTables.forEach(s),this.sources=[...e]}async getSelectedFeatures(e,s={},o="layerView"){const{view:i,selections:n}=this;if(!i&&"layerView"===o)return r.getLogger(this).warn("Cannot query layer views without a view."),[];const l=(e?.length?n.filter((t=>e.includes(t.layer))):n).map((async e=>{const{layer:t,selection:n}=e;if(!n.length)return;const r=y(t)?t.parent:t;if(null!=r){if(i&&"layerView"===o&&!j(r)&&E(r)){const e=await i.whenLayerView(r).catch((()=>null));if(e)return L(e,n,s)}return L(r,n,s)}})).filter(t);return(await Promise.all(l)).filter(t)}updateSelection(e){const t=new Map;for(const[s,n]of this._selectionMap)t.set(s,[...n.selection]);let o=!1;const i=e.current.concat(e.added);for(const s of i){const e=s.sourceLayer,i=s.getObjectId();if(this.sources.includes(e)&&(S(e)||y(e))&&null!==i){const s=l(t,e,(()=>[]));s.includes(i)||(s.push(i),o=!0)}}for(const s of e.removed){const e=s.sourceLayer,i=s.getObjectId();if(this.sources.includes(e)&&(S(e)||y(e))&&null!==i){const s=t.get(e),n=s?.indexOf(i);void 0!==n&&n>=0&&(s?.splice(n,1),o=!0)}}if(o){const{_selectionMap:e,_trashCan:o}=this,i=[];for(const[n,r]of t){const t=e.get(n);void 0!==t&&o.push(t),e.set(n,{selection:r}),i.push({layer:n,selection:r,...s(void 0!==t?t.selection:[],r)})}this._onSelectionChange(i)}}setSelection(e,t){this._setSelection(e,t)}getSelection(e){const t=this._selectionMap.get(e);return t?.selection}appendToSelection(e,t){const s=this._selectionMap.get(e),o=void 0!==s?[...s.selection]:[];for(const i of t)o.includes(i)||o.push(i);this._setSelection(e,o)}removeFromSelection(e,t){const s=this._selectionMap.get(e);if(!s)return;const o=[];for(const i of s.selection)t.includes(i)||o.push(i);this._setSelection(e,o)}toggleInSelection(e,t){const s=this._selectionMap.get(e);if(!s||0===s.selection.length)return void this._setSelection(e,t);const o=new Set(s.selection),i=new Set(t),n=p(o,i);this._setSelection(e,Array.from(n))}clear(){const e=this._selectionMap.values();this._trashCan.push(...e);const t=[];for(const[s,o]of this._selectionMap.entries())t.push({layer:s,added:[],removed:[...o.selection],selection:[]});this._selectionMap.clear(),this._onSelectionChange(t)}_onSelectionChange(e){this._refreshVisualization(),this.emit("selection-change",{view:this.view,changes:e})}_refreshVisualization(){for(this._vizTaskId++;this._trashCan.length>0;){const e=this._trashCan.pop();e?.highlightHandle?.remove()}if(null==this.view)return;const{sources:e,view:t,_selectionMap:s,showHighlight:o}=this,i=this._vizTaskId;for(const n of e){const e=s.get(n),r=y(n)?n.parent:n;if(null!=r&&E(r)){if(j(r))continue;t.whenLayerView(r).then((t=>{e?.highlightHandle?.remove(),null!=e&&o&&i===this._vizTaskId&&"highlight"in t&&"function"==typeof t.highlight&&e.selection.length>0&&(e.highlightHandle=t.highlight(e.selection,this.highlightName))})).catch((()=>{e?.highlightHandle?.remove()}))}}}_refreshListeners(){this._layerEditHandles.drain(c);const e=new Set(this.sources.map((e=>y(e)?e.parent:e)));for(const t of e)S(t)&&"on"in t&&t.on&&this._layerEditHandles.push(t.on("edits",(e=>this._onLayerEdit(e,t))))}_onLayerEdit(e,t){if(m(t))this._onParentLayerEdit(e,t);else if(e.deletedFeatures.length&&this._selectionMap.has(t)){const s=[];e.deletedFeatures.forEach((({error:e,objectId:t})=>{null!=t&&null==e&&s.push(t)})),this.removeFromSelection(t,s)}}_onParentLayerEdit(e,t){const{deletedFeatures:s,edits:o,updatedFeatures:i}=e;if(o?.updateFeatures?.forEach((e=>{const s=e.getObjectId()??e.attributes[t.objectIdField];if(null==s)return;if(i.find((e=>e.objectId===s))?.error)return;const o=t.findSublayerForFeature(e);if(!S(o))return;const n=t.sublayers.find((e=>!(!S(e)||!this.getSelection(e)?.includes(s))));S(n)&&n!==o&&(this.removeFromSelection(n,[s]),this.appendToSelection(o,[s]))})),s.length){const e=[];s.forEach((({error:t,objectId:s})=>{null!=s&&null==t&&e.push(s)})),t.sublayers.forEach((t=>{S(t)&&this._selectionMap.has(t)&&this.removeFromSelection(t,e)}))}}_setSelection(e,t){if(!this.sources.includes(e))throw new Error(`Cannot set selection on layer ${e.title} because it is not in 'sources'`);const o=this._selectionMap.get(e);if(void 0===o||!F(o,{selection:t})){void 0!==o&&this._trashCan.push(o),this._selectionMap.set(e,{selection:[...t]});const i={layer:e,selection:[...t],...s(void 0!==o?o.selection:[],t)};this._onSelectionChange([i])}}};e([f()],b.prototype,"_selectionMap",void 0),e([f()],b.prototype,"_sources",void 0),e([f({readOnly:!0,nonNullable:!0})],b.prototype,"selections",null),e([f({readOnly:!0,nonNullable:!0})],b.prototype,"count",null),e([f()],b.prototype,"view",void 0),e([f({readOnly:!0,nonNullable:!0})],b.prototype,"hasSelection",null),e([f()],b.prototype,"showHighlight",void 0),e([f()],b.prototype,"sources",null),e([f()],b.prototype,"highlightName",void 0),b=e([g("esri.views.SelectionManager")],b);const j=e=>y(e)?!0===e.parent?.isTable:e.isTable,M=e=>void 0!==e.layer,E=e=>void 0!==e?.when,F=(e,t)=>{if(null==e&&null==t)return!0;if(null!=e&&null==t||null==e&&null!=t)return!1;if(null!=e&&null!=t&&null!=e.selection&&null!=t.selection){const s=[...e.selection],o=[...t.selection];if(s.length!==o.length)return!1;s.sort(),o.sort();for(let e=0;e<s.length;e++)if(s[e]!==o[e])return!1}return!0},L=async(e,t,s={})=>{let o;if(M(e)){const i=e;o=void 0===i?null:await i.queryFeatures(new w({...s,objectIds:t})).then((t=>({data:t,layer:e.layer})))}else{const i=e;o=void 0===i?null:await i.queryFeatures(new w({...s,objectIds:t})).then((e=>({data:e,layer:i})))}return o},C=b;export{C 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.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import{unique as e,isSome as r}from"../../core/arrayUtils.js";import o from"../../core/Collection.js";import i from"../../core/Error.js";import s from"../../core/Logger.js";import{destroyMaybe as a}from"../../core/maybe.js";import{whenOnce as n}from"../../core/reactiveUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{isTable as u}from"../../layers/support/layerUtils.js";import{hasEffectiveFeatureExpressionInfo as p}from"../../support/elevationInfoUtils.js";import c from"../BatchAttributeForm/BatchAttributeFormViewModel.js";import h from"./UpdateFeaturesWorkflowData.js";import f from"./Workflow.js";import{whenEditorLayerView as m,makeMultipleSourceLayersError as y}from"./workflowUtils.js";import{SketchController as w}from"./support/SketchController.js";var g;const F=()=>s.getLogger("esri.widgets.Editor.UpdateFeaturesWorkflow");let _=g=class extends f{constructor(t){super(t),this.type="update-features",this._formViewModel=null,this._sketchController=null}async initialize(){this._initializeFormViewModel();try{await this._updatingHandles.addPromise((async()=>{const{fullFeatures:t}=await this.data.when();this._formViewModel.features=new o(t),await this._initializeVisuals(t)})())}catch(t){this.cancel({force:!0,error:new i("update-features-workflow:initialize","Failed to initialize the workflow data.",t)})}}destroy(){this._sketchController=a(this._sketchController),this._formViewModel.destroy()}get features(){return this.data.features}get formViewModel(){return this._formViewModel}get hasPendingEdits(){const{data:t}=this;return t.features.some((e=>!!t.getPendingEditsForFeature(e)?.modified))}get parent(){return this.data.parent}get parentLayer(){return this.parent?.data.editorItem.layer}get selectedFeature(){return this.data.selectedFeature}get sketchViewModel(){return this._sketchController?.viewModel}get updating(){return this._updatingHandles.updating||this._formViewModel.updating||!!this._sketchController?.updating}static create(t){const{applyEdits:o,applyEditsFeatureService:i,...s}=t,a=e(t.features.map((t=>t.sourceLayer??t.layer))).map((e=>t.viewModel.editorItems.find((t=>t.layer===e)))).filter(r),n=new g({data:new h({...s,editorItems:a}),onCommit:k(t.applyEdits)});return n._set("steps",M()),n}async deleteAndCommit(){return this.data.stageDelete(),this.commit()}enter(){throw new Error("Method not implemented.")}exit(t){throw new Error("Method not implemented.")}async reset(){}async save(){const{formViewModel:t}=this;t.submit(),t.valid&&await super.save()}async start(){await super.start(),await n((()=>!this.updating))}_initializeFormViewModel(){const{data:t}=this,e=t.viewModel.view,r=t.getEditorItemForLayer(b(t)),o=new c({editType:"UPDATE",map:e?.map,readOnly:!1===r?.capabilities.update.attributes,spatialReference:e?.spatialReference,timeZone:t.timeZone});this._formViewModel=o,this.addHandles(o.on("value-change",(e=>{for(const r of e.features)t.getPendingEditsForFeature(r)?.setAttribute(e.fieldName,e.value);this._sketchController?.notifyAttributesChanged(e)})))}async _initializeHighlights(t,e,r){const o=await m(r,e);this.addHandles(o.highlight(t))}async _initializeSketchController(t,e,r){const o=new w({sourceLayer:e,view:r,features:t});this._sketchController=o,await n((()=>!o.updating));const{data:i}=this;await o.startUpdatingFeatures(t,(t=>{const e=[];for(const{feature:r,geometry:o}of t)i.getPendingEditsForFeature(r)?.updateGeometry(o),e.push(r);this._formViewModel.notifyGeometriesChanged(e)}),(()=>{F().warnOnce("editor:batch-update-visual-variables","UpdateFeaturesWorkflow does not currently support modifying visual variables through the scale and rotate tools.")}))}async _initializeVisuals(t){const{data:e}=this,{view:r}=e.viewModel;if(!r)return;const o=b(e);if(u(o))return;const i=e.getEditorItemForLayer(o);return!i?.capabilities.update.geometry||"3d"===r?.type&&p(o.elevationInfo)?this._initializeHighlights(t,o,r):this._initializeSketchController(t,o,r)}};t([l()],_.prototype,"features",null),t([l()],_.prototype,"formViewModel",null),t([l()],_.prototype,"hasPendingEdits",null),t([l()],_.prototype,"parent",null),t([l()],_.prototype,"parentLayer",null),t([l()],_.prototype,"selectedFeature",null),t([l()],_.prototype,"sketchViewModel",null),t([l()],_.prototype,"type",void 0),t([l()],_.prototype,"updating",null),t([l()],_.prototype,"_formViewModel",void 0),t([l()],_.prototype,"_sketchController",void 0),_=g=t([d("esri.widgets.Editor.UpdateFeaturesWorkflow")],_);const v=_;function M(){return[{id:"editing-features",async setUp(){},async tearDown(){}}]}function k(t){return async e=>{const r=b(e),o=[],i=[];for(const t of e.fullFeatures){const r=e.getPendingEditsForFeature(t),s=r?.stagedForDelete;if(!r?.modified&&!s)continue;const a=t.clone();if(!r?.attributesModified||s){const e=t.sourceLayer;if(!e){F().warn("Feature has no sourceLayer. It will not be included in any applyEdits payload.");continue}const r=e.objectIdField;if(a.attributes={[r]:t.getAttribute(r)},"scene"===e.type&&null!=e.infoFor3D){const r=e.associatedLayer?.globalIdField;null!=r&&a.setAttribute(r,t.getAttribute(r))}}r?.geometryModified&&!s||(a.geometry=null),s?i.push(a):o.push(a)}if(o.length+i.length===0)return void F().warn("No edits to apply. Workflow will finish without sending an applyEdits request.");const s={updateFeatures:o.length>0?o:void 0,deleteFeatures:i.length>0?i:void 0};await t(r,s)}}function b(t){if(t.layers.length>1)throw y();return t.layers[0]}export{v as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import{unique as e,isSome as r}from"../../core/arrayUtils.js";import o from"../../core/Collection.js";import i from"../../core/Error.js";import s from"../../core/Logger.js";import{destroyMaybe as a}from"../../core/maybe.js";import{whenOnce as n}from"../../core/reactiveUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{isTable as u}from"../../layers/support/layerUtils.js";import{hasEffectiveFeatureExpressionInfo as p}from"../../support/elevationInfoUtils.js";import c from"../BatchAttributeForm/BatchAttributeFormViewModel.js";import f from"./UpdateFeaturesWorkflowData.js";import h from"./Workflow.js";import{whenEditorLayerView as m,makeMultipleSourceLayersError as y}from"./workflowUtils.js";import{SketchController as w}from"./support/SketchController.js";var g;const F=()=>s.getLogger("esri.widgets.Editor.UpdateFeaturesWorkflow");let _=g=class extends h{constructor(t){super(t),this.type="update-features",this._formViewModel=null,this._sketchController=null}async initialize(){this._initializeFormViewModel();try{await this._updatingHandles.addPromise((async()=>{const{fullFeatures:t}=await this.data.when();this._formViewModel.features=new o(t),await this._initializeVisuals(t)})())}catch(t){this.cancel({force:!0,error:new i("update-features-workflow:initialize","Failed to initialize the workflow data.",t)})}}destroy(){this._sketchController=a(this._sketchController),this._formViewModel.destroy()}get features(){return this.data.features}get formViewModel(){return this._formViewModel}get hasPendingEdits(){const{data:t}=this;return t.features.some((e=>!!t.getPendingEditsForFeature(e)?.modified))}get parent(){return this.data.parent}get parentLayer(){return this.parent?.data.editorItem.layer}get selectedFeature(){return this.data.selectedFeature}get sketchViewModel(){return this._sketchController?.viewModel}get updating(){return this._updatingHandles.updating||this._formViewModel.updating||!!this._sketchController?.updating}async commit(){const{data:t,_formViewModel:e}=this;for(const r of t.fullFeatures)E(t.getPendingEditsForFeature(r),e.getValues(r));await super.commit()}static create(t){const{applyEdits:o,applyEditsFeatureService:i,...s}=t,a=e(t.features.map((t=>t.sourceLayer??t.layer))).map((e=>t.viewModel.editorItems.find((t=>t.layer===e)))).filter(r),n=new g({data:new f({...s,editorItems:a}),onCommit:M(t.applyEdits)});return n._set("steps",b()),n}async deleteAndCommit(){return this.data.stageDelete(),this.commit()}enter(){throw new Error("Method not implemented.")}exit(t){throw new Error("Method not implemented.")}async reset(){}async save(){const{formViewModel:t}=this;t.submit(),t.valid&&await super.save()}async start(){await super.start(),await n((()=>!this.updating))}_initializeFormViewModel(){const{data:t}=this,e=t.viewModel.view,r=t.getEditorItemForLayer(k(t)),o=new c({editType:"UPDATE",map:e?.map,readOnly:!1===r?.capabilities.update.attributes,spatialReference:e?.spatialReference,timeZone:t.timeZone});this._formViewModel=o,this.addHandles(o.on("value-change",(e=>{for(const r of e.features)t.getPendingEditsForFeature(r)?.setAttribute(e.fieldName,e.value);this._sketchController?.notifyAttributesChanged(e)})))}async _initializeHighlights(t,e,r){const o=await m(r,e);this.addHandles(o.highlight(t))}async _initializeSketchController(t,e,r){const o=new w({sourceLayer:e,view:r,features:t});this._sketchController=o,await n((()=>!o.updating));const{data:i}=this;await o.startUpdatingFeatures(t,(t=>{const e=[];for(const{feature:r,geometry:o}of t)i.getPendingEditsForFeature(r)?.updateGeometry(o),e.push(r);this._formViewModel.notifyGeometriesChanged(e)}),(()=>{F().warnOnce("editor:batch-update-visual-variables","UpdateFeaturesWorkflow does not currently support modifying visual variables through the scale and rotate tools.")}))}async _initializeVisuals(t){const{data:e}=this,{view:r}=e.viewModel;if(!r)return;const o=k(e);if(u(o))return;const i=e.getEditorItemForLayer(o);return!i?.capabilities.update.geometry||"3d"===r?.type&&p(o.elevationInfo)?this._initializeHighlights(t,o,r):this._initializeSketchController(t,o,r)}};t([l()],_.prototype,"features",null),t([l()],_.prototype,"formViewModel",null),t([l()],_.prototype,"hasPendingEdits",null),t([l()],_.prototype,"parent",null),t([l()],_.prototype,"parentLayer",null),t([l()],_.prototype,"selectedFeature",null),t([l()],_.prototype,"sketchViewModel",null),t([l()],_.prototype,"type",void 0),t([l()],_.prototype,"updating",null),t([l()],_.prototype,"_formViewModel",void 0),t([l()],_.prototype,"_sketchController",void 0),_=g=t([d("esri.widgets.Editor.UpdateFeaturesWorkflow")],_);const v=_;function b(){return[{id:"editing-features",async setUp(){},async tearDown(){}}]}function M(t){return async e=>{const r=k(e),o=[],i=[];for(const t of e.fullFeatures){const r=e.getPendingEditsForFeature(t),s=r?.stagedForDelete;if(!r?.modified&&!s)continue;const a=t.clone();if(!r?.attributesModified||s){const e=t.sourceLayer;if(!e){F().warn("Feature has no sourceLayer. It will not be included in any applyEdits payload.");continue}const r=e.objectIdField;if(a.attributes={[r]:t.getAttribute(r)},"scene"===e.type&&null!=e.infoFor3D){const r=e.associatedLayer?.globalIdField;null!=r&&a.setAttribute(r,t.getAttribute(r))}}r?.geometryModified&&!s||(a.geometry=null),s?i.push(a):o.push(a)}if(o.length+i.length===0)return void F().warn("No edits to apply. Workflow will finish without sending an applyEdits request.");const s={updateFeatures:o.length>0?o:void 0,deleteFeatures:i.length>0?i:void 0};await t(r,s)}}function k(t){if(t.layers.length>1)throw y();return t.layers[0]}function E(t,e){if(!t||!t.feature)return;const{attributes:r}=t.feature;Object.keys(e).some((t=>e[t]!==r[t]))&&t.updateAttributes(e)}export{v as default};