@arcgis/core 5.2.0-next.90 → 5.2.0-next.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/arcgisGlobal.d.ts +1 -0
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/24a6b28db94e07a702a4.js +1 -0
  4. package/assets/esri/core/workers/chunks/9246e2468528650bdc7c.js +1 -0
  5. package/assets/esri/core/workers/chunks/9509bef285929c52c244.js +1 -0
  6. package/assets/esri/core/workers/chunks/ad404195107eadf91e16.js +1 -0
  7. package/config.js +1 -1
  8. package/core/has.js +1 -1
  9. package/kernel.js +1 -1
  10. package/layers/ImageryTileLayer.d.ts +20 -20
  11. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  12. package/layers/MapImageLayer.d.ts +20 -21
  13. package/layers/catalog/CatalogFootprintLayer.d.ts +1 -1
  14. package/layers/mixins/FeatureLayerBase.d.ts +20 -21
  15. package/layers/support/DateTimeFieldFormat.d.ts +1 -1
  16. package/layers/support/FieldConfiguration.d.ts +1 -1
  17. package/package.json +4 -4
  18. package/popup/FeatureContent.d.ts +3 -3
  19. package/popup/FeatureContentCollection.d.ts +3 -3
  20. package/popup/FieldInfo.d.ts +18 -12
  21. package/popup/support/FieldInfoFormat.d.ts +13 -8
  22. package/portal/Portal.js +1 -1
  23. package/support/revision.js +1 -1
  24. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  25. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  26. package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
  27. package/views/3d/layers/graphics/Labeler.js +1 -1
  28. package/views/3d/webgl-engine/effects/RenderNodes.js +1 -1
  29. package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
  30. package/views/3d/webgl-engine/effects/raymarching/DistanceFalloff.glsl.js +2 -2
  31. package/views/3d/webgl-engine/lib/EmissionComposite.js +1 -1
  32. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  33. package/views/SceneView.d.ts +64 -1
  34. package/views/SceneView.js +1 -1
  35. package/views/View2D.d.ts +17 -4
  36. package/views/support/LayerLayerViewInfo.js +1 -1
  37. package/views/support/LayerViewManager.js +1 -1
  38. package/webmap/InitialViewProperties.d.ts +1 -1
  39. package/webscene/SunLighting.d.ts +3 -1
  40. package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
  41. package/widgets/BatchAttributeForm/expressions/ExpressionsModel.js +1 -1
  42. package/widgets/BatchAttributeForm/inputs/EditableInput.js +1 -1
  43. package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +4 -4
  44. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  45. package/widgets/BatchAttributeForm/inputs/GroupInput.js +1 -1
  46. package/widgets/BatchAttributeForm/inputs/InputBase.js +1 -1
  47. package/widgets/BatchAttributeForm/inputs/TextElementInput.js +1 -1
  48. package/widgets/BatchAttributeForm/inputs/support/DynamicChoiceController.d.ts +12 -0
  49. package/widgets/BatchAttributeForm/inputs/support/DynamicChoiceController.js +2 -0
  50. package/widgets/BatchAttributeForm/inputs/support/controllerUtils.d.ts +5 -0
  51. package/widgets/BatchAttributeForm/inputs/support/controllerUtils.js +2 -0
  52. package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
  53. package/widgets/BatchAttributeForm.js +1 -1
  54. package/widgets/Daylight.d.ts +4 -0
  55. package/widgets/Editor.d.ts +1 -1
  56. package/widgets/Feature/FeatureViewModel.d.ts +3 -3
  57. package/widgets/Feature.d.ts +3 -3
  58. package/widgets/FeatureTable/FeatureTableViewModel.d.ts +3 -3
  59. package/widgets/FeatureTable/support/ColumnTemplateBase.d.ts +1 -0
  60. package/widgets/FeatureTable.d.ts +1 -1
  61. package/widgets/Features/FeaturesViewModel.d.ts +3 -3
  62. package/widgets/Features.d.ts +2 -2
  63. package/widgets/TimeSlider.d.ts +3 -3
  64. package/assets/esri/core/workers/chunks/05fbd1f373cfa3724f0c.js +0 -1
  65. package/assets/esri/core/workers/chunks/27c0bed59626c7f64125.js +0 -1
  66. package/assets/esri/core/workers/chunks/41cf6163758d28fb1968.js +0 -1
  67. package/assets/esri/core/workers/chunks/e55507e4114b34d1ef4e.js +0 -1
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import r from"../../core/Accessor.js";import i from"../../core/Error.js";import t from"../../core/Logger.js";import{someMap as s}from"../../core/MapUtils.js";import{createAbortError as o,isAbortError as a}from"../../core/promiseUtils.js";import{on as n,watch as l,syncAndInitial as h}from"../../core/reactiveUtils.js";import{schedule as y}from"../../core/scheduling.js";import{property as c,subclass as p}from"../../core/accessorSupport/decorators.js";import{get as d}from"../../core/accessorSupport/get.js";import{UpdatingHandles as w}from"../../core/support/UpdatingHandles.js";import{destroyMap as f}from"../../support/collectionUtils.js";import{LayerLayerViewInfo as g}from"./LayerLayerViewInfo.js";function u(e){return null!=e&&"object"==typeof e&&"layerViews"in e}let m=class extends r{constructor(e){super(e),this._layerLayerViewInfoMap=new Map,this._recyclingInfoMap=new Map,this._watchUpdatingTracking=new w,this._preloadLayerViewModules=()=>{const e=this.view.map?.allLayers;if(e)for(const r of e)!1!==this.layerViewFilter?.(r)&&this.layerViewImporter.hasLayerViewModule(r)&&this.layerViewImporter.importLayerView(r)},this._reschedule=()=>this.destroyed?Promise.reject():(null==this._workPromise&&(this._workPromise=Promise.withResolvers(),this._workPromise.promise.catch(()=>{})),this.removeHandles("reschedule"),this.addHandles(y(this._doWork),"reschedule"),this._workPromise.promise),this._doWork=()=>{if(this.destroyed)return;const{map:e}=this.view;if(!e)return void this.clear();if(this._map!==e&&(this.clear(),this._map=e),null==this._workPromise)return void this.notifyChange("updating");this.removeHandles("reschedule"),this.removeHandles("collection-change");const r=new Set,i=[],t=this.view.ready,s=e=>{if(null!=e)for(const o of e)if(o){if(!1===this.layerViewFilter?.(o))continue;r.add(o);const e=this._layerLayerViewInfoMap.get(o);e&&t?e.start():e||this._recyclingInfoMap.has(o)||i.push(o),"layers"in o&&o.layers&&s(o.layers)}};for(const a of this._rootCollectionNames)s(d(this,a));const o=new Array,n=e=>{const r=e.tryRecycle(i);if(r){const i=e.layer;this._recyclingInfoMap.set(i,e),this._watchUpdatingTracking.consumePromise(r),this.notifyChange("updating"),r.then(()=>{this._recyclingInfoMap.get(i)===e&&e.promise===r&&(this._recyclingInfoMap.delete(i),this._layerLayerViewInfoMap.set(i,e),this._reschedule(),this.notifyChange("updating"),this.notifyChange("allLayerViews"))}).catch(t=>{this._recyclingInfoMap.get(i)!==e||e.promise!==r||a(t)||(this._recyclingInfoMap.delete(i),e.destroy(),this._reschedule(),this.notifyChange("updating"),this.notifyChange("allLayerViews"))})}else o.push(e)};for(const a of this._layerLayerViewInfoMap.values())r.has(a.layer)||(this._layerLayerViewInfoMap.delete(a.layer),n(a));for(const a of this._recyclingInfoMap.values())r.has(a.layer)||(this._recyclingInfoMap.delete(a.layer),n(a));for(const a of i)this._createLayerView(a);this._refreshCollections(),o.forEach(e=>e.destroy());const l=[e?.ground?.layers,e?.basemap?.baseLayers,e?.basemap?.groundLayers,e?.basemap?.referenceLayers,e?.layers].filter(e=>!!e);r.forEach(e=>"layers"in e&&l.push(e.layers)),this.addHandles(l.map(e=>this._watchUpdatingTracking.addOnCollectionChange(()=>e,this._reschedule)),"collection-change"),this._workPromise.resolve(),this._workPromise=null},this._layersToLayerViews=new Map(e.layerviewMapping)}initialize(){this.addHandles([n(()=>this.view?.map?.allLayers,"change",this._preloadLayerViewModules,{onListenerAdd:this._preloadLayerViewModules}),l(()=>{const e=this.view,r=e?.map;return[r?.basemap,r?.ground,r?.layers,e?.ready]},()=>this._reschedule().catch(()=>{}),h)]),this._preloadLayerViewModules(),this._reschedule().catch(()=>{})}clearHandles(){this._watchUpdatingTracking.removeAll()}destroy(){this.clear(),f(this._recyclingInfoMap),f(this._layerLayerViewInfoMap),this._watchUpdatingTracking.destroy(),this._map=null,null!=this._workPromise&&(this._workPromise.reject(o()),this._workPromise=null)}get _rootCollectionNames(){return Array.from(this._layersToLayerViews.keys())}get updating(){return null!=this._workPromise||this._watchUpdatingTracking.updating||s(this._layerLayerViewInfoMap,e=>!e.done)||this._recyclingInfoMap.size>0}get updatingRemaining(){let e=0;for(const r of this._layerLayerViewInfoMap.values())r.done||++e;return e}clear(){this.destroyed||(this._clearCollections(),f(this._layerLayerViewInfoMap),f(this._recyclingInfoMap),this.notifyChange("allLayerViews"))}async whenLayerView(e){await this._reschedule();const r=this._layerLayerViewInfoMap.get(e)?.promise;if(!r){const r=this._recyclingInfoMap.get(e)?.promise;if(!r)throw new i("view:no-layerview-for-layer","No layerview has been found for the layer",{layer:e});return r}return r}isCreatingLayerViewsForLayer(e,r){this.commitProperty("updatingRemaining");const i=this._layerLayerViewInfoMap.get(e);if(!i?.done)return!0;const t=i.layerView;return!(!t||!r||t.parent===r)||!!(i.done&&t&&"layers"in e&&e.layers?.length)&&e.layers.some(e=>this.isCreatingLayerViewsForLayer(e,t))}get allLayerViews(){const e=[];for(const r of this._layerLayerViewInfoMap.values())r.layerView&&e.push(r.layerView);for(const r of this._recyclingInfoMap.values())r.layerView&&e.push(r.layerView);return e}_refreshCollections(){for(const[e,r]of this._layersToLayerViews)this._populateLayerViewsOwners(d(this,e),d(this,r),this.view);this.notifyChange("updating"),this.notifyChange("updatingRemaining"),this.notifyChange("allLayerViews")}_clearCollections(){for(const e of this._layersToLayerViews.values())d(this,e)?.removeAll()}_populateLayerViewsOwners(e,r,i){if(!e||!r)return void r?.removeAll();let t=0;for(const s of e){const e=this._layerLayerViewInfoMap.get(s);if(!e?.layerView)continue;const{layerView:o}=e;o.layer=s,o.parent=i,r.at(t)!==o&&r.splice(t,0,o),"layers"in s&&u(o)&&this._populateLayerViewsOwners(s.layers,o.layerViews,o),++t}t<r.length&&r.splice(t)}_createLayerView(e){e.load().catch(()=>{}),this.layerViewImporter.hasLayerViewModule(e)&&this.layerViewImporter.importLayerView(e);const r=new g(e,this.view,this.layerViewImporter),i=r.promise?.then(()=>this._refreshCollections(),r=>{r&&(a(r)||"cancelled:layerview-create"===r.name)||t.getLogger(this).error(`Failed to create layerview for layer title:'${e.title??"no title"}', id:'${e.id??"no id"}' of type '${e.type}'.`,{layer:e,error:r}),this.destroyed||this._refreshCollections()});this._watchUpdatingTracking.consumePromise(i),this._layerLayerViewInfoMap.set(e,r),this.view.ready&&r.start(),this.notifyChange("updating"),this.notifyChange("updatingRemaining"),this.notifyChange("allLayerViews")}};e([c()],m.prototype,"_workPromise",void 0),e([c({readOnly:!0})],m.prototype,"_watchUpdatingTracking",void 0),e([c({readOnly:!0})],m.prototype,"_layersToLayerViews",void 0),e([c({constructOnly:!0})],m.prototype,"layerviewMapping",void 0),e([c({readOnly:!0})],m.prototype,"_rootCollectionNames",null),e([c({constructOnly:!0})],m.prototype,"layerViewFilter",void 0),e([c()],m.prototype,"layerViewImporter",void 0),e([c({readOnly:!0})],m.prototype,"updating",null),e([c({readOnly:!0})],m.prototype,"updatingRemaining",null),e([c({constructOnly:!0})],m.prototype,"view",void 0),e([c({readOnly:!0})],m.prototype,"allLayerViews",null),m=e([p("esri.views.support.LayerViewManager")],m);const _=m;export{_ as default};
2
+ import{__decorate as e}from"tslib";import r from"../../core/Accessor.js";import t from"../../core/Error.js";import i from"../../core/Logger.js";import{someMap as s}from"../../core/MapUtils.js";import{createAbortError as o,isAbortError as a}from"../../core/promiseUtils.js";import l from"../../core/ReactiveMap.js";import{on as n,watch as c,syncAndInitial as y}from"../../core/reactiveUtils.js";import{schedule as h}from"../../core/scheduling.js";import{property as p,subclass as w}from"../../core/accessorSupport/decorators.js";import{get as d}from"../../core/accessorSupport/get.js";import{UpdatingHandles as f}from"../../core/support/UpdatingHandles.js";import{destroyMap as m}from"../../support/collectionUtils.js";import{LayerLayerViewInfo as u}from"./LayerLayerViewInfo.js";function _(e){return null!=e&&"object"==typeof e&&"layerViews"in e}let g=class extends r{constructor(e){super(e),this._layerLayerViewInfoMap=new l,this._recyclingInfoMap=new l,this._watchUpdatingTracking=new f,this._preloadLayerViewModules=()=>{const e=this.view.map?.allLayers;if(e)for(const r of e)!1!==this.layerViewFilter?.(r)&&this.layerViewImporter.hasLayerViewModule(r)&&this.layerViewImporter.importLayerView(r)},this._reschedule=()=>this.destroyed?Promise.reject():(null==this._workPromise&&(this._workPromise=Promise.withResolvers(),this._workPromise.promise.catch(()=>{})),this.removeHandles("reschedule"),this.addHandles(h(this._doWork),"reschedule"),this._workPromise.promise),this._doWork=()=>{if(this.destroyed)return;const{map:e}=this.view;if(!e)return void this.clear();if(this._map!==e&&(this.clear(),this._map=e),null==this._workPromise)return;this.removeHandles("reschedule"),this.removeHandles("collection-change");const r=new Set,t=[],i=this.view.ready,s=e=>{if(null!=e)for(const o of e)if(o){if(!1===this.layerViewFilter?.(o))continue;r.add(o);const e=this._layerLayerViewInfoMap.get(o);e&&i?e.start():e||this._recyclingInfoMap.has(o)||t.push(o),"layers"in o&&o.layers&&s(o.layers)}};for(const a of this._rootCollectionNames)s(d(this,a));const o=new Array,l=e=>{const r=e.tryRecycle(t);if(r){const t=e.layer;this._recyclingInfoMap.set(t,e),this._watchUpdatingTracking.consumePromise(r),r.then(()=>{this._recyclingInfoMap.get(t)===e&&e.promise===r&&(this._recyclingInfoMap.delete(t),this._layerLayerViewInfoMap.set(t,e),this._reschedule())}).catch(i=>{this._recyclingInfoMap.get(t)!==e||e.promise!==r||a(i)||(this._recyclingInfoMap.delete(t),e.destroy(),this._reschedule())})}else o.push(e)};for(const a of this._layerLayerViewInfoMap.values())r.has(a.layer)||(this._layerLayerViewInfoMap.delete(a.layer),l(a));for(const a of this._recyclingInfoMap.values())r.has(a.layer)||(this._recyclingInfoMap.delete(a.layer),l(a));for(const a of t)this._createLayerView(a);this._refreshCollections(),o.forEach(e=>e.destroy());const n=[e?.ground?.layers,e?.basemap?.baseLayers,e?.basemap?.groundLayers,e?.basemap?.referenceLayers,e?.layers].filter(e=>!!e);r.forEach(e=>"layers"in e&&n.push(e.layers)),this.addHandles(n.map(e=>this._watchUpdatingTracking.addOnCollectionChange(()=>e,this._reschedule)),"collection-change"),this._workPromise.resolve(),this._workPromise=null},this._layersToLayerViews=new Map(e.layerviewMapping)}initialize(){this.addHandles([n(()=>this.view?.map?.allLayers,"change",this._preloadLayerViewModules,{onListenerAdd:this._preloadLayerViewModules}),c(()=>{const e=this.view,r=e?.map;return[r?.basemap,r?.ground,r?.layers,e?.ready]},()=>this._reschedule().catch(()=>{}),y)]),this._preloadLayerViewModules(),this._reschedule().catch(()=>{})}clearHandles(){this._watchUpdatingTracking.removeAll()}destroy(){this.clear(),m(this._recyclingInfoMap),m(this._layerLayerViewInfoMap),this._watchUpdatingTracking.destroy(),this._map=null,null!=this._workPromise&&(this._workPromise.reject(o()),this._workPromise=null)}get _rootCollectionNames(){return Array.from(this._layersToLayerViews.keys())}get updating(){return null!=this._workPromise||this._watchUpdatingTracking.updating||s(this._layerLayerViewInfoMap,e=>!e.done)||this._recyclingInfoMap.size>0}get updatingRemaining(){let e=0;for(const r of this._layerLayerViewInfoMap.values())r.done||++e;return e}clear(){this.destroyed||(this._clearCollections(),m(this._layerLayerViewInfoMap),m(this._recyclingInfoMap))}async whenLayerView(e){await this._reschedule();const r=this._layerLayerViewInfoMap.get(e)?.promise;if(!r){const r=this._recyclingInfoMap.get(e)?.promise;if(!r)throw new t("view:no-layerview-for-layer","No layerview has been found for the layer",{layer:e});return r}return r}isCreatingLayerViewsForLayer(e,r){const t=this._layerLayerViewInfoMap.get(e);if(!t?.done)return!0;const i=t.layerView;return!(!i||!r||i.parent===r)||!!(t.done&&i&&"layers"in e&&e.layers?.length)&&e.layers.some(e=>this.isCreatingLayerViewsForLayer(e,i))}get allLayerViews(){const e=[];for(const r of this._layerLayerViewInfoMap.values())r.layerView&&e.push(r.layerView);for(const r of this._recyclingInfoMap.values())r.layerView&&e.push(r.layerView);return e}_refreshCollections(){for(const[e,r]of this._layersToLayerViews)this._populateLayerViewsOwners(d(this,e),d(this,r),this.view)}_clearCollections(){for(const e of this._layersToLayerViews.values())d(this,e)?.removeAll()}_populateLayerViewsOwners(e,r,t){if(!e||!r)return void r?.removeAll();let i=0;for(const s of e){const e=this._layerLayerViewInfoMap.get(s);if(!e?.layerView)continue;const{layerView:o}=e;o.layer=s,o.parent=t,r.at(i)!==o&&r.splice(i,0,o),"layers"in s&&_(o)&&this._populateLayerViewsOwners(s.layers,o.layerViews,o),++i}i<r.length&&r.splice(i)}_createLayerView(e){e.load().catch(()=>{}),this.layerViewImporter.hasLayerViewModule(e)&&this.layerViewImporter.importLayerView(e);const r=new u(e,this.view,this.layerViewImporter),t=r.promise?.then(()=>this._refreshCollections(),r=>{r&&(a(r)||"cancelled:layerview-create"===r.name)||i.getLogger(this).error(`Failed to create layerview for layer title:'${e.title??"no title"}', id:'${e.id??"no id"}' of type '${e.type}'.`,{layer:e,error:r}),this.destroyed||this._refreshCollections()});this._watchUpdatingTracking.consumePromise(t),this._layerLayerViewInfoMap.set(e,r),this.view.ready&&r.start()}};e([p()],g.prototype,"_workPromise",void 0),e([p({readOnly:!0})],g.prototype,"_watchUpdatingTracking",void 0),e([p({readOnly:!0})],g.prototype,"_layersToLayerViews",void 0),e([p({constructOnly:!0})],g.prototype,"layerviewMapping",void 0),e([p({readOnly:!0})],g.prototype,"_rootCollectionNames",null),e([p({constructOnly:!0})],g.prototype,"layerViewFilter",void 0),e([p()],g.prototype,"layerViewImporter",void 0),e([p({readOnly:!0})],g.prototype,"updating",null),e([p({readOnly:!0})],g.prototype,"updatingRemaining",null),e([p({constructOnly:!0})],g.prototype,"view",void 0),e([p({readOnly:!0})],g.prototype,"allLayerViews",null),g=e([w("esri.views.support.LayerViewManager")],g);const V=g;export{V as default};
@@ -64,7 +64,7 @@ export default class InitialViewProperties extends InitialViewPropertiesSupercla
64
64
  * Value | Description |
65
65
  * ----- | ----------- |
66
66
  * system | Dates and times are be displayed in the timezone of the device or browser.
67
- * unknown | Dates and times will be displayed based on the time zone that has been defined for the layer. No adjustments are made to the display of date info. Additionally, the [TimeSlider](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/) is disabled.
67
+ * unknown | Dates and times will be displayed based on the time zone that has been defined for the layer. No adjustments are made to the display of date info. Additionally, the [Time Bar component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-time-bar/) is disabled.
68
68
  * Specified IANA timezone | Dates and times will be displayed in the specified IANA time zone. See [wikipedia - List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
69
69
  *
70
70
  * > [!WARNING]
@@ -52,7 +52,9 @@ export default class SunLighting extends JSONSupport {
52
52
  accessor directShadowsEnabled: boolean;
53
53
  /**
54
54
  * The UTC time zone offset in hours that should be displayed in the UI to represent the date.
55
- * This value does not have an impact on the actual lighting of the scene.
55
+ * The Daylight component and widget use this value when displaying and editing the simulated sun date.
56
+ * It is separate from [SceneView.timeZone](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#timeZone), which controls how supported date/time values are displayed.
57
+ * This value does not affect the actual lighting of the scene.
56
58
  */
57
59
  accessor displayUTCOffset: number | null | undefined;
58
60
  /**
@@ -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 s from"../../../core/Error.js";import r from"../../../core/Logger.js";import{getOrCreateMapValue as o}from"../../../core/MapUtils.js";import{whenOrAbort as a,settleWithPromise as n}from"../../../core/promiseUtils.js";import i from"../../../core/ReactiveMap.js";import{addMany as l}from"../../../core/SetUtils.js";import{property as c,subclass as u}from"../../../core/accessorSupport/decorators.js";import{makeArcadeContext as p,castArcadeValue as d}from"./expressionUtils.js";import{makeUseId as f}from"../inputs/support/inputUtils.js";import{isFieldElementTemplate as h,isGroupElementTemplate as m}from"../templates/support/templateUtils.js";let x=null;const v=()=>r.getLogger("esri.widgets.BatchAttributeForm.expressions.ExpressionsManager");let g=class extends t{constructor(e){super(e),this.calculating=!1,this.arcadeContext=null,this._abortController=new AbortController,this.layerExpressionsModelMap=new Map,this.evaluatedExpressions=new i,this.expressionEvaluationFailed=!1}destroy(){this.abort()}abort(){this._abortController.abort()}async runAllExpressions(e,t){return this._evaluateSpecifiedComponentsForEachFeature(e,y,t)}async runGeometryDependentExpressions(e,t){return this._evaluateSpecifiedComponentsForEachFeature(e,E,t)}async runOriginalFeatureDependentExpressions(e,t){return this._evaluateSpecifiedComponentsForEachFeature([e],C,t)}async runExpressionsDependentOnChangedFields(e){try{this.calculating=!0;const t=Array.from(e.changes).map(([t,s])=>this.runExpressionsDependentOnChangedFieldsForFeature([...s.keys()],t,e));_(await Promise.allSettled(t))}catch(t){v().error(t),this.expressionEvaluationFailed=!0}finally{this.calculating=!1}}async runExpressionsDependentOnChangedFieldsForFeature(e,t,s){if(this._abortController.signal.aborted)return;const r=this.layerExpressionsModelMap.get(t.layer);if(!r||0===r.components.length)return;const o=w(r,e);0!==o.length&&await this.evaluateAffectedComponents([...o],t,r,s)}async evaluateAffectedComponents(e,t,s,r){const n=new Map;for(const a of e){o(n,a,()=>this.createSccEvaluator({scc:a,feature:t,evaluatorMap:n,expressionModel:s,isRoot:!0})).isRoot=!0}if(0===n.size)return;const l=[...n.values()],c={transaction:r,previousOutcomes:new i},u=l.map(e=>e.evaluate(c));_(await a(Promise.allSettled(u),this._abortController))}createSccEvaluator({scc:e,feature:t,evaluatorMap:s,expressionModel:r,isRoot:a}){const n=new b(e,t,this.arcadeContext,r,this.evaluatedExpressions,a,this._abortController);for(const i of e.adjacencyList){o(s,i,()=>this.createSccEvaluator({scc:i,feature:t,evaluatorMap:s,expressionModel:r,isRoot:!1})).dependencies.push(n)}return n}async _evaluateSpecifiedComponentsForEachFeature(e,t,s){this.calculating=!0;try{const r=[];for(const o of e){const e=this.layerExpressionsModelMap.get(o.layer);e&&0!==e.components.length&&r.push(this.evaluateAffectedComponents(t(e),o,e,s))}_(await a(Promise.allSettled(r),this._abortController))}catch(r){v().error(r),this.expressionEvaluationFailed=!0}finally{this.calculating=!1}}};e([c()],g.prototype,"calculating",void 0),e([c({constructOnly:!0})],g.prototype,"arcadeContext",void 0),e([c()],g.prototype,"_abortController",void 0),e([c()],g.prototype,"layerExpressionsModelMap",void 0),e([c()],g.prototype,"evaluatedExpressions",void 0),e([c()],g.prototype,"expressionEvaluationFailed",void 0),g=e([u("esri.widgets.BatchAttributeForm.expressions.ExpressionsManager")],g);class b{constructor(e,t,s,r,o,a,n){this.scc=e,this.feature=t,this.arcadeContextInfo=s,this.expressionsModel=r,this.evaluatedExpressions=o,this.isRoot=a,this._abortController=n,this._resolver=null,this.dependencies=[]}get baseContext(){return p(this.arcadeContextInfo,this.feature,this._abortController.signal)}evaluate(e){return this._resolver||(this._resolver=Promise.withResolvers(),n(this._resolver,this._evaluate(e))),this._resolver.promise}async _evaluate(e){null===x&&(x=await(import("../../../arcade/languageUtils.js")));const t=[],r=this.dependencies.map(t=>t.evaluate(e));if(_(await a(Promise.allSettled(r),this._abortController)),this._shouldEvaluate(e.transaction)){for(const r of this.scc.executors){const a=this.baseContext;if(this._abortController.signal.aborted)break;const c=this.expressionsModel.arcadeExecutorUses.get(r)??[],u=o(this.evaluatedExpressions,this.feature,()=>new i);let p=null,h=null;try{p=r.isAsync?await r.executeAsync(a.variables,a.executeContext):r.execute(a.variables,a.executeContext),h={result:p,status:"success"}}catch(n){h={error:n,status:"error"}}const{transaction:m,previousOutcomes:g}=e;for(const t of c){const s=f(t),r=u.get(s);r&&g.set(s,r),u.set(f(t),h);const o=this.expressionsModel.elementTemplateMap.get(t.elementId);switch(t.executorPurpose){case"editable":if(!1===h.result&&!1!==r?.result){const e=u.get(f({elementId:o.elementId,executorPurpose:"value"}));if(e){const{fieldName:t}=o,s=F(this.feature,t),r=d(e.result,s,this.arcadeContextInfo.timeZone,x);m.setValue(this.feature,t,r)}}break;case"value":{if("error"===h?.status)continue;const e=o.getExpressionExecutorsForLayer(this.feature.layer);let t=!0;if(e?.editableExpression&&(t=!1===u.get(f({elementId:o.elementId,executorPurpose:"editable"}))?.result),t){const e=o.fieldName,t=this.feature.getAttribute(e)??null;try{const s=F(this.feature,e),r=d(h.result,s,this.arcadeContextInfo.timeZone,x);r!==t&&m.setValue(this.feature,e,r)}catch(l){v().error(`Failed to set calculated value for field '${e}'`,l)}}}break;case"visibility":this.expressionsModel.preserveFieldValuesWhenHidden||!0!==r?.result||!1!==h.result||"user"!==m.originActor||A(o,this.feature,u,e)}}if("error"===h?.status){const e=new Set;for(const t of c){const s=this.expressionsModel.elementTemplateMap.get(t.elementId);if(s)switch(t.executorPurpose){case"editable":e.add(s.label+" - Editable expression");break;case"required":e.add(s.label+" - Required expression");break;case"value":e.add(s.label+" - Value expression");break;case"visibility":e.add(s.label+" - Visibility expression")}}t.push(e.size>0?new s("expression-evaluation-failed","Arcade evaluation failed ("+[...e].join(",")+")"):new s("expression-evaluation-failed","Arcade evaluation failed "))}}if(t.length>0)throw M(t)}}_shouldEvaluate(e){if(this._abortController.signal.aborted)return!1;if(this.isRoot)return!0;const t=e.changesForFeature(this.feature);return!(!t||0===t.size)&&this.scc.fieldsReferenced.values().some(e=>t.has(e))}}function y(e){return e.components}function E(e){return Array.from(e.geometryReferences)}function C(e){return Array.from(e.originalFeatureReferences)}function F(e,t){const r=e.layer.fieldsIndex.get(t);if(!r)throw new s("field-not-found",`Field '${t}' not found on layer.`);return r}function w(e,t){const s=new Set;for(const r of t)l(s,e.fieldReferencesMap.get(r));return Array.from(s)}function M(e){return new AggregateError(e,`One or more expression executions failed. First error message: ${e[0].message}`)}function _(e){const t=[],s=new Set;for(const r of e){if("fulfilled"===r.status)continue;const e=r.reason instanceof AggregateError?r.reason.errors:[r.reason];for(const r of e)s.has(r)||(s.add(r),t.push(r))}if(t.length>0)throw M(t)}function A(e,t,s,r){h(e)?S(e,t,s,r):m(e)&&j(e,t,s,r)}function S(e,t,s,r){const{group:o}=e;o&&!R(o,s,r.previousOutcomes)||I(t,e,r)}function j(e,t,s,r){for(const o of e.elements)h(o)&&R(o,s,r.previousOutcomes)&&I(t,o,r)}function I(e,{fieldName:t},s){s.transaction.setValue(e,t,null)}function R(e,t,s){const r=f({elementId:e.elementId,executorPurpose:"visibility"}),o=s.get(r)??t.get(r);return!o||!!o.result}export{g as ExpressionsManager};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import s from"../../../core/Error.js";import r from"../../../core/Logger.js";import{getOrCreateMapValue as o}from"../../../core/MapUtils.js";import{whenOrAbort as n,settleWithPromise as a}from"../../../core/promiseUtils.js";import i from"../../../core/ReactiveMap.js";import{addMany as l}from"../../../core/SetUtils.js";import{property as c,subclass as u}from"../../../core/accessorSupport/decorators.js";import{makeArcadeContext as p,castArcadeValue as d}from"./expressionUtils.js";import{makeUseId as f}from"../inputs/support/inputUtils.js";import{isFieldElementTemplate as h,isGroupElementTemplate as m}from"../templates/support/templateUtils.js";let x=null;const v=()=>r.getLogger("esri.widgets.BatchAttributeForm.expressions.ExpressionsManager");let g=class extends t{constructor(e){super(e),this.calculating=!1,this.arcadeContext=null,this._abortController=new AbortController,this.layerExpressionsModelMap=new Map,this.evaluatedExpressions=new i,this.expressionEvaluationFailed=!1}destroy(){this.abort()}abort(){this._abortController.abort()}async runAllExpressions(e,t){return this._evaluateSpecifiedComponentsForEachFeature(e,b,t)}async runGeometryDependentExpressions(e,t){return this._evaluateSpecifiedComponentsForEachFeature(e,y,t)}async runOriginalFeatureDependentExpressions(e,t){return this._evaluateSpecifiedComponentsForEachFeature([e],C,t)}async runExpressionsDependentOnChangedFields(e){try{this.calculating=!0;const t=Array.from(e.changes).map(([t,s])=>this.runExpressionsDependentOnChangedFieldsForFeature([...s.keys()],t,e));_(await Promise.allSettled(t))}catch(t){v().error(t),this.expressionEvaluationFailed=!0}finally{this.calculating=!1}}async runExpressionsDependentOnChangedFieldsForFeature(e,t,s){if(this._abortController.signal.aborted)return;const r=this.layerExpressionsModelMap.get(t.layer);if(!r||0===r.components.length)return;const o=w(r,e);0!==o.length&&await this.evaluateAffectedComponents([...o],t,r,s)}async evaluateAffectedComponents(e,t,s,r){const a=new Map;for(const n of e){o(a,n,()=>this.createSccEvaluator({scc:n,feature:t,evaluatorMap:a,expressionModel:s,isRoot:!0})).isRoot=!0}if(0===a.size)return;const l=[...a.values()],c={transaction:r,previousOutcomes:new i},u=l.map(e=>e.evaluate(c));_(await n(Promise.allSettled(u),this._abortController))}createSccEvaluator({scc:e,feature:t,evaluatorMap:s,expressionModel:r,isRoot:n}){const a=new E(e,t,this.arcadeContext,r,this.evaluatedExpressions,n,this._abortController);for(const i of e.adjacencyList){o(s,i,()=>this.createSccEvaluator({scc:i,feature:t,evaluatorMap:s,expressionModel:r,isRoot:!1})).dependencies.push(a)}return a}async _evaluateSpecifiedComponentsForEachFeature(e,t,s){this.calculating=!0;try{const r=[];for(const o of e){const e=this.layerExpressionsModelMap.get(o.layer);e&&0!==e.components.length&&r.push(this.evaluateAffectedComponents(t(e),o,e,s))}_(await n(Promise.allSettled(r),this._abortController))}catch(r){v().error(r),this.expressionEvaluationFailed=!0}finally{this.calculating=!1}}};e([c()],g.prototype,"calculating",void 0),e([c({constructOnly:!0})],g.prototype,"arcadeContext",void 0),e([c()],g.prototype,"_abortController",void 0),e([c()],g.prototype,"layerExpressionsModelMap",void 0),e([c()],g.prototype,"evaluatedExpressions",void 0),e([c()],g.prototype,"expressionEvaluationFailed",void 0),g=e([u("esri.widgets.BatchAttributeForm.expressions.ExpressionsManager")],g);class E{constructor(e,t,s,r,o,n,a){this.scc=e,this.feature=t,this.arcadeContextInfo=s,this.expressionsModel=r,this.evaluatedExpressions=o,this.isRoot=n,this._abortController=a,this._resolver=null,this.dependencies=[]}get baseContext(){return p(this.arcadeContextInfo,this.feature,this._abortController.signal)}evaluate(e){return this._resolver||(this._resolver=Promise.withResolvers(),a(this._resolver,this._evaluate(e))),this._resolver.promise}async _evaluate(e){null===x&&(x=await(import("../../../arcade/languageUtils.js")));const t=[],r=this.dependencies.map(t=>t.evaluate(e));if(_(await n(Promise.allSettled(r),this._abortController)),this._shouldEvaluate(e.transaction)){for(const r of this.scc.executors){const n=this.baseContext;if(this._abortController.signal.aborted)break;const c=this.expressionsModel.arcadeExecutorUses.get(r)??[],u=o(this.evaluatedExpressions,this.feature,()=>new i);let p=null,h=null;try{p=r.isAsync?await r.executeAsync(n.variables,n.executeContext):r.execute(n.variables,n.executeContext),h={result:p,status:"success"}}catch(a){h={error:a,status:"error"}}const{transaction:m,previousOutcomes:g}=e;for(const t of c){const s=f(t),r=u.get(s);r&&g.set(s,r),u.set(f(t),h);const o=this.expressionsModel.elementTemplateMap.get(t.elementId);switch(t.executorPurpose){case"editableExpression":if(!1===h.result&&!1!==r?.result){const e=u.get(f({elementId:o.elementId,executorPurpose:"valueExpression"}));if(e){const{fieldName:t}=o,s=F(this.feature,t),r=d(e.result,s,this.arcadeContextInfo.timeZone,x);m.setValue(this.feature,t,r)}}break;case"valueExpression":{if("error"===h?.status)continue;const e=o.getExpressionExecutorsForLayer(this.feature.layer);let t=!0;if(e?.editableExpression&&(t=!1===u.get(f({elementId:o.elementId,executorPurpose:"editableExpression"}))?.result),t){const e=o.fieldName,t=this.feature.getAttribute(e)??null;try{const s=F(this.feature,e),r=d(h.result,s,this.arcadeContextInfo.timeZone,x);r!==t&&m.setValue(this.feature,e,r)}catch(l){v().error(`Failed to set calculated value for field '${e}'`,l)}}}break;case"visibilityExpression":this.expressionsModel.preserveFieldValuesWhenHidden||!0!==r?.result||!1!==h.result||"user"!==m.originActor||A(o,this.feature,u,e)}}if("error"===h?.status){const e=new Set;for(const t of c){const s=this.expressionsModel.elementTemplateMap.get(t.elementId);if(s)switch(t.executorPurpose){case"editableExpression":e.add(s.label+" - Editable expression");break;case"requiredExpression":e.add(s.label+" - Required expression");break;case"valueExpression":e.add(s.label+" - Value expression");break;case"visibilityExpression":e.add(s.label+" - Visibility expression")}}t.push(e.size>0?new s("expression-evaluation-failed","Arcade evaluation failed ("+[...e].join(",")+")"):new s("expression-evaluation-failed","Arcade evaluation failed "))}}if(t.length>0)throw M(t)}}_shouldEvaluate(e){if(this._abortController.signal.aborted)return!1;if(this.isRoot)return!0;const t=e.changesForFeature(this.feature);return!(!t||0===t.size)&&this.scc.fieldsReferenced.values().some(e=>t.has(e))}}function b(e){return e.components}function y(e){return Array.from(e.geometryReferences)}function C(e){return Array.from(e.originalFeatureReferences)}function F(e,t){const r=e.layer.fieldsIndex.get(t);if(!r)throw new s("field-not-found",`Field '${t}' not found on layer.`);return r}function w(e,t){const s=new Set;for(const r of t)l(s,e.fieldReferencesMap.get(r));return Array.from(s)}function M(e){return new AggregateError(e,`One or more expression executions failed. First error message: ${e[0].message}`)}function _(e){const t=[],s=new Set;for(const r of e){if("fulfilled"===r.status)continue;const e=r.reason instanceof AggregateError?r.reason.errors:[r.reason];for(const r of e)s.has(r)||(s.add(r),t.push(r))}if(t.length>0)throw M(t)}function A(e,t,s,r){h(e)?S(e,t,s,r):m(e)&&j(e,t,s,r)}function S(e,t,s,r){const{group:o}=e;o&&!R(o,s,r.previousOutcomes)||I(t,e,r)}function j(e,t,s,r){for(const o of e.elements)h(o)&&R(o,s,r.previousOutcomes)&&I(t,o,r)}function I(e,{fieldName:t},s){s.transaction.setValue(e,t,null)}function R(e,t,s){const r=f({elementId:e.elementId,executorPurpose:"visibilityExpression"}),o=s.get(r)??t.get(r);return!o||!!o.result}export{g as ExpressionsManager};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{isSome as e,addMany as t,pushIfSome as n}from"../../../core/arrayUtils.js";import{getOrCreateMapValue as s}from"../../../core/MapUtils.js";import o from"../../../core/Queue.js";import{addMany as i,last as r}from"../../../core/SetUtils.js";import{isFieldElementTemplate as a}from"../templates/support/templateUtils.js";class d{constructor({executorMap:e,fieldsIndex:t,preserveFieldValuesWhenHidden:n}){this.arcadeExecutorUses=new Map,this.components=[],this.preserveFieldValuesWhenHidden=!1,this.fieldsIndex=t,this.preserveFieldValuesWhenHidden=!0===n,this.elementTemplateMap=new Map;for(const s of e.keys())this.elementTemplateMap.set(s.elementId,s);this._buildDependencyGraph(e)}_buildDependencyGraph(e){const t=m(e,this.fieldsIndex),n={components:[],arcadeExecutorUses:this.arcadeExecutorUses,elementTemplatesById:new Map([...e.keys()].map(e=>[e.elementId,e])),executorMap:e,fieldElementTemplateMap:f(e),fieldReferencesMap:new Map,geometryReferences:new Set,originalFeatureReferences:new Set,nextIndex:0,nodeInfoMap:t,nodeStack:new o(r),shouldConsiderVisibility:!this.preserveFieldValuesWhenHidden};for(const[o,i]of e)null!=i&&(i.editableExpression&&s(this.arcadeExecutorUses,i.editableExpression,()=>[]).push({elementId:o.elementId,executorPurpose:"editable"}),i.valueExpression&&s(this.arcadeExecutorUses,i.valueExpression,()=>[]).push({elementId:o.elementId,executorPurpose:"value"}),i.visibilityExpression&&s(this.arcadeExecutorUses,i.visibilityExpression,()=>[]).push({elementId:o.elementId,executorPurpose:"visibility"}),i.requiredExpression&&s(this.arcadeExecutorUses,i.requiredExpression,()=>[]).push({elementId:o.elementId,executorPurpose:"required"}),i.textExpressions&&i.textExpressions.forEach((e,t)=>{s(this.arcadeExecutorUses,e,()=>[]).push({elementId:o.elementId,executorPurpose:"text",textExpressionIndex:t})}));for(const s of this.arcadeExecutorUses.values())s.sort(e=>"editable"===e.executorPurpose?-1:1);for(const s of t.values())-1===s.index&&c(s,n);this.dependencyGraphComponents=x(t),this.fieldReferencesMap=h(n),this.geometryReferences=E(n.geometryReferences,t),this.originalFeatureReferences=E(n.originalFeatureReferences,t),this.components=n.components}}class l{constructor(){this._executors=new Set,this._fieldsReferenced=new Set,this.adjacencyList=new Set}get executors(){return this._executors}get fieldsReferenced(){return this._fieldsReferenced}addExecutor(e){this._executors.add(e.executor),i(this._fieldsReferenced,e.fieldsUsedNormalized)}}function c(e,t){e.index=e.lowlink=t.nextIndex++,t.nodeStack.push(e);for(const n of p(e,t))-1===n.index?(c(n,t),e.lowlink=Math.min(e.lowlink,n.lowlink)):n.index<e.index&&t.nodeStack.contains(n)&&(e.lowlink=Math.min(e.lowlink,n.index)),t.nodeStack.contains(n)||null!=n.component&&e.incomingCrossLinkNeighbors.add(n.component);if(e.lowlink===e.index){const n=new l;for(t.components.push(n);y(t.nodeStack)>=e.index;){const e=t.nodeStack.pop();if(null!=e){e.component=n,n.addExecutor(e);for(const t of e.incomingCrossLinkNeighbors)t.adjacencyList.add(n)}}}}function p({executor:t,fieldsUsedNormalized:n},o){const r=new Set;for(const e of n){s(o.fieldReferencesMap,e,()=>new Set).add(t),i(r,u(e,o))}t.geometryUsed&&o.geometryReferences.add(t),t.variablesUsed.includes("$originalfeature")&&o.originalFeatureReferences.add(t);const d=o.arcadeExecutorUses.get(t)??[];for(const e of d)switch(e.executorPurpose){case"value":{const n=o.executorMap.get(o.elementTemplatesById.get(e.elementId));n?.editableExpression&&n.editableExpression!==t&&r.add(n.editableExpression);break}case"visibility":{const t=o.elementTemplatesById.get(e.elementId);if(o.shouldConsiderVisibility&&t&&a(t)){const e=t.group,n=e?o.executorMap.get(e):null;n?.visibilityExpression&&r.add(n.visibilityExpression)}break}}return Array.from(r).map(e=>o.nodeInfoMap.get(e)).filter(e)}function u(e,{executorMap:t,fieldElementTemplateMap:s,shouldConsiderVisibility:o}){const i=[],r=s.get(e);if(null==r)return i;const a=t.get(r);if(null==a)return i;if(n(i,a.editableExpression),n(i,a.valueExpression),o){n(i,a.visibilityExpression);const{group:e}=r;if(null!=e){const s=t.get(e)?.visibilityExpression;n(i,s)}}return i}function f(e){const t=new Map;for(const n of e.keys())a(n)&&t.set(n.fieldName,n);return t}function m(n,s){const o=Array.from(n.values()).filter(e),i=new Set(o.flatMap(e=>{const{textExpressions:n,...s}=e,o=[];return n?.length&&t(o,n),t(o,Object.values(s)),o})),r=Array.from(i).filter(e).map(e=>({component:null,incomingCrossLinkNeighbors:new Set,executor:e,fieldsUsedNormalized:e.fieldsUsed.map(e=>s.normalizeFieldName(e)??e),index:-1,lowlink:-1,onStack:!1}));return new Map(r.map(e=>[e.executor,e]))}function x(e){return new Map([...e.values()].map(({component:e,executor:t})=>[t,e]))}function h({fieldReferencesMap:e,nodeInfoMap:t}){const n=new Map;for(const[s,o]of e.entries())n.set(s,E(o,t));return n}function E(e,t){const n=new Set;for(const s of e){const e=t.get(s);e?.component&&n.add(e.component)}return n}function y(e){return e.peek()?.index??-1}export{d as ExpressionsModel,l as StronglyConnectedComponent,p as getDirectDependencies};
2
+ import{isSome as e,addMany as n,pushIfSome as t}from"../../../core/arrayUtils.js";import{getOrCreateMapValue as s}from"../../../core/MapUtils.js";import o from"../../../core/Queue.js";import{addMany as i,last as r}from"../../../core/SetUtils.js";import{isFieldElementTemplate as a}from"../templates/support/templateUtils.js";class c{constructor({executorMap:e,fieldsIndex:n,preserveFieldValuesWhenHidden:t}){this.arcadeExecutorUses=new Map,this.components=[],this.preserveFieldValuesWhenHidden=!1,this.fieldsIndex=n,this.preserveFieldValuesWhenHidden=!0===t,this.elementTemplateMap=new Map;for(const s of e.keys())this.elementTemplateMap.set(s.elementId,s);this._buildDependencyGraph(e)}_buildDependencyGraph(e){const n=m(e,this.fieldsIndex),t={components:[],arcadeExecutorUses:this.arcadeExecutorUses,elementTemplatesById:new Map([...e.keys()].map(e=>[e.elementId,e])),executorMap:e,fieldElementTemplateMap:f(e),fieldReferencesMap:new Map,geometryReferences:new Set,originalFeatureReferences:new Set,nextIndex:0,nodeInfoMap:n,nodeStack:new o(r),shouldConsiderVisibility:!this.preserveFieldValuesWhenHidden};for(const[o,i]of e)if(null!=i)for(const e of Object.keys(i))switch(e){case"editableExpression":case"requiredExpression":case"valueExpression":case"visibilityExpression":{const n=i[e];if(null==n)break;s(this.arcadeExecutorUses,n,()=>[]).push({elementId:o.elementId,executorPurpose:e});break}case"textExpressions":{const n=i[e];if(!Array.isArray(n))break;n.forEach((e,n)=>{s(this.arcadeExecutorUses,e,()=>[]).push({elementId:o.elementId,executorPurpose:"textExpressions",textExpressionIndex:n})});break}}for(const s of this.arcadeExecutorUses.values())s.sort(e=>"editableExpression"===e.executorPurpose?-1:1);for(const s of n.values())-1===s.index&&d(s,t);this.dependencyGraphComponents=x(n),this.fieldReferencesMap=h(t),this.geometryReferences=y(t.geometryReferences,n),this.originalFeatureReferences=y(t.originalFeatureReferences,n),this.components=t.components}}class l{constructor(){this._executors=new Set,this._fieldsReferenced=new Set,this.adjacencyList=new Set}get executors(){return this._executors}get fieldsReferenced(){return this._fieldsReferenced}addExecutor(e){this._executors.add(e.executor),i(this._fieldsReferenced,e.fieldsUsedNormalized)}}function d(e,n){e.index=e.lowlink=n.nextIndex++,n.nodeStack.push(e);for(const t of p(e,n))-1===t.index?(d(t,n),e.lowlink=Math.min(e.lowlink,t.lowlink)):t.index<e.index&&n.nodeStack.contains(t)&&(e.lowlink=Math.min(e.lowlink,t.index)),n.nodeStack.contains(t)||null!=t.component&&e.incomingCrossLinkNeighbors.add(t.component);if(e.lowlink===e.index){const t=new l;for(n.components.push(t);E(n.nodeStack)>=e.index;){const e=n.nodeStack.pop();if(null!=e){e.component=t,t.addExecutor(e);for(const n of e.incomingCrossLinkNeighbors)n.adjacencyList.add(t)}}}}function p({executor:n,fieldsUsedNormalized:t},o){const r=new Set;for(const e of t){s(o.fieldReferencesMap,e,()=>new Set).add(n),i(r,u(e,o))}n.geometryUsed&&o.geometryReferences.add(n),n.variablesUsed.includes("$originalfeature")&&o.originalFeatureReferences.add(n);const c=o.arcadeExecutorUses.get(n)??[];for(const e of c)switch(e.executorPurpose){case"valueExpression":{const t=o.executorMap.get(o.elementTemplatesById.get(e.elementId));t?.editableExpression&&t.editableExpression!==n&&r.add(t.editableExpression);break}case"visibilityExpression":{const n=o.elementTemplatesById.get(e.elementId);if(o.shouldConsiderVisibility&&n&&a(n)){const e=n.group,t=e?o.executorMap.get(e):null;t?.visibilityExpression&&r.add(t.visibilityExpression)}break}}return Array.from(r).map(e=>o.nodeInfoMap.get(e)).filter(e)}function u(e,{executorMap:n,fieldElementTemplateMap:s,shouldConsiderVisibility:o}){const i=[],r=s.get(e);if(null==r)return i;const a=n.get(r);if(null==a)return i;if(t(i,a.editableExpression),t(i,a.valueExpression),o){t(i,a.visibilityExpression);const{group:e}=r;if(null!=e){const s=n.get(e)?.visibilityExpression;t(i,s)}}return i}function f(e){const n=new Map;for(const t of e.keys())a(t)&&n.set(t.fieldName,t);return n}function m(t,s){const o=Array.from(t.values()).filter(e),i=new Set(o.flatMap(e=>{const{textExpressions:t,...s}=e,o=[];return t?.length&&n(o,t),n(o,Object.values(s)),o})),r=Array.from(i).filter(e).map(e=>({component:null,incomingCrossLinkNeighbors:new Set,executor:e,fieldsUsedNormalized:e.fieldsUsed.map(e=>s.normalizeFieldName(e)??e),index:-1,lowlink:-1,onStack:!1}));return new Map(r.map(e=>[e.executor,e]))}function x(e){return new Map([...e.values()].map(({component:e,executor:n})=>[n,e]))}function h({fieldReferencesMap:e,nodeInfoMap:n}){const t=new Map;for(const[s,o]of e.entries())t.set(s,y(o,n));return t}function y(e,n){const t=new Set;for(const s of e){const e=n.get(s);e?.component&&t.add(e.component)}return t}function E(e){return e.peek()?.index??-1}export{c as ExpressionsModel,l as StronglyConnectedComponent,p as getDirectDependencies};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{property as e,subclass as s}from"../../../core/accessorSupport/decorators.js";import r from"./InputBase.js";let o=class extends r{constructor(){super(...arguments),this.editType="NA"}get editable(){return this._evaluatedEditableExpression??!0}get valid(){return!0}get _evaluatedEditableExpression(){let t=!0,e=!0;for(const s of this.features){if(null==this.template.getExpressionExecutorsForLayer(s.layer)?.editableExpression){t=t&&!0;continue}e=!1;const r=this._lookupEvaluatedExpression(s,"editable");"success"===r?.status?t=t&&!0===r.result:t=!1}return e?null:t}};t([e()],o.prototype,"editable",null),t([e({readOnly:!0})],o.prototype,"valid",null),t([e()],o.prototype,"editType",void 0),t([e()],o.prototype,"_evaluatedEditableExpression",null),o=t([s("esri.widgets.BatchAttributeForm.inputs.EditableInput")],o);const i=o;export{i as default};
2
+ import{__decorate as e}from"tslib";import{property as t,subclass as s}from"../../../core/accessorSupport/decorators.js";import r from"./InputBase.js";let o=class extends r{constructor(){super(...arguments),this.editType="NA"}get editable(){return this._evaluatedEditableExpression??!0}get valid(){return!0}get _evaluatedEditableExpression(){let e=!0,t=!0;for(const s of this.features){if(null==this.template.getExpressionExecutorsForLayer(s.layer)?.editableExpression){e=e&&!0;continue}t=!1;const r=this._lookupEvaluatedExpression(s,"editableExpression");"success"===r?.status?e=e&&!0===r.result:e=!1}return t?null:e}};e([t()],o.prototype,"editable",null),e([t({readOnly:!0})],o.prototype,"valid",null),e([t()],o.prototype,"editType",void 0),e([t()],o.prototype,"_evaluatedEditableExpression",null),o=e([s("esri.widgets.BatchAttributeForm.inputs.EditableInput")],o);const i=o;export{i as default};
@@ -2,15 +2,15 @@ import type Graphic from "../../../Graphic.js";
2
2
  import type Field from "../../../layers/support/Field.js";
3
3
  import type EditableInput from "./EditableInput.js";
4
4
  import type GroupInput from "./GroupInput.js";
5
- import type MultipleChoiceController from "./support/MultipleChoiceController.js";
6
5
  import type { Input } from "../../../form/elements/inputs.js";
7
6
  import type { FieldValue } from "../../../layers/support/fieldUtils.js";
8
7
  import type { DomainUnion as Domain } from "../../../layers/support/types.js";
9
8
  import type { EditableInputProperties } from "./EditableInput.js";
9
+ import type { InputController } from "./support/controllerUtils.js";
10
10
  import type { MultipleChoiceOtherChoiceRenderState } from "./support/MultipleChoiceController.js";
11
11
  import type { FieldInputDataTypes } from "../../support/forms/types.js";
12
12
 
13
- export interface FieldInputProperties extends EditableInputProperties, Partial<Pick<FieldInput, "multipleChoiceController">> {}
13
+ export interface FieldInputProperties extends EditableInputProperties, Partial<Pick<FieldInput, "inputController">> {}
14
14
 
15
15
  /**
16
16
  * This is a read-only support class that represents a [field element](https://developers.arcgis.com/javascript/latest/references/core/form/elements/FieldElement/) in a [BatchAttributeForm](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/).
@@ -61,6 +61,8 @@ export default class FieldInput extends EditableInput<any> {
61
61
  get includeTimeOffset(): boolean;
62
62
  /** The configured input for this field. */
63
63
  get input(): Input | null | undefined;
64
+ /** @internal */
65
+ accessor inputController: InputController | null;
64
66
  /** An array of features that do not have a valid value for this field. */
65
67
  get invalidFeatures(): Graphic[];
66
68
  /** The input's label. */
@@ -69,8 +71,6 @@ export default class FieldInput extends EditableInput<any> {
69
71
  get maxLength(): number;
70
72
  /** The minimum length of the input. If no length is specified, the value is `-1`. */
71
73
  get minLength(): number;
72
- /** @internal */
73
- accessor multipleChoiceController: MultipleChoiceController | null;
74
74
  /**
75
75
  * The checked state derived from the current other-choice values across all features.
76
76
  *
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{isSome as t}from"../../../core/arrayUtils.js";import{property as i,subclass as l}from"../../../core/accessorSupport/decorators.js";import{isMultipleChoiceInput as r}from"../../../form/elements/inputs/inputUtils.js";import n from"../../../layers/support/CodedValue.js";import o from"../../../layers/support/CodedValueDomain.js";import{getDomainRange as a,validateDomainValue as s,dateTimeFieldValuesToNumericRange as u,isDomainValidForField as p}from"../../../layers/support/domainUtils.js";import{getFieldRange as d,isDateOnlyField as m,isTimeOnlyField as h,isTimestampOffsetField as c}from"../../../layers/support/fieldUtils.js";import{supportsFieldConfiguration as f}from"../../../layers/support/layerUtils.js";import y from"../../../layers/support/RangeDomain.js";import{isNumber as g}from"../../../support/guards.js";import x from"./EditableInput.js";import{getFieldInputDataType as b,visibilityCodeToBoolean as v,isFieldInputWithShowNoValueOptionInput as C,differentValuesString as V}from"./support/inputUtils.js";import F from"./support/MultipleChoiceController.js";import{otherChoiceCheckedPlaceholderValue as _}from"./support/multipleChoiceInputUtils.js";import{timeResolutionToStepMap as E}from"../../support/dateUtils.js";import{valuesAreEquivalent as M,getMaxLength as w,getMinLength as D,dateIsValid as O,validateFormValue as S}from"../../support/forms/formUtils.js";let k=class extends x{constructor(e){super(e),this.getExternalErrorForFeature=null,this.getFieldValueOptionsForFeature=null,this.group=null,this.multipleChoiceController=null,this.type="field",this.userHasChangedValue=!1,this._hasIntersectionWithElementFieldDomain=!1}initialize(){this.input&&r(this.input)&&(this.multipleChoiceController=new F({fieldInput:this}))}get compositeError(){if(this.valid)return null;const{errors:e}=this;if(e.length<this.features.length)return"batch-attribute-form-validation::features-have-different-errors";const t=e[0];for(const i of e)if(i.error!==t.error)return"batch-attribute-form-validation::features-have-different-errors";return t.error}get dataType(){return b(this.field)}get domain(){const e=this._allDomains.toArray();return this.calculateDomain(e)}get distinctValues(){if(this.featuresHaveSameValue)return[this.value];const e=new Set;for(const t of this.features)e.add(t.getAttribute(this.fieldName));return Array.from(e)}get editable(){return!!this.field.editable&&(this._evaluatedEditableExpression??!0)}get label(){const{label:e}=this.template,t=this._computeStringLiteralText(e);if(t)return t;const{field:i,layers:l}=this;if(1===l.length){const e=l[0];if(f(e)){const t=e.getFieldAlias(i.name);if(null!=t&&""!==t)return t}}return i.alias||i.name}get effectiveVisible(){return v(this.effectiveVisibilityCode)}get effectiveVisibilityCode(){const{visibilityCode:e}=this;if("visible"!==e)return e;const{group:t}=this;if(null==t)return e;const i=t.visibilityCode;return"hidden:visibility-expression:all-features"===i?"hidden:group-visibility-expression:all-features":"hidden:visibility-expression:some-features"===i?"hidden:group-visibility-expression:some-features":e}get errors(){return this._validate()}get featuresHaveSameValue(){const{fieldName:e}=this,t=this.features.at(0)?.getAttribute(e);return this.features.every(i=>M(i.getAttribute(e),t))}get field(){return this.template.field}get fieldName(){return this.field.name}get input(){return this.template.input}get invalidFeatures(){return this.errors.map(e=>e.feature)}get isSubtypeField(){return this.layers.some(e=>{if(e&&"subtypeField"in e){const{subtypeField:t,fieldsIndex:i}=e;return(i.get(t)?.name??t)===this.fieldName}return!1})}get showNoValueOptionEnabled(){const{input:e}=this;return!this.required&&(!C(e)||!0===e?.showNoValueOption)}get showNoValueLabel(){const{input:e}=this;return C(e)?e?.noValueOptionLabel:null}get includeTime(){const{template:e,field:t}=this;return"date"===this.dataType&&("time-only"===t.type||"date-only"!==t.type&&("datetime-picker"!==e.input?.type||e.input.includeTime))}get includeTimeOffset(){if("timestamp-offset"!==this.field.type)return!1;const{input:e}=this;return!e||"timestampoffset-picker"===e.type&&e.includeTimeOffset}get inputType(){return this.input?.type}get maxLength(){return w({dataType:this.dataType,field:this.field,input:this.input})}get minLength(){return D({dataType:this.dataType,field:this.field,input:this.input})}get multipleChoiceOtherChoiceCheckboxState(){return this.multipleChoiceController?.otherChoiceCheckboxState??{checked:!1,indeterminate:!1}}get range(){if("date"===this.dataType)return this._dateRange;const{domain:e,field:t}=this;if(e){const i=a(t,e);return{max:i?.max,min:i?.min}}const i=this._allDomains.toArray().every(e=>!e)?d(t):null;return{max:i?.max===Number.MAX_VALUE?null:i?.max??null,min:i?.min===-Number.MAX_VALUE?null:i?.min??null}}get required(){if(!this.editable)return!1;if(!this.field.nullable||this.isSubtypeField)return!0;const e=this.visible&&!1!==this.group?.visible,t=this._evaluatedRequiredExpression;return!(!e||null==t)&&t}get timeResolution(){const e=this.input;if(e&&("timestampoffset-picker"===e.type||"time-picker"===e.type))return e.timeResolution??"minutes"}get timeStep(){return null!=this.timeResolution?E.get(this.timeResolution):void 0}get valid(){return 0===this.errors.length||!this.editable}get value(){return this.featuresHaveSameValue?this.features.at(0)?.getAttribute(this.fieldName)??null:V}get valueIsOutOfDomain(){const{domain:e,value:t,field:i}=this;return!(!e||null==t)&&null!==s(i,t,e)}get visibilityCode(){return this.field.visible?this._fieldShouldHaveDomain&&null==this.domain?"hidden:no-domain-in-common":this._baseVisibilityCode:"hidden:field-definition"}get codedValueDomainOptions(){return"coded-value"===this.domain?.type?this.domain.codedValues.map(({name:e,code:t})=>({name:e,value:t})):[]}getExplicitMultipleChoiceOtherChoiceCheckedState(){return this.multipleChoiceController?.getExplicitOtherChoiceCheckedState()}getMultipleChoiceOtherChoiceRenderState(e){const t=this.multipleChoiceController?.otherChoiceRenderState;return t?{...t,label:t.label??e}:{fieldName:void 0,hint:"",label:e,shouldShow:!1,checkboxState:{checked:!1,indeterminate:!1},value:null,normalizedValue:null,maxLength:void 0,status:"idle"}}hasExplicitMultipleChoiceOtherChoiceCheckedState(){return this.multipleChoiceController?.hasExplicitOtherChoiceCheckedState()??!1}initializeExplicitMultipleChoiceOtherChoiceCheckedState(){this.multipleChoiceController?.initializeExplicitOtherChoiceCheckedState()}setExplicitMultipleChoiceOtherChoiceCheckedState(e){this.multipleChoiceController?.setExplicitOtherChoiceCheckedState(e)}get codedValueOptions(){const{getFieldValueOptionsForFeature:e}=this;if(1===this.features.length&&e){const t=this.features.at(0);return e({domain:this.domain??void 0,feature:t,fieldName:this.fieldName,layer:t.layer})}const t=this.codedValueDomainOptions,{value:i}=this,l=null==i||i===V||t.some(e=>e.value===i)?[]:[{name:`${i}`,value:i}];return{recommended:t,other:[],unsupported:l,containsEmptyOption:!1}}get _evaluatedRequiredExpression(){let e=!1,t=!0;const i=this.template;for(const l of this.features){if(null==i.getExpressionExecutorsForLayer(l.layer)?.requiredExpression)continue;t=!1;const r=this._lookupEvaluatedExpression(l,"required");"success"===r?.status?e=e||!0===r.result:e=!0}return t?null:e}get _allDomains(){const e=this.template.domain;return this.features.map(t=>{const i=t.layer.getFieldDomain(this.fieldName,{feature:t.plainGraphic});return"range"===i?.type||"range"===e?.type?i??this.template.domain:i})}get _fieldShouldHaveDomain(){return!!this._hasIntersectionWithElementFieldDomain||this._allDomains.some(t)}get _dateFormRange(){if("date"!==this.dataType)return{};const{input:e}=this;if(!e)return{};const{type:t}=e;let i={};if("date-picker"!==t&&"time-picker"!==t&&"timestampoffset-picker"!==t||(i=u(this.field,e.max,e.min)),"datetime-picker"===t){const{max:t,min:l}=e;i={max:null!=t&&O(t)?t.getTime():null,min:null!=l&&O(l)?l.getTime():null}}return{min:i.min,max:i.max,rawMax:i?.rawMax??null,rawMin:i?.rawMin??null}}get _dateRange(){const{_dateFormRange:e,template:t,field:i,domain:l}=this;if("date"!==this.dataType)return{};if(!l)return this._fieldShouldHaveDomain?{}:e;const r=a(i,l);if(!r)return e;const{max:n,min:o,rawMax:s,rawMin:u}=e,{type:p}=t.field;if("date"===p){const{max:e,min:t}=r;return{max:g(n)&&(null===e||null!=e&&n<=e)?n:e??null,min:g(o)&&(null===t||null!=t&&o>=t)?o:t??null}}if("date-only"===p||"time-only"===p||"timestamp-offset"===p){const{max:e,min:t,rawMax:i,rawMin:l}=r,a=g(n)&&s&&(null==e||n<e),p=g(o)&&u&&(null==t||o>t);return{max:a?n:e,min:p?o:t,rawMax:a?s:i,rawMin:p?u:l}}return{}}_validate(){const{dataType:e,fieldName:t,maxLength:i,minLength:l,range:r}=this,n=[],o=this.multipleChoiceController?.input;for(const a of this.features){const{layer:s}=a,u=s.getField(t)??this.field,p=s.getFieldDomain(t,{feature:a.plainGraphic}),d=this.calculateDomain([p]),m=d&&"coded-value"!==d.type?d:null,h=this._requiredForFeature(a),c=a.getAttribute(t);let f=S(c,{dataType:e,domain:m,field:u,maxLength:i,minLength:l,multipleChoice:o,range:r,required:h})??this.getExternalErrorForFeature?.(a,t);if(!f&&o&&this.multipleChoiceController){const{multipleChoiceController:e}=this,{otherChoice:t}=o,i=e.otherChoiceFieldName,l=e.shouldShowOtherChoice,r=e.otherChoiceEffectiveCheckboxState;if(l&&t&&i&&r.checked){const e=s.getField(i),t=a.getAttribute(i),l=t===_?null:t;if(e){const t=b(e);f=S(l,{dataType:t,domain:e.domain,field:e,maxLength:w({dataType:t,field:e,input:null}),minLength:D({dataType:t,field:e,input:null}),multipleChoice:null,range:{max:void 0,min:void 0},required:!0})}}}f&&n.push({error:f,feature:a.source})}return n}_editableForFeature(e){if(!this.field.editable)return!1;if(null==this.template.getExpressionExecutorsForLayer(e.layer)?.editableExpression)return!0;const t=this._lookupEvaluatedExpression(e,"editable");return"success"===t?.status&&!0===t.result}_effectiveVisibleFeature(e){if(this.group&&!this.group.visibleForFeature(e))return!1;if(null==this.template.getExpressionExecutorsForLayer(e.layer)?.visibilityExpression)return!0;const t=this._lookupEvaluatedExpression(e,"visibility");return"success"===t?.status&&!0===t.result}_requiredForFeature(e){if(!this._editableForFeature(e))return!1;if(!this.field.nullable||this.isSubtypeField)return!0;const t=this._effectiveVisibleFeature(e);if(null==this.template.getExpressionExecutorsForLayer(e.layer)?.requiredExpression)return!1;const i=this._lookupEvaluatedExpression(e,"required");return"success"!==i?.status?t:t&&!0===i.result}calculateDomain(e){const t=e.find(e=>null!=e),i=this.template.domain;if(!t)return i&&p(this.field,i)?i:null;switch(t.type){case"coded-value":if(e.some(e=>!e)){if(!i)return null;e=e.filter(e=>null!==e)}break;case"range":e=e.filter(e=>null!==e)}if(!e.every(e=>e?.type===t?.type))return null;let l=null;switch(t?.type){case"range":l=this._intersectRangeDomains(e);break;case"coded-value":l=this._intersectCodedValueDomains(e)}return l}_intersectCodedValueDomains(e){if(!e.length)return null;const t=new Map(e[0].codedValues.map(({code:e,name:t})=>[e,t])),i=this.template.domain?new Map(this.template.domain.codedValues.map(({code:e,name:t})=>[e,t])):null;for(const n of e)for(const[e,i]of t){n.codedValues.some(t=>t.code===e&&t.name===i)||t.delete(e)}let l=t;if(i){l=new Map;for(const[e,r]of i)t.has(e)&&l.set(e,r)}const r=Array.from(l.entries()).map(([e,t])=>new n({code:e,name:t}));return r.length?new o({codedValues:r}):null}_intersectRangeDomains(e){if(!e.length)return null;let t=e[0];for(let l=1;l<e.length;l++){if(!t)return null;t=this._findMinMaxValuesBetweenTwoDomains(t,e[l])}if(t&&!p(this.field,t))return null;const{domain:i}=this.template;if(t&&i&&i instanceof y){const e=this._findMinMaxValuesBetweenTwoDomains(t,i);return this._hasIntersectionWithElementFieldDomain=!!e,e}return t}_getMinMaxFromRangeDomain(e){const t=e.minValue,i=e.maxValue,{field:l}=this;return m(l)||h(l)||c(l)?u(l,i,t):{min:null!=t&&"number"==typeof t?t:null,max:null!=i&&"number"==typeof i?i:null}}_findMinMaxValuesBetweenTwoDomains(e,t){const i=new y,l=this._getMinMaxFromRangeDomain(e),r=this._getMinMaxFromRangeDomain(t),{field:n}=this,o=this._getValidRangeValue(l.min,-1/0),a=this._getValidRangeValue(l.max,1/0),s=this._getValidRangeValue(r.min,-1/0),u=this._getValidRangeValue(r.max,1/0);return i.minValue=Math.max(o,s),i.maxValue=Math.min(a,u),i.minValue===-1/0||i.maxValue===1/0||i.minValue>i.maxValue?null:((m(n)||h(n)||c(n))&&(i.minValue=Number(l.min)>Number(r.min)?l.rawMin:r.rawMin,i.maxValue=Number(l.max)<Number(r.max)?l.rawMax:r.rawMax),i.name="intersection",i)}_getValidRangeValue(e,t){return g(e)?e:t}};e([i()],k.prototype,"dataType",null),e([i()],k.prototype,"domain",null),e([i()],k.prototype,"distinctValues",null),e([i()],k.prototype,"editable",null),e([i()],k.prototype,"label",null),e([i()],k.prototype,"effectiveVisible",null),e([i()],k.prototype,"effectiveVisibilityCode",null),e([i()],k.prototype,"errors",null),e([i()],k.prototype,"featuresHaveSameValue",null),e([i()],k.prototype,"field",null),e([i()],k.prototype,"fieldName",null),e([i()],k.prototype,"getExternalErrorForFeature",void 0),e([i()],k.prototype,"getFieldValueOptionsForFeature",void 0),e([i()],k.prototype,"group",void 0),e([i()],k.prototype,"input",null),e([i()],k.prototype,"multipleChoiceController",void 0),e([i()],k.prototype,"invalidFeatures",null),e([i()],k.prototype,"isSubtypeField",null),e([i()],k.prototype,"showNoValueOptionEnabled",null),e([i()],k.prototype,"showNoValueLabel",null),e([i()],k.prototype,"includeTime",null),e([i()],k.prototype,"includeTimeOffset",null),e([i({readOnly:!0})],k.prototype,"inputType",null),e([i()],k.prototype,"maxLength",null),e([i()],k.prototype,"minLength",null),e([i()],k.prototype,"multipleChoiceOtherChoiceCheckboxState",null),e([i()],k.prototype,"range",null),e([i()],k.prototype,"required",null),e([i()],k.prototype,"timeResolution",null),e([i()],k.prototype,"timeStep",null),e([i({readOnly:!0})],k.prototype,"type",void 0),e([i()],k.prototype,"userHasChangedValue",void 0),e([i()],k.prototype,"valid",null),e([i()],k.prototype,"value",null),e([i()],k.prototype,"valueIsOutOfDomain",null),e([i()],k.prototype,"visibilityCode",null),e([i()],k.prototype,"codedValueDomainOptions",null),e([i()],k.prototype,"codedValueOptions",null),e([i()],k.prototype,"_evaluatedRequiredExpression",null),e([i()],k.prototype,"_hasIntersectionWithElementFieldDomain",void 0),e([i()],k.prototype,"_allDomains",null),e([i()],k.prototype,"_fieldShouldHaveDomain",null),e([i()],k.prototype,"_dateFormRange",null),e([i()],k.prototype,"_dateRange",null),k=e([l("esri.widgets.BatchAttributeForm.inputs.FieldInput")],k);const T=k;export{T as default};
2
+ import{__decorate as e}from"tslib";import{isSome as t}from"../../../core/arrayUtils.js";import{destroyMaybe as i}from"../../../core/maybe.js";import{property as r,subclass as n}from"../../../core/accessorSupport/decorators.js";import{isDynamicChoiceInput as l,isMultipleChoiceInput as o}from"../../../form/elements/inputs/inputUtils.js";import a from"../../../layers/support/CodedValue.js";import s from"../../../layers/support/CodedValueDomain.js";import{getDomainRange as u,validateDomainValue as p,dateTimeFieldValuesToNumericRange as d,isDomainValidForField as m}from"../../../layers/support/domainUtils.js";import{getFieldRange as h,isDateOnlyField as c,isTimeOnlyField as f,isTimestampOffsetField as y}from"../../../layers/support/fieldUtils.js";import{supportsFieldConfiguration as g}from"../../../layers/support/layerUtils.js";import x from"../../../layers/support/RangeDomain.js";import{isNumber as b}from"../../../support/guards.js";import v from"./EditableInput.js";import{isMultipleChoiceController as C}from"./support/controllerUtils.js";import V from"./support/DynamicChoiceController.js";import{getFieldInputDataType as F,visibilityCodeToBoolean as E,isFieldInputWithShowNoValueOptionInput as _,differentValuesString as w}from"./support/inputUtils.js";import M from"./support/MultipleChoiceController.js";import{otherChoiceCheckedPlaceholderValue as D}from"./support/multipleChoiceInputUtils.js";import{timeResolutionToStepMap as O}from"../../support/dateUtils.js";import{valuesAreEquivalent as S,getMaxLength as k,getMinLength as T,dateIsValid as R,validateFormValue as N}from"../../support/forms/formUtils.js";let L=class extends v{constructor(e){super(e),this.getExternalErrorForFeature=null,this.getFieldValueOptionsForFeature=null,this.group=null,this.inputController=null,this.type="field",this.userHasChangedValue=!1,this._hasIntersectionWithElementFieldDomain=!1}destroy(){this.inputController=i(this.inputController)}initialize(){this.input&&(l(this.input)&&(this.inputController=new V({fieldInput:this})),o(this.input)&&(this.inputController=new M({fieldInput:this})))}get compositeError(){if(this.valid)return null;const{errors:e}=this;if(e.length<this.features.length)return"batch-attribute-form-validation::features-have-different-errors";const t=e[0];for(const i of e)if(i.error!==t.error)return"batch-attribute-form-validation::features-have-different-errors";return t.error}get dataType(){return F(this.field)}get domain(){const e=this._allDomains.toArray();return this.calculateDomain(e)}get distinctValues(){if(this.featuresHaveSameValue)return[this.value];const e=new Set;for(const t of this.features)e.add(t.getAttribute(this.fieldName));return Array.from(e)}get editable(){return!!this.field.editable&&(this._evaluatedEditableExpression??!0)}get label(){const{label:e}=this.template,t=this._computeStringLiteralText(e);if(t)return t;const{field:i,layers:r}=this;if(1===r.length){const e=r[0];if(g(e)){const t=e.getFieldAlias(i.name);if(null!=t&&""!==t)return t}}return i.alias||i.name}get effectiveVisible(){return E(this.effectiveVisibilityCode)}get effectiveVisibilityCode(){const{visibilityCode:e}=this;if("visible"!==e)return e;const{group:t}=this;if(null==t)return e;const i=t.visibilityCode;return"hidden:visibility-expression:all-features"===i?"hidden:group-visibility-expression:all-features":"hidden:visibility-expression:some-features"===i?"hidden:group-visibility-expression:some-features":e}get errors(){return this._validate()}get featuresHaveSameValue(){const{fieldName:e}=this,t=this.features.at(0)?.getAttribute(e);return this.features.every(i=>S(i.getAttribute(e),t))}get field(){return this.template.field}get fieldName(){return this.field.name}get input(){return this.template.input}get invalidFeatures(){return this.errors.map(e=>e.feature)}get isSubtypeField(){return this.layers.some(e=>{if(e&&"subtypeField"in e){const{subtypeField:t,fieldsIndex:i}=e;return(i.get(t)?.name??t)===this.fieldName}return!1})}get showNoValueOptionEnabled(){const{input:e}=this;return!this.required&&(!_(e)||!0===e?.showNoValueOption)}get showNoValueLabel(){const{input:e}=this;return _(e)?e?.noValueOptionLabel:null}get includeTime(){const{template:e,field:t}=this;return"date"===this.dataType&&("time-only"===t.type||"date-only"!==t.type&&("datetime-picker"!==e.input?.type||e.input.includeTime))}get includeTimeOffset(){if("timestamp-offset"!==this.field.type)return!1;const{input:e}=this;return!e||"timestampoffset-picker"===e.type&&e.includeTimeOffset}get inputType(){return this.input?.type}get maxLength(){return k({dataType:this.dataType,field:this.field,input:this.input})}get minLength(){return T({dataType:this.dataType,field:this.field,input:this.input})}get multipleChoiceOtherChoiceCheckboxState(){return A(this.inputController)?.otherChoiceCheckboxState??{checked:!1,indeterminate:!1}}get range(){if("date"===this.dataType)return this._dateRange;const{domain:e,field:t}=this;if(e){const i=u(t,e);return{max:i?.max,min:i?.min}}const i=this._allDomains.toArray().every(e=>!e)?h(t):null;return{max:i?.max===Number.MAX_VALUE?null:i?.max??null,min:i?.min===-Number.MAX_VALUE?null:i?.min??null}}get required(){if(!this.editable)return!1;if(!this.field.nullable||this.isSubtypeField)return!0;const e=this.visible&&!1!==this.group?.visible,t=this._evaluatedRequiredExpression;return!(!e||null==t)&&t}get timeResolution(){const e=this.input;if(e&&("timestampoffset-picker"===e.type||"time-picker"===e.type))return e.timeResolution??"minutes"}get timeStep(){return null!=this.timeResolution?O.get(this.timeResolution):void 0}get valid(){return 0===this.errors.length||!this.editable}get value(){return this.featuresHaveSameValue?this.features.at(0)?.getAttribute(this.fieldName)??null:w}get valueIsOutOfDomain(){const{domain:e,value:t,field:i}=this;return!(!e||null==t)&&null!==p(i,t,e)}get visibilityCode(){return this.field.visible?this._fieldShouldHaveDomain&&null==this.domain?"hidden:no-domain-in-common":this._baseVisibilityCode:"hidden:field-definition"}get codedValueDomainOptions(){return"coded-value"===this.domain?.type?this.domain.codedValues.map(({name:e,code:t})=>({name:e,value:t})):[]}getExplicitMultipleChoiceOtherChoiceCheckedState(){return A(this.inputController)?.getExplicitOtherChoiceCheckedState()}getMultipleChoiceOtherChoiceRenderState(e){const t=A(this.inputController)?.otherChoiceRenderState;return t?{...t,label:t.label??e}:{fieldName:void 0,hint:"",label:e,shouldShow:!1,checkboxState:{checked:!1,indeterminate:!1},value:null,normalizedValue:null,maxLength:void 0,status:"idle"}}hasExplicitMultipleChoiceOtherChoiceCheckedState(){return A(this.inputController)?.hasExplicitOtherChoiceCheckedState()??!1}initializeExplicitMultipleChoiceOtherChoiceCheckedState(){A(this.inputController)?.initializeExplicitOtherChoiceCheckedState()}setExplicitMultipleChoiceOtherChoiceCheckedState(e){A(this.inputController)?.setExplicitOtherChoiceCheckedState(e)}get codedValueOptions(){const{getFieldValueOptionsForFeature:e}=this;if(1===this.features.length&&e){const t=this.features.at(0);return e({domain:this.domain??void 0,feature:t,fieldName:this.fieldName,layer:t.layer})}const t=this.codedValueDomainOptions,{value:i}=this,r=null==i||i===w||t.some(e=>e.value===i)?[]:[{name:`${i}`,value:i}];return{recommended:t,other:[],unsupported:r,containsEmptyOption:!1}}get _evaluatedRequiredExpression(){let e=!1,t=!0;const i=this.template;for(const r of this.features){if(null==i.getExpressionExecutorsForLayer(r.layer)?.requiredExpression)continue;t=!1;const n=this._lookupEvaluatedExpression(r,"requiredExpression");"success"===n?.status?e=e||!0===n.result:e=!0}return t?null:e}get _allDomains(){const e=this.template.domain;return this.features.map(t=>{const i=t.layer.getFieldDomain(this.fieldName,{feature:t.plainGraphic});return"range"===i?.type||"range"===e?.type?i??this.template.domain:i})}get _fieldShouldHaveDomain(){return!!this._hasIntersectionWithElementFieldDomain||this._allDomains.some(t)}get _dateFormRange(){if("date"!==this.dataType)return{};const{input:e}=this;if(!e)return{};const{type:t}=e;let i={};if("date-picker"!==t&&"time-picker"!==t&&"timestampoffset-picker"!==t||(i=d(this.field,e.max,e.min)),"datetime-picker"===t){const{max:t,min:r}=e;i={max:null!=t&&R(t)?t.getTime():null,min:null!=r&&R(r)?r.getTime():null}}return{min:i.min,max:i.max,rawMax:i?.rawMax??null,rawMin:i?.rawMin??null}}get _dateRange(){const{_dateFormRange:e,template:t,field:i,domain:r}=this;if("date"!==this.dataType)return{};if(!r)return this._fieldShouldHaveDomain?{}:e;const n=u(i,r);if(!n)return e;const{max:l,min:o,rawMax:a,rawMin:s}=e,{type:p}=t.field;if("date"===p){const{max:e,min:t}=n;return{max:b(l)&&(null===e||null!=e&&l<=e)?l:e??null,min:b(o)&&(null===t||null!=t&&o>=t)?o:t??null}}if("date-only"===p||"time-only"===p||"timestamp-offset"===p){const{max:e,min:t,rawMax:i,rawMin:r}=n,u=b(l)&&a&&(null==e||l<e),p=b(o)&&s&&(null==t||o>t);return{max:u?l:e,min:p?o:t,rawMax:u?a:i,rawMin:p?s:r}}return{}}_validate(){const{dataType:e,fieldName:t,maxLength:i,minLength:r,range:n}=this,l=[],o=C(this.inputController)?this.inputController:void 0,a=o?.input;for(const s of this.features){const{layer:u}=s,p=u.getField(t)??this.field,d=u.getFieldDomain(t,{feature:s.plainGraphic}),m=this.calculateDomain([d]),h=m&&"coded-value"!==m.type?m:null,c=this._requiredForFeature(s),f=s.getAttribute(t);let y=N(f,{dataType:e,domain:h,field:p,maxLength:i,minLength:r,multipleChoice:a,range:n,required:c})??this.getExternalErrorForFeature?.(s,t);if(!y&&a&&o){const{otherChoice:e}=a,t=o.otherChoiceFieldName,i=o.shouldShowOtherChoice,r=o.otherChoiceEffectiveCheckboxState;if(i&&e&&t&&r.checked){const e=u.getField(t),i=s.getAttribute(t),r=i===D?null:i;if(e){const t=F(e);y=N(r,{dataType:t,domain:e.domain,field:e,maxLength:k({dataType:t,field:e,input:null}),minLength:T({dataType:t,field:e,input:null}),multipleChoice:null,range:{max:void 0,min:void 0},required:!0})}}}y&&l.push({error:y,feature:s.source})}return l}_editableForFeature(e){if(!this.field.editable)return!1;if(null==this.template.getExpressionExecutorsForLayer(e.layer)?.editableExpression)return!0;const t=this._lookupEvaluatedExpression(e,"editableExpression");return"success"===t?.status&&!0===t.result}_effectiveVisibleFeature(e){if(this.group&&!this.group.visibleForFeature(e))return!1;if(null==this.template.getExpressionExecutorsForLayer(e.layer)?.visibilityExpression)return!0;const t=this._lookupEvaluatedExpression(e,"visibilityExpression");return"success"===t?.status&&!0===t.result}_requiredForFeature(e){if(!this._editableForFeature(e))return!1;if(!this.field.nullable||this.isSubtypeField)return!0;const t=this._effectiveVisibleFeature(e);if(null==this.template.getExpressionExecutorsForLayer(e.layer)?.requiredExpression)return!1;const i=this._lookupEvaluatedExpression(e,"requiredExpression");return"success"!==i?.status?t:t&&!0===i.result}calculateDomain(e){const t=e.find(e=>null!=e),i=this.template.domain;if(!t)return i&&m(this.field,i)?i:null;switch(t.type){case"coded-value":if(e.some(e=>!e)){if(!i)return null;e=e.filter(e=>null!==e)}break;case"range":e=e.filter(e=>null!==e)}if(!e.every(e=>e?.type===t?.type))return null;let r=null;switch(t?.type){case"range":r=this._intersectRangeDomains(e);break;case"coded-value":r=this._intersectCodedValueDomains(e)}return r}_intersectCodedValueDomains(e){if(!e.length)return null;const t=new Map(e[0].codedValues.map(({code:e,name:t})=>[e,t])),i=this.template.domain?new Map(this.template.domain.codedValues.map(({code:e,name:t})=>[e,t])):null;for(const l of e)for(const[e,i]of t){l.codedValues.some(t=>t.code===e&&t.name===i)||t.delete(e)}let r=t;if(i){r=new Map;for(const[e,n]of i)t.has(e)&&r.set(e,n)}const n=Array.from(r.entries()).map(([e,t])=>new a({code:e,name:t}));return n.length?new s({codedValues:n}):null}_intersectRangeDomains(e){if(!e.length)return null;let t=e[0];for(let r=1;r<e.length;r++){if(!t)return null;t=this._findMinMaxValuesBetweenTwoDomains(t,e[r])}if(t&&!m(this.field,t))return null;const{domain:i}=this.template;if(t&&i&&i instanceof x){const e=this._findMinMaxValuesBetweenTwoDomains(t,i);return this._hasIntersectionWithElementFieldDomain=!!e,e}return t}_getMinMaxFromRangeDomain(e){const t=e.minValue,i=e.maxValue,{field:r}=this;return c(r)||f(r)||y(r)?d(r,i,t):{min:null!=t&&"number"==typeof t?t:null,max:null!=i&&"number"==typeof i?i:null}}_findMinMaxValuesBetweenTwoDomains(e,t){const i=new x,r=this._getMinMaxFromRangeDomain(e),n=this._getMinMaxFromRangeDomain(t),{field:l}=this,o=this._getValidRangeValue(r.min,-1/0),a=this._getValidRangeValue(r.max,1/0),s=this._getValidRangeValue(n.min,-1/0),u=this._getValidRangeValue(n.max,1/0);return i.minValue=Math.max(o,s),i.maxValue=Math.min(a,u),i.minValue===-1/0||i.maxValue===1/0||i.minValue>i.maxValue?null:((c(l)||f(l)||y(l))&&(i.minValue=Number(r.min)>Number(n.min)?r.rawMin:n.rawMin,i.maxValue=Number(r.max)<Number(n.max)?r.rawMax:n.rawMax),i.name="intersection",i)}_getValidRangeValue(e,t){return b(e)?e:t}};e([r()],L.prototype,"dataType",null),e([r()],L.prototype,"domain",null),e([r()],L.prototype,"distinctValues",null),e([r()],L.prototype,"editable",null),e([r()],L.prototype,"label",null),e([r()],L.prototype,"effectiveVisible",null),e([r()],L.prototype,"effectiveVisibilityCode",null),e([r()],L.prototype,"errors",null),e([r()],L.prototype,"featuresHaveSameValue",null),e([r()],L.prototype,"field",null),e([r()],L.prototype,"fieldName",null),e([r()],L.prototype,"getExternalErrorForFeature",void 0),e([r()],L.prototype,"getFieldValueOptionsForFeature",void 0),e([r()],L.prototype,"group",void 0),e([r()],L.prototype,"input",null),e([r()],L.prototype,"inputController",void 0),e([r()],L.prototype,"invalidFeatures",null),e([r()],L.prototype,"isSubtypeField",null),e([r()],L.prototype,"showNoValueOptionEnabled",null),e([r()],L.prototype,"showNoValueLabel",null),e([r()],L.prototype,"includeTime",null),e([r()],L.prototype,"includeTimeOffset",null),e([r({readOnly:!0})],L.prototype,"inputType",null),e([r()],L.prototype,"maxLength",null),e([r()],L.prototype,"minLength",null),e([r()],L.prototype,"multipleChoiceOtherChoiceCheckboxState",null),e([r()],L.prototype,"range",null),e([r()],L.prototype,"required",null),e([r()],L.prototype,"timeResolution",null),e([r()],L.prototype,"timeStep",null),e([r({readOnly:!0})],L.prototype,"type",void 0),e([r()],L.prototype,"userHasChangedValue",void 0),e([r()],L.prototype,"valid",null),e([r()],L.prototype,"value",null),e([r()],L.prototype,"valueIsOutOfDomain",null),e([r()],L.prototype,"visibilityCode",null),e([r()],L.prototype,"codedValueDomainOptions",null),e([r()],L.prototype,"codedValueOptions",null),e([r()],L.prototype,"_evaluatedRequiredExpression",null),e([r()],L.prototype,"_hasIntersectionWithElementFieldDomain",void 0),e([r()],L.prototype,"_allDomains",null),e([r()],L.prototype,"_fieldShouldHaveDomain",null),e([r()],L.prototype,"_dateFormRange",null),e([r()],L.prototype,"_dateRange",null),L=e([n("esri.widgets.BatchAttributeForm.inputs.FieldInput")],L);const j=L;function A(e){return C(e)?e:null}export{j as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{destroyMaybe as s}from"../../../core/maybe.js";import{property as e,subclass as i}from"../../../core/accessorSupport/decorators.js";import o from"./InputBase.js";import{visibilityCodeToBoolean as r}from"./support/inputUtils.js";let p=class extends o{constructor(t){super(t),this.inputs=[],this.staleInputs=new Map,this.type="group"}initialize(){for(const t of this.inputs)t.group=this}destroy(){this.inputs.forEach(t=>s(t))}get open(){return"expanded"===this.template.initialState}set open(t){this._override("open",t)}get visible(){return r(this.visibilityCode)&&this.inputs.some(t=>t.visible)}visibleForFeature(t){if(null==this.template.getExpressionExecutorsForLayer(t.layer)?.visibilityExpression)return!0;const s=this._lookupEvaluatedExpression(t,"visibility");return"success"===s?.status&&!0===s.result}};t([e()],p.prototype,"inputs",void 0),t([e({readOnly:!0})],p.prototype,"type",void 0),t([e()],p.prototype,"open",null),t([e()],p.prototype,"visible",null),p=t([i("esri.widgets.BatchAttributeForm.inputs.GroupInput")],p);const n=p;export{n as default};
2
+ import{__decorate as t}from"tslib";import{destroyMaybe as s}from"../../../core/maybe.js";import{property as e,subclass as i}from"../../../core/accessorSupport/decorators.js";import o from"./InputBase.js";import{visibilityCodeToBoolean as r}from"./support/inputUtils.js";let p=class extends o{constructor(t){super(t),this.inputs=[],this.staleInputs=new Map,this.type="group"}initialize(){for(const t of this.inputs)t.group=this}destroy(){this.inputs.forEach(t=>s(t))}get open(){return"expanded"===this.template.initialState}set open(t){this._override("open",t)}get visible(){return r(this.visibilityCode)&&this.inputs.some(t=>t.visible)}visibleForFeature(t){if(null==this.template.getExpressionExecutorsForLayer(t.layer)?.visibilityExpression)return!0;const s=this._lookupEvaluatedExpression(t,"visibilityExpression");return"success"===s?.status&&!0===s.result}};t([e()],p.prototype,"inputs",void 0),t([e({readOnly:!0})],p.prototype,"type",void 0),t([e()],p.prototype,"open",null),t([e()],p.prototype,"visible",null),p=t([i("esri.widgets.BatchAttributeForm.inputs.GroupInput")],p);const n=p;export{n 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 t from"../../../core/Accessor.js";import i from"../../../core/Collection.js";import{property as s,subclass as r}from"../../../core/accessorSupport/decorators.js";import{getEffectiveTimeZone as o,isAttributeFormSupportedLayerUnion as l}from"../batchAttributeFormUtils.js";import{parseFormTemplateString as a}from"../stringUtils.js";import{visibilityCodeToBoolean as n,makeUseId as p}from"./support/inputUtils.js";import{isEmptyValue as u}from"../../support/forms/formUtils.js";let y=class extends t{constructor(e){super(e),this.existsInAllLayers=!0,this.features=new i}get description(){return this._computeStringLiteralText(this.template.description)}get effectiveTimeZone(){return o(this.template.formTimeZone,this.template.layerTimeZone)}get featuresHaveSameCalculatedVisibility(){const e=new Set;for(const t of this.features){if(null==this.template.getExpressionExecutorsForLayer(t.layer)?.visibilityExpression){e.add(!0);continue}const i=this._lookupEvaluatedExpression(t,"visibility");if("success"===i?.status){if(e.add(!0===i.result),e.size>1)return!1}else e.add(!1)}return e.size<=1}get label(){return this._computeStringLiteralText(this.template.label)}get layers(){return Array.from(new Set(this.features.map(e=>e.layer).filter(l)))}get visibilityCode(){return this._baseVisibilityCode}get visible(){return n(this.visibilityCode)}get _baseVisibilityCode(){return this.existsInAllLayers?this.featuresHaveSameCalculatedVisibility?!1===this._evaluatedVisibilityExpression?"hidden:visibility-expression:all-features":"visible":"hidden:visibility-expression:some-features":"hidden:not-in-all-layers"}get _evaluatedVisibilityExpression(){let e=!0,t=!0;for(const i of this.features){if(null==this.template.getExpressionExecutorsForLayer(i.layer)?.visibilityExpression){e=e&&!0;continue}t=!1;const s=this._lookupEvaluatedExpression(i,"visibility");"success"===s?.status?e=e&&!0===s.result:e=!1}return t?null:e}_lookupEvaluatedExpression(e,t,i){return this.expressionsManager.evaluatedExpressions.get(e)?.get(p({elementId:this.template.elementId,executorPurpose:t,textExpressionIndex:i}))}_computeStringLiteralText(e){const t=this.features.getItemAt(0);return!t||1!==this.features.length||u(e)?e:a({attributes:t.attributes,label:e,layer:t.layer,timeZone:this.effectiveTimeZone})}};e([s({constructOnly:!0})],y.prototype,"expressionsManager",void 0),e([s()],y.prototype,"description",null),e([s()],y.prototype,"effectiveTimeZone",null),e([s()],y.prototype,"existsInAllLayers",void 0),e([s()],y.prototype,"features",void 0),e([s()],y.prototype,"featuresHaveSameCalculatedVisibility",null),e([s()],y.prototype,"label",null),e([s()],y.prototype,"layers",null),e([s({constructOnly:!0})],y.prototype,"template",void 0),e([s()],y.prototype,"visibilityCode",null),e([s()],y.prototype,"visible",null),e([s()],y.prototype,"_baseVisibilityCode",null),e([s()],y.prototype,"_evaluatedVisibilityExpression",null),y=e([r("esri.widgets.BatchAttributeForm.inputs.InputBase")],y);const m=y;export{m as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import i from"../../../core/Collection.js";import{property as s,subclass as r}from"../../../core/accessorSupport/decorators.js";import{getEffectiveTimeZone as o,isAttributeFormSupportedLayerUnion as l}from"../batchAttributeFormUtils.js";import{parseFormTemplateString as a}from"../stringUtils.js";import{visibilityCodeToBoolean as n,makeUseId as p}from"./support/inputUtils.js";import{isEmptyValue as u}from"../../support/forms/formUtils.js";let y=class extends t{constructor(e){super(e),this.existsInAllLayers=!0,this.features=new i}get description(){return this._computeStringLiteralText(this.template.description)}get effectiveTimeZone(){return o(this.template.formTimeZone,this.template.layerTimeZone)}get featuresHaveSameCalculatedVisibility(){const e=new Set;for(const t of this.features){if(null==this.template.getExpressionExecutorsForLayer(t.layer)?.visibilityExpression){e.add(!0);continue}const i=this._lookupEvaluatedExpression(t,"visibilityExpression");if("success"===i?.status){if(e.add(!0===i.result),e.size>1)return!1}else e.add(!1)}return e.size<=1}get label(){return this._computeStringLiteralText(this.template.label)}get layers(){return Array.from(new Set(this.features.map(e=>e.layer).filter(l)))}get visibilityCode(){return this._baseVisibilityCode}get visible(){return n(this.visibilityCode)}get _baseVisibilityCode(){return this.existsInAllLayers?this.featuresHaveSameCalculatedVisibility?!1===this._evaluatedVisibilityExpression?"hidden:visibility-expression:all-features":"visible":"hidden:visibility-expression:some-features":"hidden:not-in-all-layers"}get _evaluatedVisibilityExpression(){let e=!0,t=!0;for(const i of this.features){if(null==this.template.getExpressionExecutorsForLayer(i.layer)?.visibilityExpression){e=e&&!0;continue}t=!1;const s=this._lookupEvaluatedExpression(i,"visibilityExpression");"success"===s?.status?e=e&&!0===s.result:e=!1}return t?null:e}_lookupEvaluatedExpression(e,t,i){return this.expressionsManager.evaluatedExpressions.get(e)?.get(p({elementId:this.template.elementId,executorPurpose:t,textExpressionIndex:i}))}_computeStringLiteralText(e){const t=this.features.getItemAt(0);return!t||1!==this.features.length||u(e)?e:a({attributes:t.attributes,label:e,layer:t.layer,timeZone:this.effectiveTimeZone})}};e([s({constructOnly:!0})],y.prototype,"expressionsManager",void 0),e([s()],y.prototype,"description",null),e([s()],y.prototype,"effectiveTimeZone",null),e([s()],y.prototype,"existsInAllLayers",void 0),e([s()],y.prototype,"features",void 0),e([s()],y.prototype,"featuresHaveSameCalculatedVisibility",null),e([s()],y.prototype,"label",null),e([s()],y.prototype,"layers",null),e([s({constructOnly:!0})],y.prototype,"template",void 0),e([s()],y.prototype,"visibilityCode",null),e([s()],y.prototype,"visible",null),e([s()],y.prototype,"_baseVisibilityCode",null),e([s()],y.prototype,"_evaluatedVisibilityExpression",null),y=e([r("esri.widgets.BatchAttributeForm.inputs.InputBase")],y);const m=y;export{m as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{renderingSanitizer as e}from"../../../core/sanitizerUtils.js";import{property as r,subclass as s}from"../../../core/accessorSupport/decorators.js";import o from"./InputBase.js";import i from"./SingleFeatureInputAdapter.js";import{assembleStringFromParts as p}from"./support/textElementInputUtils.js";let n=class extends o{constructor(t){super(t),this.group=null,this.single=new i({input:this}),this.type="text"}get feature(){return this.single.feature}get layer(){return this.single.layer}get text(){const{expressionParts:t,literalParts:r}=this.template,s=this.feature;if(!s)return e.sanitize(r.join(" "));const o=[];for(let e=0;e<t.length;e++){const t=this._lookupEvaluatedExpression(s,"text",e);"success"===t?.status?o.push(`${t.result}`):o.push("")}return e.sanitize(p(r,o))}};t([r()],n.prototype,"feature",null),t([r()],n.prototype,"group",void 0),t([r()],n.prototype,"layer",null),t([r()],n.prototype,"single",void 0),t([r()],n.prototype,"text",null),t([r()],n.prototype,"type",void 0),n=t([s("esri.widgets.BatchAttributeForm.inputs.TextElementInput")],n);const u=n;export{u as default};
2
+ import{__decorate as t}from"tslib";import{renderingSanitizer as e}from"../../../core/sanitizerUtils.js";import{property as r,subclass as s}from"../../../core/accessorSupport/decorators.js";import o from"./InputBase.js";import i from"./SingleFeatureInputAdapter.js";import{assembleStringFromParts as p}from"./support/textElementInputUtils.js";let n=class extends o{constructor(t){super(t),this.group=null,this.single=new i({input:this}),this.type="text"}get feature(){return this.single.feature}get layer(){return this.single.layer}get text(){const{expressionParts:t,literalParts:r}=this.template,s=this.feature;if(!s)return e.sanitize(r.join(" "));const o=[];for(let e=0;e<t.length;e++){const t=this._lookupEvaluatedExpression(s,"textExpressions",e);"success"===t?.status?o.push(`${t.result}`):o.push("")}return e.sanitize(p(r,o))}};t([r()],n.prototype,"feature",null),t([r()],n.prototype,"group",void 0),t([r()],n.prototype,"layer",null),t([r()],n.prototype,"single",void 0),t([r()],n.prototype,"text",null),t([r()],n.prototype,"type",void 0),n=t([s("esri.widgets.BatchAttributeForm.inputs.TextElementInput")],n);const u=n;export{u as default};
@@ -0,0 +1,12 @@
1
+ import type Accessor from "../../../../core/Accessor.js";
2
+ import type FieldInput from "../FieldInput.js";
3
+
4
+ /** @internal */
5
+ export type FieldInputWithDynamicChoice = FieldInput;
6
+
7
+ /**
8
+ * Manages state and computes values for dynamic-choice inputs in BatchAttributeForm field inputs.
9
+ *
10
+ * @internal
11
+ */
12
+ export default abstract class DynamicChoiceController extends Accessor {}
@@ -0,0 +1,2 @@
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 o}from"../../../../core/asyncUtils.js";import s from"../../../../core/Logger.js";import{getOrCreateMapValue as i}from"../../../../core/MapUtils.js";import{abortMaybe as r}from"../../../../core/maybe.js";import{ignoreAbortErrors as n,throwIfAborted as a}from"../../../../core/promiseUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as p}from"../../../../core/support/UpdatingHandles.js";import{makeArcadeContext as u,castArcadeValue as h}from"../../expressions/expressionUtils.js";let d=class extends t{constructor(e){super(e),this.filterValue="",this._choices=[],this._expressionTask=null,this._updatingHandles=new p}destroy(){r(this._expressionTask),this._updatingHandles.destroy()}get arcadeContextInfo(){return this.fieldInput.expressionsManager.arcadeContext}get choices(){return this._choices}get evaluating(){return this._updatingHandles.updating}get features(){return this.fieldInput.features}get filteredChoices(){const e=this.choices,t=this.filterValue.trim().toLocaleLowerCase();return t?e.filter((e,o)=>this._normalizedChoiceNames[o].includes(t)):e}get input(){return this.fieldInput.input}get _normalizedChoiceNames(){return this._choices.map(({name:e})=>e.toLocaleLowerCase())}async evaluateChoiceExpression(){this._expressionTask=r(this._expressionTask);const e=o(e=>this._evaluateChoiceExpression(e));this._expressionTask=e;try{return await n(this._updatingHandles.addPromise(e.promise))??this.choices}finally{this._expressionTask===e&&(this._expressionTask=null)}}async _evaluateChoiceExpression(e){const t=await(import("../../../../arcade/languageUtils.js"));a(e);const o=this.arcadeContextInfo,s=this.fieldInput.field,r=new Array(this.features.length),n=new Map;let c;this.features.forEach((t,s)=>{const a=this.fieldInput.template.getChoiceExpressionExecutorForLayer(t.layer);if(!a)return void(r[s]=[]);const l=u(o,t,e);c||(c=l.executeContext),i(n,a,()=>[]).push({index:s,variables:l.variables})});for(const[i,p]of n){const n=await i.executeAsyncBatch(p,({variables:e})=>e,c);a(e);for(let e=0;e<n.length;e++){const i=n[e];"rejected"!==i.status?r[p[e].index]=this._parseChoices(i.value,o,s,t):r[p[e].index]=[]}}const l=g(m(r));return this._choices=l,l}_parseChoices(e,t,o,s){if(!s.isDictionary(e))return y(this),[];const i=e.hasField("choices")?e.field("choices"):null,r=s.isImmutableArray(i)?i.toArray():Array.isArray(i)?i:[],n=[];for(const a of r){if(!s.isDictionary(a)||!a.hasField("name")||!a.hasField("code")){y(this);continue}const e=a.field("name"),i=a.field("code");if("string"!=typeof e||void 0===i||s.isVoid(i)||s.isFunctionParameter(i)){y(this);continue}const r=h(i,o,t.timeZone,s);null!=r&&n.push({name:e,code:r})}return n}};e([c()],d.prototype,"arcadeContextInfo",null),e([c()],d.prototype,"choices",null),e([c()],d.prototype,"evaluating",null),e([c()],d.prototype,"features",null),e([c({constructOnly:!0})],d.prototype,"fieldInput",void 0),e([c()],d.prototype,"filteredChoices",null),e([c()],d.prototype,"filterValue",void 0),e([c()],d.prototype,"input",null),e([c()],d.prototype,"_choices",void 0),e([c()],d.prototype,"_normalizedChoiceNames",null),d=e([l("esri.widgets.BatchAttributeForm.inputs.support.DynamicChoiceController")],d);const f=d;function m(e){const[t,...o]=e;if(!t)return[];let s=t;for(const r of o.sort((e,t)=>e.length-t.length)){if(!r.length)return[];const e=new Map;for(const{code:t,name:o}of r)i(e,t,()=>new Set).add(o);if(s=s.filter(({code:t,name:o})=>e.get(t)?.has(o)),!s.length)break}return s}function g(e){const t=new Set;return e.filter(({code:e})=>!t.has(e)&&(t.add(e),!0))}function y(e){s.getLogger(e).error("Value returned by choice expression does not conform to specification.")}export{f as default};
@@ -0,0 +1,5 @@
1
+ import type DynamicChoiceController from "./DynamicChoiceController.js";
2
+ import type MultipleChoiceController from "./MultipleChoiceController.js";
3
+
4
+ /** @internal */
5
+ export type InputController = DynamicChoiceController | MultipleChoiceController;
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import o from"./MultipleChoiceController.js";function r(r){return r instanceof o}export{r as isMultipleChoiceController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../core/Error.js";import t from"../AttachmentElementInput.js";import s from"../BatchFormInputs.js";import r from"../FieldInput.js";import n from"../GroupInput.js";import o from"../RelationshipElementInput.js";import p from"../TextElementInput.js";import a from"../UtilityNetworkAssociationsElementInput.js";import{hashGroupElementTemplateWithoutChildren as i}from"../../templates/support/hashElementTemplate.js";import{isFieldElementTemplate as l,isGroupElementTemplate as u,isRelationshipElementTemplate as m,isTextElementTemplate as f,isAttachmentElementTemplate as c,isUtilityNetworkAssociationsElementTemplate as g}from"../../templates/support/templateUtils.js";function h(e,t){const r=new s({inputs:e.elements.map(e=>w(e,t)),template:e});return F(r),r}function I(e,t,s){const r=h(t,s),{mergedInputs:n}=d(e.inputs,r.inputs,e.staleInputs);e.template=t,e.inputs=n,F(e)}function d(e,t,s){const r=new Set,n=[],o=new Map(e.map(e=>[y(e),e]));for(const p of t){const e=y(p);r.add(e);const t=o.get(e);if(t){x(t,p),n.push(t),p.destroy();continue}const a=s.get(e);a?(x(a,p),n.push(a),s.delete(e),p.destroy()):n.push(p)}for(const p of e){const e=y(p);r.has(e)||s.set(e,p)}return{mergedInputs:n}}function x(e,t){if(e.features=t.features,e.existsInAllLayers=t.existsInAllLayers,"group"!==e.type||"group"!==t.type)return;const{mergedInputs:s}=d(e.inputs,t.inputs,e.staleInputs);e.inputs=s;for(const r of s)r.group=e}function y(e){return"group"===e.type?i(e.template):e.template.elementId}function F(e){const t=e.allFieldInputs,s=new Set(t.map(e=>e.fieldName));for(const r of t){const e=r.multipleChoiceController,t=e?.otherChoiceFieldName;if(!t)continue;const n=r.layers[0]?.getField(t)?.name??t;s.has(n)&&(e.shouldShowOtherChoice=!1)}}function w(s,i){const{allFeatures:h,expressionsManager:I,getFieldValueOptionsForFeature:d,getExternalErrorForFeature:x,map:y}=i,F=new Set(s.layers),j=h.filter(e=>F.has(e.layer)),A=j.length===h.length;if(l(s))return new r({existsInAllLayers:A,features:j,template:s,expressionsManager:I,getExternalErrorForFeature:x,getFieldValueOptionsForFeature:d});if(u(s)){const e=s.elements.map(e=>w(e,i));return new n({existsInAllLayers:A,features:j,inputs:e,template:s,expressionsManager:I})}if(m(s))return new o({existsInAllLayers:A,features:j,map:y,template:s,expressionsManager:I});if(f(s))return new p({existsInAllLayers:A,features:j,template:s,expressionsManager:I});if(c(s))return new t({existsInAllLayers:A,features:j,template:s,expressionsManager:I});if(g(s))return new a({existsInAllLayers:A,features:j,template:s,expressionsManager:I,map:y});throw new e("batch-attribute-form:unsupported-element-template","The type of form element template provided is not supported")}export{h as createBatchFormInputsFromBatchFormTemplate,I as mergeBatchFormInputsFromNewTemplate};
2
+ import e from"../../../../core/Error.js";import t from"../AttachmentElementInput.js";import n from"../BatchFormInputs.js";import r from"../FieldInput.js";import s from"../GroupInput.js";import o from"../RelationshipElementInput.js";import p from"../TextElementInput.js";import a from"../UtilityNetworkAssociationsElementInput.js";import{isMultipleChoiceController as l}from"./controllerUtils.js";import{hashGroupElementTemplateWithoutChildren as i}from"../../templates/support/hashElementTemplate.js";import{isFieldElementTemplate as u,isGroupElementTemplate as m,isRelationshipElementTemplate as f,isTextElementTemplate as c,isAttachmentElementTemplate as g,isUtilityNetworkAssociationsElementTemplate as I}from"../../templates/support/templateUtils.js";function d(e,t){const r=new n({inputs:e.elements.map(e=>j(e,t)),template:e});return w(r),r}function h(e,t,n){const r=d(t,n),{mergedInputs:s}=x(e.inputs,r.inputs,e.staleInputs);e.template=t,e.inputs=s,w(e)}function x(e,t,n){const r=new Set,s=[],o=new Map(e.map(e=>[F(e),e]));for(const p of t){const e=F(p);r.add(e);const t=o.get(e);if(t){y(t,p),s.push(t),p.destroy();continue}const a=n.get(e);a?(y(a,p),s.push(a),n.delete(e),p.destroy()):s.push(p)}for(const p of e){const e=F(p);r.has(e)||n.set(e,p)}return{mergedInputs:s}}function y(e,t){if(e.features=t.features,e.existsInAllLayers=t.existsInAllLayers,e instanceof r&&t instanceof r&&e.template.foldIn(t.template),"group"!==e.type||"group"!==t.type)return;const{mergedInputs:n}=x(e.inputs,t.inputs,e.staleInputs);e.inputs=n;for(const r of n)r.group=e}function F(e){return"group"===e.type?i(e.template):e.template.elementId}function w(e){const t=e.allFieldInputs,n=new Set(t.map(e=>e.fieldName));for(const r of t){const e=l(r.inputController)?r.inputController:null,t=e?.otherChoiceFieldName;if(!t)continue;const s=r.layers[0]?.getField(t)?.name??t;n.has(s)&&(e.shouldShowOtherChoice=!1)}}function j(n,l){const{allFeatures:i,expressionsManager:d,getFieldValueOptionsForFeature:h,getExternalErrorForFeature:x,map:y}=l,F=new Set(n.layers),w=i.filter(e=>F.has(e.layer)),A=w.length===i.length;if(u(n))return new r({existsInAllLayers:A,features:w,template:n,expressionsManager:d,getExternalErrorForFeature:x,getFieldValueOptionsForFeature:h});if(m(n)){const e=n.elements.map(e=>j(e,l));return new s({existsInAllLayers:A,features:w,inputs:e,template:n,expressionsManager:d})}if(f(n))return new o({existsInAllLayers:A,features:w,map:y,template:n,expressionsManager:d});if(c(n))return new p({existsInAllLayers:A,features:w,template:n,expressionsManager:d});if(g(n))return new t({existsInAllLayers:A,features:w,template:n,expressionsManager:d});if(I(n))return new a({existsInAllLayers:A,features:w,template:n,expressionsManager:d,map:y});throw new e("batch-attribute-form:unsupported-element-template","The type of form element template provided is not supported")}export{d as createBatchFormInputsFromBatchFormTemplate,h as mergeBatchFormInputsFromNewTemplate};