@arcgis/core 5.2.0-next.113 → 5.2.0-next.114
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/Ground.d.ts +5 -4
- package/arcgisGlobal.d.ts +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/e164acd876bbd42ed658.js +1 -0
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ar.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.bg.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.bs.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ca.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.cs.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.da.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.de.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.el.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.es.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.et.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.fi.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.fr.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.he.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.hr.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.hu.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.id.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.it.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ja.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ko.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.lt.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.lv.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.nl.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.no.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.pl.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.pt-BR.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ro.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ru.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.sk.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.sl.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.sr.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.sv.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.th.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.tr.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.uk.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.vi.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.zh-CN.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.zh-HK.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.zh-TW.json +1 -1
- package/assets/esri/views/3d/analysis/VolumeMeasurement/t9n/messages.ja.json +1 -1
- package/assets/esri/views/3d/environment/resources/milkyway-band.ktx2 +0 -0
- package/assets/esri/widgets/DistanceMeasurement2D/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/DistanceMeasurement2D/t9n/messages.ro.json +1 -1
- package/assets/esri/widgets/Expand/t9n/messages.id.json +1 -1
- package/assets/esri/widgets/Features/t9n/messages.he.json +1 -1
- package/assets/esri/widgets/Features/t9n/messages.uk.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.bs.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.et.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.fi.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.hr.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.hu.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.id.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.lv.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.nl.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.th.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.tr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/Print/t9n/messages.es.json +1 -1
- package/assets/esri/widgets/Print/t9n/messages.it.json +1 -1
- package/assets/esri/widgets/Print/t9n/messages.lt.json +1 -1
- package/assets/esri/widgets/Print/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/widgets/Print/t9n/messages.sl.json +1 -1
- package/assets/esri/widgets/Print/t9n/messages.sr.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.bs.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.es.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.et.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.fi.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.he.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.hr.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.it.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.lv.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.ar.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.ca.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.cs.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.el.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.es.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.fi.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.he.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.it.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.lt.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.lv.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.pl.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.ro.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.ru.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.sl.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.uk.json +1 -1
- package/assets/esri/widgets/support/GridControls/t9n/messages.pt-BR.json +1 -1
- package/chunks/DeepSky.glsl.js +1 -1
- package/config.js +1 -1
- package/core/Evented.d.ts +1 -1
- package/form/elements/AttachmentElement.d.ts +5 -5
- package/form/elements/inputs/attachments/AttachmentInput.d.ts +1 -1
- package/kernel.js +1 -1
- package/layers/FeatureLayer.d.ts +2 -2
- package/layers/support/FeatureReductionBinning.d.ts +2 -2
- package/layers/support/FeatureReductionCluster.d.ts +2 -2
- package/layers/support/SubtypeSublayer.d.ts +1 -1
- package/package.json +3 -3
- package/popup/FeatureContent.d.ts +7 -7
- package/portal/schemas/definitions.js +1 -1
- package/portal/types.d.ts +1 -1
- package/renderers/DotDensityRenderer.d.ts +2 -2
- package/rest/knowledgeGraph/ReplicaDefinition.d.ts +1 -1
- package/rest/knowledgeGraphService.d.ts +2 -2
- package/rest/support/Query.d.ts +1 -3
- package/rest/support/RelationshipQuery.d.ts +1 -1
- package/support/revision.js +1 -1
- package/symbols/LineSymbol3D.js +1 -1
- package/symbols/cim/types.d.ts +32 -0
- package/views/3d/analysis/ShadowCastAnalysisView3D.d.ts +1 -1
- package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/webgl-engine/effects/glow/BlurEmission.js +1 -1
- package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
- package/views/BreakpointsOwner.d.ts +2 -2
- package/views/SceneView.js +1 -1
- package/views/SelectionManager.d.ts +24 -24
- package/views/View.js +1 -1
- package/views/View2D.js +1 -1
- package/views/interactive/support/types.d.ts +0 -1
- package/views/support/DefaultsFromMap.js +1 -1
- package/widgets/Attachments/support/attachmentUtils.d.ts +8 -0
- package/widgets/BasemapLayerList/BasemapLayerListViewModel.d.ts +1 -0
- package/widgets/BasemapLayerList/BasemapLayerListViewModel.js +1 -1
- package/widgets/BasemapLayerList/BasemapLayerListVisibleElements.d.ts +5 -1
- package/widgets/BasemapLayerList/types.d.ts +15 -2
- package/widgets/BasemapLayerList.d.ts +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.d.ts +14 -0
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/BatchFormInputs.js +1 -1
- package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +29 -2
- package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/MultipleChoiceController.d.ts +1 -5
- package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
- package/widgets/BatchAttributeForm/inputs/types.d.ts +8 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.d.ts +2 -2
- package/widgets/Editor.d.ts +2 -2
- package/widgets/FeatureTable/FeatureTableViewModel.d.ts +6 -6
- package/widgets/FeatureTable/support/FeatureStore.d.ts +2 -2
- package/widgets/FeatureTable.d.ts +5 -5
- package/widgets/LayerList/LayerListVisibleElements.d.ts +4 -1
- package/widgets/support/SelectionList/SelectionListViewModel.d.ts +1 -1
- package/assets/esri/core/workers/chunks/f9b29d2ce1cd31c0fce1.js +0 -1
- package/graphic/graphicOrigins.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import{createTask as n}from"../../core/asyncUtils.js";import{abortMaybe as a}from"../../core/maybe.js";import{isAborted as i,isAbortError as r}from"../../core/promiseUtils.js";import{property as
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import{createTask as n}from"../../core/asyncUtils.js";import{abortMaybe as a}from"../../core/maybe.js";import{isAborted as i,isAbortError as r}from"../../core/promiseUtils.js";import{property as l,subclass as s}from"../../core/accessorSupport/decorators.js";import{supportsHeightModelInfo as o,getLayerHeightModelInfo as p,deriveHeightModelInfoFromLayer as u}from"../../geometry/support/heightModelInfoUtils.js";import{projectWithEngineOrService as c}from"./projectionUtils.js";let d=class extends t{constructor(e){super(e),this.required={extent:!1,heightModelInfo:!1,tileInfo:!1},this.defaultSpatialReference=null,this.inputSpatialReference=null,this.sourcePreloadCount=10,this.priorityCollection=null,this.requiresExtentInSpatialReference=!0,this.viewReady=!1,this._projectExtentTask={task:null,input:null,output:null,spatialReference:null}}destroy(){this._projectExtentTask.task&&(this._projectExtentTask.task=a(this._projectExtentTask.task)),this._set("map",null)}get ready(){return!this._spatialReferenceTask.updating&&!this._tileInfoTask.updating&&!this._extentTask.updating}get heightModelInfoReady(){return!this._heightModelInfoTask.updating}get spatialReference(){return this.inputSpatialReference??this._spatialReferenceTask.spatialReference}get extent(){return this._extentTask.extent}get heightModelInfo(){return this._heightModelInfoTask.heightModelInfo}get combinedHorizontalAndVerticalSpatialReference(){return this.heightModelInfoReady?this._heightModelInfoTask.spatialReference:null}get viewingMode(){return null==this.inputSpatialReference||this.inputSpatialReference.equals(this._spatialReferenceTask.spatialReference)?this._spatialReferenceTask.viewingMode??null:null}get tileInfo(){return this._tileInfoTask.tileInfo}get mapCollections(){const e=this.map?.(),t=[];return null!=this.priorityCollection&&t.push(this.priorityCollection),t.push({parent:e?.basemap,layers:e?.basemap?.baseLayers},{parent:e?.basemap,layers:e?.basemap?.groundLayers},{layers:e?.layers},{parent:e?.ground,layers:e?.ground?.layers},{parent:e?.basemap,layers:e?.basemap?.referenceLayers}),t}get _spatialReferenceTask(){if(this.viewReady)return this._get("_spatialReferenceTask")??{updating:!1};const{spatialReference:e,viewingMode:t,updating:n}=this._combinedSpatialReferenceTask(null,!1);return{spatialReference:e,viewingMode:t,updating:n}}get _heightModelInfoTask(){if(!this.required.heightModelInfo)return{updating:!1};const e=this.viewReady?this._get("_heightModelInfoTask"):null;return e&&!e.updating&&e.heightModelInfo?e:this._combinedSpatialReferenceTask(this.inputSpatialReference,!0)}_combinedSpatialReferenceTask(e,t){let n=e?[new f(e,null,null)]:null;const a=()=>1===n?.length&&(!t||null!=n[0].heightModelInfo);if(this._collectLayers(this.mapCollections,e=>{const t=this._getSupportedSpatialReferences(e);if(t.length>0){const e=this._narrowDownSpatialReferenceCandidates(n,t);null!=e&&(n=e)}return!!a()})&&!a())return{updating:!0};const i=this._pickSpatialReferenceCandidate(n);return{heightModelInfo:i?.heightModelInfo??null,spatialReference:i?.spatialReference??null,viewingMode:i?.viewingMode??null,updating:!1}}get _tileInfoTask(){if(!this.required.tileInfo)return this._get("_tileInfoTask")??{updating:!1};const e=this.map?.(),t=this.spatialReference;if(!t)return{updating:this._spatialReferenceTask.updating};let n;const a=this._collectLayers([{parent:e?.basemap,layers:e?.basemap?.baseLayers},{parent:e?.basemap,layers:e?.basemap?.groundLayers},{layers:e?.layers}],e=>!(!("tileInfo"in e)||!e.tileInfo?.spatialReference.equals(t))&&(n=e,!0),e=>"tileInfo"in e);if(n){return{tileInfo:n.tileInfo,updating:!1}}return{updating:a}}get _extentCandidatesTask(){if(this.viewReady||!this.required.extent)return this._get("_extentCandidatesTask")??{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const e=[],t=this._collectLayers(this.mapCollections,t=>{const n="fullExtents"in t&&t.fullExtents||(null!=t.fullExtent?[t.fullExtent]:[]),a=this.requiresExtentInSpatialReference?null:n[0],i=n.find(e=>e.spatialReference.equals(this.spatialReference))??a;if(i)return e.push({extent:i,layer:t}),!0;if(this._getSupportedSpatialReferences(t).length>0)for(const r of n)e.push({extent:r,layer:t});return!1});return{candidates:e,updating:t}}get _extentTask(){const{candidates:e,updating:t}=this._extentCandidatesTask;if(t)return{updating:t};if(null==e||0===e.length)return{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const r=this._pickExtentCandidate(e),l=this.spatialReference;return r.extent.equals(this._projectExtentTask.input)&&l.equals(this._projectExtentTask.spatialReference)?{extent:this._projectExtentTask.output,updating:null!=this._projectExtentTask.task&&!this._projectExtentTask.task.finished}:(null!=this._projectExtentTask.task&&(this._projectExtentTask.task=a(this._projectExtentTask.task)),this._projectExtentTask={input:r.extent.clone(),output:null,spatialReference:l.clone(),task:n(async e=>{try{const t=await c(r.extent,l,"portalItem"in r.layer?r.layer.portalItem:void 0,e);this._projectExtentTask={...this._projectExtentTask,task:null,output:t}}catch(t){if(i(e))return;this._projectExtentTask={...this._projectExtentTask,task:null}}})},{updating:!0})}_narrowDownSpatialReferenceCandidates(e,t){if(null==e)return t;const n=new Array;for(const a of e)for(const e of t){if(!a.spatialReference.equals(e.spatialReference))continue;const t=g(a.viewingMode,e.viewingMode);if(!1!==t){const i=e.heightModelInfo&&!a.heightModelInfo;n.push(new f(i?e.spatialReference:a.spatialReference,i?e.heightModelInfo:a.heightModelInfo,t));break}}return n.length>0?n:null}_pickSpatialReferenceCandidate(e){const t=this.defaultSpatialReference;if(!e?.length)return t?{heightModelInfo:null,spatialReference:t,viewingMode:null}:null;return(e.length>1&&t?e.find(({spatialReference:e})=>e.equals(t)):null)??e[0]}_getSupportedSpatialReferences(e){const t="supportedSpatialReferences"in e&&e.supportedSpatialReferences||(e.spatialReference?[e.spatialReference]:[]);if(0===t.length)return[];const n=this.required.heightModelInfo&&o(e),a=p(e),i=[];for(const r of t){const t=this.getSpatialReferenceSupport(r,e);if(null!=t){const l=t.constraints??[{spatialReference:r,viewingMode:null}];for(const{spatialReference:t,viewingMode:r}of l)if(!this.requiresExtentInSpatialReference||(this.inputSpatialReference?.equals(t)??!0)){const l=n?a??u(e,t):null;i.push(new f(t,l,r))}}}return i}_pickExtentCandidate(e){const t=this.spatialReference;return e.find(({extent:e})=>t.equals(e.spatialReference))||e[0]}_collectLayers(e,t,n=()=>!0){switch(this._loadMaybe(this.map?.())){case"loading":return!0;case"failed":return!1}const a=new h(n,t);for(const i of e)if(this._collectCollection(i,a),a.done||a.preloading===this.sourcePreloadCount)break;return a.updating}_collectCollection(e,t){if(e.layers){switch(this._loadMaybe(e.parent)){case"loading":return t.updating=!0,void++t.preloading;case"failed":return}for(const n of e.layers)if(("graphics"!==n.type||!n.internal)&&t.layerFilter(n)){switch(this._loadMaybe(n)){case"failed":continue;case"loading":t.updating=!0,++t.preloading;break;case"loaded":if(t.updating||(t.done=t.pushLayer(n)),t.done||t.preloading===this.sourcePreloadCount)break;"layers"in n&&this._collectCollection({layers:n.layers},t)}if(t.done||t.preloading===this.sourcePreloadCount)break}}}_loadMaybe(e){return e&&"loadStatus"in e&&null!=e.loadStatus?"not-loaded"===e.loadStatus?(e.load().catch(e=>{r(e)}),"loading"):e.loadStatus:"loaded"}};e([l()],d.prototype,"required",void 0),e([l({constructOnly:!0})],d.prototype,"map",void 0),e([l({constructOnly:!0})],d.prototype,"getSpatialReferenceSupport",void 0),e([l()],d.prototype,"defaultSpatialReference",void 0),e([l()],d.prototype,"inputSpatialReference",void 0),e([l()],d.prototype,"sourcePreloadCount",void 0),e([l()],d.prototype,"priorityCollection",void 0),e([l()],d.prototype,"requiresExtentInSpatialReference",void 0),e([l()],d.prototype,"viewReady",void 0),e([l({readOnly:!0})],d.prototype,"ready",null),e([l({readOnly:!0})],d.prototype,"heightModelInfoReady",null),e([l({readOnly:!0})],d.prototype,"spatialReference",null),e([l({readOnly:!0})],d.prototype,"extent",null),e([l({readOnly:!0})],d.prototype,"heightModelInfo",null),e([l({readOnly:!0})],d.prototype,"combinedHorizontalAndVerticalSpatialReference",null),e([l({readOnly:!0})],d.prototype,"viewingMode",null),e([l({readOnly:!0})],d.prototype,"tileInfo",null),e([l({readOnly:!0})],d.prototype,"mapCollections",null),e([l({readOnly:!0})],d.prototype,"_spatialReferenceTask",null),e([l({readOnly:!0})],d.prototype,"_heightModelInfoTask",null),e([l({readOnly:!0})],d.prototype,"_tileInfoTask",null),e([l({readOnly:!0})],d.prototype,"_extentCandidatesTask",null),e([l()],d.prototype,"_extentTask",null),e([l()],d.prototype,"_projectExtentTask",void 0),d=e([s("esri.views.support.DefaultsFromMap")],d);class f{constructor(e,t,n){this.spatialReference=e,this.heightModelInfo=t,this.viewingMode=n}}class h{constructor(e,t){this.layerFilter=e,this.pushLayer=t,this.preloading=-1,this.updating=!1,this.done=!1}}function g(e,t){return null!=e?null!=t?e===t&&e:e:t}export{d as DefaultsFromMap};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AttachmentTypeCategory } from "../../BatchAttributeForm/inputs/types.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param contentType - Content type of the attachment to test
|
|
5
|
+
* @returns Category of the attachment
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export function getAttachmentTypeCategory(contentType: string | null | undefined): AttachmentTypeCategory;
|
|
@@ -13,6 +13,7 @@ export interface BasemapLayerListViewModelEvents extends LayerListViewModelEvent
|
|
|
13
13
|
/**
|
|
14
14
|
* Provides logic for the [BasemapLayerList](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapLayerList/) widget and [component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-basemap-layer-list/).
|
|
15
15
|
*
|
|
16
|
+
* @deprecated since 5.2. Use the [Basemap Layer List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-basemap-layer-list-next/) component instead.
|
|
16
17
|
* @since 4.13
|
|
17
18
|
* @see [BasemapLayerList](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapLayerList/) widget
|
|
18
19
|
* @see [Basemap Layer List component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-basemap-layer-list/)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../core/Collection.js";import{
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../core/Collection.js";import{deprecateUnnecessaryViewModel as s}from"../../core/deprecate.js";import{EventedAccessor as i}from"../../core/Evented.js";import a from"../../core/Logger.js";import{watch as r,initial as l}from"../../core/reactiveUtils.js";import{property as n,subclass as o}from"../../core/accessorSupport/decorators.js";import m from"../LayerList/ListItem.js";import{getItemLayers as c,findLayerListMode as h}from"../LayerList/support/layerListUtils.js";const d={view:"view",basemap:"basemap",baseLayers:"base-layers",referenceLayers:"reference-layers",baseLayersListMode:"reference-layers-list-mode",referenceLayersListMode:"base-layers-list-mode",baseLayerViews:"base-layer-views",referenceLayerViews:"reference-layer-views",children:"children"},p="hide",y=t.ofType(m);let b=class extends i{constructor(e){super(e),this.baseItems=new y,this.baseListItemCreatedFunction=null,this.checkPublishStatusEnabled=!1,this.listModeDisabled=!1,this.referenceListItemCreatedFunction=null,this.referenceItems=new y,this.view=null,e?.suppressDeprecationWarning||s(a.getLogger(this),"Basemap Layer List (Next)","arcgis-basemap-layer-list-next",{see:"https://esriurl.com/arcgis-basemap-layer-list-next/",version:"5.2"}),this._compileBaseList=this._compileBaseList.bind(this),this._compileReferenceList=this._compileReferenceList.bind(this)}normalizeCtorArgs(e){const{suppressDeprecationWarning:t,...s}=e??{};return s}initialize(){this.addHandles([r(()=>[this.view?.map?.basemap,!0===this.view?.ready,this.view?.basemapView],()=>this._watchBasemapLayers(),l),r(()=>[this.baseListItemCreatedFunction,this.checkPublishStatusEnabled,this.listModeDisabled],()=>this._baseListItemCreatedFunctionChanged()),r(()=>[this.referenceListItemCreatedFunction,this.checkPublishStatusEnabled,this.listModeDisabled],()=>this._referenceListItemCreatedFunctionChanged())],d.view)}destroy(){this.view=null,this._removeAllBaseItems(),this._removeAllReferenceItems()}get basemapTitle(){return this.view?.map?.basemap?.title??null}set basemapTitle(e){this._override("basemapTitle",e)}get state(){return this.view?.ready?"ready":this.view?"loading":"disabled"}get totalBaseItems(){return this.baseItems.flatten(e=>e.children).length}get totalReferenceItems(){return this.referenceItems.flatten(e=>e.children).length}triggerAction(e,t){e&&!e.disabled&&this.emit("trigger-action",{action:e,item:t})}moveListItem({targetItem:e,fromParentItem:t,toParentItem:s,from:i,to:a,newIndex:r}){const l=e?.layer;if(!l||"subtype-sublayer"===l.type||"sublayer"===l.type)return;const n=this.view?.map?.basemap,o=n?.baseLayers,m=n?.referenceLayers,h=t?c(t):"base"===i?o:m,d=s?c(s):"base"===a?o:m;if(!h||!d)return;const{baseItems:p,referenceItems:y}=this,b="base"===i?p:y,L="base"===a?p:y,f=t?.children||b,u=s?.children||L,I=d.length-r;e.parent=s||null,f.remove(e),h.remove(l),u.includes(e)||u.add(e,I),d.includes(l)||d.add(l,I),this._compileLists()}_createItemChangeHandles({items:e,key:t,callback:s}){this.removeHandles(t),s(),e&&this.addHandles(e.on("change",()=>s()),t)}_createListItem({layer:e,type:t}){const{view:s,baseListItemCreatedFunction:i,referenceListItemCreatedFunction:a,checkPublishStatusEnabled:r,listModeDisabled:l}=this;return new m({layer:e,checkPublishStatusEnabled:r,listItemCreatedFunction:"base"===t?i:a,listModeDisabled:l,view:s})}_watchLayersListMode({layers:e,key:t,callback:s}){this.removeHandles(t),e&&!this.listModeDisabled&&this.addHandles(r(()=>e.filter(e=>"listMode"in e).map(e=>e.listMode).toArray(),()=>s()),t)}_getViewableLayers(e){return e?this.listModeDisabled?e:e.filter(e=>h(e)!==p):void 0}_compileListItems({layers:e,items:t,key:s,type:i,callback:a}){this._watchLayersListMode({layers:e,key:s,callback:a});const r=this._getViewableLayers(e);r?.length?(this._createNewItems({type:i,items:t,layers:r}),this._removeItems({items:t,layers:r}),this._sortItems(t,r)):"base"===i?this._removeAllBaseItems():this._removeAllReferenceItems()}_compileReferenceList(){const{referenceItems:e}=this,t=this.view?.map?.basemap?.referenceLayers;this._compileListItems({type:"reference",layers:t,items:e,key:d.referenceLayersListMode,callback:this._compileReferenceList})}_compileBaseList(){const{baseItems:e}=this,t=this.view?.map?.basemap?.baseLayers;this._compileListItems({type:"base",layers:t,items:e,key:d.baseLayersListMode,callback:this._compileBaseList})}_compileLists(){this._compileReferenceList(),this._compileBaseList()}_createNewItems({items:e,layers:t,type:s}){t?.forEach(t=>{e.some(e=>e.layer===t)||e.add(this._createListItem({type:s,layer:t}))})}_removeItems({items:e,layers:t}){e&&e.forEach(s=>{if(!s)return;const i=t?.some(e=>s.layer===e);i||(this.removeHandles(`${d.children}-${s.uid}`),e.remove(s),s.destroy())})}_sortItems(e,t){e&&t&&e.sort((e,s)=>{const i=t.indexOf(e.layer),a=t.indexOf(s.layer);return i>a?-1:i<a?1:0})}_removeAllBaseItems(){this.baseItems.drain(e=>{this.removeHandles(`${d.children}-${e.uid}`),e.destroy()})}_removeAllReferenceItems(){this.referenceItems.drain(e=>{this.removeHandles(`${d.children}-${e.uid}`),e.destroy()})}_baseListItemCreatedFunctionChanged(){this._removeAllBaseItems(),this._compileLists()}_referenceListItemCreatedFunctionChanged(){this._removeAllReferenceItems(),this._compileLists()}_watchBasemapLayers(){const{view:e}=this;if(this.removeHandles([d.baseLayers,d.referenceLayers,d.basemap,d.baseLayerViews,d.referenceLayerViews]),!e?.ready)return this._removeAllBaseItems(),void this._removeAllReferenceItems();this._compileLists(),this.addHandles([r(()=>this.view?.map?.basemap?.baseLayers,e=>this._createItemChangeHandles({items:e,key:d.baseLayers,callback:this._compileBaseList}),l),r(()=>this.view?.map?.basemap?.referenceLayers,e=>this._createItemChangeHandles({items:e,key:d.referenceLayers,callback:this._compileReferenceList}),l),r(()=>this.view?.basemapView?.baseLayerViews,e=>this._createItemChangeHandles({items:e,key:d.baseLayerViews,callback:this._compileBaseList}),l),r(()=>this.view?.basemapView?.referenceLayerViews,e=>this._createItemChangeHandles({items:e,key:d.referenceLayerViews,callback:this._compileReferenceList}),l)],d.basemap)}};e([n({type:y,readOnly:!0})],b.prototype,"baseItems",void 0),e([n()],b.prototype,"basemapTitle",null),e([n()],b.prototype,"baseListItemCreatedFunction",void 0),e([n()],b.prototype,"checkPublishStatusEnabled",void 0),e([n({nonNullable:!0})],b.prototype,"listModeDisabled",void 0),e([n()],b.prototype,"referenceListItemCreatedFunction",void 0),e([n({type:y,readOnly:!0})],b.prototype,"referenceItems",void 0),e([n({readOnly:!0})],b.prototype,"state",null),e([n()],b.prototype,"totalBaseItems",null),e([n()],b.prototype,"totalReferenceItems",null),e([n()],b.prototype,"view",void 0),b=e([o("esri.widgets.BasemapLayerList.BasemapLayerListViewModel")],b);const L=b;export{L as default};
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type Accessor from "../../core/Accessor.js";
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated since 5.2. Use the [Basemap Layer List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-basemap-layer-list-next/) component instead.
|
|
5
|
+
* @since 5.0
|
|
6
|
+
*/
|
|
4
7
|
export interface BasemapLayerListVisibleElementsProperties extends Partial<Pick<BasemapLayerListVisibleElements, "baseLayers" | "closeButton" | "collapseButton" | "editTitleButton" | "errors" | "filter" | "flow" | "heading" | "referenceLayers" | "statusIndicators" | "temporaryLayerIndicators">> {}
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
* The visible elements that are displayed within the basemap layer list.
|
|
8
11
|
* This provides the ability to turn on/off individual elements of the basemap layer list.
|
|
9
12
|
*
|
|
13
|
+
* @deprecated since 5.2. Use the [Basemap Layer List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-basemap-layer-list-next/) component instead.
|
|
10
14
|
* @since 5.0
|
|
11
15
|
*/
|
|
12
16
|
export default class BasemapLayerListVisibleElements extends Accessor {
|
|
@@ -1,7 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the BasemapLayerList widget.
|
|
3
|
+
*
|
|
4
|
+
* @deprecated since 5.2. Use the [Basemap Layer List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-basemap-layer-list-next/) component instead.
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
/**
|
|
2
8
|
* Describes the current state of the list items in the [BasemapLayerListViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapLayerList/BasemapLayerListViewModel/).
|
|
3
9
|
*
|
|
10
|
+
* @deprecated since 5.2. Use the [Basemap Layer List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-basemap-layer-list-next/) component instead.
|
|
4
11
|
* @since 5.0
|
|
5
|
-
* @see [BasemapLayerListViewModel.state](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapLayerList/BasemapLayerListViewModel/#state)
|
|
6
12
|
*/
|
|
7
|
-
export type BasemapLayerListState = "ready" | "loading" | "disabled";
|
|
13
|
+
export type BasemapLayerListState = "ready" | "loading" | "disabled";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Defines whether an item is a base layer or a reference layer in the basemap.
|
|
17
|
+
*
|
|
18
|
+
* @deprecated since 5.2. Use the [Basemap Layer List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-basemap-layer-list-next/) component instead.
|
|
19
|
+
*/
|
|
20
|
+
export type BasemapItemType = "reference" | "base";
|
|
@@ -80,7 +80,7 @@ export interface BasemapLayerListEvents extends BasemapLayerListViewModelEvents
|
|
|
80
80
|
* [Sample - LayerList widget](https://developers.arcgis.com/javascript/latest/sample-code/widgets-layerlist/)\
|
|
81
81
|
* [Sample - LayerList widget with actions](https://developers.arcgis.com/javascript/latest/sample-code/widgets-layerlist-actions/)
|
|
82
82
|
*
|
|
83
|
-
* @deprecated since version 5.0. Use the [Basemap Layer List](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-basemap-layer-list/) component instead. For information on widget deprecation, read about [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/).
|
|
83
|
+
* @deprecated since version 5.0. Use the [Basemap Layer List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-basemap-layer-list-next/) component instead. For information on widget deprecation, read about [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/).
|
|
84
84
|
* @since 4.13
|
|
85
85
|
* @see [BasemapLayerListViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapLayerList/BasemapLayerListViewModel/)
|
|
86
86
|
* @example
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../core/Collection.js";import{deprecateWidget as i}from"../core/deprecate.js";import{IdentifiableMixin as s}from"../core/Identifiable.js";import o from"../core/Logger.js";import l from"../core/ReactiveMap.js";import{on as r,initial as a,watch as n,syncAndInitial as d}from"../core/reactiveUtils.js";import{property as c,subclass as p}from"../core/accessorSupport/decorators.js";import m from"./Widget.js";import h from"./BasemapLayerList/BasemapLayerListViewModel.js";import u from"./BasemapLayerList/BasemapLayerListVisibleElements.js";import{css as g}from"./BasemapLayerList/css.js";import f from"./LayerList/LayerListItem.js";import y from"./LayerList/ListItem.js";import{minFilterItems as _,getItem as b,getLayerType as L,removeDestroyedListItems as v,setFilterPredicate as I,sortLayersToIds as w,sortChildLayersToIds as F}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as E}from"./support/componentsUtils.js";import{globalCss as C}from"./support/globalCss.js";import{incrementHeadingLevel as T}from"./support/Heading.js";import{calciteListFilterProps as M}from"./support/listUtils.js";import{tsx as P,messageBundle as O,vmEvent as A}from"./support/widget.js";import{setFocus as B}from"./support/widgetUtils.js";const R=t.ofType(y),k="nested",D=".*\\S+.*",j="data-basemap-layer-type";let x=class extends(s(m)){constructor(e,s){super(e,s),this._baseListEl=null,this._referenceListEl=null,this._activeItem=null,this._tooltipReferenceMap=new Map,this._editTitleInput=null,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusLayerFlowItem=null,this._focusEditingFlowItem=!1,this._layerListMap=new l,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`basemap-${this.uid}`,this._openedLayersController=null,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.dragEnabled=!1,this.editingTitle=!1,this.filterPlaceholder="",this.baseFilterPredicate=null,this.baseFilterText="",this.referenceFilterPredicate=null,this.referenceFilterText="",this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.headingLevel=2,this.knowledgeGraphOptions=null,this.layerTablesEnabled=new t(["knowledge-graph"]),this.mapImageOptions=null,this.messages=null,this.messagesCommon=null,this.minFilterItems=_,this.openedLayers=new t,this.openedLayerLists=new t,this.tableList=null,this.selectedItems=new R,this.selectionMode="none",this.tileOptions=null,this.viewModel=new h,this.visibilityAppearance="default",this.visibleElements=new u,this._canMove=({dragEl:e,fromEl:t,toEl:i},s)=>{const o="pull"===s?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,l=b(e);if(!l?.sortable)return!1;const r=b(t),a=L(t),n=b(i),d=L(i),c=!!a&&!!d&&a===d,p={selected:l,from:r,to:n},m=t.group,h=i.group,u=r?.layer?.type??"",g=n?.layer?.type??"",f=new Set(["map-image","catalog","knowledge-graph"]),y="sublayer";return m&&h&&"function"==typeof o?o.call(null,p):c&&!f.has(u)&&!f.has(g)&&l?.layer?.type!==y},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onTablesOpen=e=>{this.openedLayers.push(e.layer),this._focusLayerFlowItem=e.layer?.uid},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onCatalogOpen=e=>{this.openedLayers.push(e.layer?.parent),this._focusLayerFlowItem=e.layer?.uid},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find(e=>e.classList?.contains(g.item));this._activeItem=b(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:s,dragEl:o,newIndex:l}=e;if(!s||!i||t?.newIndex===l&&t?.dragEl===o&&t?.toEl===i&&t?.fromEl===s)return;this._lastDragDetail=e,this._selectedDragItemLayerUid=o.value;const r=s,a=i;if(r===a){const e=Array.from(s.children).filter(e=>e?.matches("calcite-list-item")).map(e=>e.value);return void this._sortLayers(r,e)}null!=l&&this._moveLayerFromChildList({toEl:a,fromEl:r,dragEl:o,newIndex:l})},this.announceDeprecation=()=>{i(o.getLogger(this),"Basemap Layer List","arcgis-basemap-layer-list",{version:"5.0"})}}initialize(){this.addHandles([r(()=>this.openedLayers,"change",()=>this._handleOpenedLayersChange(),a),n(()=>[this.viewModel.referenceItems.toArray(),this.viewModel.baseItems.toArray()],()=>v(this.selectedItems),d),n(()=>[this.baseFilterPredicate,this._baseListEl],()=>I(this._baseListEl,this.baseFilterPredicate)),n(()=>[this.referenceFilterPredicate,this._referenceListEl],()=>I(this._referenceListEl,this.referenceFilterPredicate))])}loadDependencies(){return E({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}destroy(){this._tooltipReferenceMap.clear(),this._destroyOpenedLayerLists()}get _visibleBaseItems(){return this.baseItems?.filter(e=>!e.hidden&&(this.visibleElements.errors||!e.error))}get _visibleReferenceItems(){return this.referenceItems?.filter(e=>!e.hidden&&(this.visibleElements.errors||!e.error))}get _openedPanelItems(){return this._visibleReferenceItems.concat(this._visibleBaseItems).flatten(e=>e.children).filter(({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled)}get _totalBaseItems(){return this.viewModel.baseItems.flatten(e=>e.children.filter(e=>"catalog-dynamic-group"!==e.layer?.type)).length}get _totalReferenceItems(){return this.viewModel.referenceItems.flatten(e=>e.children.filter(e=>"catalog-dynamic-group"!==e.layer?.type)).length}get _baseFilterEnabled(){return this._totalBaseItems>=this.minFilterItems&&this.visibleElements.filter}get _referenceFilterEnabled(){return this._totalReferenceItems>=this.minFilterItems&&this.visibleElements.filter}get _renderedOpenLayerFlowItems(){const{openedLayers:e}=this;return e.toArray().map((t,i)=>this._renderLayerFlowItem(t,i===e.length-1))}get basemapTitle(){return this.viewModel.basemapTitle}set basemapTitle(e){this.viewModel.basemapTitle=e}get baseListItemCreatedFunction(){return this.viewModel.baseListItemCreatedFunction}set baseListItemCreatedFunction(e){this.viewModel.baseListItemCreatedFunction=e}get icon(){return"layers"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get referenceListItemCreatedFunction(){return this.viewModel.referenceListItemCreatedFunction}set referenceListItemCreatedFunction(e){this.viewModel.referenceListItemCreatedFunction=e}get baseItems(){return this.viewModel.baseItems}get referenceItems(){return this.viewModel.referenceItems}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const{state:e}=this.viewModel,t={[C.hidden]:"loading"===e,[C.disabled]:"disabled"===e};return P("div",{class:this.classes(g.base,C.widget,C.panel,t)},this._renderItems())}async _createCatalogLayerList(e){const{default:t}=await(import("./CatalogLayerList.js")),{headingLevel:i,catalogOptions:s,view:o,filterPlaceholder:l,minFilterItems:r,selectionMode:a,visibilityAppearance:n,_onCatalogOpen:d,_onTablesOpen:c,layerTablesEnabled:p}=this;return new t({headingLevel:i,view:o,filterPlaceholder:l,minFilterItems:r,selectionMode:a,visibilityAppearance:n,...s,catalogLayer:e,layerTablesEnabled:p,onCatalogOpen:d,onTablesOpen:c})}_getTableListParams(e){switch(e.type){case"knowledge-graph":return{...this.knowledgeGraphOptions,tables:e.tables};case"map-image":return{...this.mapImageOptions,tables:e.subtables};case"tile":return{...this.tileOptions,tables:e.subtables};default:return null}}async _createTableList(e){const{default:t}=await(import("./TableList.js")),{headingLevel:i,selectionMode:s,dragEnabled:o}=this;return new t({headingLevel:i,selectionMode:s,dragEnabled:o,...this._getTableListParams(e)})}async _createFlowList(e,t){const{_layerListMap:i}=this,s=i.get(e);if(s)return s;const o="catalog"===e.type?await this._createCatalogLayerList(e):await this._createTableList(e);return t.aborted||i.set(e,o),o}async _handleOpenedLayersChange(){const{_layerListMap:e,openedLayers:t,openedLayerLists:i}=this;this._openedLayersController?.abort();const s=new AbortController,{signal:o}=s;this._openedLayersController=s,e.forEach((i,s)=>{t.includes(s)||(i.destroy(),e.delete(s))});const l=await Promise.all(t.map(e=>this._createFlowList(e,o)));if(o.aborted)return;i.removeAll(),i.addMany(l);const r=i.at(-1);r?"catalogLayer"in r?(this._set("catalogLayerList",r),this._set("tableList",null)):(this._set("catalogLayerList",null),this._set("tableList",r)):(this._set("catalogLayerList",null),this._set("tableList",null))}_destroyOpenedLayerLists(){this.openedLayerLists.destroyAll(),this.openedLayers.removeAll(),this._layerListMap.clear()}_renderItemTooltip(e){return e?P("calcite-tooltip",{key:`tooltip-${e.layer?.uid}`,overlayPositioning:"fixed",referenceElement:this._tooltipReferenceMap.get(e.layer?.uid),topLayerDisabled:this.topLayerDisabled},this.messages.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter(e=>!e.hidden).toArray().map(e=>this._renderItemTooltipNodes(e))}_renderItemTooltips(){return this._visibleReferenceItems.concat(this._visibleBaseItems)?.toArray().map(e=>this._renderItemTooltipNodes(e))}_focusLayerFlowItemNode(e){this._focusLayerFlowItem===e.dataset.layerUid&&(this._focusLayerFlowItem=null,B(e))}_renderPanelFlowItems(){const{_openedPanelItems:e,openedLayers:t}=this;return e.toArray().map(({title:i,panel:s},o)=>{const l=()=>this._handlePanelFlowItemBack(s);return P("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:i,heading:s.title,headingLevel:this.headingLevel,key:`flow-panel-${s.uid}`,selected:!t.length&&o===e.length-1,onCalciteFlowItemBack:e=>{e.preventDefault(),l()}},s.render(),P("calcite-button",{appearance:"transparent",slot:"footer-start",width:"full",onclick:l},this.messagesCommon.back))})}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusEditingFlowItemNode(e){this._focusEditingFlowItem&&(this._focusEditingFlowItem=!1,B(e))}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,B(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,B(e))}_renderItem(e,t,i,s){return P(f,{activeItem:this._activeItem,canMove:this._canMove,css:g,displayMode:k,dragDisabled:t,dragEnabled:this.dragEnabled,item:e,key:`layerListItem-${e.layer?.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:i,parentTitles:s,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:s}){const o=b(i),l=b(e),r=b(t),a=N(t),n=N(e);a&&n&&this.viewModel.moveListItem({targetItem:o,fromParentItem:r,toParentItem:l,newIndex:s,from:a,to:n})}_handleCalciteListDragEnd({fromEl:e,dragEl:t,oldIndex:i}){null!=i&&e.insertBefore(t,e.children[i])}_sortLayers(e,t){if(e)if(e===this._referenceListEl||e===this._baseListEl){const i=e===this._referenceListEl?"reference":"base",s="base"===i?this.view?.map?.basemap?.baseLayers:"reference"===i?this.view?.map?.basemap?.referenceLayers:null;w(s,t)}else{const i=b(e);if(!i)return;F(i,t)}}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const s=e.target.selectedItems.map(e=>b(e)).filter(Boolean);i.removeAll(),i.addMany(s)}_renderEditingInput(){const{messages:e}=this,{basemapTitle:t}=this.viewModel;return P("div",{class:g.editing},P("calcite-label",null,e.basemapTitle,P("calcite-input",{afterCreate:e=>this._editTitleInput=e,label:e.basemapTitle,name:"basemaptitle",pattern:D,placeholder:e.basemapTitle,required:!0,title:e.basemapTitle,type:"text",value:t??void 0})))}_renderCancelButton(){const{messagesCommon:{cancel:e}}=this;return P("calcite-button",{appearance:"outline",bind:this,label:e,slot:"footer",title:e,width:"full",onclick:this._toggleEditingTitle},e)}_renderSubmitButton(){const{messagesCommon:e}=this;return P("calcite-button",{label:e.form.submit,slot:"footer",title:e.form.submit,type:"submit",width:"full"},e.form.ok)}_renderEditingFlowItem(){return this.editingTitle?P("calcite-flow-item",{afterCreate:this._focusEditingFlowItemNode,afterUpdate:this._focusEditingFlowItemNode,bind:this,heading:this.visibleElements.heading?this.messages.basemapTitle:void 0,headingLevel:this.headingLevel,selected:0===this.openedLayers.length&&0===this._openedPanelItems.length,onCalciteFlowItemBack:e=>{e.preventDefault(),this._toggleEditingTitle()}},this._renderEditingInput(),this._renderCancelButton(),this._renderSubmitButton()):null}_renderEditTitleButton(){const{editingTitle:e,visibleElements:t,messagesCommon:i}=this,s=i.edit;return t.editTitleButton&&!e?P("calcite-action",{bind:this,icon:"pencil",slot:"header-actions-end",text:s,title:s,onclick:this._toggleEditingTitle}):null}_renderNoLayersInfoMessage(e){return P("div",{slot:"message"},e)}_renderNoLayersInfo(e,t){return P("div",{class:g.itemMessage},P("calcite-notice",{icon:"information",key:t,kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(e)))}_renderItems(){const{collapsed:e,visible:t,visibleElements:{closeButton:i,collapseButton:s,heading:o,flow:l},messages:r,viewModel:a}=this,n=[P("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:i,closed:!t,collapsed:e,collapsible:s,heading:o?a.basemapTitle??r.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",selected:!this.editingTitle&&0===this.openedLayers.length&&0===this._openedPanelItems.length,onCalciteFlowItemClose:()=>this.visible=!1},this._renderEditTitleButton(),this._renderReferenceSection(),this._renderBaseSection()),this._renderEditingFlowItem(),this._renderPanelFlowItems(),this._renderedOpenLayerFlowItems],d=l?P("calcite-flow",{key:"root-flow"},n):n;return t?[this.editingTitle?P("form",{bind:this,class:g.editingForm,onsubmit:this._formSubmit},d):d,this._renderItemTooltips()]:null}_renderLayerFlowItem(e,t){const{messages:i,openedLayers:s}=this,o=e.title||this.messages.untitledLayer;return P("calcite-flow-item",{afterCreate:this._focusLayerFlowItemNode,afterUpdate:this._focusLayerFlowItemNode,bind:this,"data-layer-uid":e.uid,description:o,heading:i["catalog"===e.type?"catalogLayers":"tables"],headingLevel:this.headingLevel,key:`flow-layer-list-${e.uid}`,selected:t,onCalciteFlowItemBack:e=>{e.preventDefault(),s.pop();const t=s.at(-1);t?this._focusLayerFlowItem=t.uid:this._focusRootFlowItem=!0}},this._layerListMap.get(e)?.render())}_renderList(e,t,i){const{messages:s,dragEnabled:o,selectionMode:l,filterPlaceholder:r,baseFilterText:a,referenceFilterText:n,_baseFilterEnabled:d,_referenceFilterEnabled:c,_rootGroupUid:p}=this,m="reference"===t?s.noReferenceLayers:s.noBaseLayers,h="reference"===t?c:d;return P("calcite-block",{class:g.section,collapsible:!0,expanded:!0,heading:"reference"===t?s.referenceHeading:s.baseHeading,headingLevel:T(this.headingLevel),key:`block-${t}`},e?.length?null:this._renderNoLayersInfo(m,t),P("calcite-list",{afterCreate:e=>{"reference"===t?this._referenceListEl=e:this._baseListEl=e,e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{"reference"===t?this._referenceListEl=null:this._baseListEl=null,e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),displayMode:k,filterProps:M,[j]:t,"data-layer-type":p,dragEnabled:o,filterEnabled:h,filterPlaceholder:r,filterText:h?"reference"===t?n:a:"",group:p,key:`list-${t}`,label:s.widgetLabel,selectionAppearance:"border",selectionMode:l,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this["reference"===t?"referenceFilterText":"baseFilterText"]=e.currentTarget?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail),onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem},e?.toArray().map(e=>this._renderItem(e,i)),h?P("div",{class:g.filterNoResults,slot:"filter-no-results"},P("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(m))):null))}_renderBaseSection(){const{_visibleBaseItems:e}=this;return this.visibleElements.baseLayers?this._renderList(e,"base",1===e?.length):null}_renderReferenceSection(){return this.visibleElements.referenceLayers?this._renderList(this._visibleReferenceItems,"reference",!1):null}_toggleEditingTitle(){const{editingTitle:e}=this,t=!e;this.editingTitle=t,t?this._focusEditingFlowItem=!0:this._focusRootFlowItem=!0}_formSubmit(e){e.preventDefault();const t=this._editTitleInput?.value;t?.trim()&&(this.basemapTitle=t),this._toggleEditingTitle()}};function N(e){return e?.closest(`[${j}]`)?.getAttribute(j)}e([c()],x.prototype,"_baseListEl",void 0),e([c()],x.prototype,"_referenceListEl",void 0),e([c()],x.prototype,"_activeItem",void 0),e([c()],x.prototype,"_tooltipReferenceMap",void 0),e([c()],x.prototype,"_focusRootFlowItem",void 0),e([c()],x.prototype,"_focusPanelFlowItem",void 0),e([c()],x.prototype,"_focusLayerFlowItem",void 0),e([c()],x.prototype,"_focusEditingFlowItem",void 0),e([c()],x.prototype,"_layerListMap",void 0),e([c()],x.prototype,"_visibleBaseItems",null),e([c()],x.prototype,"_visibleReferenceItems",null),e([c()],x.prototype,"_openedPanelItems",null),e([c()],x.prototype,"_totalBaseItems",null),e([c()],x.prototype,"_totalReferenceItems",null),e([c()],x.prototype,"_baseFilterEnabled",null),e([c()],x.prototype,"_referenceFilterEnabled",null),e([c()],x.prototype,"_renderedOpenLayerFlowItems",null),e([c()],x.prototype,"basemapTitle",null),e([c({readOnly:!0})],x.prototype,"catalogLayerList",void 0),e([c()],x.prototype,"catalogOptions",void 0),e([c()],x.prototype,"collapsed",void 0),e([c()],x.prototype,"dragEnabled",void 0),e([c()],x.prototype,"editingTitle",void 0),e([c()],x.prototype,"filterPlaceholder",void 0),e([c()],x.prototype,"baseFilterPredicate",void 0),e([c()],x.prototype,"baseFilterText",void 0),e([c()],x.prototype,"referenceFilterPredicate",void 0),e([c()],x.prototype,"referenceFilterText",void 0),e([c()],x.prototype,"listItemCanGiveFunction",void 0),e([c()],x.prototype,"listItemCanReceiveFunction",void 0),e([c()],x.prototype,"baseListItemCreatedFunction",null),e([c()],x.prototype,"headingLevel",void 0),e([c()],x.prototype,"icon",null),e([c()],x.prototype,"knowledgeGraphOptions",void 0),e([c()],x.prototype,"label",null),e([c()],x.prototype,"layerTablesEnabled",void 0),e([c()],x.prototype,"mapImageOptions",void 0),e([c(),O("esri/widgets/BasemapLayerList/t9n/BasemapLayerList")],x.prototype,"messages",void 0),e([c(),O("esri/t9n/common")],x.prototype,"messagesCommon",void 0),e([c()],x.prototype,"minFilterItems",void 0),e([c({readOnly:!0})],x.prototype,"openedLayers",void 0),e([c({readOnly:!0})],x.prototype,"openedLayerLists",void 0),e([c()],x.prototype,"referenceListItemCreatedFunction",null),e([c({readOnly:!0})],x.prototype,"tableList",void 0),e([c({readOnly:!0})],x.prototype,"baseItems",null),e([c({readOnly:!0})],x.prototype,"referenceItems",null),e([c({type:R})],x.prototype,"selectedItems",void 0),e([c()],x.prototype,"selectionMode",void 0),e([c()],x.prototype,"tileOptions",void 0),e([c()],x.prototype,"view",null),e([A("trigger-action"),c({type:h})],x.prototype,"viewModel",void 0),e([c()],x.prototype,"visibilityAppearance",void 0),e([c({type:u,nonNullable:!0})],x.prototype,"visibleElements",void 0),x=e([p("esri.widgets.BasemapLayerList")],x);const U=x;export{U as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../core/Collection.js";import{deprecateWidget as i}from"../core/deprecate.js";import{IdentifiableMixin as s}from"../core/Identifiable.js";import o from"../core/Logger.js";import l from"../core/ReactiveMap.js";import{on as r,initial as a,watch as n,syncAndInitial as d}from"../core/reactiveUtils.js";import{property as c,subclass as p}from"../core/accessorSupport/decorators.js";import m from"./Widget.js";import h from"./BasemapLayerList/BasemapLayerListViewModel.js";import u from"./BasemapLayerList/BasemapLayerListVisibleElements.js";import{css as g}from"./BasemapLayerList/css.js";import f from"./LayerList/LayerListItem.js";import y from"./LayerList/ListItem.js";import{minFilterItems as _,getItem as b,getLayerType as L,removeDestroyedListItems as v,setFilterPredicate as I,sortLayersToIds as w,sortChildLayersToIds as F}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as E}from"./support/componentsUtils.js";import{globalCss as C}from"./support/globalCss.js";import{incrementHeadingLevel as T}from"./support/Heading.js";import{calciteListFilterProps as M}from"./support/listUtils.js";import{tsx as P,messageBundle as O,vmEvent as A}from"./support/widget.js";import{setFocus as B}from"./support/widgetUtils.js";const R=t.ofType(y),k="nested",D=".*\\S+.*",x="data-basemap-layer-type";let N=class extends(s(m)){constructor(e,s){super(e,s),this._baseListEl=null,this._referenceListEl=null,this._activeItem=null,this._tooltipReferenceMap=new Map,this._editTitleInput=null,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusLayerFlowItem=null,this._focusEditingFlowItem=!1,this._layerListMap=new l,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`basemap-${this.uid}`,this._openedLayersController=null,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.dragEnabled=!1,this.editingTitle=!1,this.filterPlaceholder="",this.baseFilterPredicate=null,this.baseFilterText="",this.referenceFilterPredicate=null,this.referenceFilterText="",this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.headingLevel=2,this.knowledgeGraphOptions=null,this.layerTablesEnabled=new t(["knowledge-graph"]),this.mapImageOptions=null,this.messages=null,this.messagesCommon=null,this.minFilterItems=_,this.openedLayers=new t,this.openedLayerLists=new t,this.tableList=null,this.selectedItems=new R,this.selectionMode="none",this.tileOptions=null,this.viewModel=new h({suppressDeprecationWarning:!0}),this.visibilityAppearance="default",this.visibleElements=new u,this._canMove=({dragEl:e,fromEl:t,toEl:i},s)=>{const o="pull"===s?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,l=b(e);if(!l?.sortable)return!1;const r=b(t),a=L(t),n=b(i),d=L(i),c=!!a&&!!d&&a===d,p={selected:l,from:r,to:n},m=t.group,h=i.group,u=r?.layer?.type??"",g=n?.layer?.type??"",f=new Set(["map-image","catalog","knowledge-graph"]),y="sublayer";return m&&h&&"function"==typeof o?o.call(null,p):c&&!f.has(u)&&!f.has(g)&&l?.layer?.type!==y},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onTablesOpen=e=>{this.openedLayers.push(e.layer),this._focusLayerFlowItem=e.layer?.uid},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onCatalogOpen=e=>{this.openedLayers.push(e.layer?.parent),this._focusLayerFlowItem=e.layer?.uid},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find(e=>e.classList?.contains(g.item));this._activeItem=b(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:s,dragEl:o,newIndex:l}=e;if(!s||!i||t?.newIndex===l&&t?.dragEl===o&&t?.toEl===i&&t?.fromEl===s)return;this._lastDragDetail=e,this._selectedDragItemLayerUid=o.value;const r=s,a=i;if(r===a){const e=Array.from(s.children).filter(e=>e?.matches("calcite-list-item")).map(e=>e.value);return void this._sortLayers(r,e)}null!=l&&this._moveLayerFromChildList({toEl:a,fromEl:r,dragEl:o,newIndex:l})},this.announceDeprecation=()=>{i(o.getLogger(this),"Basemap Layer List (Next)","arcgis-basemap-layer-list-next",{version:"5.0"})}}initialize(){this.addHandles([r(()=>this.openedLayers,"change",()=>this._handleOpenedLayersChange(),a),n(()=>[this.viewModel.referenceItems.toArray(),this.viewModel.baseItems.toArray()],()=>v(this.selectedItems),d),n(()=>[this.baseFilterPredicate,this._baseListEl],()=>I(this._baseListEl,this.baseFilterPredicate)),n(()=>[this.referenceFilterPredicate,this._referenceListEl],()=>I(this._referenceListEl,this.referenceFilterPredicate))])}loadDependencies(){return E({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}destroy(){this._tooltipReferenceMap.clear(),this._destroyOpenedLayerLists()}get _visibleBaseItems(){return this.baseItems?.filter(e=>!e.hidden&&(this.visibleElements.errors||!e.error))}get _visibleReferenceItems(){return this.referenceItems?.filter(e=>!e.hidden&&(this.visibleElements.errors||!e.error))}get _openedPanelItems(){return this._visibleReferenceItems.concat(this._visibleBaseItems).flatten(e=>e.children).filter(({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled)}get _totalBaseItems(){return this.viewModel.baseItems.flatten(e=>e.children.filter(e=>"catalog-dynamic-group"!==e.layer?.type)).length}get _totalReferenceItems(){return this.viewModel.referenceItems.flatten(e=>e.children.filter(e=>"catalog-dynamic-group"!==e.layer?.type)).length}get _baseFilterEnabled(){return this._totalBaseItems>=this.minFilterItems&&this.visibleElements.filter}get _referenceFilterEnabled(){return this._totalReferenceItems>=this.minFilterItems&&this.visibleElements.filter}get _renderedOpenLayerFlowItems(){const{openedLayers:e}=this;return e.toArray().map((t,i)=>this._renderLayerFlowItem(t,i===e.length-1))}get basemapTitle(){return this.viewModel.basemapTitle}set basemapTitle(e){this.viewModel.basemapTitle=e}get baseListItemCreatedFunction(){return this.viewModel.baseListItemCreatedFunction}set baseListItemCreatedFunction(e){this.viewModel.baseListItemCreatedFunction=e}get icon(){return"layers"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get referenceListItemCreatedFunction(){return this.viewModel.referenceListItemCreatedFunction}set referenceListItemCreatedFunction(e){this.viewModel.referenceListItemCreatedFunction=e}get baseItems(){return this.viewModel.baseItems}get referenceItems(){return this.viewModel.referenceItems}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const{state:e}=this.viewModel,t={[C.hidden]:"loading"===e,[C.disabled]:"disabled"===e};return P("div",{class:this.classes(g.base,C.widget,C.panel,t)},this._renderItems())}async _createCatalogLayerList(e){const{default:t}=await(import("./CatalogLayerList.js")),{headingLevel:i,catalogOptions:s,view:o,filterPlaceholder:l,minFilterItems:r,selectionMode:a,visibilityAppearance:n,_onCatalogOpen:d,_onTablesOpen:c,layerTablesEnabled:p}=this;return new t({headingLevel:i,view:o,filterPlaceholder:l,minFilterItems:r,selectionMode:a,visibilityAppearance:n,...s,catalogLayer:e,layerTablesEnabled:p,onCatalogOpen:d,onTablesOpen:c})}_getTableListParams(e){switch(e.type){case"knowledge-graph":return{...this.knowledgeGraphOptions,tables:e.tables};case"map-image":return{...this.mapImageOptions,tables:e.subtables};case"tile":return{...this.tileOptions,tables:e.subtables};default:return null}}async _createTableList(e){const{default:t}=await(import("./TableList.js")),{headingLevel:i,selectionMode:s,dragEnabled:o}=this;return new t({headingLevel:i,selectionMode:s,dragEnabled:o,...this._getTableListParams(e)})}async _createFlowList(e,t){const{_layerListMap:i}=this,s=i.get(e);if(s)return s;const o="catalog"===e.type?await this._createCatalogLayerList(e):await this._createTableList(e);return t.aborted||i.set(e,o),o}async _handleOpenedLayersChange(){const{_layerListMap:e,openedLayers:t,openedLayerLists:i}=this;this._openedLayersController?.abort();const s=new AbortController,{signal:o}=s;this._openedLayersController=s,e.forEach((i,s)=>{t.includes(s)||(i.destroy(),e.delete(s))});const l=await Promise.all(t.map(e=>this._createFlowList(e,o)));if(o.aborted)return;i.removeAll(),i.addMany(l);const r=i.at(-1);r?"catalogLayer"in r?(this._set("catalogLayerList",r),this._set("tableList",null)):(this._set("catalogLayerList",null),this._set("tableList",r)):(this._set("catalogLayerList",null),this._set("tableList",null))}_destroyOpenedLayerLists(){this.openedLayerLists.destroyAll(),this.openedLayers.removeAll(),this._layerListMap.clear()}_renderItemTooltip(e){return e?P("calcite-tooltip",{key:`tooltip-${e.layer?.uid}`,overlayPositioning:"fixed",referenceElement:this._tooltipReferenceMap.get(e.layer?.uid),topLayerDisabled:this.topLayerDisabled},this.messages.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter(e=>!e.hidden).toArray().map(e=>this._renderItemTooltipNodes(e))}_renderItemTooltips(){return this._visibleReferenceItems.concat(this._visibleBaseItems)?.toArray().map(e=>this._renderItemTooltipNodes(e))}_focusLayerFlowItemNode(e){this._focusLayerFlowItem===e.dataset.layerUid&&(this._focusLayerFlowItem=null,B(e))}_renderPanelFlowItems(){const{_openedPanelItems:e,openedLayers:t}=this;return e.toArray().map(({title:i,panel:s},o)=>{const l=()=>this._handlePanelFlowItemBack(s);return P("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:i,heading:s.title,headingLevel:this.headingLevel,key:`flow-panel-${s.uid}`,selected:!t.length&&o===e.length-1,onCalciteFlowItemBack:e=>{e.preventDefault(),l()}},s.render(),P("calcite-button",{appearance:"transparent",slot:"footer-start",width:"full",onclick:l},this.messagesCommon.back))})}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusEditingFlowItemNode(e){this._focusEditingFlowItem&&(this._focusEditingFlowItem=!1,B(e))}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,B(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,B(e))}_renderItem(e,t,i,s){return P(f,{activeItem:this._activeItem,canMove:this._canMove,css:g,displayMode:k,dragDisabled:t,dragEnabled:this.dragEnabled,item:e,key:`layerListItem-${e.layer?.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:i,parentTitles:s,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:s}){const o=b(i),l=b(e),r=b(t),a=j(t),n=j(e);a&&n&&this.viewModel.moveListItem({targetItem:o,fromParentItem:r,toParentItem:l,newIndex:s,from:a,to:n})}_handleCalciteListDragEnd({fromEl:e,dragEl:t,oldIndex:i}){null!=i&&e.insertBefore(t,e.children[i])}_sortLayers(e,t){if(e)if(e===this._referenceListEl||e===this._baseListEl){const i=e===this._referenceListEl?"reference":"base",s="base"===i?this.view?.map?.basemap?.baseLayers:"reference"===i?this.view?.map?.basemap?.referenceLayers:null;w(s,t)}else{const i=b(e);if(!i)return;F(i,t)}}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const s=e.target.selectedItems.map(e=>b(e)).filter(Boolean);i.removeAll(),i.addMany(s)}_renderEditingInput(){const{messages:e}=this,{basemapTitle:t}=this.viewModel;return P("div",{class:g.editing},P("calcite-label",null,e.basemapTitle,P("calcite-input",{afterCreate:e=>this._editTitleInput=e,label:e.basemapTitle,name:"basemaptitle",pattern:D,placeholder:e.basemapTitle,required:!0,title:e.basemapTitle,type:"text",value:t??void 0})))}_renderCancelButton(){const{messagesCommon:{cancel:e}}=this;return P("calcite-button",{appearance:"outline",bind:this,label:e,slot:"footer",title:e,width:"full",onclick:this._toggleEditingTitle},e)}_renderSubmitButton(){const{messagesCommon:e}=this;return P("calcite-button",{label:e.form.submit,slot:"footer",title:e.form.submit,type:"submit",width:"full"},e.form.ok)}_renderEditingFlowItem(){return this.editingTitle?P("calcite-flow-item",{afterCreate:this._focusEditingFlowItemNode,afterUpdate:this._focusEditingFlowItemNode,bind:this,heading:this.visibleElements.heading?this.messages.basemapTitle:void 0,headingLevel:this.headingLevel,selected:0===this.openedLayers.length&&0===this._openedPanelItems.length,onCalciteFlowItemBack:e=>{e.preventDefault(),this._toggleEditingTitle()}},this._renderEditingInput(),this._renderCancelButton(),this._renderSubmitButton()):null}_renderEditTitleButton(){const{editingTitle:e,visibleElements:t,messagesCommon:i}=this,s=i.edit;return t.editTitleButton&&!e?P("calcite-action",{bind:this,icon:"pencil",slot:"header-actions-end",text:s,title:s,onclick:this._toggleEditingTitle}):null}_renderNoLayersInfoMessage(e){return P("div",{slot:"message"},e)}_renderNoLayersInfo(e,t){return P("div",{class:g.itemMessage},P("calcite-notice",{icon:"information",key:t,kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(e)))}_renderItems(){const{collapsed:e,visible:t,visibleElements:{closeButton:i,collapseButton:s,heading:o,flow:l},messages:r,viewModel:a}=this,n=[P("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:i,closed:!t,collapsed:e,collapsible:s,heading:o?a.basemapTitle??r.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",selected:!this.editingTitle&&0===this.openedLayers.length&&0===this._openedPanelItems.length,onCalciteFlowItemClose:()=>this.visible=!1},this._renderEditTitleButton(),this._renderReferenceSection(),this._renderBaseSection()),this._renderEditingFlowItem(),this._renderPanelFlowItems(),this._renderedOpenLayerFlowItems],d=l?P("calcite-flow",{key:"root-flow"},n):n;return t?[this.editingTitle?P("form",{bind:this,class:g.editingForm,onsubmit:this._formSubmit},d):d,this._renderItemTooltips()]:null}_renderLayerFlowItem(e,t){const{messages:i,openedLayers:s}=this,o=e.title||this.messages.untitledLayer;return P("calcite-flow-item",{afterCreate:this._focusLayerFlowItemNode,afterUpdate:this._focusLayerFlowItemNode,bind:this,"data-layer-uid":e.uid,description:o,heading:i["catalog"===e.type?"catalogLayers":"tables"],headingLevel:this.headingLevel,key:`flow-layer-list-${e.uid}`,selected:t,onCalciteFlowItemBack:e=>{e.preventDefault(),s.pop();const t=s.at(-1);t?this._focusLayerFlowItem=t.uid:this._focusRootFlowItem=!0}},this._layerListMap.get(e)?.render())}_renderList(e,t,i){const{messages:s,dragEnabled:o,selectionMode:l,filterPlaceholder:r,baseFilterText:a,referenceFilterText:n,_baseFilterEnabled:d,_referenceFilterEnabled:c,_rootGroupUid:p}=this,m="reference"===t?s.noReferenceLayers:s.noBaseLayers,h="reference"===t?c:d;return P("calcite-block",{class:g.section,collapsible:!0,expanded:!0,heading:"reference"===t?s.referenceHeading:s.baseHeading,headingLevel:T(this.headingLevel),key:`block-${t}`},e?.length?null:this._renderNoLayersInfo(m,t),P("calcite-list",{afterCreate:e=>{"reference"===t?this._referenceListEl=e:this._baseListEl=e,e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{"reference"===t?this._referenceListEl=null:this._baseListEl=null,e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),displayMode:k,filterProps:M,[x]:t,"data-layer-type":p,dragEnabled:o,filterEnabled:h,filterPlaceholder:r,filterText:h?"reference"===t?n:a:"",group:p,key:`list-${t}`,label:s.widgetLabel,selectionAppearance:"border",selectionMode:l,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this["reference"===t?"referenceFilterText":"baseFilterText"]=e.currentTarget?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail),onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem},e?.toArray().map(e=>this._renderItem(e,i)),h?P("div",{class:g.filterNoResults,slot:"filter-no-results"},P("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(m))):null))}_renderBaseSection(){const{_visibleBaseItems:e}=this;return this.visibleElements.baseLayers?this._renderList(e,"base",1===e?.length):null}_renderReferenceSection(){return this.visibleElements.referenceLayers?this._renderList(this._visibleReferenceItems,"reference",!1):null}_toggleEditingTitle(){const{editingTitle:e}=this,t=!e;this.editingTitle=t,t?this._focusEditingFlowItem=!0:this._focusRootFlowItem=!0}_formSubmit(e){e.preventDefault();const t=this._editTitleInput?.value;t?.trim()&&(this.basemapTitle=t),this._toggleEditingTitle()}};function j(e){return e?.closest(`[${x}]`)?.getAttribute(x)}e([c()],N.prototype,"_baseListEl",void 0),e([c()],N.prototype,"_referenceListEl",void 0),e([c()],N.prototype,"_activeItem",void 0),e([c()],N.prototype,"_tooltipReferenceMap",void 0),e([c()],N.prototype,"_focusRootFlowItem",void 0),e([c()],N.prototype,"_focusPanelFlowItem",void 0),e([c()],N.prototype,"_focusLayerFlowItem",void 0),e([c()],N.prototype,"_focusEditingFlowItem",void 0),e([c()],N.prototype,"_layerListMap",void 0),e([c()],N.prototype,"_visibleBaseItems",null),e([c()],N.prototype,"_visibleReferenceItems",null),e([c()],N.prototype,"_openedPanelItems",null),e([c()],N.prototype,"_totalBaseItems",null),e([c()],N.prototype,"_totalReferenceItems",null),e([c()],N.prototype,"_baseFilterEnabled",null),e([c()],N.prototype,"_referenceFilterEnabled",null),e([c()],N.prototype,"_renderedOpenLayerFlowItems",null),e([c()],N.prototype,"basemapTitle",null),e([c({readOnly:!0})],N.prototype,"catalogLayerList",void 0),e([c()],N.prototype,"catalogOptions",void 0),e([c()],N.prototype,"collapsed",void 0),e([c()],N.prototype,"dragEnabled",void 0),e([c()],N.prototype,"editingTitle",void 0),e([c()],N.prototype,"filterPlaceholder",void 0),e([c()],N.prototype,"baseFilterPredicate",void 0),e([c()],N.prototype,"baseFilterText",void 0),e([c()],N.prototype,"referenceFilterPredicate",void 0),e([c()],N.prototype,"referenceFilterText",void 0),e([c()],N.prototype,"listItemCanGiveFunction",void 0),e([c()],N.prototype,"listItemCanReceiveFunction",void 0),e([c()],N.prototype,"baseListItemCreatedFunction",null),e([c()],N.prototype,"headingLevel",void 0),e([c()],N.prototype,"icon",null),e([c()],N.prototype,"knowledgeGraphOptions",void 0),e([c()],N.prototype,"label",null),e([c()],N.prototype,"layerTablesEnabled",void 0),e([c()],N.prototype,"mapImageOptions",void 0),e([c(),O("esri/widgets/BasemapLayerList/t9n/BasemapLayerList")],N.prototype,"messages",void 0),e([c(),O("esri/t9n/common")],N.prototype,"messagesCommon",void 0),e([c()],N.prototype,"minFilterItems",void 0),e([c({readOnly:!0})],N.prototype,"openedLayers",void 0),e([c({readOnly:!0})],N.prototype,"openedLayerLists",void 0),e([c()],N.prototype,"referenceListItemCreatedFunction",null),e([c({readOnly:!0})],N.prototype,"tableList",void 0),e([c({readOnly:!0})],N.prototype,"baseItems",null),e([c({readOnly:!0})],N.prototype,"referenceItems",null),e([c({type:R})],N.prototype,"selectedItems",void 0),e([c()],N.prototype,"selectionMode",void 0),e([c()],N.prototype,"tileOptions",void 0),e([c()],N.prototype,"view",null),e([A("trigger-action"),c({type:h})],N.prototype,"viewModel",void 0),e([c()],N.prototype,"visibilityAppearance",void 0),e([c({type:u,nonNullable:!0})],N.prototype,"visibleElements",void 0),N=e([p("esri.widgets.BasemapLayerList")],N);const U=N;export{U as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{pushIfSome as t}from"../../core/arrayUtils.js";import{createTask as s}from"../../core/asyncUtils.js";import a from"../../core/Collection.js";import i from"../../core/Error.js";import{EventedAccessor as n}from"../../core/Evented.js";import r from"../../core/Logger.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{destroyMaybe as l,abortMaybe as h}from"../../core/maybe.js";import{throwIfAborted as c,whenOrAbort as p,ignoreAbortErrors as u,isAbortError as m}from"../../core/promiseUtils.js";import d from"../../core/ReactiveMap.js";import{on as g,sync as y,watch as f,syncAndInitial as v,initial as _,whenOnce as A}from"../../core/reactiveUtils.js";import{property as F,subclass as I}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as w}from"../../core/support/UpdatingHandles.js";import x from"../../geometry/SpatialReference.js";import{getGraphicLayer as E}from"../../graphic/graphicOriginUtils.js";import{isSubtypeGroupLayer as C,isSubtypeSublayer as T,isFeatureLayer as M,getSubtypesFromLayer as k}from"../../layers/support/layerUtils.js";import{system as b}from"../../time/constants.js";import{getAttachmentKey as V}from"./attachmentUtils.js";import{getLayerTimeZone as S,getEffectiveTimeZone as L,createReactiveGraphic as R,isAttributeFormSupportedLayerWithAttachments as H,layerSupportsAttachments as P,queryAttachmentsForElements as j}from"./batchAttributeFormUtils.js";import{ReactiveContingentValuesManager as U}from"./ReactiveContingentValuesManager.js";import{parseFormTemplateString as O}from"./stringUtils.js";import{ValueChangeTransaction as G}from"./ValueChangeTransaction.js";import{ArcadeExecutorProvider as B}from"./expressions/ArcadeExecutorProvider.js";import{ExpressionsManager as D}from"./expressions/ExpressionsManager.js";import{ExpressionsModel as N}from"./expressions/ExpressionsModel.js";import Z from"./inputs/BatchFormInputs.js";import{createBatchFormInputsFromBatchFormTemplate as W,mergeBatchFormInputsFromNewTemplate as $}from"./inputs/support/createBatchFormInputs.js";import{isGroupInput as K,isFieldInput as z}from"./inputs/support/inputUtils.js";import q from"./templates/BatchFormTemplate.js";import{createBatchFormTemplate as J}from"./templates/support/createBatchFormTemplate.js";import{isExcludedFromSharedForm as Q,isGroupElementTemplate as X}from"./templates/support/templateUtils.js";import{ContingentValuesManager as Y,isLayerWithContingentValues as ee}from"../support/ContingentValuesManager.js";import{isEmptyValue as te}from"../support/forms/formUtils.js";function se(e,t){return e?.find(e=>e.layer===t)}let ae=class extends n{constructor(e){super(e),this._attachmentCache=new d,this.activeFeatureIndex=-1,this.attachmentsEnabled=!1,this.callbacks=null,this.disabled=!1,this.editType="NA",this.features=new a,this._hasAsyncArcadeExpressions=!1,this.highlightHelper=null,this.maximumFeatureCount=2e3,this.maximumFeatureCountWithComplexForms=50,this.pageStack=[],this.readOnly=!1,this.pendingSubtypeChoice=null,this.spatialReference=null,this.submitHasBeenAttempted=!1,this.view=null,this.userHasChangedValues=!1,this.layerInfos=null,this._arcadeExecutorProvider=new B,this._activeAssociation=null,this._activeAssociationsInput=null,this._activeRelationshipInput=null,this._ownContingentValuesManager=null,this._activeFormInputsByElementId=new Map,this._emptyForm=new Z({inputs:[]}),this._emptyFormTemplate=new q({elements:[]}),this._featureFormMap=new d,this._prepareTask=null,this._layerTemplateUpdateTask=null,this._syncAttachmentsTask=null,this._reactiveGraphicLookup=new d,this._updatingHandles=new w,this._submitTask=null,this._layerTemplateMap=new d,this._workingFeatures=new a,this._expressionsManager=new D({arcadeContext:{editType:"NA",spatialReference:null,map:null,timeZone:b}}),this._getExternalErrorForFeature=(e,t)=>this._reactiveContingentValuesManager.getViolationTypeForField(e,t),this._getFieldValueOptionsForFeature=e=>this._reactiveContingentValuesManager.getAndWatchFieldValueOptions(e),this.sharedForm=this._emptyForm,this.sharedFormTemplate=this._emptyFormTemplate}initialize(){this.contingentValuesManager||(this.contingentValuesManager=this._ownContingentValuesManager=new Y),this.addHandles([g(()=>this.features,"after-changes",()=>{this.goHome(),this.notifyChange("layers"),this._prepare()},y),f(()=>[this.attachmentsEnabled,this.features,this.map,this.timeZone,this.editType],()=>this._prepare(),y),f(()=>this.activeForm,()=>{this.goHome(),this._activeFormInputsByElementId.clear(),this._syncAttachments()},y),f(()=>this.activeFeature,()=>{this.goHome()},y),f(()=>this.page,e=>{const t=[...this.pageStack];if(t.includes(e))for(;t.length&&t.at(-1)!==e;)t.pop();else t.push(e);this.pageStack=t},v),f(()=>this.contingentValuesManager,e=>{l(this._reactiveContingentValuesManager),this._reactiveContingentValuesManager=new U({manager:e})},_)]),this._prepare()}destroy(){this._prepareTask=h(this._prepareTask),this.pendingSubtypeChoice?.reject(),this._layerTemplateUpdateTask=h(this._layerTemplateUpdateTask),this._syncAttachmentsTask=h(this._syncAttachmentsTask),this._workingFeatures.destroyAll(),l(this._expressionsManager),l(this._reactiveContingentValuesManager),this._updatingHandles.destroy(),this._reactiveGraphicLookup=new d,this._emptyForm.destroy(),this._emptyFormTemplate.destroy(),this._ownContingentValuesManager=l(this._ownContingentValuesManager),this.highlightHelper?.removeAll()}get activeFeature(){const e=this.activeFeatureIndex;return e<0?null:this.features.at(e)}get activeForm(){if("batch"===this.mode)return this.sharedForm;const e=this._workingFeatures.at(this.activeFeatureIndex);if(!e)return this._emptyForm;const t=this._featureFormMap.get(e);if(t)return t;const s=this._makeBatchFormInputsForFeature(e);return s!==this._emptyForm&&this._featureFormMap.set(e,s),s}get activeLayer(){const{activeFeature:e}=this;if(!e)return null;return E(e)??null}get activeAssociation(){return this._activeAssociation}get activeAssociationsInput(){return this._activeAssociationsInput}get activeAssociationType(){return this.activeAssociationsInput?.activeAssociationType}get activeRelationshipInput(){return this._activeRelationshipInput}get calculating(){return this._expressionsManager.calculating}get expressionsManager(){return this._expressionsManager}get canGoBack(){return this.pageStack.length>1}get expressionEvaluationFailed(){return this._expressionsManager.expressionEvaluationFailed}get hasNonActiveInvalidFeatures(){if("batch"===this.mode)return!1;const{activeFeature:e}=this;return this.invalidFeatures.some(t=>t!==e)}get hasAsyncArcadeExpressions(){return this._hasAsyncArcadeExpressions}get hasTooManyFeatures(){return this._workingFeatures.length>this.maximumFeatureCount}get hasTooManyComplexFeatures(){return this._workingFeatures.length>this.maximumFeatureCountWithComplexForms&&this.hasAsyncArcadeExpressions}get invalidFeatures(){return this.sharedForm.invalidFeatures}get hasVisibleInputs(){return this.visibleInputs.length>0}get hasLayersWithContingentValues(){const e=this.contingentValuesManager;for(const t of this.layers)if(e.getFieldsWithContingentValues(t).size>0)return!0;return!1}get formDescription(){return this._computeFormHeaderField(this.activeForm?.description)}get formTitle(){return this._computeFormHeaderField(this.activeForm?.title)}get effectiveTimeZone(){const{activeLayer:e,timeZone:t}=this;if(!e)return t??"system";const s=S(e);return L(t,s)}get visibleInputs(){return this.activeForm.inputs.filter(e=>e.visible)}get map(){return this.view?.map??null}set map(e){this._override("map",e)}get noVisibleElementsReason(){if(this.hasVisibleInputs)return null;if(0===this.activeForm.inputs.length)return"noElements";const e=new Set;for(const t of this.activeForm.inputs)switch(t.visibilityCode){case"hidden:not-in-all-layers":case"hidden:no-domain-in-common":e.add("noElementsInCommon");break;case"hidden:field-definition":case"hidden:group-visibility-expression:all-features":case"hidden:visibility-expression:all-features":e.add("allElementsHidden");break;case"hidden:group-visibility-expression:some-features":case"hidden:visibility-expression:some-features":return"elementsHiddenInSome"}return e.has("allElementsHidden")?"allElementsHidden":"noElementsInCommon"}get page(){return this.showingSelectedAttachmentReplacePage&&this.selectedAttachmentDetails?"replacing-attachment":this.selectedAttachmentDetails?"viewing-attachment-details":this.selectedAttachmentAddInput?"adding-attachments":this.selectedAttachmentListInput?"viewing-attachments":this.activeAssociationsInput?.associatedLayer?"viewing-associated-features":this.activeAssociationsInput?"viewing-associated-layers":this.activeRelationshipInput?.showAllRelatedRecords?"viewing-related-records":this.activeRelationshipInput?.showAllCategories?"viewing-related-categories":"default"}get subtypes(){const e=this.activeLayer;return C(e)||T(e)||M(e)?k(e):[]}get status(){const e=this._prepareTask;return null==e?"not-loaded":e.finished?null!=e.error?"failed":"loaded":"loading"}get timeZone(){return this.view?.timeZone??null}set timeZone(e){this._overrideIfSome("timeZone",e)}get updating(){return this._updatingHandles.updating||this.calculating}get valid(){return this.sharedForm.valid&&Array.from(this._featureFormMap.values()).every(e=>e.valid)}get layers(){return Array.from(this._layersSet)}get mode(){return this.activeFeatureIndex>-1?"single":"batch"}submit(){if(this.submitHasBeenAttempted=!0,this.validateContingentValues(this._workingFeatures),!this._hasPendingAttachmentHydration)return this._emitSubmit(),Promise.resolve();if(this._submitTask)return this._submitTask.promise;const e=s(async()=>{await Promise.all(this._allAttachmentInputs.map(e=>e.waitForPendingAttachmentUpdateData())),this._emitSubmit()});return this._submitTask=e,e.promise.finally(()=>{this._submitTask===e&&(this._submitTask=null)}),e.promise}get selectedAttachment(){return this._get("selectedAttachment")??null}set selectedAttachment(e){this.showingSelectedAttachmentReplacePage=!1,this._set("selectedAttachment",e),null!=e&&(this.selectedAttachmentAddElementId=null)}get selectedAttachmentAddElementId(){return this._get("selectedAttachmentAddElementId")??null}set selectedAttachmentAddElementId(e){this.showingSelectedAttachmentReplacePage=!1,this._set("selectedAttachmentAddElementId",e),null!=e&&(this.selectedAttachment=null,this.selectedAttachmentListElementId=null)}get selectedAttachmentListElementId(){return this._get("selectedAttachmentListElementId")??null}set selectedAttachmentListElementId(e){this._set("selectedAttachmentListElementId",e),null!=e&&(this.selectedAttachment=null,this.selectedAttachmentAddElementId=null)}get selectedAttachmentListInput(){const e=this.selectedAttachmentListElementId,t=this.activeForm;if(!e||!t)return null;const s=t.allAttachmentElementInputs.find(t=>t.template.elementId===e)||null;return s?.attachments.length?s:null}get showingSelectedAttachmentReplacePage(){return this._get("showingSelectedAttachmentReplacePage")??!1}set showingSelectedAttachmentReplacePage(e){this._set("showingSelectedAttachmentReplacePage",e&&null!=this.selectedAttachmentDetails)}get selectedAttachmentAddInput(){const e=this.selectedAttachmentAddElementId,t=this.activeForm;return e&&t&&t.allAttachmentElementInputs.find(t=>t.template.elementId===e)||null}get selectedAttachmentDetails(){const e=this.selectedAttachment,t=this.activeForm;if(!e||!t)return null;const s=t.allAttachmentElementInputs.find(t=>t.template.elementId===e.elementId);if(!s)return null;const a=s.attachments.findIndex(t=>V(t)===e.attachmentKey);if(-1===a)return null;return{attachment:s.attachments[a],input:s}}get _allAttachmentInputs(){const e=[...this.sharedForm.allAttachmentElementInputs];for(const t of this._featureFormMap.values())e.push(...t.allAttachmentElementInputs);return e}get _hasPendingAttachmentHydration(){return this._allAttachmentInputs.some(e=>e.hasPendingAttachmentUpdateData)}get _layersSet(){const e=new Set;for(const t of this._workingFeatures){const s=E(t.plainGraphic);s&&e.add(s)}return e}applyStashedAttachmentEdits(e){const t=this._allAttachmentInputs;for(const s of e){const e=t.find(e=>e.label===s.label&&e.attachmentKeyword===s.keywords);e&&e.applyStashedEdits(s)}}findFieldInput(e){if(null==e)return;const t=this._activeFormInputsByElementId;if(t.has(e))return t.get(e);const s=this.activeForm.allFieldInputs.find(t=>t.template.elementId===e);return void 0!==s?(t.set(e,s),s):void 0}getFirstVisibleInvalidFieldInput(){if(this.hasVisibleInputs&&!this.activeForm.valid)for(const e of this.visibleInputs){if(K(e)){const t=e.inputs.find(e=>z(e)&&!e.valid);if(t)return{input:t,groupInput:e}}if(z(e)&&!e.valid)return{input:e}}}getFieldInputValue(e){return this.findFieldInput(e)?.value}getValues(e){const t=this._reactiveGraphicLookup.get(e);if(!t)throw new i("feature-not-found","The given feature is not present in the BatchAttributeForm");return{...t.attributes}}async goBack(){switch(this.page){case"replacing-attachment":return void this.setShowingSelectedAttachmentReplacePage(!1);case"viewing-attachment-details":return void this.setSelectedAttachment(null);case"adding-attachments":return void this.setSelectedAttachmentAddElementId(null);case"viewing-attachments":return void this.setSelectedAttachmentListElementId(null);case"viewing-associated-features":return void this.setActiveAssociationsLayer(null);case"viewing-associated-layers":return void this.setActiveAssociationsInput(null);case"viewing-related-categories":case"viewing-related-records":return void this.clearActiveRelationshipCategoryOrInput();default:return}}async goHome(){this.setShowingSelectedAttachmentReplacePage(!1),this.setSelectedAttachment(null),this.setSelectedAttachmentAddElementId(null),this.setSelectedAttachmentListElementId(null),this.setActiveAssociationsLayer(null),this.setActiveAssociationsInput(null),this.clearAllRelationshipSettings()}notifyGeometriesChanged(e){const t=[];for(const s of e){const e=this._reactiveGraphicLookup.get(s);e&&(t.push(e),e.geometry=s.geometry)}this._updatingHandles.consumePromise(this._valueChangeTransaction(async e=>this._expressionsManager.runGeometryDependentExpressions(t,e),"user"))}async overrideOriginalFeature(e,t){await(this._prepareTask?.promise);const s=this._reactiveGraphicLookup.get(e);s&&(s.original=t,this._updatingHandles.consumePromise(this._valueChangeTransaction(e=>this._expressionsManager.runOriginalFeatureDependentExpressions(s,e),"expression")))}async setFieldInputValue(e,t){const{fieldName:s}=e;await this._updatingHandles.addPromise(this._valueChangeTransaction(async a=>{for(const i of e.features)a.setValue(i,s,t)},"user",e))}async setFieldInputValuePerFeature(e,t){await this._updatingHandles.addPromise(this._valueChangeTransaction(async s=>{for(const[a,i]of t)s.setValue(a,e.fieldName,i);s.hasChanges&&(e.userHasChangedValue=!0)},"user",e))}async setValueForFieldName(e,t,s){await this._updatingHandles.addPromise(this._valueChangeTransaction(async a=>{for(const i of s){const s=this._reactiveGraphicLookup.get(i);s&&a.setValue(s,e,t)}},"user",e))}async setValuePerFeatureForFieldName(e,t){await this._updatingHandles.addPromise(this._valueChangeTransaction(async s=>{for(const[a,i]of t){const t=this._reactiveGraphicLookup.get(a);t&&s.setValue(t,e,i)}},"user",e))}async setFieldValue(e,t){const s=this.activeForm.allFieldInputs.find(t=>t.fieldName===e);if(null==s)throw new i("no-field-input-found",`Cannot set the value of FieldInput with field name: ${e} because none was found in the active form`);await this.setFieldInputValue(s,t)}async setValue(e,t){const s=this.findFieldInput(e);if(null==s)throw new i("no-FieldInput-found",`Cannot set the value of FieldInput with ID: ${e} because none was found in the active form`);await this.setFieldInputValue(s,t)}async applySubtypeDefaults(e){const{defaultValues:t}=e,{allFieldInputs:s}=this.activeForm;await this._updatingHandles.addPromise(this._valueChangeTransaction(async e=>{for(const a of s){const{fieldName:s}=a,i=t[s];if(null!=i)for(const t of a.features)e.setValue(t,s,i)}},"user"))}async handleSubtypeChanged(e){const t=this._workingFeatures.at(e);if(t)return this._updatingHandles.addPromise(this._handleSubtypeChanged(t))}async stageAddAttachments(e,t){if(0===t.length)return[];const s=this._findAttachmentInput(e);if(!s)return[];const a=await this._updatingHandles.addPromise(s.stageAddAttachments(t,this._expressionsManager.arcadeContext));return 0===a.length||(this.userHasChangedValues=!0,this._emitAttachmentsChange(s)),a}stageDeleteAttachment(e,t){const s=this._findAttachmentInput(e);if(!s)return;const a=this._findAttachment(s,t);a&&(s.stageDeleteAttachment(a),this.userHasChangedValues=!0,this._emitAttachmentsChange(s))}async stageRenameAttachment(e,t,s){const a=this._findAttachmentInput(e);if(!a)return;const i=this._findAttachment(a,t);i&&(a.stageRenameAttachment(i,s.trim()),this.userHasChangedValues=!0,await a.ensureStagedUpdateData(i),this._emitAttachmentsChange(a))}async stageReplaceAttachment(e,t,s){const a=this._findAttachmentInput(e);if(!a)return!1;const i=this._findAttachment(a,t);if(!i)return!1;return!!await this._updatingHandles.addPromise(a.stageReplaceAttachment(i,s,this._expressionsManager.arcadeContext))&&(this.userHasChangedValues=!0,this._emitAttachmentsChange(a),!0)}clearAttachmentChanges(e){const t=this._findAttachmentInput(e);t&&(t.clearAttachmentChanges(),this._emitAttachmentsChange(t))}setActiveAssociation(e){this._activeAssociation=e}setActiveAssociationsInput(e){this._activeAssociationsInput=e}setActiveAssociationsLayer(e){this._activeAssociationsInput?.setAssociatedLayer(e)}setActiveAssociationType(e){this._activeAssociationsInput?.setActiveAssociationType(e)}setActiveRelationshipInput(e){e||this._activeRelationshipInput?.setActiveCategory(null),this._activeRelationshipInput=e}setActiveRelationshipCategory(e,t){t.setActiveCategory(e),this.setActiveRelationshipInput(t)}clearAllRelationshipSettings(){const e=this.activeRelationshipInput;e&&(e.setActiveCategory(null),e.setShowAllCategories(!1),e.setShowAllRelatedRecords(!1),this._activeRelationshipInput=null)}clearActiveRelationshipCategoryOrInput(){const e=this.activeRelationshipInput;e&&(e.showAllRelatedRecords?e.showAllCategories?e.setActiveCategory(null):this.setActiveRelationshipInput(null):e.showAllCategories&&(e.setShowAllCategories(!1),this.setActiveRelationshipInput(null)))}resetAttachmentChanges(e,t){const s=this._findAttachmentInput(e);if(!s||!s.editable)return;const a=this._findAttachment(s,t);a&&(s.discardStagedEdits(a),this._emitAttachmentsChange(s))}setSelectedAttachment(e){this.selectedAttachment=e??null}setShowingSelectedAttachmentReplacePage(e){this.showingSelectedAttachmentReplacePage=e}setSelectedAttachmentAddElementId(e){this.selectedAttachmentAddElementId=e??null}setSelectedAttachmentListElementId(e){this.selectedAttachmentListElementId=e??null}userChangesHaveMadeFeatureInvalid(e){return!!this._reactiveGraphicLookup.get(e)?.userChangesHaveMadeInvalid}validate(){return!1}validateContingentValues(e,t=!1){if(t&&!this.submitHasBeenAttempted)for(const s of e)this._reactiveContingentValuesManager.validateContingenciesForNonNullFields(s);else for(const s of e)this._reactiveContingentValuesManager.validateContingencyConstraints(s,{includeIncompleteViolations:!0})}_makeBatchFormInputsForFeature(e){const t=this._layerTemplateMap.get(e.layer);return t?W(t,{allFeatures:new a([e]),expressionsManager:this._expressionsManager,getExternalErrorForFeature:this._getExternalErrorForFeature,getFieldValueOptionsForFeature:this._getFieldValueOptionsForFeature,map:this.map}):this._emptyForm}async _ensureLayerTemplate(e,t){const{_layersSet:s,contingentValuesManager:a}=this,i=e.layer;let n=!1;for(const r of this._layerTemplateMap.keys())s.has(r)||(this._layerTemplateMap.delete(r),this._expressionsManager.layerExpressionsModelMap.delete(r),a.resetOptionsForLayer(r),ee(r)&&a.resetViolationsForLayer(r),n=!0);this._layerTemplateMap.has(i)||(await this._prepareLayer(i,t),c(t),a.layers.add(i),n=!0),n&&(this._prepareSharedFormTemplate(),$(this.sharedForm,this.sharedFormTemplate,{allFeatures:this._workingFeatures,expressionsManager:this._expressionsManager,getFieldValueOptionsForFeature:this._getFieldValueOptionsForFeature,map:this.map}),this._recomputeHasAsyncArcadeExpressions(),await A(()=>!a.updating,t))}_recomputeHasAsyncArcadeExpressions(){this._hasAsyncArcadeExpressions=!1;for(const e of this._expressionsManager.layerExpressionsModelMap.values())for(const t of e.arcadeExecutorUses.keys())if(t.isAsync)return void(this._hasAsyncArcadeExpressions=!0)}_computeFormHeaderField(e){const{activeFeature:t,activeLayer:s}=this;return e&&s&&t?O({attributes:t?.attributes,label:e,layer:s,timeZone:this.effectiveTimeZone}):null}_makeSubmitResults(){const e=new Map;for(const[s,a]of this._reactiveGraphicLookup){const i=[],n=[],r=this._featureFormMap.get(a)?.allAttachmentElementInputs??[];for(const e of r)t(i,e.toSubmitEdits()),e.valid||n.push(e.template.elementId);e.set(s,{feature:s,values:{...a.attributes},invalidFields:[],attachmentEdits:i,invalidAttachmentElementIds:n})}for(const t of this.sharedForm.allFieldInputs)for(const s of t.invalidFeatures)e.get(s)?.invalidFields.push(t.fieldName);return Array.from(e.values())}async _handleSubtypeChanged(e){const t=e.layer;if(this.contingentValuesManager.resetOptionsForFeature(t,e.plainGraphic),ee(t)&&this.contingentValuesManager.resetViolationsForFeature(t,e.plainGraphic),!T(t))return;const a=t.parent?.findSublayerForFeature(e.plainGraphic);if(!a)return;this._layerTemplateUpdateTask=h(this._layerTemplateUpdateTask);const i=s(async t=>{c(t),e.source.sourceLayer=a,e.source.origin=a.graphicOrigin,await this._ensureLayerTemplate(e,t),c(t),this._featureFormMap.get(e)?.destroy(),this._featureFormMap.set(e,this._makeBatchFormInputsForFeature(e)),await p(this._valueChangeTransaction(t=>this._expressionsManager.runAllExpressions([e],t),"user"),t),c(t)});this._layerTemplateUpdateTask=i,await u(this._updatingHandles.addPromise(i.promise))}_emitSubmit(){this.emit("submit",{name:"submit",results:this._makeSubmitResults(),valid:this.valid})}_findAttachmentInput(e){const t=this.activeForm.allAttachmentElementInputs.find(t=>t.template.elementId===e);return t||r.getLogger(this).error(`Attachment input not found for elementId '${e}'`),t}_findAttachment(e,t){const s=e.findAttachment(t);return s||r.getLogger(this).error(`Attachment '${t}' not found for attachment element '${e.template.elementId}'`),s}_makeAttachmentEdits(e){const s=[];for(const a of e.allAttachmentElementInputs)t(s,a.toSubmitEdits());return s}_emitAttachmentsChange(e){const t=e.single.feature;if(!t)return;const s=this._featureFormMap.get(t);this.emit("attachments-change",{name:"attachments-change",feature:t.source,attachmentEdits:this._makeAttachmentEdits(s??this.activeForm),valid:this.valid})}async _valueChangeTransaction(e,t,s){const a=new G(this,t,"string"==typeof s?s:s?.fieldName);if(await e(a),"user"===t&&await this._expressionsManager.runExpressionsDependentOnChangedFields(a),await a.close(),a.hasChanges&&s){const e="string"==typeof s?this.activeForm.allFieldInputs.find(e=>e.fieldName===s):s;e&&(e.userHasChangedValue=!0)}}_prepare(){this.pendingSubtypeChoice?.reject(),this._hasAsyncArcadeExpressions=!1,this._prepareTask=h(this._prepareTask),this._layerTemplateUpdateTask=h(this._layerTemplateUpdateTask),this._layerTemplateMap.clear(),this._updateWorkingFeatures(),l(this._expressionsManager),this.userHasChangedValues=!1,this._expressionsManager=new D({arcadeContext:{editType:this.editType,spatialReference:this.spatialReference??x.WebMercator,map:this.map,timeZone:this.timeZone||"system"}});const{layers:e}=this;if(0===e.length)return;const t=s(async t=>{try{c(t),this._updateWorkingFeatures(),this.contingentValuesManager.layers.addMany(e),await Promise.all(e.map(e=>e.load()));for(const s of e)await this._prepareLayer(s,t);if(this.hasTooManyComplexFeatures)throw new i("too-many-features-with-complex-forms","There are too many features to load into the form with the configured complexity");if(this.hasTooManyFeatures)throw new i("too-many-features","There are too many features to load into the form.");this._prepareSharedFormTemplate(),this.sharedForm=W(this.sharedFormTemplate,{allFeatures:this._workingFeatures,expressionsManager:this._expressionsManager,getExternalErrorForFeature:this._getExternalErrorForFeature,getFieldValueOptionsForFeature:this._getFieldValueOptionsForFeature,map:this.map}),await this._valueChangeTransaction(async e=>await this._expressionsManager.runAllExpressions(this._workingFeatures.toArray(),e),"expression"),await A(()=>!this.contingentValuesManager.updating)}catch(s){throw m(s)||r.getLogger(this).error("Failed preparing form",s),s}});this._updatingHandles.consumePromise(t.promise),this._prepareTask=t}async _prepareLayer(e,t){const s=se(this.layerInfos,e),a=await J(e,{arcadeExecutorProvider:this._arcadeExecutorProvider,formTimeZone:this.timeZone,attachmentsEnabled:this.attachmentsEnabled},s?.formTemplate);c(t),this._layerTemplateMap.set(e,a);const i=a.getExpressionExecutorsForLayer(e);if(this._expressionsManager.layerExpressionsModelMap.set(e,new N({preserveFieldValuesWhenHidden:a.preserveFieldValuesWhenHidden,executorMap:i,fieldsIndex:e.fieldsIndex})),!this._hasAsyncArcadeExpressions)for(const n of i.values())if(n&&(this._hasAsyncArcadeExpressions=!0===(n.editableExpression?.isAsync||n.requiredExpression?.isAsync||n.valueExpression?.isAsync||n.visibilityExpression?.isAsync),this._hasAsyncArcadeExpressions))break}_prepareSharedFormTemplate(){const e=new Map;for(const t of this._layerTemplateMap.values())for(const s of t.elements){if(Q(s))continue;const t=s.clone();X(t)&&(t.elements=t.elements.filter(e=>!Q(e)));const{elementId:a}=t;e.has(a)?e.get(a).foldIn(t):e.set(a,t)}this.sharedFormTemplate=new q({elements:Array.from(e.values())})}_updateWorkingFeatures(){this._workingFeatures.destroyAll(),this._reactiveContingentValuesManager.reset();for(const t of this._featureFormMap.values())t.destroy();this._featureFormMap.clear(),this._attachmentCache.clear();const{features:e}=this;if(this._reactiveGraphicLookup=new d,0!==e.length){this._workingFeatures.addMany(e.map(R));for(const e of this._workingFeatures)this._reactiveGraphicLookup.set(e.source,e)}}async _syncAttachments(){const{activeFeature:e,activeLayer:t,activeForm:a}=this;if(!(e&&a&&H(t)&&P(t)))return;const i=e.getObjectId();if(null==i)return;const n=this._attachmentCache.get(t),r=a.allAttachmentElementInputs;if(!r.length)return;const l=s(async e=>{let s;if(n){const e=n.get(i);e&&(s=e)}if(!s){s=await j(t,i,r,e);o(this._attachmentCache,t,()=>new d).set(i,s)}for(const t of r)t.applyFetchedAttachments(oe(t,s))});this._syncAttachmentsTask=l,await u(l.promise)}get test(){return{expressionsManager:this._expressionsManager,reactiveGraphicLookup:this._reactiveGraphicLookup,syncAttachmentsTask:this._syncAttachmentsTask}}};e([F()],ae.prototype,"_attachmentCache",void 0),e([F({readOnly:!0})],ae.prototype,"activeFeature",null),e([F()],ae.prototype,"activeFeatureIndex",void 0),e([F({readOnly:!0})],ae.prototype,"activeForm",null),e([F({readOnly:!0})],ae.prototype,"activeLayer",null),e([F()],ae.prototype,"activeAssociation",null),e([F()],ae.prototype,"activeAssociationsInput",null),e([F()],ae.prototype,"activeAssociationType",null),e([F()],ae.prototype,"activeRelationshipInput",null),e([F()],ae.prototype,"attachmentsEnabled",void 0),e([F()],ae.prototype,"callbacks",void 0),e([F()],ae.prototype,"disabled",void 0),e([F()],ae.prototype,"calculating",null),e([F()],ae.prototype,"canGoBack",null),e([F()],ae.prototype,"contingentValuesManager",void 0),e([F()],ae.prototype,"editType",void 0),e([F()],ae.prototype,"features",void 0),e([F()],ae.prototype,"expressionEvaluationFailed",null),e([F()],ae.prototype,"hasNonActiveInvalidFeatures",null),e([F()],ae.prototype,"hasAsyncArcadeExpressions",null),e([F()],ae.prototype,"_hasAsyncArcadeExpressions",void 0),e([F()],ae.prototype,"invalidFeatures",null),e([F()],ae.prototype,"hasVisibleInputs",null),e([F()],ae.prototype,"hasLayersWithContingentValues",null),e([F()],ae.prototype,"formDescription",null),e([F()],ae.prototype,"formTitle",null),e([F()],ae.prototype,"effectiveTimeZone",null),e([F()],ae.prototype,"highlightHelper",void 0),e([F()],ae.prototype,"maximumFeatureCount",void 0),e([F()],ae.prototype,"maximumFeatureCountWithComplexForms",void 0),e([F()],ae.prototype,"visibleInputs",null),e([F()],ae.prototype,"map",null),e([F()],ae.prototype,"noVisibleElementsReason",null),e([F()],ae.prototype,"page",null),e([F()],ae.prototype,"pageStack",void 0),e([F()],ae.prototype,"readOnly",void 0),e([F()],ae.prototype,"pendingSubtypeChoice",void 0),e([F()],ae.prototype,"subtypes",null),e([F()],ae.prototype,"spatialReference",void 0),e([F()],ae.prototype,"submitHasBeenAttempted",void 0),e([F()],ae.prototype,"timeZone",null),e([F()],ae.prototype,"view",void 0),e([F()],ae.prototype,"updating",null),e([F()],ae.prototype,"valid",null),e([F()],ae.prototype,"layers",null),e([F()],ae.prototype,"mode",null),e([F()],ae.prototype,"sharedForm",void 0),e([F()],ae.prototype,"sharedFormTemplate",void 0),e([F()],ae.prototype,"selectedAttachment",null),e([F()],ae.prototype,"selectedAttachmentAddElementId",null),e([F()],ae.prototype,"selectedAttachmentListElementId",null),e([F()],ae.prototype,"selectedAttachmentListInput",null),e([F()],ae.prototype,"showingSelectedAttachmentReplacePage",null),e([F()],ae.prototype,"selectedAttachmentAddInput",null),e([F()],ae.prototype,"selectedAttachmentDetails",null),e([F()],ae.prototype,"userHasChangedValues",void 0),e([F()],ae.prototype,"layerInfos",void 0),e([F()],ae.prototype,"_arcadeExecutorProvider",void 0),e([F()],ae.prototype,"_activeAssociation",void 0),e([F()],ae.prototype,"_activeAssociationsInput",void 0),e([F()],ae.prototype,"_activeRelationshipInput",void 0),e([F()],ae.prototype,"_prepareTask",void 0),e([F()],ae.prototype,"_reactiveGraphicLookup",void 0),e([F()],ae.prototype,"_allAttachmentInputs",null),e([F()],ae.prototype,"_hasPendingAttachmentHydration",null),e([F()],ae.prototype,"_layerTemplateMap",void 0),e([F()],ae.prototype,"_layersSet",null),e([F()],ae.prototype,"_workingFeatures",void 0),e([F()],ae.prototype,"_expressionsManager",void 0),ae=e([I("esri.widgets.BatchAttributeForm.BatchAttributeFormViewModel")],ae);const ie=ae;function ne(e){return null!=e&&e.trim().length>0}function re(e,t){const s=e.keywords;return ne(s)&&s.toLowerCase()===t}function oe(e,t){const s="attachment"===e.input?.type?e.input.attachmentAssociationType:"exact",a=e.attachmentKeyword;if("any"===s)return t;if("exactOrNone"===s){if(te(a))return t.filter(e=>!ne(e.keywords));const e=a.toLowerCase();return t.filter(t=>!ne(t.keywords)||re(t,e))}if(te(a))return t;const i=a.toLowerCase();return t.filter(e=>re(e,i))}export{ie as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{pushIfSome as t}from"../../core/arrayUtils.js";import{createTask as s}from"../../core/asyncUtils.js";import a from"../../core/Collection.js";import i from"../../core/Error.js";import{EventedAccessor as n}from"../../core/Evented.js";import r from"../../core/Logger.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{destroyMaybe as l,abortMaybe as h}from"../../core/maybe.js";import{throwIfAborted as c,whenOrAbort as p,ignoreAbortErrors as u,isAbortError as m}from"../../core/promiseUtils.js";import d from"../../core/ReactiveMap.js";import{on as g,sync as y,watch as f,syncAndInitial as v,initial as _,whenOnce as A}from"../../core/reactiveUtils.js";import{property as F,subclass as I}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as w}from"../../core/support/UpdatingHandles.js";import x from"../../geometry/SpatialReference.js";import{getGraphicLayer as E}from"../../graphic/graphicOriginUtils.js";import{isSubtypeGroupLayer as C,isSubtypeSublayer as T,isFeatureLayer as M,getSubtypesFromLayer as k}from"../../layers/support/layerUtils.js";import{system as b}from"../../time/constants.js";import{getAttachmentKey as V}from"./attachmentUtils.js";import{getLayerTimeZone as S,getEffectiveTimeZone as L,createReactiveGraphic as R,isAttributeFormSupportedLayerWithAttachments as H,layerSupportsAttachments as P,queryAttachmentsForElements as j}from"./batchAttributeFormUtils.js";import{ReactiveContingentValuesManager as U}from"./ReactiveContingentValuesManager.js";import{parseFormTemplateString as O}from"./stringUtils.js";import{ValueChangeTransaction as G}from"./ValueChangeTransaction.js";import{ArcadeExecutorProvider as B}from"./expressions/ArcadeExecutorProvider.js";import{ExpressionsManager as D}from"./expressions/ExpressionsManager.js";import{ExpressionsModel as N}from"./expressions/ExpressionsModel.js";import Z from"./inputs/BatchFormInputs.js";import{createBatchFormInputsFromBatchFormTemplate as W,mergeBatchFormInputsFromNewTemplate as $}from"./inputs/support/createBatchFormInputs.js";import{isGroupInput as K,isFieldInput as z}from"./inputs/support/inputUtils.js";import q from"./templates/BatchFormTemplate.js";import{createBatchFormTemplate as J}from"./templates/support/createBatchFormTemplate.js";import{isExcludedFromSharedForm as Q,isGroupElementTemplate as X}from"./templates/support/templateUtils.js";import{ContingentValuesManager as Y,isLayerWithContingentValues as ee}from"../support/ContingentValuesManager.js";import{isEmptyValue as te}from"../support/forms/formUtils.js";function se(e,t){return e?.find(e=>e.layer===t)}let ae=class extends n{constructor(e){super(e),this._attachmentCache=new d,this.activeFeatureIndex=-1,this.attachmentsEnabled=!1,this.callbacks=null,this.disabled=!1,this.editType="NA",this.features=new a,this._hasAsyncArcadeExpressions=!1,this.highlightHelper=null,this.maximumFeatureCount=2e3,this.maximumFeatureCountWithComplexForms=50,this.pageStack=[],this.readOnly=!1,this.pendingSubtypeChoice=null,this.spatialReference=null,this.submitHasBeenAttempted=!1,this.view=null,this.userHasChangedValues=!1,this.layerInfos=null,this._arcadeExecutorProvider=new B,this._activeAssociation=null,this._activeAssociationsInput=null,this._activeRelationshipInput=null,this._ownContingentValuesManager=null,this._activeFormInputsByElementId=new Map,this._emptyForm=new Z({inputs:[]}),this._emptyFormTemplate=new q({elements:[]}),this._featureFormMap=new d,this._prepareTask=null,this._layerTemplateUpdateTask=null,this._syncAttachmentsTask=null,this._reactiveGraphicLookup=new d,this._updatingHandles=new w,this._submitTask=null,this._layerTemplateMap=new d,this._workingFeatures=new a,this._expressionsManager=new D({arcadeContext:{editType:"NA",spatialReference:null,map:null,timeZone:b}}),this._getExternalErrorForFeature=(e,t)=>this._reactiveContingentValuesManager.getViolationTypeForField(e,t),this._getFieldValueOptionsForFeature=e=>this._reactiveContingentValuesManager.getAndWatchFieldValueOptions(e),this.sharedForm=this._emptyForm,this.sharedFormTemplate=this._emptyFormTemplate}initialize(){this.contingentValuesManager||(this.contingentValuesManager=this._ownContingentValuesManager=new Y),this.addHandles([g(()=>this.features,"after-changes",()=>{this.goHome(),this.notifyChange("layers"),this._prepare()},y),f(()=>[this.attachmentsEnabled,this.features,this.map,this.timeZone,this.editType],()=>this._prepare(),y),f(()=>this.activeForm,()=>{this.goHome(),this._activeFormInputsByElementId.clear(),this._syncAttachments()},y),f(()=>this.activeFeature,()=>{this.goHome()},y),f(()=>this.page,e=>{const t=[...this.pageStack];if(t.includes(e))for(;t.length&&t.at(-1)!==e;)t.pop();else t.push(e);this.pageStack=t},v),f(()=>this.contingentValuesManager,e=>{l(this._reactiveContingentValuesManager),this._reactiveContingentValuesManager=new U({manager:e})},_)]),this._prepare()}destroy(){this._prepareTask=h(this._prepareTask),this.pendingSubtypeChoice?.reject(),this._layerTemplateUpdateTask=h(this._layerTemplateUpdateTask),this._syncAttachmentsTask=h(this._syncAttachmentsTask),this._workingFeatures.destroyAll(),l(this._expressionsManager),l(this._reactiveContingentValuesManager),this._updatingHandles.destroy(),this._reactiveGraphicLookup=new d,this._emptyForm.destroy(),this._emptyFormTemplate.destroy(),this._ownContingentValuesManager=l(this._ownContingentValuesManager),this.highlightHelper?.removeAll()}get activeFeature(){const e=this.activeFeatureIndex;return e<0?null:this.features.at(e)}get activeForm(){if("batch"===this.mode)return this.sharedForm;const e=this._workingFeatures.at(this.activeFeatureIndex);if(!e)return this._emptyForm;const t=this._featureFormMap.get(e);if(t)return t;const s=this._makeBatchFormInputsForFeature(e);return s!==this._emptyForm&&this._featureFormMap.set(e,s),s}get activeLayer(){const{activeFeature:e}=this;if(!e)return null;return E(e)??null}get activeAssociation(){return this._activeAssociation}get activeAssociationsInput(){return this._activeAssociationsInput}get activeAssociationType(){return this.activeAssociationsInput?.activeAssociationType}get activeRelationshipInput(){return this._activeRelationshipInput}get calculating(){return this._expressionsManager.calculating}get expressionsManager(){return this._expressionsManager}get canGoBack(){return this.pageStack.length>1}get expressionEvaluationFailed(){return this._expressionsManager.expressionEvaluationFailed}get hasNonActiveInvalidFeatures(){if("batch"===this.mode)return!1;const{activeFeature:e}=this;return this.invalidFeatures.some(t=>t!==e)}get hasAsyncArcadeExpressions(){return this._hasAsyncArcadeExpressions}get hasTooManyFeatures(){return this._workingFeatures.length>this.maximumFeatureCount}get hasTooManyComplexFeatures(){return this._workingFeatures.length>this.maximumFeatureCountWithComplexForms&&this.hasAsyncArcadeExpressions}get invalidFeatures(){return this.sharedForm.invalidFeatures}get hasVisibleInputs(){return this.visibleInputs.length>0}get hasLayersWithContingentValues(){const e=this.contingentValuesManager;for(const t of this.layers)if(e.getFieldsWithContingentValues(t).size>0)return!0;return!1}get formDescription(){return this._computeFormHeaderField(this.activeForm?.description)}get formTitle(){return this._computeFormHeaderField(this.activeForm?.title)}get effectiveTimeZone(){const{activeLayer:e,timeZone:t}=this;if(!e)return t??"system";const s=S(e);return L(t,s)}get visibleInputs(){return this.activeForm.inputs.filter(e=>e.visible)}get map(){return this.view?.map??null}set map(e){this._override("map",e)}get noVisibleElementsReason(){if(this.hasVisibleInputs)return null;if(0===this.activeForm.inputs.length)return"noElements";const e=new Set;for(const t of this.activeForm.inputs)switch(t.visibilityCode){case"hidden:not-in-all-layers":case"hidden:no-domain-in-common":e.add("noElementsInCommon");break;case"hidden:field-definition":case"hidden:group-visibility-expression:all-features":case"hidden:visibility-expression:all-features":e.add("allElementsHidden");break;case"hidden:group-visibility-expression:some-features":case"hidden:visibility-expression:some-features":return"elementsHiddenInSome"}return e.has("allElementsHidden")?"allElementsHidden":"noElementsInCommon"}get page(){return this.showingSelectedAttachmentReplacePage&&this.selectedAttachmentDetails?"replacing-attachment":this.selectedAttachmentDetails?"viewing-attachment-details":this.selectedAttachmentAddInput?"adding-attachments":this.selectedAttachmentListInput?"viewing-attachments":this.activeAssociationsInput?.associatedLayer?"viewing-associated-features":this.activeAssociationsInput?"viewing-associated-layers":this.activeRelationshipInput?.showAllRelatedRecords?"viewing-related-records":this.activeRelationshipInput?.showAllCategories?"viewing-related-categories":"default"}get subtypes(){const e=this.activeLayer;return C(e)||T(e)||M(e)?k(e):[]}get status(){const e=this._prepareTask;return null==e?"not-loaded":e.finished?null!=e.error?"failed":"loaded":"loading"}get timeZone(){return this.view?.timeZone??null}set timeZone(e){this._overrideIfSome("timeZone",e)}get updating(){return this._updatingHandles.updating||this.calculating}get valid(){return this.sharedForm.valid&&Array.from(this._featureFormMap.values()).every(e=>e.valid)}get layers(){return Array.from(this._layersSet)}get mode(){return this.activeFeatureIndex>-1?"single":"batch"}submit(){if(this.submitHasBeenAttempted=!0,this.sharedForm.touchAll(),this._featureFormMap.forEach(e=>e.touchAll()),this.validateContingentValues(this._workingFeatures),!this._hasPendingAttachmentHydration)return this._emitSubmit(),Promise.resolve();if(this._submitTask)return this._submitTask.promise;const e=s(async()=>{await Promise.all(this._allAttachmentInputs.map(e=>e.waitForPendingAttachmentUpdateData())),this._emitSubmit()});return this._submitTask=e,e.promise.finally(()=>{this._submitTask===e&&(this._submitTask=null)}),e.promise}get selectedAttachment(){return this._get("selectedAttachment")??null}set selectedAttachment(e){this.showingSelectedAttachmentReplacePage=!1,this._set("selectedAttachment",e),null!=e&&(this.selectedAttachmentAddElementId=null)}get selectedAttachmentAddElementId(){return this._get("selectedAttachmentAddElementId")??null}set selectedAttachmentAddElementId(e){this.showingSelectedAttachmentReplacePage=!1,this._set("selectedAttachmentAddElementId",e),null!=e&&(this.selectedAttachment=null,this.selectedAttachmentListElementId=null)}get selectedAttachmentListElementId(){return this._get("selectedAttachmentListElementId")??null}set selectedAttachmentListElementId(e){this._set("selectedAttachmentListElementId",e),null!=e&&(this.selectedAttachment=null,this.selectedAttachmentAddElementId=null)}get selectedAttachmentListInput(){const e=this.selectedAttachmentListElementId,t=this.activeForm;if(!e||!t)return null;const s=t.allAttachmentElementInputs.find(t=>t.template.elementId===e)||null;return s?.attachments.length?s:null}get showingSelectedAttachmentReplacePage(){return this._get("showingSelectedAttachmentReplacePage")??!1}set showingSelectedAttachmentReplacePage(e){this._set("showingSelectedAttachmentReplacePage",e&&null!=this.selectedAttachmentDetails)}get selectedAttachmentAddInput(){const e=this.selectedAttachmentAddElementId,t=this.activeForm;return e&&t&&t.allAttachmentElementInputs.find(t=>t.template.elementId===e)||null}get selectedAttachmentDetails(){const e=this.selectedAttachment,t=this.activeForm;if(!e||!t)return null;const s=t.allAttachmentElementInputs.find(t=>t.template.elementId===e.elementId);if(!s)return null;const a=s.attachments.findIndex(t=>V(t)===e.attachmentKey);if(-1===a)return null;return{attachment:s.attachments[a],input:s}}get _allAttachmentInputs(){const e=[...this.sharedForm.allAttachmentElementInputs];for(const t of this._featureFormMap.values())e.push(...t.allAttachmentElementInputs);return e}get _hasPendingAttachmentHydration(){return this._allAttachmentInputs.some(e=>e.hasPendingAttachmentUpdateData)}get _layersSet(){const e=new Set;for(const t of this._workingFeatures){const s=E(t.plainGraphic);s&&e.add(s)}return e}applyStashedAttachmentEdits(e){const t=this._allAttachmentInputs;for(const s of e){const e=t.find(e=>e.label===s.label&&e.attachmentKeyword===s.keywords);e&&e.applyStashedEdits(s)}}findFieldInput(e){if(null==e)return;const t=this._activeFormInputsByElementId;if(t.has(e))return t.get(e);const s=this.activeForm.allFieldInputs.find(t=>t.template.elementId===e);return void 0!==s?(t.set(e,s),s):void 0}getFirstVisibleInvalidFieldInput(){if(this.hasVisibleInputs&&!this.activeForm.valid)for(const e of this.visibleInputs){if(K(e)){const t=e.inputs.find(e=>z(e)&&!e.valid);if(t)return{input:t,groupInput:e}}if(z(e)&&!e.valid)return{input:e}}}getFieldInputValue(e){return this.findFieldInput(e)?.value}getValues(e){const t=this._reactiveGraphicLookup.get(e);if(!t)throw new i("feature-not-found","The given feature is not present in the BatchAttributeForm");return{...t.attributes}}async goBack(){switch(this.page){case"replacing-attachment":return void this.setShowingSelectedAttachmentReplacePage(!1);case"viewing-attachment-details":return void this.setSelectedAttachment(null);case"adding-attachments":return void this.setSelectedAttachmentAddElementId(null);case"viewing-attachments":return void this.setSelectedAttachmentListElementId(null);case"viewing-associated-features":return void this.setActiveAssociationsLayer(null);case"viewing-associated-layers":return void this.setActiveAssociationsInput(null);case"viewing-related-categories":case"viewing-related-records":return void this.clearActiveRelationshipCategoryOrInput();default:return}}async goHome(){this.setShowingSelectedAttachmentReplacePage(!1),this.setSelectedAttachment(null),this.setSelectedAttachmentAddElementId(null),this.setSelectedAttachmentListElementId(null),this.setActiveAssociationsLayer(null),this.setActiveAssociationsInput(null),this.clearAllRelationshipSettings()}notifyGeometriesChanged(e){const t=[];for(const s of e){const e=this._reactiveGraphicLookup.get(s);e&&(t.push(e),e.geometry=s.geometry)}this._updatingHandles.consumePromise(this._valueChangeTransaction(async e=>this._expressionsManager.runGeometryDependentExpressions(t,e),"user"))}async overrideOriginalFeature(e,t){await(this._prepareTask?.promise);const s=this._reactiveGraphicLookup.get(e);s&&(s.original=t,this._updatingHandles.consumePromise(this._valueChangeTransaction(e=>this._expressionsManager.runOriginalFeatureDependentExpressions(s,e),"expression")))}async setFieldInputValue(e,t){const{fieldName:s}=e;await this._updatingHandles.addPromise(this._valueChangeTransaction(async a=>{for(const i of e.features)a.setValue(i,s,t)},"user",e))}async setFieldInputValuePerFeature(e,t){await this._updatingHandles.addPromise(this._valueChangeTransaction(async s=>{for(const[a,i]of t)s.setValue(a,e.fieldName,i);s.hasChanges&&(e.userHasChangedValue=!0)},"user",e))}async setValueForFieldName(e,t,s){await this._updatingHandles.addPromise(this._valueChangeTransaction(async a=>{for(const i of s){const s=this._reactiveGraphicLookup.get(i);s&&a.setValue(s,e,t)}},"user",e))}async setValuePerFeatureForFieldName(e,t){await this._updatingHandles.addPromise(this._valueChangeTransaction(async s=>{for(const[a,i]of t){const t=this._reactiveGraphicLookup.get(a);t&&s.setValue(t,e,i)}},"user",e))}async setFieldValue(e,t){const s=this.activeForm.allFieldInputs.find(t=>t.fieldName===e);if(null==s)throw new i("no-field-input-found",`Cannot set the value of FieldInput with field name: ${e} because none was found in the active form`);await this.setFieldInputValue(s,t)}async setValue(e,t){const s=this.findFieldInput(e);if(null==s)throw new i("no-FieldInput-found",`Cannot set the value of FieldInput with ID: ${e} because none was found in the active form`);await this.setFieldInputValue(s,t)}async applySubtypeDefaults(e){const{defaultValues:t}=e,{allFieldInputs:s}=this.activeForm;await this._updatingHandles.addPromise(this._valueChangeTransaction(async e=>{for(const a of s){const{fieldName:s}=a,i=t[s];if(null!=i)for(const t of a.features)e.setValue(t,s,i)}},"user"))}async handleSubtypeChanged(e){const t=this._workingFeatures.at(e);if(t)return this._updatingHandles.addPromise(this._handleSubtypeChanged(t))}async stageAddAttachments(e,t){if(0===t.length)return[];const s=this._findAttachmentInput(e);if(!s)return[];const a=await this._updatingHandles.addPromise(s.stageAddAttachments(t,this._expressionsManager.arcadeContext));return 0===a.length||(this.userHasChangedValues=!0,this._emitAttachmentsChange(s)),a}stageDeleteAttachment(e,t){const s=this._findAttachmentInput(e);if(!s)return;const a=this._findAttachment(s,t);a&&(s.stageDeleteAttachment(a),this.userHasChangedValues=!0,this._emitAttachmentsChange(s))}async stageRenameAttachment(e,t,s){const a=this._findAttachmentInput(e);if(!a)return;const i=this._findAttachment(a,t);i&&(a.stageRenameAttachment(i,s.trim()),this.userHasChangedValues=!0,await a.ensureStagedUpdateData(i),this._emitAttachmentsChange(a))}async stageReplaceAttachment(e,t,s){const a=this._findAttachmentInput(e);if(!a)return!1;const i=this._findAttachment(a,t);if(!i)return!1;return!!await this._updatingHandles.addPromise(a.stageReplaceAttachment(i,s,this._expressionsManager.arcadeContext))&&(this.userHasChangedValues=!0,this._emitAttachmentsChange(a),!0)}clearAttachmentChanges(e){const t=this._findAttachmentInput(e);t&&(t.clearAttachmentChanges(),this._emitAttachmentsChange(t))}setActiveAssociation(e){this._activeAssociation=e}setActiveAssociationsInput(e){this._activeAssociationsInput=e}setActiveAssociationsLayer(e){this._activeAssociationsInput?.setAssociatedLayer(e)}setActiveAssociationType(e){this._activeAssociationsInput?.setActiveAssociationType(e)}setActiveRelationshipInput(e){e||this._activeRelationshipInput?.setActiveCategory(null),this._activeRelationshipInput=e}setActiveRelationshipCategory(e,t){t.setActiveCategory(e),this.setActiveRelationshipInput(t)}clearAllRelationshipSettings(){const e=this.activeRelationshipInput;e&&(e.setActiveCategory(null),e.setShowAllCategories(!1),e.setShowAllRelatedRecords(!1),this._activeRelationshipInput=null)}clearActiveRelationshipCategoryOrInput(){const e=this.activeRelationshipInput;e&&(e.showAllRelatedRecords?e.showAllCategories?e.setActiveCategory(null):this.setActiveRelationshipInput(null):e.showAllCategories&&(e.setShowAllCategories(!1),this.setActiveRelationshipInput(null)))}resetAttachmentChanges(e,t){const s=this._findAttachmentInput(e);if(!s||!s.editable)return;const a=this._findAttachment(s,t);a&&(s.discardStagedEdits(a),this._emitAttachmentsChange(s))}setSelectedAttachment(e){this.selectedAttachment=e??null}setShowingSelectedAttachmentReplacePage(e){this.showingSelectedAttachmentReplacePage=e}setSelectedAttachmentAddElementId(e){this.selectedAttachmentAddElementId=e??null}setSelectedAttachmentListElementId(e){this.selectedAttachmentListElementId=e??null}userChangesHaveMadeFeatureInvalid(e){return!!this._reactiveGraphicLookup.get(e)?.userChangesHaveMadeInvalid}validate(){return!1}validateContingentValues(e,t=!1){if(t&&!this.submitHasBeenAttempted)for(const s of e)this._reactiveContingentValuesManager.validateContingenciesForNonNullFields(s);else for(const s of e)this._reactiveContingentValuesManager.validateContingencyConstraints(s,{includeIncompleteViolations:!0})}_makeBatchFormInputsForFeature(e){const t=this._layerTemplateMap.get(e.layer);return t?W(t,{allFeatures:new a([e]),expressionsManager:this._expressionsManager,getExternalErrorForFeature:this._getExternalErrorForFeature,getFieldValueOptionsForFeature:this._getFieldValueOptionsForFeature,map:this.map}):this._emptyForm}async _ensureLayerTemplate(e,t){const{_layersSet:s,contingentValuesManager:a}=this,i=e.layer;let n=!1;for(const r of this._layerTemplateMap.keys())s.has(r)||(this._layerTemplateMap.delete(r),this._expressionsManager.layerExpressionsModelMap.delete(r),a.resetOptionsForLayer(r),ee(r)&&a.resetViolationsForLayer(r),n=!0);this._layerTemplateMap.has(i)||(await this._prepareLayer(i,t),c(t),a.layers.add(i),n=!0),n&&(this._prepareSharedFormTemplate(),$(this.sharedForm,this.sharedFormTemplate,{allFeatures:this._workingFeatures,expressionsManager:this._expressionsManager,getFieldValueOptionsForFeature:this._getFieldValueOptionsForFeature,map:this.map}),this._recomputeHasAsyncArcadeExpressions(),await A(()=>!a.updating,t))}_recomputeHasAsyncArcadeExpressions(){this._hasAsyncArcadeExpressions=!1;for(const e of this._expressionsManager.layerExpressionsModelMap.values())for(const t of e.arcadeExecutorUses.keys())if(t.isAsync)return void(this._hasAsyncArcadeExpressions=!0)}_computeFormHeaderField(e){const{activeFeature:t,activeLayer:s}=this;return e&&s&&t?O({attributes:t?.attributes,label:e,layer:s,timeZone:this.effectiveTimeZone}):null}_makeSubmitResults(){const e=new Map;for(const[s,a]of this._reactiveGraphicLookup){const i=[],n=[],r=this._featureFormMap.get(a)?.allAttachmentElementInputs??[];for(const e of r)t(i,e.toSubmitEdits()),e.valid||n.push(e.template.elementId);e.set(s,{feature:s,values:{...a.attributes},invalidFields:[],attachmentEdits:i,invalidAttachmentElementIds:n})}for(const t of this.sharedForm.allFieldInputs)for(const s of t.invalidFeatures)e.get(s)?.invalidFields.push(t.fieldName);return Array.from(e.values())}async _handleSubtypeChanged(e){const t=e.layer;if(this.contingentValuesManager.resetOptionsForFeature(t,e.plainGraphic),ee(t)&&this.contingentValuesManager.resetViolationsForFeature(t,e.plainGraphic),!T(t))return;const a=t.parent?.findSublayerForFeature(e.plainGraphic);if(!a)return;this._layerTemplateUpdateTask=h(this._layerTemplateUpdateTask);const i=s(async t=>{c(t),e.source.sourceLayer=a,e.source.origin=a.graphicOrigin,await this._ensureLayerTemplate(e,t),c(t),this._featureFormMap.get(e)?.destroy(),this._featureFormMap.set(e,this._makeBatchFormInputsForFeature(e)),await p(this._valueChangeTransaction(t=>this._expressionsManager.runAllExpressions([e],t),"user"),t),c(t)});this._layerTemplateUpdateTask=i,await u(this._updatingHandles.addPromise(i.promise))}_emitSubmit(){this.emit("submit",{name:"submit",results:this._makeSubmitResults(),valid:this.valid})}_findAttachmentInput(e){const t=this.activeForm.allAttachmentElementInputs.find(t=>t.template.elementId===e);return t||r.getLogger(this).error(`Attachment input not found for elementId '${e}'`),t}_findAttachment(e,t){const s=e.findAttachment(t);return s||r.getLogger(this).error(`Attachment '${t}' not found for attachment element '${e.template.elementId}'`),s}_makeAttachmentEdits(e){const s=[];for(const a of e.allAttachmentElementInputs)t(s,a.toSubmitEdits());return s}_emitAttachmentsChange(e){const t=e.single.feature;if(!t)return;const s=this._featureFormMap.get(t);this.emit("attachments-change",{name:"attachments-change",feature:t.source,attachmentEdits:this._makeAttachmentEdits(s??this.activeForm),valid:this.valid})}async _valueChangeTransaction(e,t,s){const a=new G(this,t,"string"==typeof s?s:s?.fieldName);if(await e(a),"user"===t&&await this._expressionsManager.runExpressionsDependentOnChangedFields(a),await a.close(),a.hasChanges&&s){const e="string"==typeof s?this.activeForm.allFieldInputs.find(e=>e.fieldName===s):s;e&&(e.userHasChangedValue=!0)}}_prepare(){this.pendingSubtypeChoice?.reject(),this._hasAsyncArcadeExpressions=!1,this._prepareTask=h(this._prepareTask),this._layerTemplateUpdateTask=h(this._layerTemplateUpdateTask),this._layerTemplateMap.clear(),this._updateWorkingFeatures(),l(this._expressionsManager),this.userHasChangedValues=!1,this._expressionsManager=new D({arcadeContext:{editType:this.editType,spatialReference:this.spatialReference??x.WebMercator,map:this.map,timeZone:this.timeZone||"system"}});const{layers:e}=this;if(0===e.length)return;const t=s(async t=>{try{c(t),this._updateWorkingFeatures(),this.contingentValuesManager.layers.addMany(e),await Promise.all(e.map(e=>e.load()));for(const s of e)await this._prepareLayer(s,t);if(this.hasTooManyComplexFeatures)throw new i("too-many-features-with-complex-forms","There are too many features to load into the form with the configured complexity");if(this.hasTooManyFeatures)throw new i("too-many-features","There are too many features to load into the form.");this._prepareSharedFormTemplate(),this.sharedForm=W(this.sharedFormTemplate,{allFeatures:this._workingFeatures,expressionsManager:this._expressionsManager,getExternalErrorForFeature:this._getExternalErrorForFeature,getFieldValueOptionsForFeature:this._getFieldValueOptionsForFeature,map:this.map}),await this._valueChangeTransaction(async e=>await this._expressionsManager.runAllExpressions(this._workingFeatures.toArray(),e),"expression"),await A(()=>!this.contingentValuesManager.updating)}catch(s){throw m(s)||r.getLogger(this).error("Failed preparing form",s),s}});this._updatingHandles.consumePromise(t.promise),this._prepareTask=t}async _prepareLayer(e,t){const s=se(this.layerInfos,e),a=await J(e,{arcadeExecutorProvider:this._arcadeExecutorProvider,formTimeZone:this.timeZone,attachmentsEnabled:this.attachmentsEnabled},s?.formTemplate);c(t),this._layerTemplateMap.set(e,a);const i=a.getExpressionExecutorsForLayer(e);if(this._expressionsManager.layerExpressionsModelMap.set(e,new N({preserveFieldValuesWhenHidden:a.preserveFieldValuesWhenHidden,executorMap:i,fieldsIndex:e.fieldsIndex})),!this._hasAsyncArcadeExpressions)for(const n of i.values())if(n&&(this._hasAsyncArcadeExpressions=!0===(n.editableExpression?.isAsync||n.requiredExpression?.isAsync||n.valueExpression?.isAsync||n.visibilityExpression?.isAsync),this._hasAsyncArcadeExpressions))break}_prepareSharedFormTemplate(){const e=new Map;for(const t of this._layerTemplateMap.values())for(const s of t.elements){if(Q(s))continue;const t=s.clone();X(t)&&(t.elements=t.elements.filter(e=>!Q(e)));const{elementId:a}=t;e.has(a)?e.get(a).foldIn(t):e.set(a,t)}this.sharedFormTemplate=new q({elements:Array.from(e.values())})}_updateWorkingFeatures(){this._workingFeatures.destroyAll(),this._reactiveContingentValuesManager.reset();for(const t of this._featureFormMap.values())t.destroy();this._featureFormMap.clear(),this._attachmentCache.clear();const{features:e}=this;if(this._reactiveGraphicLookup=new d,0!==e.length){this._workingFeatures.addMany(e.map(R));for(const e of this._workingFeatures)this._reactiveGraphicLookup.set(e.source,e)}}async _syncAttachments(){const{activeFeature:e,activeLayer:t,activeForm:a}=this;if(!(e&&a&&H(t)&&P(t)))return;const i=e.getObjectId();if(null==i)return;const n=this._attachmentCache.get(t),r=a.allAttachmentElementInputs;if(!r.length)return;const l=s(async e=>{let s;if(n){const e=n.get(i);e&&(s=e)}if(!s){s=await j(t,i,r,e);o(this._attachmentCache,t,()=>new d).set(i,s)}for(const t of r)t.applyFetchedAttachments(oe(t,s))});this._syncAttachmentsTask=l,await u(l.promise)}get test(){return{expressionsManager:this._expressionsManager,reactiveGraphicLookup:this._reactiveGraphicLookup,syncAttachmentsTask:this._syncAttachmentsTask}}};e([F()],ae.prototype,"_attachmentCache",void 0),e([F({readOnly:!0})],ae.prototype,"activeFeature",null),e([F()],ae.prototype,"activeFeatureIndex",void 0),e([F({readOnly:!0})],ae.prototype,"activeForm",null),e([F({readOnly:!0})],ae.prototype,"activeLayer",null),e([F()],ae.prototype,"activeAssociation",null),e([F()],ae.prototype,"activeAssociationsInput",null),e([F()],ae.prototype,"activeAssociationType",null),e([F()],ae.prototype,"activeRelationshipInput",null),e([F()],ae.prototype,"attachmentsEnabled",void 0),e([F()],ae.prototype,"callbacks",void 0),e([F()],ae.prototype,"disabled",void 0),e([F()],ae.prototype,"calculating",null),e([F()],ae.prototype,"canGoBack",null),e([F()],ae.prototype,"contingentValuesManager",void 0),e([F()],ae.prototype,"editType",void 0),e([F()],ae.prototype,"features",void 0),e([F()],ae.prototype,"expressionEvaluationFailed",null),e([F()],ae.prototype,"hasNonActiveInvalidFeatures",null),e([F()],ae.prototype,"hasAsyncArcadeExpressions",null),e([F()],ae.prototype,"_hasAsyncArcadeExpressions",void 0),e([F()],ae.prototype,"invalidFeatures",null),e([F()],ae.prototype,"hasVisibleInputs",null),e([F()],ae.prototype,"hasLayersWithContingentValues",null),e([F()],ae.prototype,"formDescription",null),e([F()],ae.prototype,"formTitle",null),e([F()],ae.prototype,"effectiveTimeZone",null),e([F()],ae.prototype,"highlightHelper",void 0),e([F()],ae.prototype,"maximumFeatureCount",void 0),e([F()],ae.prototype,"maximumFeatureCountWithComplexForms",void 0),e([F()],ae.prototype,"visibleInputs",null),e([F()],ae.prototype,"map",null),e([F()],ae.prototype,"noVisibleElementsReason",null),e([F()],ae.prototype,"page",null),e([F()],ae.prototype,"pageStack",void 0),e([F()],ae.prototype,"readOnly",void 0),e([F()],ae.prototype,"pendingSubtypeChoice",void 0),e([F()],ae.prototype,"subtypes",null),e([F()],ae.prototype,"spatialReference",void 0),e([F()],ae.prototype,"submitHasBeenAttempted",void 0),e([F()],ae.prototype,"timeZone",null),e([F()],ae.prototype,"view",void 0),e([F()],ae.prototype,"updating",null),e([F()],ae.prototype,"valid",null),e([F()],ae.prototype,"layers",null),e([F()],ae.prototype,"mode",null),e([F()],ae.prototype,"sharedForm",void 0),e([F()],ae.prototype,"sharedFormTemplate",void 0),e([F()],ae.prototype,"selectedAttachment",null),e([F()],ae.prototype,"selectedAttachmentAddElementId",null),e([F()],ae.prototype,"selectedAttachmentListElementId",null),e([F()],ae.prototype,"selectedAttachmentListInput",null),e([F()],ae.prototype,"showingSelectedAttachmentReplacePage",null),e([F()],ae.prototype,"selectedAttachmentAddInput",null),e([F()],ae.prototype,"selectedAttachmentDetails",null),e([F()],ae.prototype,"userHasChangedValues",void 0),e([F()],ae.prototype,"layerInfos",void 0),e([F()],ae.prototype,"_arcadeExecutorProvider",void 0),e([F()],ae.prototype,"_activeAssociation",void 0),e([F()],ae.prototype,"_activeAssociationsInput",void 0),e([F()],ae.prototype,"_activeRelationshipInput",void 0),e([F()],ae.prototype,"_prepareTask",void 0),e([F()],ae.prototype,"_reactiveGraphicLookup",void 0),e([F()],ae.prototype,"_allAttachmentInputs",null),e([F()],ae.prototype,"_hasPendingAttachmentHydration",null),e([F()],ae.prototype,"_layerTemplateMap",void 0),e([F()],ae.prototype,"_layersSet",null),e([F()],ae.prototype,"_workingFeatures",void 0),e([F()],ae.prototype,"_expressionsManager",void 0),ae=e([I("esri.widgets.BatchAttributeForm.BatchAttributeFormViewModel")],ae);const ie=ae;function ne(e){return null!=e&&e.trim().length>0}function re(e,t){const s=e.keywords;return ne(s)&&s.toLowerCase()===t}function oe(e,t){const s="attachment"===e.input?.type?e.input.attachmentAssociationType:"exact",a=e.attachmentKeyword;if("any"===s)return t;if("exactOrNone"===s){if(te(a))return t.filter(e=>!ne(e.keywords));const e=a.toLowerCase();return t.filter(t=>!ne(t.keywords)||re(t,e))}if(te(a))return t;const i=a.toLowerCase();return t.filter(e=>re(e,i))}export{ie as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{substitute as e}from"../../intl.js";import{equalsShallow as t}from"../../core/lang.js";import{throwIfAborted as i}from"../../core/promiseUtils.js";import{isLayerWithHistoricMoment as n}from"../../layers/mixins/EditBusLayer.js";import{DomainValidationError as r}from"../../layers/support/domainUtils.js";import{NumericRangeValidationError as o,TypeValidationError as s}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as a,getSubtypesFromLayer as u}from"../../layers/support/layerUtils.js";import l from"../../rest/support/AttachmentQuery.js";import{unknown as c,utc as d}from"../../time/constants.js";import{ReactiveGraphic as
|
|
2
|
+
import{substitute as e}from"../../intl.js";import{equalsShallow as t}from"../../core/lang.js";import{throwIfAborted as i}from"../../core/promiseUtils.js";import{isLayerWithHistoricMoment as n}from"../../layers/mixins/EditBusLayer.js";import{DomainValidationError as r}from"../../layers/support/domainUtils.js";import{NumericRangeValidationError as o,TypeValidationError as s}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as a,getSubtypesFromLayer as u}from"../../layers/support/layerUtils.js";import l from"../../rest/support/AttachmentQuery.js";import{unknown as c,utc as d}from"../../time/constants.js";import{ReactiveGraphic as f}from"./ReactiveGraphic.js";import{isMultipleChoiceFieldInput as p,isGroupInput as m}from"./inputs/support/inputUtils.js";import{getIntlOptionsForField as y}from"../support/dateUtils.js";import{isEmptyValue as b,InputValidationError as h,getRangeErrorMessage as O,shouldUseScientificNotation as E,scientificNumberFormatOptions as T,numberFormatOptions as _,ContingentValuesValidationError as v}from"../support/forms/formUtils.js";const I=(e,t)=>null!=e&&e.input?.type===t;function j(e){return new f({source:e})}function C(t,i,n,a){const{dataType:u,minLength:l}=t;if(!n||!i)return null;const{validationErrors:c}=n;if("batch-attribute-form-validation::features-have-different-errors"===i)return c.invalidBatchFormType;if(i===h.CANNOT_BE_EMPTY)return c.cannotBeNull;if(i===r.VALUE_OUT_OF_RANGE||i===o.OUT_OF_RANGE){const{field:i,range:n}=t,r={type:"date",intlOptions:{timeZone:"date"===i.type&&a?a:void 0,...y(i)}},o=O(n,c);return e(o,n,{format:{max:"date"===u?r:null!=n.max&&E(n.max)?T:_,min:"date"===u?r:null!=n.min&&E(n.min)?T:_}})}if(i===r.INVALID_CODED_VALUE)return c.invalidCodedValue;if(i===s.INVALID_TYPE)return c.invalidType;if(i===h.TOO_SHORT)return e(c.tooShort,{min:l});if(p(t)){if(i===h.TOO_FEW_SELECTED_CHOICES)return e(c.tooFewSelectedChoices,{min:t.input.minimumChoices});if(i===h.TOO_MANY_SELECTED_CHOICES)return e(c.tooManySelectedChoices,{max:t.input.maximumChoices})}return i===h.TOO_LONG?null:i===v.CONTINGENCY_VIOLATION_WARNING||i===v.CONTINGENCY_VIOLATION_ERROR?c.valuesIncompatible:"batch-attribute-form-validation::out-of-subtype-domain"===i?n.subtypes.fieldOutOfSubtypeDomainWarning:null}function N(e,t,i){const n=i?.validationErrors;if(!n)return null;let r=null;for(const o of e.invalidHiddenInputs)switch(o.effectiveVisibilityCode){case"hidden:visibility-expression:all-features":case"hidden:group-visibility-expression:all-features":case"hidden:field-definition":return"single"===t?n.nonVisibleError_changeValues:n.nonVisibleError_checkIndividualFeatures;case"hidden:no-domain-in-common":case"hidden:visibility-expression:some-features":case"hidden:group-visibility-expression:some-features":case"hidden:not-in-all-layers":r=n.nonVisibleError_checkIndividualFeatures;break;case"visible":continue;default:o.effectiveVisibilityCode}return r}function A(e){return null!=e&&"object"==typeof e&&"type"in e&&("feature"===e.type||"geojson"===e.type||"knowledge-graph-sublayer"===e.type||"oriented-imagery"===e.type||"scene"===e.type||"subtype-sublayer"===e.type)}function V(e){return!!A(e)||!!(null!=e&&"object"==typeof e&&"type"in e&&e.type&&"id"in e&&e.id&&"fields"in e&&e.fields&&"fieldsIndex"in e&&e.fieldsIndex&&"objectIdField"in e&&e.objectIdField&&"capabilities"in e&&"getField"in e&&e.getField)}function g(e){return V(e)&&"queryAttachments"in e}function x(e){return null!=e&&"object"==typeof e&&"type"in e&&("feature"===e.type||"subtype-sublayer"===e.type)}function U(e){if(!g(e))return!1;const t=e?.effectiveCapabilities??e?.capabilities;return!!t?.data?.supportsAttachment}async function w(e,t,r,o){const s=new Set;let u=!1;for(const i of r){if("attachment"===i.input?.type&&("any"===i.input.attachmentAssociationType||"exactOrNone"===i.input.attachmentAssociationType)){u=!0;break}if(b(i.attachmentKeyword)){u=!0;break}s.add(i.attachmentKeyword)}const c=s.size&&!u?Array.from(s):void 0,d=new l({objectIds:[t],returnMetadata:!0,keywords:c}),f=a(e)?e.parent:e;n(f)&&f.historicMoment&&(d.historicMoment=f.historicMoment);const p=await e.queryAttachments(d,{signal:o});return i(o),p[t]??[]}function F(e,i,n){const r=u(e),o=r?.find(e=>e.code===n);if(!o)return!1;const s=r?.find(e=>e.code===i);return!t(o.defaultValues,s?.defaultValues)&&Object.values(o.defaultValues).some(e=>null!=e)}function L(e){return e.reduce((e,t)=>m(t)?[...e,...t.inputs]:[...e,t],[])}function S(e){return a(e)&&e.parent&&(e=e.parent),e&&"datesInUnknownTimezone"in e&&e.datesInUnknownTimezone?c:e&&"preferredTimeZone"in e&&e.preferredTimeZone?e.preferredTimeZone:null}function k(e,t){return e||t?t===c?d:e&&e!==c?e:t??"system":"system"}export{j as createReactiveGraphic,L as flattenInputs,k as getEffectiveTimeZone,N as getHiddenFieldsValidationErrorMessage,S as getLayerTimeZone,C as getMessageString,x as isAssociationsLayerUnion,V as isAttributeFormSupportedLayer,A as isAttributeFormSupportedLayerUnion,g as isAttributeFormSupportedLayerWithAttachments,I as isElementTemplateWithInputType,U as layerSupportsAttachments,w as queryAttachmentsForElements,F as subtypeChangeShouldPrompt};
|
|
@@ -79,6 +79,14 @@ export default class AttachmentElementInput extends EditableInput<any> {
|
|
|
79
79
|
get maxAttachmentCount(): number | null | undefined;
|
|
80
80
|
/** The minimum number of attachments required. */
|
|
81
81
|
get minAttachmentCount(): number | null | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Indicates whether the field input representing this field has been
|
|
84
|
+
* interacted with by the user.
|
|
85
|
+
*
|
|
86
|
+
* @default false
|
|
87
|
+
* @since 5.2
|
|
88
|
+
*/
|
|
89
|
+
get touched(): boolean;
|
|
82
90
|
/** The type of input. */
|
|
83
91
|
get type(): "attachment";
|
|
84
92
|
/** Indicates if the original filename should be used when creating attachments. */
|
|
@@ -173,6 +181,12 @@ export default class AttachmentElementInput extends EditableInput<any> {
|
|
|
173
181
|
stageReplaceAttachment(attachment: AttachmentInfo, file: Blob | File, arcadeContextInfo: ArcadeBatchFormCalculationContextInfo): Promise<boolean>;
|
|
174
182
|
/** @internal */
|
|
175
183
|
toSubmitEdits(): PendingAttachmentEdits | null;
|
|
184
|
+
/**
|
|
185
|
+
* Marks the field input as touched, indicating that the user has interacted with it.
|
|
186
|
+
*
|
|
187
|
+
* @since 5.2
|
|
188
|
+
*/
|
|
189
|
+
touch(): void;
|
|
176
190
|
/** @internal */
|
|
177
191
|
waitForPendingAttachmentUpdateData(): Promise<void>;
|
|
178
192
|
}
|