@arcgis/core 5.2.0-next.111 → 5.2.0-next.112
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/components/assets/icon/alignBottom16.json +1 -0
- package/assets/components/assets/icon/alignBottom24.json +1 -0
- package/assets/components/assets/icon/alignBottom32.json +1 -0
- package/assets/components/assets/icon/alignCenterHorizontal16.json +1 -0
- package/assets/components/assets/icon/alignCenterHorizontal24.json +1 -0
- package/assets/components/assets/icon/alignCenterHorizontal32.json +1 -0
- package/assets/components/assets/icon/alignCenterVertical16.json +1 -0
- package/assets/components/assets/icon/alignCenterVertical24.json +1 -0
- package/assets/components/assets/icon/alignCenterVertical32.json +1 -0
- package/assets/components/assets/icon/alignLeft16.json +1 -0
- package/assets/components/assets/icon/alignLeft24.json +1 -0
- package/assets/components/assets/icon/alignLeft32.json +1 -0
- package/assets/components/assets/icon/alignRight16.json +1 -0
- package/assets/components/assets/icon/alignRight24.json +1 -0
- package/assets/components/assets/icon/alignRight32.json +1 -0
- package/assets/components/assets/icon/alignTop16.json +1 -0
- package/assets/components/assets/icon/alignTop24.json +1 -0
- package/assets/components/assets/icon/alignTop32.json +1 -0
- package/assets/components/assets/icon/columnGroup16.json +1 -0
- package/assets/components/assets/icon/columnGroup24.json +1 -0
- package/assets/components/assets/icon/columnGroup32.json +1 -0
- package/assets/components/assets/icon/columnRemove16.json +1 -0
- package/assets/components/assets/icon/columnRemove24.json +1 -0
- package/assets/components/assets/icon/columnRemove32.json +1 -0
- package/assets/components/assets/icon/columnUngroup16.json +1 -0
- package/assets/components/assets/icon/columnUngroup24.json +1 -0
- package/assets/components/assets/icon/columnUngroup32.json +1 -0
- package/assets/components/assets/icon/envelopeOpen16.json +1 -0
- package/assets/components/assets/icon/envelopeOpen24.json +1 -0
- package/assets/components/assets/icon/envelopeOpen32.json +1 -0
- package/assets/components/assets/icon/handDraw16.json +1 -0
- package/assets/components/assets/icon/handDraw24.json +1 -0
- package/assets/components/assets/icon/handDraw32.json +1 -0
- package/assets/components/assets/icon/monitorShare16.json +1 -0
- package/assets/components/assets/icon/monitorShare24.json +1 -0
- package/assets/components/assets/icon/monitorShare32.json +1 -0
- package/assets/components/assets/icon/pi16.json +1 -0
- package/assets/components/assets/icon/pi24.json +1 -0
- package/assets/components/assets/icon/pi32.json +1 -0
- package/assets/components/assets/icon/rowGroup16.json +1 -0
- package/assets/components/assets/icon/rowGroup24.json +1 -0
- package/assets/components/assets/icon/rowGroup32.json +1 -0
- package/assets/components/assets/icon/rowRemove16.json +1 -0
- package/assets/components/assets/icon/rowRemove24.json +1 -0
- package/assets/components/assets/icon/rowRemove32.json +1 -0
- package/assets/components/assets/icon/rowUngroup16.json +1 -0
- package/assets/components/assets/icon/rowUngroup24.json +1 -0
- package/assets/components/assets/icon/rowUngroup32.json +1 -0
- package/assets/components/assets/icon/sdCard16.json +1 -0
- package/assets/components/assets/icon/sdCard24.json +1 -0
- package/assets/components/assets/icon/sdCard32.json +1 -0
- package/assets/components/assets/icon/spaceAroundHorizontal16.json +1 -0
- package/assets/components/assets/icon/spaceAroundHorizontal24.json +1 -0
- package/assets/components/assets/icon/spaceAroundHorizontal32.json +1 -0
- package/assets/components/assets/icon/spaceAroundVertical16.json +1 -0
- package/assets/components/assets/icon/spaceAroundVertical24.json +1 -0
- package/assets/components/assets/icon/spaceAroundVertical32.json +1 -0
- package/assets/components/assets/icon/spaceBetweenHorizontal16.json +1 -0
- package/assets/components/assets/icon/spaceBetweenHorizontal24.json +1 -0
- package/assets/components/assets/icon/spaceBetweenHorizontal32.json +1 -0
- package/assets/components/assets/icon/spaceBetweenVertical16.json +1 -0
- package/assets/components/assets/icon/spaceBetweenVertical24.json +1 -0
- package/assets/components/assets/icon/spaceBetweenVertical32.json +1 -0
- package/assets/components/assets/icon/spacedEvenlyHorizontal16.json +1 -0
- package/assets/components/assets/icon/spacedEvenlyHorizontal24.json +1 -0
- package/assets/components/assets/icon/spacedEvenlyHorizontal32.json +1 -0
- package/assets/components/assets/icon/spacedEvenlyVertical16.json +1 -0
- package/assets/components/assets/icon/spacedEvenlyVertical24.json +1 -0
- package/assets/components/assets/icon/spacedEvenlyVertical32.json +1 -0
- package/assets/components/assets/icon/stretchHorizontal16.json +1 -0
- package/assets/components/assets/icon/stretchHorizontal24.json +1 -0
- package/assets/components/assets/icon/stretchHorizontal32.json +1 -0
- package/assets/components/assets/icon/stretchVertical16.json +1 -0
- package/assets/components/assets/icon/stretchVertical24.json +1 -0
- package/assets/components/assets/icon/stretchVertical32.json +1 -0
- package/assets/components/assets/icon/swatchPalette16.json +1 -0
- package/assets/components/assets/icon/swatchPalette24.json +1 -0
- package/assets/components/assets/icon/swatchPalette32.json +1 -0
- package/assets/components/assets/icon/thermometer16.json +1 -0
- package/assets/components/assets/icon/thermometer24.json +1 -0
- package/assets/components/assets/icon/thermometer32.json +1 -0
- package/assets/components/assets/icon/webCamera16.json +1 -0
- package/assets/components/assets/icon/webCamera24.json +1 -0
- package/assets/components/assets/icon/webCamera32.json +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/078ed48eb055dd213ee6.js +1 -0
- package/assets/esri/core/workers/chunks/186350d720352bd5ff33.js +1 -0
- package/assets/esri/core/workers/chunks/21c0743b2f612e7e7de3.js +1 -0
- package/assets/esri/core/workers/chunks/25cc6d7178a52f2f46b7.js +1 -0
- package/assets/esri/core/workers/chunks/{6010799e05d239073de0.js → 25ecf94d776c3b6db0f3.js} +1 -1
- package/assets/esri/core/workers/chunks/{10d33b4f248864225f85.js → 2728eda8178e02fbca47.js} +1 -1
- package/assets/esri/core/workers/chunks/{4c9df8ae9238454969b8.js → 2c21f4744e19b925a6ae.js} +1 -1
- package/assets/esri/core/workers/chunks/32fc7d1db4b311f6b880.js +1 -0
- package/assets/esri/core/workers/chunks/3acc1299c1382c3b034d.js +1 -0
- package/assets/esri/core/workers/chunks/{c2684fcde2923c9830e0.js → 42c4d0c1c08bf111e5a4.js} +1 -1
- package/assets/esri/core/workers/chunks/430802108b63194b7ddd.js +2 -0
- package/assets/esri/core/workers/chunks/{f5e8ccbd6b4c0a386903.js → 448f068a14f24f2f8a43.js} +1 -1
- package/assets/esri/core/workers/chunks/49c6dc487714f9cd55c7.js +1 -0
- package/assets/esri/core/workers/chunks/{70e0ead69a722fd964b8.js → 49e8ff5ed079a9e3be4b.js} +1 -1
- package/assets/esri/core/workers/chunks/{69921d068add041b5dcb.js → 5134241be1f1bf25231a.js} +1 -1
- package/assets/esri/core/workers/chunks/{54bb3678570ca032f051.js → 5762746cfb02a4119d82.js} +1 -1
- package/assets/esri/core/workers/chunks/{434c5b54e89ace974cbd.js → 5965a947f68b707eaa6b.js} +2 -2
- package/assets/esri/core/workers/chunks/6c25c929bcde7e3a2af1.js +1 -0
- package/assets/esri/core/workers/chunks/7610dd0b46948b7bd840.js +1 -0
- package/assets/esri/core/workers/chunks/7be56ac60e580c806a5d.js +1 -0
- package/assets/esri/core/workers/chunks/7f2ac03efaa4a4898ba2.js +2 -0
- package/assets/esri/core/workers/chunks/{847781aefed049493444.js → 9f760dc4492a03e0504c.js} +1 -1
- package/assets/esri/core/workers/chunks/{013c9cc198736a72f7f2.js → 9fb46ccd4be4c3b61c31.js} +1 -1
- package/assets/esri/core/workers/chunks/bdcca906fdfb8e179abb.js +2 -0
- package/assets/esri/core/workers/chunks/c5ceceb0683671f92efa.js +1 -0
- package/assets/esri/core/workers/chunks/c5e288d57bacb8451e2d.js +2 -0
- package/assets/esri/core/workers/chunks/{b92b7d6c1e693c97a3eb.js → d1f54b0079fb71a15612.js} +1 -1
- package/assets/esri/core/workers/chunks/{72be81c1394285b51ed3.js → d45483dd0dc2853b18b7.js} +212 -216
- package/assets/esri/core/workers/chunks/d5e3f8e5b8d2576d3cb3.js +2 -0
- package/assets/esri/core/workers/chunks/{21d4219844ae5654618b.js → d926bffc3ff9f87e9081.js} +1 -1
- package/assets/esri/core/workers/chunks/{abcda435bc83ef4240f9.js → e6dae16208f6978b59e0.js} +1 -1
- package/assets/esri/core/workers/chunks/e755075ac2e02e881fad.js +1 -0
- package/assets/esri/core/workers/chunks/{058d4c927486a361e633.js → ea9e770efc85594e4dd2.js} +1 -1
- package/assets/esri/core/workers/chunks/eff99e45d818e58fd443.js +1 -0
- package/assets/esri/core/workers/chunks/{a49147203e55609630cc.js → f453dc4a075d2f900c7d.js} +1 -1
- package/assets/esri/core/workers/chunks/f465fb26541372fdc908.js +2 -0
- package/assets/esri/core/workers/chunks/{b7809ef3e1dabd921339.js → f72f4413fc7461e11a2a.js} +1 -1
- package/assets/esri/themes/base/widgets/_BasemapLayerList.scss +1 -0
- package/assets/esri/themes/base/widgets/_Bookmarks.scss +1 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/ChapmanAtmosphere.glsl.js +1 -1
- package/chunks/Component.glsl.js +57 -56
- package/chunks/DefaultMaterial.glsl.js +19 -23
- package/chunks/GaussianSplat.glsl.js +13 -11
- package/chunks/GlobalIllumination.glsl.js +1 -1
- package/chunks/Haze.glsl.js +1 -1
- package/chunks/Path.glsl.js +21 -24
- package/chunks/RealisticTree.glsl.js +42 -41
- package/chunks/RibbonLine.glsl.js +65 -56
- package/chunks/SimpleAtmosphere.glsl.js +1 -1
- package/chunks/Terrain.glsl.js +25 -25
- package/chunks/Water.glsl.js +4 -4
- package/config.js +1 -1
- package/core/units.js +1 -1
- package/geometry/support/heightModelInfoUtils.js +1 -1
- package/kernel.js +1 -1
- package/layers/GaussianSplatLayer.js +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/mixins/TiledImagery.d.ts +6 -0
- package/layers/mixins/TiledImagery.js +1 -1
- package/layers/raster/datasets/ImageServerRaster.js +1 -1
- package/layers/raster/datasets/RasterFactory.js +1 -1
- package/layers/support/domainUtils.d.ts +2 -0
- package/layers/support/domainUtils.js +1 -1
- package/layers/support/fieldUtils.d.ts +10 -0
- package/layers/support/fieldUtils.js +1 -1
- package/package.json +6 -6
- package/support/revision.js +1 -1
- package/symbols/LineStyleMarker3D.d.ts +3 -4
- package/symbols/LineSymbol3D.d.ts +19 -2
- package/symbols/LineSymbol3D.js +1 -1
- package/symbols/LineSymbol3DLayer.d.ts +13 -6
- package/symbols/Symbol3DLayer.d.ts +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/clipping.js +2 -0
- package/views/2d/input/MapViewInputManager.js +1 -1
- package/views/2d/input/handlers/KeyPan.js +1 -1
- package/views/2d/layers/support/annodime/DimensionInfo.js +1 -1
- package/views/2d/layers/support/annodime/dimensionUtils.js +1 -1
- package/views/3d/input/SceneInputManager.js +1 -1
- package/views/3d/input/handlers/KeyboardNavigation.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
- package/views/3d/support/MemoryController.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentDrawParameters.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/Component.glsl.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +4 -4
- package/views/3d/webgl-engine/core/shaderLibrary/output/getEmissions.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +57 -58
- package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +5 -3
- package/views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/MarkerSizing.glsl.js +7 -6
- package/views/3d/webgl-engine/core/shaderLibrary/shading/NormalUtils.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/shading/Normals.glsl.js +5 -10
- package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js +10 -48
- package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js +16 -22
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +6 -6
- package/views/3d/webgl-engine/core/shaderLibrary/shading/calculateUVZShadow.glsl.js +5 -3
- package/views/3d/webgl-engine/core/shaderLibrary/shading/pbrGlobals.glsl.js +19 -0
- package/views/3d/webgl-engine/core/shaderLibrary/shading/pbrShadingInfo.glsl.js +24 -0
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +2 -2
- package/views/3d/webgl-engine/effects/snowcover/SnowCover.glsl.js +4 -4
- package/views/3d/webgl-engine/lib/GaussianSplatDepthRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/LineMaterial.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/VisualVariablePassParameters.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatPass.glsl.js +19 -22
- package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarkerTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/SlicePlaneMaterialTechniqueConfiguration.js +1 -1
- package/views/MapView.d.ts +1 -0
- package/views/SceneView.d.ts +1 -0
- package/views/View.js +1 -1
- package/views/support/DefaultsFromMap.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/BatchAttributeForm/ReactiveContingentValuesManager.js +1 -1
- package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/MultipleChoiceController.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Bookmarks.js +1 -1
- package/widgets/FeatureForm/featureFormUtils.js +1 -1
- package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
- package/widgets/Search/LocatorSearchSource.d.ts +4 -3
- package/widgets/support/forms/formUtils.d.ts +5 -0
- package/widgets/support/forms/formUtils.js +1 -1
- package/widgets/support/forms/types.d.ts +7 -1
- package/assets/esri/core/workers/chunks/075eb62465edb9cbf907.js +0 -1
- package/assets/esri/core/workers/chunks/0ff13f7a18b0123d253e.js +0 -1
- package/assets/esri/core/workers/chunks/1082bb0858585bd4fa21.js +0 -2
- package/assets/esri/core/workers/chunks/19ac6f4664f97fb3821c.js +0 -1
- package/assets/esri/core/workers/chunks/1ec01fd6330d011c76d6.js +0 -1
- package/assets/esri/core/workers/chunks/2e2349387a2b9903f13c.js +0 -2
- package/assets/esri/core/workers/chunks/349e9f3d3e3267d02988.js +0 -1
- package/assets/esri/core/workers/chunks/3ffc852db1a820ed143b.js +0 -1
- package/assets/esri/core/workers/chunks/411bbdecba340df11d95.js +0 -2
- package/assets/esri/core/workers/chunks/4490dd8bae0dd2769d99.js +0 -1
- package/assets/esri/core/workers/chunks/476535cfb06ced74d611.js +0 -2
- package/assets/esri/core/workers/chunks/5e56a004b4407b8066eb.js +0 -1
- package/assets/esri/core/workers/chunks/6df29716f75696434807.js +0 -1
- package/assets/esri/core/workers/chunks/a322afbb48898ce35851.js +0 -1
- package/assets/esri/core/workers/chunks/b82b523b6837ed1f28d3.js +0 -2
- package/assets/esri/core/workers/chunks/c7b762bae945f383c723.js +0 -1
- package/assets/esri/core/workers/chunks/ef24fd6c0322e5de9fdf.js +0 -2
- package/assets/esri/core/workers/chunks/f9e5740b05de24ba81be.js +0 -1
- package/assets/esri/core/workers/chunks/fc622f9e33e3b48113c8.js +0 -1
- /package/assets/esri/core/workers/chunks/{476535cfb06ced74d611.js.LICENSE.txt → 430802108b63194b7ddd.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{b82b523b6837ed1f28d3.js.LICENSE.txt → 7f2ac03efaa4a4898ba2.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{ef24fd6c0322e5de9fdf.js.LICENSE.txt → bdcca906fdfb8e179abb.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{1082bb0858585bd4fa21.js.LICENSE.txt → c5e288d57bacb8451e2d.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{2e2349387a2b9903f13c.js.LICENSE.txt → d5e3f8e5b8d2576d3cb3.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{411bbdecba340df11d95.js.LICENSE.txt → f465fb26541372fdc908.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{deprecateWidget as a}from"../core/deprecate.js";import i from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{destroyMaybe as s}from"../core/maybe.js";import o from"../core/ReactiveMap.js";import{watch as l,when as r,on as c,sync as d}from"../core/reactiveUtils.js";import{formatFileSize as m}from"../core/unitFormatUtils.js";import{property as u,subclass as h}from"../core/accessorSupport/decorators.js";import{formatDate as p}from"../intl/date.js";import{isIntegerField as g}from"../layers/support/fieldUtils.js";import{isString as v}from"../support/guards.js";import b from"./Widget.js";import{getAttachmentTypeCategory as f,getCalciteIconForAttachment as _}from"./Attachments/support/attachmentUtils.js";import{getAttachmentKey as C,isImageAttachment as y,getAttachmentFilenameParts as A}from"./BatchAttributeForm/attachmentUtils.js";import{getHiddenFieldsValidationErrorMessage as I,getVisibleFieldInputValidationErrorMessage as w,isElementTemplateWithInputType as F,subtypeChangeShouldPrompt as k,flattenInputs as M}from"./BatchAttributeForm/batchAttributeFormUtils.js";import x from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as D}from"./BatchAttributeForm/css.js";import{makeViewingEditedAttachmentFooterButtons as S,makeViewingAttachmentFooterButtons as E,makeCancelFooterButton as O,makeDefaultFooterButtons as T}from"./BatchAttributeForm/interfaceUtils.js";import L from"./BatchAttributeForm/VisibleElements.js";import{isDynamicChoiceController as V,isMultipleChoiceController as R}from"./BatchAttributeForm/inputs/support/controllerUtils.js";import{isGroupInput as N,isFieldInput as U,isTextElementInput as P,isRelationshipElementInput as B,isAttachmentElementInput as $,isUtilityNetworkAssociationsElementInput as z,differentValuesString as j,getNormalizedFieldName as H,isGroupedInput as W}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{clearMultipleChoiceOtherChoiceStateForViewModel as G,otherChoiceCheckedPlaceholderValue as Z,canRestoreMultipleChoiceOtherChoiceDraftValue as q}from"./BatchAttributeForm/inputs/support/multipleChoiceInputUtils.js";import{loadRelationshipDetailsComponents as K,RelationshipDetails as X}from"./BatchAttributeForm/rendered-content/RelationshipDetails.js";import{Prompt as J}from"./Editor/components/Prompt.js";import{downloadAttachmentInfo as Q}from"./FeatureTable/support/exportUtils.js";import{loadCalciteComponents as Y}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as ee,getIntlOptionsForField as te,prepareISOFieldValueForDateComponents as ae,prepareUnixFieldValueForDateComponents as ie,normalizeTimeOnlyString as ne,getISOFieldValueFromDateComponents as se,getUnixFieldValueFromDateComponents as oe}from"./support/dateUtils.js";import{globalCss as le}from"./support/globalCss.js";import{Heading as re}from"./support/Heading.js";import{calciteListFilterProps as ce}from"./support/listUtils.js";import{messageBundle as de,vmEvent as me,tsx as ue}from"./support/widget.js";import{setFocus as he}from"./support/widgetUtils.js";import{isEmptyValue as pe}from"./support/forms/formUtils.js";const ge="data-element-id",ve="data-field-name",be="esri_BatchAttributeForm_select_all",fe="esri_BatchAttributeForm_other_choice";let _e=class extends b{constructor(e,t){super(e,t),this.headingLevel=2,this.messagesCommon=null,this.messages=null,this.featureFormMessages=null,this.featureTableMessages=null,this.messagesUnits=null,this.viewModel=new x,this.visibleElements=new L,this.groupDisplay="all",this._associationsList=null,this._associationsWidgetsMap=new o,this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._touchedInputs=new Set,this._dynamicChoiceItemSelections=new WeakSet,this._focusedFieldInput=null,this._pendingSubtypeChoice=null,this._batchSwitchInputInitialValues=new Map,this._listObserverNode=null,this._listObserver=new IntersectionObserver(e=>{e.length&&e[0].isIntersecting&&this.viewModel.activeRelationshipInput?.incrementPage()},{root:window.document}),this._attachmentDialogInfo=null,this._attachmentListFilterText="",this._attachmentFileInputMap=new Map,this._prompt=null,this._selectedAttachmentReplaceFileInput=null,this._afterListObserverCreated=e=>{this.viewModel.activeRelationshipInput&&(this._listObserverNode=e)},this._afterListObserverRemoved=()=>{this._listObserverNode=null},this._maximizeSelectedAttachment=()=>{this._attachmentDialogInfo=this.selectedAttachmentDetails},this._enterAttachmentReplaceView=()=>{const e=this.selectedAttachmentDetails;this._canReplaceSelectedAttachment()&&e&&(e.input.clearValidationCriteriaState(),this.viewModel.setShowingSelectedAttachmentReplacePage(!0))},this._setSelectedAttachmentReplaceFileInput=e=>{this._selectedAttachmentReplaceFileInput=e},this._openSelectedAttachmentReplaceFilePicker=()=>{this._canReplaceSelectedAttachment()&&this._selectedAttachmentReplaceFileInput?.click()},this._resetSelectedAttachmentName=()=>{const e=this.selectedAttachmentDetails;if(!e?.attachment)return;const t=e.input.getAttachmentEditState(e.attachment).initialName;if(null==t)return;const a=e.input.template.elementId,i=C(e.attachment);this.viewModel.stageRenameAttachment(a,i,t)},this._closeAttachmentDialog=()=>{this.hideAttachmentDialog()},this._saveInputFromElement=this._saveInputFromElement.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreateOrUpdate=this._afterDateComponentCreateOrUpdate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this),e?.suppressDeprecationWarning||(this.announceDeprecation=()=>{a(i.getLogger(this),"Editor","arcgis-editor",{version:"5.0"})})}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:t,...a}=e;return a}initialize(){this.addHandles([l(()=>this.features.toArray(),()=>{this._dateComponentMap.clear(),G(this.viewModel,{includeDraftValues:!0})}),l(()=>this.viewModel.activeForm,()=>{this._batchSwitchInputInitialValues.clear(),this._resetTransientFormState(),G(this.viewModel),this._setFocusableInput()}),l(()=>this.viewModel.selectedAttachmentAddElementId,()=>{this.hideAttachmentDialog()}),r(()=>!this.selectedAttachmentDetails,()=>this.hideAttachmentDialog()),l(()=>this.viewModel.selectedAttachmentListElementId,()=>{this._attachmentListFilterText=""}),l(()=>[this.viewModel.activeRelationshipInput,this._listObserverNode],()=>this._onObserverChange()),c(()=>this.viewModel,"submit",()=>{this.valid||this.goToFirstError()}),l(()=>[this._associationsEnabled,this.viewModel.activeForm.allUtilityNetworkAssociationsElementInputs],()=>this._setUpAssociationsWidgets(),d),l(()=>this.viewModel.activeAssociationsInput,e=>this._onActiveAssociationsInputChange(e)),l(()=>this.groupDisplay,()=>this._syncGroupInputStates())])}loadDependencies(){return Promise.all([Y({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),autocomplete:()=>import("@esri/calcite-components/dist/components/calcite-autocomplete"),"autocomplete-item":()=>import("@esri/calcite-components/dist/components/calcite-autocomplete-item"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group"),dialog:()=>import("@esri/calcite-components/dist/components/calcite-dialog"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group")}),K()])}destroy(){this._destroyAssociationsWidgets(),this._associationsList=s(this._associationsList),this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode)}get activeFeatureIndex(){return this.viewModel.activeFeatureIndex}set activeFeatureIndex(e){this.viewModel.activeFeatureIndex=e}get attachmentsEnabled(){return this.viewModel.attachmentsEnabled}set attachmentsEnabled(e){this.viewModel.attachmentsEnabled=e}get callbacks(){return this.viewModel.callbacks}set callbacks(e){this.viewModel.callbacks=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get effectiveTitle(){const{features:e,messages:t,page:a}=this;return t?"replacing-attachment"===a?t.titles.replaceAttachment:"viewing-attachment-details"===a?t.titles.editAttachment:"adding-attachments"===a?t.titles.addAttachments:"viewing-attachments"===a?t.titles.attachments:1===e.length||this.activeFeatureIndex>-1?t.titles.editFeature:e.length>1?t.titles.editFeatures:"":""}get effectiveDisabled(){return this.disabledOrReadOnly||this.viewModel.updating}get disabledOrReadOnly(){return this.disabled||this.readOnly}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get footerButtonInfos(){if(!this.features.length||!this.messages||!this.messagesCommon)return[];const{messages:e,messagesCommon:t,page:a}=this,i=this.effectiveDisabled;if("adding-attachments"===a||"replacing-attachment"===a)return[];if("viewing-attachment-details"===a){const t=this.selectedAttachmentDetails,a=t?.input?.getAttachmentEditState(t.attachment);if(!t?.input||!a)return[];return a.isRenamed||a.isReplaced?S({doneOnclick:()=>this._setSelectedAttachment(null),messages:e.footerButtons,resetOnclick:()=>this._resetSelectedAttachmentChanges(),resetDisabled:this._disableAttachmentModification(t.input)}):E({deleteDisabled:this._disableAttachmentModification(t.input),deleteOnclick:()=>this._deleteSelectedAttachment(),doneOnclick:()=>this._setSelectedAttachment(null),messages:e.footerButtons})}return"viewing-associated-features"===a?O({messages:t,purpose:"cancel-viewing-associated-features",onclick:()=>this.goBack()}):"viewing-associated-layers"===a?O({messages:t,purpose:"cancel-viewing-associated-layers",onclick:()=>this.goBack()}):"viewing-attachments"===a||"viewing-related-records"===a?[]:T({disabled:i||!this.valid,formId:this._formId,messages:e,callback:()=>this.submit()})}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get maximumFeatureCount(){return this.viewModel.maximumFeatureCount}set maximumFeatureCount(e){this.viewModel.maximumFeatureCount=e}get maximumFeatureCountWithComplexForms(){return this.viewModel.maximumFeatureCountWithComplexForms}set maximumFeatureCountWithComplexForms(e){this.viewModel.maximumFeatureCountWithComplexForms=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get icon(){return"edit-attributes"}set icon(e){this._overrideIfSome("icon",e)}get page(){return this.viewModel.page}get readOnly(){return this.viewModel.readOnly}set readOnly(e){this.viewModel.readOnly=e}get showPrompt(){return e=>{this._prompt?.cancel?.(),this._prompt=e}}set showPrompt(e){this._overrideIfSome("showPrompt",e)}get clearPrompt(){return()=>this._prompt=null}set clearPrompt(e){this._overrideIfSome("clearPrompt",e)}get selectedAttachment(){return this.viewModel.selectedAttachment}get selectedAttachmentDetails(){return this.viewModel.selectedAttachmentDetails}get valid(){return this.viewModel.valid}get _formHeaderVisible(){return!("batch"===this.viewModel.mode||!this.viewModel.activeFeature)&&!(!this.viewModel.formDescription&&!this.viewModel.formTitle)}get _associationsEnabled(){const{callbacks:e}=this;return!(!e?.addAssociation&&!e?.editAssociatedFeature)}get _formId(){return`${this.id}-form`}get _relatedRecordsEnabled(){const{callbacks:e}=this;return!(!e||!e.addRelatedRecord&&!e.editRelatedRecord)}async goBack(){return this.viewModel.goBack()}async goHome(){return this.viewModel.goHome()}goToFirstError(){const e=this.viewModel.getFirstVisibleInvalidFieldInput();if(!e)return;const{groupInput:t}=e;t&&(t.open||(t.open=!0)),this._setFocusableInput(e.input),this.scheduleRender()}render(){return ue("div",{class:this.classes(D.base,le.widget,le.panel),ondragover:this._handleDragAndDrop,ondrop:this._handleDragAndDrop},this._renderContent(),this._renderAttachmentDialog(),this._prompt?ue(J,{...this._prompt,headingLevel:this.headingLevel}):void 0)}setActiveAssociationsInput(e){this.viewModel.setActiveAssociationsInput(e)}setActiveAssociationsLayer(e){this.viewModel.setActiveAssociationsLayer(e)}setActiveAssociationType(e){this.viewModel.setActiveAssociationType(e)}submit(){return this.viewModel.submit()}get test(){return{saveInput:this._saveInput.bind(this),pendingSubtypeChoice:this._pendingSubtypeChoice}}_setDateTimeTimeZoneMap(e){const{datePart:t,elementId:a}=e.dataset,i=n(this._dateComponentMap,`${a}`,()=>({}));switch(t){case"date":i.date=e;break;case"time":i.time=e;break;case"timeZone":i.timeZone=e}}_renderContent(){const{messages:e,viewModel:a}=this,{status:i}=a;return"failed"===i?a.hasTooManyComplexFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyComplexFeatures,{num:a.maximumFeatureCountWithComplexForms})):a.hasTooManyFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyFeatures,{num:a.maximumFeatureCount})):e.formFailedToLoad:a.hasLayersWithContingentValues&&this.viewModel.features.length>1?this._renderErrorNotice(e.unsupportedContingentValues):"loading"===i&&this.visibleElements.loadingIndicator?ue("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):0!==this.features.length?this._renderForm():void 0}_renderErrorNotice(e,t="warning"){return ue("calcite-notice",{class:D.noticeError,icon:!0,kind:t,open:!0},ue("div",{slot:"message"},e))}_renderForm(){return ue("form",{class:D.form,id:this._formId,inert:!!this._prompt,onsubmit:this._onFormSubmit},this.viewModel.expressionEvaluationFailed&&this.visibleElements.expressionsErrorNotice&&this._renderErrorNotice(this.messages.expressionEvaluationFailed),this._renderInvisibleFieldsError(),this._renderPage())}_renderPage(){switch(this.page){case"adding-attachments":return this._renderAttachmentAddPage();case"viewing-attachment-details":case"replacing-attachment":return this._renderAttachmentDetailPage();case"viewing-attachments":return this._renderAttachmentListPage();case"viewing-associated-layers":case"viewing-associated-features":return this._renderViewingAssociationsPage();case"viewing-related-categories":case"viewing-related-records":return this._renderRelationshipListPage();default:return this._renderDefaultPage()}}_renderInvisibleFieldsError(){const{viewModel:e}=this,{hasNonActiveInvalidFeatures:t,activeForm:a}=e;let i;if(!e.submitHasBeenAttempted)return null;if(a.invalidHiddenInputs.length>0)if(i=I(a,e.mode,this.messages),"batch"===this.viewModel.mode){const e=a.invalidHiddenInputs.filter(e=>"hidden:group-visibility-expression:all-features"===e.effectiveVisibilityCode||"hidden:visibility-expression:all-features"===e.visibilityCode);e.length>0?i+=` (${e.map(e=>e.label).join(", ")})`:i=null}else i=null;else if(t)return null;return i?this._renderErrorNotice(i,"danger"):null}_renderDefaultPage(){return[this._renderReadOnlyNotice(),this._renderFormHeader(),this._renderFormContent()]}_renderReadOnlyNotice(){if((this.disabled||this.readOnly)&&this.visibleElements.readOnlyNotice)return ue("calcite-notice",{class:D.disabledNotice,"data-testid":"read-only-notice",icon:"read-only-non-editable",kind:"brand",open:!0,scale:"s",width:"full"},ue("div",{slot:"message"},this.featureFormMessages.disabledForm))}_renderFormHeader(){const{formTitle:e,formDescription:t}=this.viewModel;if(!this._formHeaderVisible)return;const a=e?ue(re,{key:"title",level:this.headingLevel},e):void 0,i=t?ue("p",{class:D.description,key:"description"},t):void 0;return ue("div",{class:D.formHeader},a,i)}_renderFormContent(){return this.viewModel.hasVisibleInputs?this.viewModel.activeForm.inputs.filter(e=>e.visible).map(e=>this._renderInput(e)):this._renderErrorNotice(this.messages.noVisibleFields[this.viewModel.noVisibleElementsReason])}_renderInput(e){return N(e)?this._renderGroupInput(e):U(e)?this._renderLabeledField(e):P(e)?this._renderTextComponent(e):B(e)?this._renderRelationshipElementInput(e):$(e)?this._renderAttachmentElementInput(e):z(e)?this._renderUtilityNetworkAssociationsElementInput(e):void 0}_renderGroupInput(e){const{inputs:t,template:a,open:i}=e,n=t.filter(e=>e.visible),s=e.label??"",o=this._focusedFieldInput?.group===e,l="sequential"===this.groupDisplay;return ue("calcite-block",{class:this.classes(D.group,l?D.groupSequential:null,o?D.groupActive:null,this.disabled?D.inputDisabled:null),collapsible:!0,description:e.description??void 0,expanded:i,heading:s,headingLevel:this.headingLevel,key:`{${a.elementId}-key}`,label:s,onCalciteBlockClose:()=>{e.open=!1},onCalciteBlockOpen:()=>{e.open=!0},onCalciteBlockToggle:({currentTarget:t})=>this._onGroupToggle(t,e)},n.map(e=>this._renderInput(e)))}_renderLabeledField(e){const{elementId:a}=e.template,{label:i,required:n,dataType:s}=e,o=n?t(this.messages.requiredFieldLabel,{name:i}):i;return ue("calcite-label",{"aria-label":o,class:D.label,key:`field--${a}`},ue("div",{class:D.labelTextContent,key:"labelTextContainer"},i,n?ue("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==s?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){const t=this.getCommonInputProps(e),{dataType:a}=e;return V(e.inputController)?this._renderDynamicChoiceComponent({input:e,props:t,controller:e.inputController}):"coded-value"===e.domain?.type?this._renderCodedInputs({input:e,props:t}):R(e.inputController)?this._renderMultipleChoiceComponent({input:e,props:t}):"date"===a?this._renderDateComponents(e,t):(t.disabled=this.disabled,t.readOnly=t.readOnly||this.viewModel.updating,"number"===a?this._renderNumberComponent(e,t):this._renderStringComponent(e,t))}_renderAuxiliaryText(e){const{description:t}=e,a=this._getErrorToDisplay(e),i=a?w(e,a,this.messages):null;return i?ue("calcite-input-message",{icon:!0,status:"invalid"},i):e.valueIsOutOfDomain&&(this._touchedInputs.has(e.template.elementId)||this.viewModel.submitHasBeenAttempted)?ue("calcite-input-message",{icon:!0,status:"idle"},this.messages.subtypes.fieldOutOfSubtypeDomainWarning):t?ue("calcite-input-message",{class:D.description,icon:!1,status:"idle"},t):null}_renderCodedInputs({input:e,props:t}){const a=e.input?.type??null,i=e.codedValueOptions;switch(a){case"switch":return this._renderSwitchField({input:e,props:t});case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:i,props:t});default:return this._renderComboBoxComponent({options:i,props:t,input:e})}}_renderDynamicChoiceComponent({input:e,props:t,controller:a}){const i=a.filteredChoices,n=e.showNoValueLabel||this.messages.empty,s=t=>{this._saveInput(e,t)},o=(e,t)=>{this._dynamicChoiceItemSelections.delete(a);const i=e.closest("calcite-autocomplete");if(i){const e=null==t?"":a.getLabel(t);a.filterValue=e,i.inputValue=e}s(t)},l=({currentTarget:t})=>{const i=t.inputValue??"";a.filterValue=i,i||null==e.value||s(null)},r=e.showNoValueOptionEnabled?ue("calcite-autocomplete-item",{heading:n,key:"dynamic-choice-empty",selected:null==e.value,value:"",onCalciteAutocompleteItemSelect:({currentTarget:e})=>o(e,null),onpointerdown:()=>{this._dynamicChoiceItemSelections.add(a)}}):null,c=t=>{const i=e.value===j?this.messages.differentValuesPlaceholder:null==e.value?"":a.inputValue;t.inputValue=i};return ue("calcite-autocomplete",{...t,afterCreate:c,loading:a.evaluating,placeholder:null==e.value?n:t.placeholder,value:String(t.value),onblur:e=>this._onDynamicChoiceBlur(e,a),onCalciteAutocompleteBeforeOpen:()=>a.beginInteraction(),onCalciteAutocompleteTextInput:l},r,i.map(t=>ue("calcite-autocomplete-item",{heading:t.name,key:`dynamic-choice-${t.code}`,selected:t.code===e.value,value:String(t.code),onCalciteAutocompleteItemSelect:({currentTarget:e})=>o(e,t.code),onpointerdown:()=>{this._dynamicChoiceItemSelections.add(a)}})))}_renderMultipleChoiceComponent({input:e,props:t}){const{messages:a}=this,i=this._getMultipleChoiceController(e);if(!i)return null;const{input:n}=i,s=!0===n.includeSelectAllChoices,{checkboxStatesByValue:o,selectAllState:l}=i.selectionState,r=l.checked?a.deselectAllLabel:a.selectAllLabel,c=i.otherChoiceRenderState,d=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:!0})},m=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t})},u=t=>{const{fieldName:a}=c;a&&this._saveOtherChoiceCheckboxValue({input:e,isChecked:t.checked,otherChoiceFieldName:a})},h=t=>{this._saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:c.fieldName??void 0})};return ue("div",{class:D.multipleChoiceInput,key:`${t.key}-multiple-choice-group`},s?this._renderMultipleChoiceSelectAllCheckbox({props:t,selectAllState:l,selectAllLabel:r,handleSelectAllCheckboxChange:d}):null,this._renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:o,handleChoiceCheckboxChange:m}),c.shouldShow?this._renderMultipleChoiceOtherChoice({props:t,includeSelectAllChoices:s,otherChoiceRenderState:c,handleOtherChoiceCheckboxChange:u,handleOtherChoiceInputChange:h,differentValuesPlaceholder:a.differentValuesPlaceholder}):null)}_renderMultipleChoiceSelectAllCheckbox({props:e,selectAllState:t,selectAllLabel:a,handleSelectAllCheckboxChange:i}){return ue("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:t.checked,class:D.multipleChoiceSelectAll,"data-element-id":e[ge],disabled:e.readOnly||e.disabled,indeterminate:t.indeterminate,key:`${e.key}-select-all`,label:a,labelText:a,value:be,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:e.onfocus})}_renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:a,handleChoiceCheckboxChange:i}){const n=this._getMultipleChoiceController(e);if(!n)return[];const{choices:s}=n;return s.map(e=>{const n=a.get(e.value)??{checked:!1,indeterminate:!1};return ue("calcite-checkbox",{afterCreate:t.afterCreate,afterUpdate:t.afterUpdate,"aria-invalid":t["aria-invalid"],checked:n.checked,class:t.class,"data-element-id":t[ge],disabled:t.readOnly||t.disabled,indeterminate:n.indeterminate,key:`${t.key}-${e.value}`,label:e.label,labelText:e.label,value:e.value,onblur:t.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:t.onfocus})})}_renderMultipleChoiceOtherChoice({props:e,includeSelectAllChoices:t,otherChoiceRenderState:a,handleOtherChoiceCheckboxChange:i,handleOtherChoiceInputChange:n,differentValuesPlaceholder:s}){const o=a.label??this.messages.otherOptionLabel;return ue("div",{class:this.classes(D.multipleChoiceOtherChoice,t?D.multipleChoiceOtherChoiceWithSelectAll:null),key:`${e.key}-other-choice`},ue("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:a.checkboxState.checked,class:e.class,"data-element-id":e[ge],disabled:e.readOnly||e.disabled,indeterminate:a.checkboxState.indeterminate,key:`${e.key}-other-choice-checkbox`,label:o,labelText:o,value:fe,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:e.onfocus}),a.checkboxState.checked?ue("calcite-input",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],"aria-label":o,class:D.textElementInput,"data-element-id":e[ge],disabled:e.readOnly||e.disabled,key:`${e.key}-other-choice-input`,maxLength:a.maxLength,placeholder:a.value===j?s:a.hint,status:a.status,type:"text",value:a.normalizedValue===j?"":a.normalizedValue?String(a.normalizedValue):"",onblur:e.onblur,onCalciteInputInput:({currentTarget:e})=>n(e),onfocus:e.onfocus}):null)}async _saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:a=!1}){this._markFieldInputTouched(e);const i=this._getMultipleChoiceController(e);if(!i)return;if(i.input&&!a&&"batch"===this.viewModel.mode)return void await this._saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t});const n=e.value,s=this._parseValue(t,e,a);s!==n&&await this.viewModel.setValue(e.template.elementId,s)}async _saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:a}){if(!a)return;const i=t.value,n=null==i||""===i?null:i,s=this._getMultipleChoiceController(e);if(!s)return;s.initializeExplicitOtherChoiceCheckedState(),s.stashOtherChoiceDraftValueForFeatures(e.features,n);const o=H(e,a);o&&await this.viewModel.setValueForFieldName(o,n,Array.from(e.features,e=>e.source))}async _saveOtherChoiceCheckboxValue({input:e,isChecked:t,otherChoiceFieldName:a}){const i=this._getMultipleChoiceController(e);if(!i)return;i.setExplicitOtherChoiceCheckedState(t),this._markFieldInputTouched(e),t||i.setOtherChoiceDraftValuesFromFeatures(e.features.toArray());const n=H(e,a);if(!n)return;const s=new Map;for(const o of e.features){const e=o.getAttribute(a);if(t){if(!pe(e))continue;const t=i.getOtherChoiceDraftValue(o),a=q(t)?t:Z;s.set(o,a);continue}null!=e&&s.set(o,null)}0!==s.size&&await this.viewModel.setValuePerFeatureForFieldName(n,new Map(Array.from(s,([e,t])=>[e.source,t])))}async _saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t}){const a=this._getMultipleChoiceController(e);if(!a)return;const i=new Map(e.features.map(i=>[i,a.getUpdatedValueForFeature({choiceValue:t.value,currentValue:i.getAttribute(e.fieldName),isChecked:t.checked})]));0!==i.size&&await this.viewModel.setFieldInputValuePerFeature(e,i)}_renderSwitchField({input:e,props:t}){if((this._batchSwitchInputInitialValues.get(e)===j||e.value===j)&&"batch"===this.viewModel.mode){const a={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,[ge]:t[ge]},trigger:{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral",slot:"trigger",label:t.label},group:{mode:"single"}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:a,options:[{name:this.messages.differentValuesPlaceholder,value:j,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return ue("calcite-switch",{...t,checked:!!F(e.template,"switch")&&e.value===e.template.input.onValue,class:D.inputSwitch,disabled:t.readOnly||t.disabled,onblur:()=>{this._focusedFieldInput=null},onCalciteSwitchChange:({currentTarget:e})=>this._saveInputFromElement(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:a}){const{trigger:i,dropdown:n,group:s}=a;return ue("calcite-dropdown",{...n,topLayerDisabled:this.topLayerDisabled,onblur:()=>{this._focusedFieldInput=null},onCalciteDropdownSelect:({currentTarget:e})=>this._saveInputFromElement(e),onfocus:this._onComponentFocus},ue("calcite-button",{...i},e===j?this.messages.differentValuesPlaceholder:e),ue("calcite-dropdown-group",{selectionMode:s.mode},t.map(t=>ue("calcite-dropdown-item",{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name))))}_renderComboBoxComponent({input:e,options:t,props:a}){const i="INSERT"===this.viewModel.editType,n=this._touchedInputs.has(e?.template?.elementId),s=i&&e.showNoValueOptionEnabled&&!n?()=>{}:a.onblur,o={...a,onblur:s};return ue("calcite-combobox",{...o,clearDisabled:e.isSubtypeField,selectionMode:"single",topLayerDisabled:this.topLayerDisabled,value:a.placeholder===this.messages.differentValuesPlaceholder?j:String(a.value),onCalciteComboboxChange:({currentTarget:t})=>{t.value!==j&&(e.isSubtypeField&&0===t.selectedItems.length?t.value=`${e.value}`:this._saveInputFromElement(t))}},this.renderComboboxOptionsList({input:e,options:t,props:a}))}renderComboboxOptionsList({input:e,options:t,props:a}){const i=e=>e.map(e=>{const{value:t}=e,i=pe(e.value)?this.messages.empty:e.name;return ue("calcite-combobox-item",{heading:i,key:`#${t}`,selected:a.value===t,value:`${t}`})});let n=[];const{messages:s}=this;t.other.length>0&&n.push(ue("calcite-combobox-item-group",{key:"other",label:s.other},i(t.other))),t.unsupported.length>0&&n.push(ue("calcite-combobox-item-group",{key:"unsupported",label:s.unsupported},i(t.unsupported)));const o=i(t.recommended);n.length>0?n.unshift(ue("calcite-combobox-item-group",{key:"recommended",label:s.recommended},o)):n=o;const l=a.placeholder===this.messages.differentValuesPlaceholder,r=!l&&pe(a.value);return e.showNoValueOptionEnabled&&!t.containsEmptyOption&&n.unshift(ue("calcite-combobox-item",{heading:e.showNoValueLabel||this.messages.empty,key:"empty-option",selected:r,value:""})),l&&n.unshift(ue("calcite-combobox-item",{heading:this.messages.differentValuesPlaceholder,key:j,selected:!0,value:j})),n}_renderRadioButtonGroupComponent({input:e,options:t,props:a}){const i=[...t.recommended,...t.other,...t.unsupported].map(({name:t,value:i})=>this._renderRadioButtons({label:t,value:i,selected:i===e.value,props:a}));if(e.showNoValueOptionEnabled&&!t.containsEmptyOption){const t="",n=e.showNoValueLabel||this.messages.empty,s=pe(e.value);i.unshift(this._renderRadioButtons({label:n,value:t,selected:s,props:a}))}return ue("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:D.inputRadioGroup,"data-field-name":a[ve],disabled:a.readOnly||a.disabled,key:`${a.key}-radio-group`,layout:"vertical",name:`${a.name}-${this.id}`,required:a.required},i,a.placeholder===this.messages.differentValuesPlaceholder?ue("calcite-label",{class:D.placeholderRadio,key:a.label,layout:"inline"},ue("calcite-radio-button",{checked:!0,class:D.inputRadio,disabled:!0,value:a.placeholder}),a.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:a,props:i}){return ue("calcite-label",{class:D.inputRadioLabel,key:i.label,layout:"inline"},ue("calcite-radio-button",{...i,afterCreate:void 0,afterUpdate:void 0,checked:t,class:D.inputRadio,disabled:i.readOnly||i.disabled,name:void 0,value:e,onblur:()=>{this._focusedFieldInput=null},onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInputFromElement(e)}}),a)}_renderStringComponent(e,t){const{template:a}=e;return!a.field.editable||this.readOnly?this._renderReadOnlyComponent(e):"text-area"===a.input?.type?ue("calcite-text-area",{...t,class:this.classes(D.individualElement),resize:"vertical",value:t.value?String(t.value):"",onblur:a=>{t.onblur(a),e.userHasChangedValue&&this._saveInputFromElement(a.currentTarget)},onCalciteTextAreaInput:t=>{e.userHasChangedValue=!0,""===t.currentTarget.value&&this._saveInputFromElement(t.currentTarget)}}):ue("calcite-input",{...t,class:this.classes(D.individualElement),type:"text",value:t.value?String(t.value):"",onblur:a=>{t.onblur(a),e.userHasChangedValue&&this._saveInputFromElement(a.currentTarget)},onCalciteInputInput:t=>{e.userHasChangedValue=!0,""===t.currentTarget.value&&this._saveInputFromElement(t.currentTarget)}})}_renderNumberComponent(e,t){const a=g(e.field);return ue("calcite-input-number",{...t,integer:a,step:a?1:"any",type:"number",value:a&&""!==t.value?Math.round(parseFloat(String(t.value))).toString():String(t.value),onblur:a=>{t.onblur(a),e.userHasChangedValue&&this._saveInputFromElement(a.currentTarget)},onCalciteInputNumberInput:t=>{e.userHasChangedValue=!0,""===t.currentTarget.value&&this._saveInputFromElement(t.currentTarget)}})}_renderReadOnlyComponent(e,t){const a=this.getCommonInputProps(e);return ue("calcite-input",{...a,class:this.classes(D.fieldInput,D.inputDisabled,D.individualElement),readOnly:!0,type:"text",value:String(t??a.value??"")})}_renderDateComponents(e,t){const{field:a}=e;let i;switch(a.type){case"date":i=this._renderDateFieldComponents(e,t);break;case"date-only":i=this._renderDateOnlyFieldComponent(e,t);break;case"time-only":i=this._renderTimeOnlyFieldComponent(e,t);break;case"timestamp-offset":i=this._renderTimestampOffsetFieldComponents(e,t);break;default:i=this._renderReadOnlyComponent(e,ee(a,t.value,{timeZone:e.effectiveTimeZone,...te(e.template.field)}))}return e.value===j?[i,ue("calcite-input-message",{icon:"information",key:"diff-values-message",status:"idle"},this.messages.differentValues)]:i}_renderDateOnlyFieldComponent(e,t){const{class:a,disabled:i,key:n,readOnly:s}=t,{rawMax:o,rawMin:l}=e.range;return ue("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,class:a,"data-date-part":"date","data-element-id":t[ge],"data-field-name":t[ve],disabled:i,key:`${n}-date-input`,max:v(o)?o:void 0,min:v(l)?l:void 0,overlayPositioning:"fixed",readOnly:s,topLayerDisabled:this.topLayerDisabled,value:e.value===j?"":e.value?String(e.value):"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:this._onComponentFocus})}_renderTimeOnlyFieldComponent(e,t){const{class:a,disabled:i,key:n,readOnly:s}=t;return ue("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,class:a,"data-date-part":"time","data-element-id":t[ge],"data-field-name":t[ve],disabled:i,key:`${n}-time-input`,overlayPositioning:"fixed",readOnly:s,step:e.timeStep,value:e.value===j?"":e.value?String(e.value):"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:this._onComponentFocus})}_renderTimestampOffsetFieldComponents(e,t){const{class:a,disabled:i,key:n,readOnly:s}=t,{rawMax:o,rawMin:l}=e.range,r=e.effectiveTimeZone,c=ae(o,r),d=ae(l,r),m=ae(e.value===j?"":e.value,r),u=e.includeTimeOffset,h={afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,disabled:i,[ge]:t[ge],[ve]:t[ve],onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:s};return ue("div",{class:D.dateInputContainer,key:`${n}-date-time-container`},ue("calcite-input-date-picker",{...h,class:a,"data-date-part":"date",key:`${n}-date-input`,max:c?.date??void 0,min:d?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:m.date??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),ue("calcite-input-time-picker",{...h,class:a,"data-date-part":"time",key:`${n}-time-input`,step:e.timeStep,value:m.time??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),u?ue("calcite-input-time-zone",{...h,class:a,clearable:e.value===j||null==e.value,"data-date-part":"timeZone",key:`${n}-timezone-input`,value:m.timeZoneOffset||"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:a,disabled:i,key:n,readOnly:s,min:o,max:l}=t,r=e.effectiveTimeZone,c=ie(e.value===j?"":e.value,r),d=ie(l,r),m=ie(o,r),u=e.includeTime,h={afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,disabled:i,[ge]:t[ge],[ve]:t[ve],onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:s};return ue("div",{class:D.dateInputContainer,key:`${n}-date-time-container`},ue("calcite-input-date-picker",{...h,class:a,"data-date-part":"date",key:`${n}-date-input`,max:d?.date??void 0,min:m?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:c.date??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),u?ue("calcite-input-time-picker",{...h,"data-date-part":"time",key:`${n}-time-input`,step:1,value:c.time??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}_renderRelationshipElementInput(e){return this._relatedRecordsEnabled?ue(X,{afterObserverCreated:this._afterListObserverCreated,afterObserverRemoved:this._afterListObserverRemoved,input:e,messages:this.messages,messagesCommon:this.messagesCommon,viewModel:this.viewModel}):null}_renderRelationshipListPage(){const{activeRelationshipInput:e}=this.viewModel;if(e)return this._renderRelationshipElementInput(e)}_renderAttachmentElementInput(e){if(!this.attachmentsEnabled)return;const{allAttachmentsVisibleOnDefaultPage:t,attachments:a,defaultPageAttachments:i,template:{description:n,elementId:s,label:o}}=e,l=t?a:i;return ue("div",{class:D.attachmentElementInput,"data-testid":`attachment-element-${s}`,key:`attachment-element-${s}`},o?ue("div",{class:D.attachmentElementLabel,key:`attachment-element-label-${s}`},o):null,n?ue("div",{class:D.description,key:`attachment-element-description-${s}`},n):null,a.length?this._renderAttachmentList(e,l,{label:o||this.messagesCommon.details,viewAllCount:t?null:a.length}):ue("div",{class:D.attachmentElementEmptyState,key:`attachment-element-empty-state-${s}`},this.messages.attachments.noAttachments),this._renderAttachmentAddAction(e))}_renderAttachmentListPage(){const e=this.viewModel.selectedAttachmentListInput;if(e)return ue("div",{class:D.attachmentElementAllPanel,key:`attachment-element-all-panel-${e.template.elementId}`},this._renderAttachmentList(e,e.attachments,{filterEnabled:!0,label:this.messages.titles.attachments}))}_renderAttachmentList(e,t,a){const{filterEnabled:i,label:n,viewAllCount:s}=a;return ue("calcite-list",{class:D.attachmentElementList,filterEnabled:i,filterPlaceholder:i?this.messages.attachments.searchAttachments:void 0,filterProps:i?ce:void 0,filterText:i?this._attachmentListFilterText:void 0,label:n,selectionAppearance:"border",selectionMode:"none",onCalciteListFilter:i?e=>{this._attachmentListFilterText=e.currentTarget.filterText??""}:void 0},this._renderAttachmentListItems(e,t),null!=s?this._renderViewAllAttachmentsItem(e,s):null)}_renderAttachmentListItems(e,t){const{elementId:a}=e.template;return t.map((t,i)=>{const n=this._formatAttachmentSize(t.size),s=this._getAttachmentLabel(t,i,n,e.displayFilename),o=s===n?void 0:n,l=C(t),r=e.isStagedAttachmentAddition(t),c=e.getAttachmentEditState(t),d=c.isDeleted,m=!d&&(r||c.isRenamed||c.isReplaced);return ue("calcite-list-item",{class:D.attachmentElementListItem,description:o,key:`attachment-item-${l}`,label:s,onCalciteListItemSelect:r||d?void 0:()=>this._setSelectedAttachment({attachmentKey:l,elementId:a})},ue("div",{class:D.attachmentElementListItemStart,slot:"content-start"},this._renderAttachmentPreviewThumbnail(t,s,e)),m?ue("span",{class:D.attachmentElementListItemStagedIndicator,slot:"content-end"}):null,r?[ue("calcite-action",{disabled:this._disableAttachmentModification(e),icon:"x",scale:"s",slot:"actions-end",text:this.messagesCommon.delete,title:this.messagesCommon.delete,onclick:()=>this.viewModel.stageDeleteAttachment(a,C(t))})]:d?ue("calcite-chip",{label:this.messages.attachments.deleted,scale:"s",slot:"content-end"},this.messages.attachments.deleted):ue("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))})}_renderViewAllAttachmentsItem(e,a){const{elementId:i}=e.template,{viewAll:n}=this.messages.attachments;return ue("calcite-list-item",{class:D.attachmentElementListItem,description:t(this.messages.attachments.count,{count:a}),key:`attachment-item-view-all-${i}`,label:n,onCalciteListItemSelect:()=>this._setAttachmentListElementId(i)},ue("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderAttachmentAddAction(e){const{elementId:t}=e.template,a=this.effectiveDisabled||e.addDisabled,i=this._renderAttachmentCountLimitsLabel(e),n=this._getAttachmentNoticeMessage(e),s=e.hasMinimumAttachmentCountNotMet||e.hasExceededAttachmentLimit?"danger":"info",o=e.canUploadFiles,l=e.isCaptureOnly&&!this.effectiveDisabled&&!n;return ue("div",{class:D.attachmentElementAddActions,key:`attachment-element-add-actions-${t}`},o?ue("calcite-button",{appearance:"outline",disabled:a,iconStart:"attachment",kind:"neutral",round:!0,scale:"s",onclick:()=>this._setAttachmentAddElementId(t)},this.messages.attachments.attach):null,this._renderAttachmentCaptureButton(e),l?this._renderAttachmentCaptureDisabledNotice(t):null,i?ue("div",{class:D.attachmentElementEmptyActionHint},i):null,!this.effectiveDisabled&&n?ue("calcite-notice",{closable:!1,icon:"danger"===s?"exclamation-mark-circle":"lightbulb",kind:s,open:!0,scale:"s",width:"full"},ue("div",{slot:"message"},n)):null)}_renderAttachmentCaptureButton(e){if(!e.hasCaptureInputs)return null;const t=e.captureMediaType;return ue("calcite-button",{appearance:"outline",disabled:!0,iconStart:Ce(t),kind:"neutral",round:!0,scale:"s"},this._getCaptureButtonLabel(t))}_getAttachmentNoticeMessage(e){const t=this.messages.attachments;return e.hasUnsupportedFileTypeValidationError?this._getUnsupportedFileTypeMessage():e.hasMinimumAttachmentCountNotMet&&this._shouldShowMinimumAttachmentNotice(e)?t.minimumNotMet:e.hasExceededAttachmentLimit?t.attachmentLimitExceeded:e.hasReachedAttachmentLimit?t.attachmentLimitReached:null}_shouldShowMinimumAttachmentNotice(e){return e.hasAttachmentChanges||this.viewModel.submitHasBeenAttempted||this._touchedInputs.has(e.template.elementId)}_getCaptureButtonLabel(e){const{capture:t,recordAudio:a,takePhoto:i,takeVideo:n}=this.messages.attachments;switch(e){case"image":return i||t;case"video":return n||t;case"audio":return a||t;default:return t}}_renderAttachmentAddPage(){const e=this.viewModel.selectedAttachmentAddInput;return e?this._renderAttachmentAddPanel(e):null}_renderAttachmentAddPanel(e){const{maxAttachmentCount:t}=e,{elementId:a}=e.template;if(e.isCaptureOnly)return this._renderAttachmentCaptureDisabledNotice(a);const i=null==t||t-e.attachments.length>1,n=this.effectiveDisabled||e.addDisabled,s=this.messages.attachments,o=s.dragAndDropFile,l="upload",r=e=>{this._attachmentFileInputMap.set(a,e)};return ue("div",{class:D.attachmentElementAddPanel,key:`attachment-element-add-panel-${a}`},ue("input",{accept:e.accept,afterCreate:r,afterRemoved:()=>{this._attachmentFileInputMap.delete(a)},afterUpdate:r,class:D.attachmentElementFileInput,"data-element-id":a,disabled:n,multiple:i,type:"file",onchange:e=>{const t=e.currentTarget,i=t.files?Array.from(t.files):[];this._stageAttachmentFiles(a,i),t.value=""}}),ue("div",{class:D.attachmentElementAddDropzone,"data-disabled":n?"true":"false",ondragover:e=>{e.stopPropagation(),e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")},ondrop:e=>{if(e.preventDefault(),e.stopPropagation(),n)return;const t=e.dataTransfer?.files?Array.from(e.dataTransfer.files):[];this._stageAttachmentFiles(a,t)}},ue("calcite-icon",{class:D.attachmentElementAddDropzoneIcon,icon:l,scale:"l"}),ue("div",{class:D.attachmentElementAddDropzoneHeading},s.addFile),ue("div",{class:D.attachmentElementAddDropzoneDetail,title:o},o),ue("calcite-button",{appearance:"transparent",disabled:n,iconStart:"folder-open",kind:"brand",scale:"s",type:"button",onclick:e=>{e.stopPropagation(),this._openAttachmentFilePicker(a,n)}},s.selectFile)),this._renderAttachmentValidationCriteria(e,{includeCountCriteria:!0}))}_renderAttachmentCaptureDisabledNotice(e){return ue("calcite-notice",{class:D.attachmentElementCaptureNotice,icon:!0,key:`attachment-element-capture-disabled-notice-${e}`,kind:"warning",open:!0,scale:"s"},ue("div",{slot:"message"},this.messages.attachments.captureMethodNotSupported))}async _stageAttachmentFiles(e,t){if(0===t.length)return;const a=this.viewModel.selectedAttachmentAddInput;let i=!0;try{i=(await this.viewModel.stageAddAttachments(e,t)).length>0&&!a?.hasInvalidValidationCriteria&&!a?.hasUnsupportedFileTypeValidationError}finally{i&&this.viewModel.setSelectedAttachmentAddElementId(null)}}_openAttachmentFilePicker(e,t){t||this._attachmentFileInputMap.get(e)?.click()}_renderAttachmentDetailPage(){const e=this.selectedAttachmentDetails;if(!e)return;if("replacing-attachment"===this.page)return this._renderAttachmentReplacePanel(e);const{attachment:t,input:a}=e,i=C(t),n=!!a.getAttachmentPreviewUrl(t),s=!this._disableAttachmentModification(a)&&a.canUploadFiles,o=a.getAttachmentEditState(t);return ue("div",{class:D.attachmentElementDetail,key:`attachment-detail-panel-${a.template.elementId}-${i}`},ue("div",{class:D.attachmentElementDetailPreview},this._renderAttachmentPreviewImageForInput(t,a)),ue("div",{class:D.attachmentElementDetailActions},y(t)?ue("calcite-button",{appearance:"outline",disabled:!n,iconStart:"expand",kind:"neutral",label:this.messages.attachments.maximize,scale:"m",title:this.messages.attachments.maximize,onclick:this._maximizeSelectedAttachment}):null,ue("calcite-button",{appearance:"outline",disabled:!n||o.isReplaced,iconStart:"download",kind:"neutral",label:this.messages.attachments.download,scale:"m",title:this.messages.attachments.download,onclick:()=>{this._downloadAttachment(t)}}),ue("calcite-button",{appearance:"outline",disabled:!s,iconStart:"upload-to",kind:"neutral",label:this.messages.attachments.replace,scale:"m",title:this.messages.attachments.replace,onclick:this._enterAttachmentReplaceView})),ue("div",{class:D.attachmentElementDetailMetadata},ue("div",{class:D.attachmentElementDetailMetadataGroup},ue("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.fileName),this._renderFileNameContent(t,a)),ue("div",{class:D.attachmentElementDetailMetadataGroup},ue("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.size),ue("span",{class:D.attachmentElementDetailMetadataValue},this._formatAttachmentSize(t.size))),ue("div",{class:D.attachmentElementDetailMetadataGroup},ue("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.type),ue("span",{class:D.attachmentElementDetailMetadataValue},this._getLabelForAttachmentType(t)))))}_renderFileNameContent(e,t){if(!t.allowUserRename)return ue("span",{class:D.attachmentElementDetailMetadataValue},e.name);const a=t.getAttachmentEditState(e),{baseName:i,extension:n}=A(e.name),s=this._disableAttachmentModification(t),o=!s&&0===e.name.trim().length;return[ue("div",{class:D.attachmentElementDetailFileNameRow,key:"file-name-row"},ue("calcite-input",{class:D.attachmentElementDetailFileNameInput,disabled:s,scale:"m",status:o?"invalid":"idle",suffixText:n,value:i,onCalciteInputInput:({currentTarget:e})=>this._renameSelectedAttachment(e.value)}),ue("calcite-button",{appearance:"transparent",disabled:s||null==a.initialName||!a.isRenamed,iconStart:"reset",kind:"neutral",label:this.messages.footerButtons.reset,scale:"m",title:this.messages.footerButtons.reset,onclick:this._resetSelectedAttachmentName})),o?ue("calcite-input-message",{icon:!0,key:"file-name-message",status:"invalid"},this.messages.validationErrors.cannotBeNull):null]}_renderAttachmentReplacePanel(e){const{attachment:t,input:a}=e,i=this._disableAttachmentModification(a)||!a.canUploadFiles,n=a.template.elementId;return ue("div",{class:D.attachmentElementAddPanel,key:`attachment-replace-panel-${n}-${C(t)}`},ue("input",{accept:a.accept,afterCreate:this._setSelectedAttachmentReplaceFileInput,afterRemoved:()=>{this._selectedAttachmentReplaceFileInput=null},afterUpdate:this._setSelectedAttachmentReplaceFileInput,class:D.attachmentElementFileInput,disabled:i,type:"file",onchange:e=>{const t=e.currentTarget,a=t.files?.[0];a&&this._stageSelectedAttachmentReplacement(a),t.value=""}}),ue("div",{class:D.attachmentElementAddDropzone,"data-disabled":i?"true":"false",ondragover:e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")},ondrop:e=>{if(e.preventDefault(),e.stopPropagation(),i)return;const t=e.dataTransfer?.files?.[0];t&&this._stageSelectedAttachmentReplacement(t)}},ue("calcite-icon",{class:D.attachmentElementAddDropzoneIcon,icon:"refresh",scale:"l"}),ue("div",{class:D.attachmentElementAddDropzoneHeading},this.messages.attachments.replace),ue("div",{class:D.attachmentElementAddDropzoneDetail,title:this.messages.attachments.dragAndDropFile},this.messages.attachments.dragAndDropFile),ue("calcite-button",{appearance:"transparent",disabled:i,iconStart:"folder-open",kind:"brand",scale:"s",onclick:e=>{e.stopPropagation(),this._openSelectedAttachmentReplaceFilePicker()}},this.messages.attachments.selectFile)),this._renderAttachmentValidationCriteria(a,{includeCountCriteria:!1}),ue("div",{class:D.attachmentElementDetailMetadata},ue("div",{class:D.attachmentElementDetailMetadataGroup},ue("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.fileToBeReplaced),ue("span",{class:D.attachmentElementDetailMetadataValue},t.name))))}_renderAttachmentDialog(){const e=this._attachmentDialogInfo;if(!e)return null;const{attachment:t,input:a}=e;return ue("calcite-dialog",{heading:t.name||this.messagesCommon.details,key:"attachment-preview-dialog",modal:!0,open:!0,placement:"cover",width:"l",onCalciteDialogClose:this._closeAttachmentDialog},ue("div",{class:D.attachmentElementDialogPreview},this._renderAttachmentPreviewImageForInput(t,a)))}_setSelectedAttachment(e){e?.elementId&&this._touchedInputs.add(e.elementId),this.viewModel.setSelectedAttachment(e),e||this.hideAttachmentDialog()}_setAttachmentAddElementId(e){e&&this._touchedInputs.add(e),this.viewModel.setSelectedAttachmentAddElementId(e),this.viewModel.selectedAttachmentAddInput?.clearValidationCriteriaState(),this.hideAttachmentDialog()}_setAttachmentListElementId(e){e&&this._touchedInputs.add(e),this.viewModel.setSelectedAttachmentListElementId(e),this.hideAttachmentDialog()}_getAttachmentLabel(e,a,i,n){return!1!==n&&v(e.name)&&e.name.length>0?e.name:i!==this.messagesCommon.notApplicable?i:t(this.messages.attachments.attachmentNumberedLabel,{index:a+1})}_renderAttachmentCountLimitsLabel(e){const t=this.messages.attachments,a=null!=e.minAttachmentCount&&e.minAttachmentCount>0?this._renderAttachmentCountLimitLabel(t.minAttachmentsShort,e.minAttachmentCount,"min"):null,i=null!=e.maxAttachmentCount?this._renderAttachmentCountLimitLabel(t.maxAttachmentsShort,e.maxAttachmentCount,"max"):null;return a||i?[a,a&&i?ue("span",{key:"attachment-count-limits-separator"},", "):null,i]:null}_renderAttachmentCountLimitLabel(e,a,i){const n="__count__",[s,o]=t(e,{count:n}).split(n);return ue("span",{key:i},s,ue("span",{class:D.attachmentElementEmptyActionHintValue},a),o)}_renderAttachmentValidationCriteria(e,{includeCountCriteria:t}){const a=this._getAttachmentValidationCriteria(e,{includeCountCriteria:t}),i=`attachment-validation-criteria-${e.template.elementId}`;return 0===a.length?null:ue("div",{class:D.attachmentElementValidationCriteria,key:i},a.map(({key:e,message:t,state:a})=>ue("calcite-notice",{appearance:"danger"===a?"outline-fill":"transparent",closable:!1,icon:!0,key:e,kind:a,open:!0,scale:"s",width:"full"},ue("div",{slot:"message"},t))))}_getAttachmentValidationCriteria(e,{includeCountCriteria:a}){const i=[],n=e.validationCriterionStates,s=this.messages.attachments,o=this._getNestableAttachmentInputs(e.input);e.hasUnsupportedFileTypeValidationError&&i.push({key:"unsupported-file-type",message:this._getUnsupportedFileTypeMessage(),state:"danger"});for(const l of o)"document"===l.type&&null!=l.maxFileSize&&i.push({key:"maximum-file-size",message:t(s.maximumFileSize,{maxSize:this._formatAttachmentSizeLimitInMegabytes(l.maxFileSize)}),state:n.get("maximum-file-size")??"info"}),"audio"===l.type&&null!=l.maxDuration&&i.push({key:"maximum-audio-length",message:t(s.maximumAudioLength,{maxDuration:this._formatAttachmentDurationLimit(l.maxDuration)}),state:n.get("maximum-audio-length")??"info"}),"video"===l.type&&null!=l.maxDuration&&i.push({key:"maximum-video-length",message:t(s.maximumVideoLength,{maxDuration:this._formatAttachmentDurationLimit(l.maxDuration)}),state:n.get("maximum-video-length")??"info"}),"image"===l.type&&null!=l.maxImageSize&&i.push({key:"maximum-image-size",message:t(s.attachmentMustBeSmallerThan,{maxSize:`${l.maxImageSize}px`}),state:n.get("maximum-image-size")??"info"});return a&&null!=e.minAttachmentCount&&e.minAttachmentCount>0&&i.push({key:"minimum-number-of-files",message:t(s.minimumNumberOfFiles,{count:e.minAttachmentCount}),state:n.get("minimum-number-of-files")??"info"}),a&&null!=e.maxAttachmentCount&&i.push({key:"maximum-number-of-files",message:t(s.maximumNumberOfFiles,{count:e.maxAttachmentCount}),state:n.get("maximum-number-of-files")??"info"}),i}_getNestableAttachmentInputs(e){return null==e?[]:"attachment"===e.type?e.inputTypes?.slice()??[]:[e]}_getUnsupportedFileTypeMessage(){return this.featureTableMessages.errorFileUnsupported}_formatAttachmentSize(e){return null==e||Number.isNaN(e)?this.messagesCommon.notApplicable:m(this.messagesUnits,e)}_formatAttachmentSizeLimitInMegabytes(e){return m(this.messagesUnits,1048576*e)}_formatAttachmentDurationLimit(e){return p(1e3*Math.round(e),{...e>=3600?{hour:"2-digit",hourCycle:"h23"}:{},minute:"2-digit",second:"2-digit",timeZone:"UTC"})}_getLabelForAttachmentType({contentType:e}){if(!e)return this.messagesCommon.notApplicable;const t=this.messages.attachments.attachmentTypes,a=f(e);return t?.[a]||e}_renderAttachmentPreviewThumbnail(e,t,a){const i=a.getAttachmentPreviewUrl(e,64);return i&&y(e)?ue("img",{alt:t,class:D.attachmentElementListItemThumb,src:i}):ue("calcite-icon",{class:D.attachmentElementListItemIcon,icon:_(e.contentType),scale:"s"})}_renderAttachmentPreviewImageForInput(e,t){const a=t.getAttachmentPreviewUrl(e),i=e.name||this.messagesCommon.details;return a&&y(e)?ue("img",{alt:i,class:D.attachmentElementDetailPreviewImage,src:a,title:i}):[ue("calcite-icon",{class:D.attachmentElementDetailPreviewIcon,icon:_(e.contentType),scale:"l",textLabel:i,title:i}),this.messages.attachments.noPreviewAvailable]}async _downloadAttachment(e){await Q(e)}_canReplaceSelectedAttachment(){return!this.effectiveDisabled&&!!this.selectedAttachmentDetails?.input.canUploadFiles}_exitAttachmentReplaceView(){this.viewModel.setShowingSelectedAttachmentReplacePage(!1),this._selectedAttachmentReplaceFileInput=null}async _stageSelectedAttachmentReplacement(e){const t=this.selectedAttachmentDetails;if(!t?.attachment)return;const a=t.input.template.elementId,i=C(t.attachment);let n=!1;try{n=await this.viewModel.stageReplaceAttachment(a,i,e)}finally{n&&this._exitAttachmentReplaceView()}}_renameSelectedAttachment(e){const t=this.selectedAttachmentDetails;if(!t?.attachment)return;const a=t.input.template.elementId,i=C(t.attachment);this.viewModel.stageRenameAttachment(a,i,e)}_resetSelectedAttachmentChanges(){const e=this.selectedAttachmentDetails;e?.attachment&&this.viewModel.resetAttachmentChanges(e.input.template.elementId,C(e.attachment))}_deleteSelectedAttachment(){const e=this.selectedAttachmentDetails;if(!e?.attachment||this._disableAttachmentModification(e.input))return;const t=e.input.template.elementId,a=C(e.attachment);this.viewModel.stageDeleteAttachment(t,a),this._setSelectedAttachment(null)}_disableAttachmentModification(e){return this.disabledOrReadOnly||!e.editable}hideAttachmentDialog(){this._attachmentDialogInfo=null}_renderTextComponent(e){const{elementId:t}=e.template;return ue("div",{class:D.textElementInput,"data-testid":`text-element-${t}`,innerHTML:e.text,key:`text-element-${t}`})}_renderUtilityNetworkAssociationsElementInput(e){if(!this._associationsEnabled)return;const{elementId:t}=e.template;return ue("div",{class:D.utilityNetworkAssociationsElementInput,"data-testid":t,key:t},this._associationsWidgetsMap.get(e)?.render())}getCommonInputProps(e){const{template:t,valid:a,value:i,minLength:n,maxLength:s,required:o,fieldName:l,editable:r,userHasChangedValue:c,range:{max:d,min:m}}=e,u=!r||this.readOnly,h=this.disabled||this.viewModel.updating;let p=t.hint??void 0,g=!1;return i===j&&(p=this.messages.differentValuesPlaceholder,g=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":a?"false":"true",class:this.classes(D.fieldInput,u?D.inputDisabled:null),status:!c&&!this.viewModel.submitHasBeenAttempted||a?"idle":"invalid",maxLength:s&&s>-1?s:void 0,minLength:n&&n>-1?n:void 0,key:t.elementId,label:l,name:l,max:null!=d?d:void 0,min:null!=m?m:void 0,disabled:h,readOnly:u,onblur:this._onComponentBlur,required:o,placeholder:p,value:g?"":i??"",[ge]:t.elementId,[ve]:l,onfocus:this._onComponentFocus}}_onObserverChange(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode);const e=this.viewModel.activeRelationshipInput;e&&this._listObserverNode&&e.showAllEnabled&&this._listObserver.observe(this._listObserverNode)}_onFormSubmit(e){e.preventDefault()}_handleDragAndDrop(e){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none")}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(ge))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,a=e.querySelector("calcite-radio-button"),i=t||a;i&&this._afterComponentCreateOrUpdate(i)}_onComponentFocus(e){const t=e.target,a=this._getFieldInputFromHTMLElement(t);this._isMultipleChoiceCheckbox(t,a)||this._markFieldInputTouched(a),this._focusedFieldInput=a}_markFieldInputTouched(e){this._touchedInputs.add(e.template.elementId)}_isMultipleChoiceCheckbox(e,t){const a=this._getMultipleChoiceController(t);return"CALCITE-CHECKBOX"===e.tagName&&null!=a?.input}_afterComponentCreateOrUpdate(e){const t=this._getFieldInputFromHTMLElement(e),a=this._focusedFieldInput;this._attemptFocusOnNextRender&&a===t&&(this._attemptFocusOnNextRender=!1,he(e))}_onComponentBlur(){this._focusedFieldInput=null}_onDynamicChoiceBlur(e,t){const a=e.currentTarget;if(this._dynamicChoiceItemSelections.delete(t))return;const i=e.relatedTarget;i instanceof Node&&a.contains(i)||(t.endInteraction(),a.inputValue=t.inputValue,this._onComponentBlur())}_resetTransientFormState(){this._attemptFocusOnNextRender=!1,this._focusedFieldInput=null,this._attachmentDialogInfo=null,this._selectedAttachmentReplaceFileInput=null,this._attachmentListFilterText="",this._attachmentFileInputMap.clear(),this._touchedInputs.clear()}_parseValue(e,t,a=!1){const i=this._getMultipleChoiceController(t);if(i){const{input:t,values:n}=i;if(t&&n){const t=e;return i.getValueFromCheckboxChange({choiceValue:t.value,isChecked:t.checked,isSelectAllCheckbox:a})}}if(F(t.template,"switch")){if("calcite-dropdown"===e.localName&&t.domain)for(const a of t.domain.codedValues)if(a.name===e.selectedItems[0].textContent)return a.code;return e.checked?t.template.input.onValue:t.template.input.offValue}const n=e.value;return null==n||""===n?null:"number"===t.dataType?"-0"===n||"-0."===n||"-0,"===n?n:parseFloat(n):"date"===t.field.type?parseFloat(n):n}_getMultipleChoiceController(e){return R(e.inputController)?e.inputController:null}_saveInputFromElement(e){const t=this._getFieldInputFromHTMLElement(e);if(!t)return;const a=this._parseValue(e,t);this._saveInput(t,a)}_saveInput(e,t){const{elementId:a}=e.template,i=e?.value,{viewModel:s}=this;if(F(e.template,"switch")&&"single"!==s.mode){const t=n(this._batchSwitchInputInitialValues,e,()=>e.value);this._batchSwitchInputInitialValues.set(e,null===t?i:t)}t!==i&&(e.isSubtypeField&&"batch"!==s.mode&&k(s.activeLayer,i,t)?this._pendingSubtypeChoice||(this._pendingSubtypeChoice=this._handleSubtypeChoice(e,t)):s.setValue(a,t))}async _handleSubtypeChoice(e,a){const{value:i,template:n}=e,{elementId:s}=n,{messages:o,viewModel:l,messagesCommon:r}=this,{subtypes:c,activeFeatureIndex:d}=l;if(await l.setValue(s,a),!c?.length)return;const m=c.find(e=>e.code===a),u=c.find(e=>e.code===i)?.name??`${i}`;if(!m)return;const h=Promise.withResolvers();l.pendingSubtypeChoice=h;let p="update-fields";const g=[{label:o.subtypes.useDefaultValuesOption,value:"update-fields"},{label:o.subtypes.keepCurrentValuesOption,value:"keep-existing"}],v={context:"info",title:o.subtypes.changeWarningTitle,message:t(o.subtypes.changeWarning,{originalType:u,newType:m.name}),radios:g,defaultRadioSelection:"update-fields",onRadioSelection:e=>{p=e},actions:{primary:{label:r.apply,action:()=>h.resolve(p),type:"positive"},secondary:{label:r.cancel,type:"neutral",action:()=>h.resolve("undo")}},cancel:()=>h.reject()};try{this.showPrompt(v);switch(await h.promise){case"update-fields":await l.applySubtypeDefaults(m),await l.handleSubtypeChanged(d);break;case"keep-existing":await l.handleSubtypeChanged(d);break;case"undo":await this.viewModel.setValue(s,i)}}finally{l.pendingSubtypeChoice=null,this.clearPrompt(),this._pendingSubtypeChoice=null}}_afterDateComponentCreateOrUpdate(e){this._setDateTimeTimeZoneMap(e),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:a}=e.template,i=e.field.type,n=this._dateComponentMap.get(`${a}`);if(!n)return;const s=e.effectiveTimeZone;let o=e.value===j?void 0:e.value,l=null;"date-only"===i?l=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===i?(o=ne(o),l=ne(t.value)):l="timestamp-offset"===i?null!=t.value?se({dateComponent:n.date,timeComponent:n.time,oldValue:o,timeZoneComponent:n.timeZone,defaultTimeZone:s}):null:null!=t.value?oe({oldValue:o,dateComponent:n.date,timeZone:s,timeComponent:n.time?.value===j?void 0:n.time}):null,o!==l&&(null!==l&&t.value?this.viewModel.setValue(`${a}`,l):this.viewModel.setValue(`${a}`,null))}_getErrorToDisplay(e){const t=e.compositeError;return e.valid||!t?null:"contingent-values-validation-error::contingency-violation-error"===t||"contingent-values-validation-error::contingency-violation-warning"===t||this._touchedInputs.has(e.template.elementId)||this.viewModel.submitHasBeenAttempted?t:null}_renderViewingAssociationsPage(){return this._associationsList?.render()}_onActiveAssociationsInputChange(e){const t=this._associationsList;t&&(e?(t.associationInput=e,t.viewModel=e.viewModel):t.associationInput=null)}async _setUpAssociationsWidgets(){const e=this.viewModel.activeForm.allUtilityNetworkAssociationsElementInputs;if(this._associationsEnabled&&0!==e.length){await this._setUpUtilityNetworkAssociationList();for(const t of e)this._associationsWidgetsMap.set(t,await this._createAssociationsWidget(t))}}async _setUpUtilityNetworkAssociationList(){if(this._associationsList)return;const e=(await(import("./FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js"))).default;this._associationsList=new e({onSelectLayer:this._onSelectAssociatedLayer.bind(this),onSelectFeature:this._onEditAssociatedFeature.bind(this),onAddAssociation:this._onAddAssociation.bind(this)});const t=this.viewModel.activeAssociationsInput;t&&(this._associationsList.associationInput=t,this._associationsList.viewModel=t.viewModel)}async _createAssociationsWidget(e){return new(0,(await(import("./Feature/FeatureUtilityNetworkAssociations.js"))).default)({viewModel:e.viewModel,onSelectAssociationType:t=>this._onSelectAssociationType(e,t)})}_destroyAssociationsWidgets(){this._associationsWidgetsMap.forEach(e=>s(e)),this._associationsWidgetsMap.clear()}_onSelectAssociationType(e,{listType:t}){this.setActiveAssociationsInput(e),this.setActiveAssociationType(t)}_onSelectAssociatedLayer({layer:e}){this.setActiveAssociationsLayer(e)}async _onEditAssociatedFeature(e){const t=this.callbacks?.editAssociatedFeature,a=this.viewModel.activeAssociationsInput;if(!t||!a?.feature)return;const{association:i,feature:n}=e;await t({parentFeature:a.feature.plainGraphic,association:i,feature:n})}_onAddAssociation(e){const t=this.callbacks?.addAssociation,a=this.viewModel.activeAssociationsInput;if(!t||!a?.feature)return;const{associationType:i,utilityNetwork:n}=e;t({feature:a.feature.plainGraphic,associationType:i,utilityNetwork:n})}_setFocusableInput(e){const t=e&&U(e)?e:this._findFocusableInput(e);this._syncGroupInputStates(),this._focusedFieldInput=t,this._attemptFocusOnNextRender=!0}_findFocusableInput(e){const t=this.viewModel.activeForm.inputs;if(!t.length)return;const a=M(t);let i;if(e)if(N(e)){const t=e.inputs.find(e=>e.visible);i=t?a.indexOf(t):0}else{let n;if(W(e)&&!e.group.open){n=e.group.inputs.filter(U)[t.length-1]}else n=e;i=a.indexOf(n)+1}else i=0;for(let n=i;n<a.length;n++){const e=a[n];if(e.visible&&U(e)){if(this.disabledOrReadOnly&&("switch"===e?.inputType||"radio-buttons"===e?.inputType))continue;return e}}return null}_onGroupToggle(e,t){e.expanded?(t.open=!0,this._setFocusableInput(t),"sequential"===this.groupDisplay&&this.viewModel.activeForm.allGroupInputs.forEach(e=>{e!==t&&(e.open=!1)})):t.open=!1,this.scheduleRender()}_syncGroupInputStates(){if("sequential"!==this.groupDisplay)return;const e=this.viewModel.activeForm?.allGroupInputs;if(!e.length)return;const t=e.filter(e=>e.open);0===t.length?e[0].open=!0:t.length>1&&t.slice(1).forEach(e=>e.open=!1)}};function Ce(e){switch(e){case"audio":return _("audio/mpeg");case"video":return _("video/mp4");case"image":return _("image/png");default:return"camera"}}e([u()],_e.prototype,"activeFeatureIndex",null),e([u()],_e.prototype,"attachmentsEnabled",null),e([u()],_e.prototype,"callbacks",null),e([u()],_e.prototype,"disabled",null),e([u()],_e.prototype,"effectiveTitle",null),e([u()],_e.prototype,"effectiveDisabled",null),e([u()],_e.prototype,"disabledOrReadOnly",null),e([u()],_e.prototype,"features",null),e([u()],_e.prototype,"footerButtonInfos",null),e([u()],_e.prototype,"map",null),e([u()],_e.prototype,"maximumFeatureCount",null),e([u()],_e.prototype,"maximumFeatureCountWithComplexForms",null),e([u()],_e.prototype,"spatialReference",null),e([u()],_e.prototype,"layerInfos",null),e([u()],_e.prototype,"timeZone",null),e([u()],_e.prototype,"headingLevel",void 0),e([u()],_e.prototype,"icon",null),e([u(),de("esri/t9n/common")],_e.prototype,"messagesCommon",void 0),e([u(),de("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],_e.prototype,"messages",void 0),e([u(),de("esri/widgets/FeatureForm/t9n/FeatureForm")],_e.prototype,"featureFormMessages",void 0),e([u(),de("esri/widgets/FeatureTable/t9n/FeatureTable")],_e.prototype,"featureTableMessages",void 0),e([u(),de("esri/core/t9n/Units")],_e.prototype,"messagesUnits",void 0),e([u()],_e.prototype,"page",null),e([u()],_e.prototype,"readOnly",null),e([u()],_e.prototype,"showPrompt",null),e([u()],_e.prototype,"clearPrompt",null),e([u()],_e.prototype,"selectedAttachment",null),e([u()],_e.prototype,"selectedAttachmentDetails",null),e([u()],_e.prototype,"valid",null),e([u({type:x}),me(["attachments-change","value-change","values-change","submit"])],_e.prototype,"viewModel",void 0),e([u({type:L,nonNullable:!0})],_e.prototype,"visibleElements",void 0),e([u()],_e.prototype,"groupDisplay",void 0),e([u()],_e.prototype,"_formHeaderVisible",null),e([u()],_e.prototype,"_associationsEnabled",null),e([u()],_e.prototype,"_associationsList",void 0),e([u()],_e.prototype,"_attemptFocusOnNextRender",void 0),e([u()],_e.prototype,"_formId",null),e([u()],_e.prototype,"_focusedFieldInput",void 0),e([u()],_e.prototype,"_pendingSubtypeChoice",void 0),e([u()],_e.prototype,"_relatedRecordsEnabled",null),e([u()],_e.prototype,"_listObserverNode",void 0),e([u()],_e.prototype,"_attachmentDialogInfo",void 0),e([u()],_e.prototype,"_attachmentListFilterText",void 0),e([u()],_e.prototype,"_prompt",void 0),e([u()],_e.prototype,"test",null),_e=e([h("esri.widgets.BatchAttributeForm")],_e);const ye=_e;export{ye as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{deprecateWidget as a}from"../core/deprecate.js";import i from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{destroyMaybe as s}from"../core/maybe.js";import o from"../core/ReactiveMap.js";import{watch as l,when as r,on as c,sync as d}from"../core/reactiveUtils.js";import{formatFileSize as m}from"../core/unitFormatUtils.js";import{property as u,subclass as h}from"../core/accessorSupport/decorators.js";import{formatDate as p}from"../intl/date.js";import{isIntegerField as g}from"../layers/support/fieldUtils.js";import{isString as v}from"../support/guards.js";import b from"./Widget.js";import{getAttachmentTypeCategory as f,getCalciteIconForAttachment as _}from"./Attachments/support/attachmentUtils.js";import{getAttachmentKey as C,isImageAttachment as y,getAttachmentFilenameParts as A}from"./BatchAttributeForm/attachmentUtils.js";import{getHiddenFieldsValidationErrorMessage as I,getVisibleFieldInputValidationErrorMessage as w,isElementTemplateWithInputType as F,subtypeChangeShouldPrompt as k,flattenInputs as M}from"./BatchAttributeForm/batchAttributeFormUtils.js";import x from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as D}from"./BatchAttributeForm/css.js";import{makeViewingEditedAttachmentFooterButtons as S,makeViewingAttachmentFooterButtons as E,makeCancelFooterButton as O,makeDefaultFooterButtons as T}from"./BatchAttributeForm/interfaceUtils.js";import L from"./BatchAttributeForm/VisibleElements.js";import{isDynamicChoiceController as V,isMultipleChoiceController as R}from"./BatchAttributeForm/inputs/support/controllerUtils.js";import{isGroupInput as N,isFieldInput as U,isTextElementInput as P,isRelationshipElementInput as B,isAttachmentElementInput as $,isUtilityNetworkAssociationsElementInput as z,differentValuesString as j,getNormalizedFieldName as H,isGroupedInput as W}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{clearMultipleChoiceOtherChoiceStateForViewModel as G,otherChoiceCheckedPlaceholderValue as Z,canRestoreMultipleChoiceOtherChoiceDraftValue as q}from"./BatchAttributeForm/inputs/support/multipleChoiceInputUtils.js";import{loadRelationshipDetailsComponents as K,RelationshipDetails as Y}from"./BatchAttributeForm/rendered-content/RelationshipDetails.js";import{Prompt as X}from"./Editor/components/Prompt.js";import{downloadAttachmentInfo as J}from"./FeatureTable/support/exportUtils.js";import{loadCalciteComponents as Q}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as ee,getIntlOptionsForField as te,prepareISOFieldValueForDateComponents as ae,prepareUnixFieldValueForDateComponents as ie,normalizeTimeOnlyString as ne,getISOFieldValueFromDateComponents as se,getUnixFieldValueFromDateComponents as oe}from"./support/dateUtils.js";import{globalCss as le}from"./support/globalCss.js";import{Heading as re}from"./support/Heading.js";import{calciteListFilterProps as ce}from"./support/listUtils.js";import{messageBundle as de,vmEvent as me,tsx as ue}from"./support/widget.js";import{setFocus as he}from"./support/widgetUtils.js";import{isEmptyValue as pe,ContingentValuesValidationError as ge}from"./support/forms/formUtils.js";const ve="data-element-id",be="data-field-name",fe="esri_BatchAttributeForm_select_all",_e="esri_BatchAttributeForm_other_choice";let Ce=class extends b{constructor(e,t){super(e,t),this.headingLevel=2,this.messagesCommon=null,this.messages=null,this.featureFormMessages=null,this.featureTableMessages=null,this.messagesUnits=null,this.viewModel=new x,this.visibleElements=new L,this.groupDisplay="all",this._associationsList=null,this._associationsWidgetsMap=new o,this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._touchedInputs=new Set,this._dynamicChoiceItemSelections=new WeakSet,this._focusedFieldInput=null,this._pendingSubtypeChoice=null,this._batchSwitchInputInitialValues=new Map,this._listObserverNode=null,this._listObserver=new IntersectionObserver(e=>{e.length&&e[0].isIntersecting&&this.viewModel.activeRelationshipInput?.incrementPage()},{root:window.document}),this._attachmentDialogInfo=null,this._attachmentListFilterText="",this._attachmentFileInputMap=new Map,this._prompt=null,this._selectedAttachmentReplaceFileInput=null,this._afterListObserverCreated=e=>{this.viewModel.activeRelationshipInput&&(this._listObserverNode=e)},this._afterListObserverRemoved=()=>{this._listObserverNode=null},this._maximizeSelectedAttachment=()=>{this._attachmentDialogInfo=this.selectedAttachmentDetails},this._enterAttachmentReplaceView=()=>{const e=this.selectedAttachmentDetails;this._canReplaceSelectedAttachment()&&e&&(e.input.clearValidationCriteriaState(),this.viewModel.setShowingSelectedAttachmentReplacePage(!0))},this._setSelectedAttachmentReplaceFileInput=e=>{this._selectedAttachmentReplaceFileInput=e},this._openSelectedAttachmentReplaceFilePicker=()=>{this._canReplaceSelectedAttachment()&&this._selectedAttachmentReplaceFileInput?.click()},this._resetSelectedAttachmentName=()=>{const e=this.selectedAttachmentDetails;if(!e?.attachment)return;const t=e.input.getAttachmentEditState(e.attachment).initialName;if(null==t)return;const a=e.input.template.elementId,i=C(e.attachment);this.viewModel.stageRenameAttachment(a,i,t)},this._closeAttachmentDialog=()=>{this.hideAttachmentDialog()},this._saveInputFromElement=this._saveInputFromElement.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreateOrUpdate=this._afterDateComponentCreateOrUpdate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this),e?.suppressDeprecationWarning||(this.announceDeprecation=()=>{a(i.getLogger(this),"Editor","arcgis-editor",{version:"5.0"})})}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:t,...a}=e;return a}initialize(){this.addHandles([l(()=>this.features.toArray(),()=>{this._dateComponentMap.clear(),G(this.viewModel,{includeDraftValues:!0})}),l(()=>this.viewModel.activeForm,()=>{this._batchSwitchInputInitialValues.clear(),this._resetTransientFormState(),G(this.viewModel),this._setFocusableInput()}),l(()=>this.viewModel.selectedAttachmentAddElementId,()=>{this.hideAttachmentDialog()}),r(()=>!this.selectedAttachmentDetails,()=>this.hideAttachmentDialog()),l(()=>this.viewModel.selectedAttachmentListElementId,()=>{this._attachmentListFilterText=""}),l(()=>[this.viewModel.activeRelationshipInput,this._listObserverNode],()=>this._onObserverChange()),c(()=>this.viewModel,"submit",()=>{this.valid||this.goToFirstError()}),l(()=>[this._associationsEnabled,this.viewModel.activeForm.allUtilityNetworkAssociationsElementInputs],()=>this._setUpAssociationsWidgets(),d),l(()=>this.viewModel.activeAssociationsInput,e=>this._onActiveAssociationsInputChange(e)),l(()=>this.groupDisplay,()=>this._syncGroupInputStates())])}loadDependencies(){return Promise.all([Q({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),autocomplete:()=>import("@esri/calcite-components/dist/components/calcite-autocomplete"),"autocomplete-item":()=>import("@esri/calcite-components/dist/components/calcite-autocomplete-item"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group"),dialog:()=>import("@esri/calcite-components/dist/components/calcite-dialog"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group")}),K()])}destroy(){this._destroyAssociationsWidgets(),this._associationsList=s(this._associationsList),this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode)}get activeFeatureIndex(){return this.viewModel.activeFeatureIndex}set activeFeatureIndex(e){this.viewModel.activeFeatureIndex=e}get attachmentsEnabled(){return this.viewModel.attachmentsEnabled}set attachmentsEnabled(e){this.viewModel.attachmentsEnabled=e}get callbacks(){return this.viewModel.callbacks}set callbacks(e){this.viewModel.callbacks=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get effectiveTitle(){const{features:e,messages:t,page:a}=this;return t?"replacing-attachment"===a?t.titles.replaceAttachment:"viewing-attachment-details"===a?t.titles.editAttachment:"adding-attachments"===a?t.titles.addAttachments:"viewing-attachments"===a?t.titles.attachments:1===e.length||this.activeFeatureIndex>-1?t.titles.editFeature:e.length>1?t.titles.editFeatures:"":""}get effectiveDisabled(){return this.disabledOrReadOnly||this.viewModel.updating}get disabledOrReadOnly(){return this.disabled||this.readOnly}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get footerButtonInfos(){if(!this.features.length||!this.messages||!this.messagesCommon)return[];const{messages:e,messagesCommon:t,page:a}=this,i=this.effectiveDisabled;if("adding-attachments"===a||"replacing-attachment"===a)return[];if("viewing-attachment-details"===a){const t=this.selectedAttachmentDetails,a=t?.input?.getAttachmentEditState(t.attachment);if(!t?.input||!a)return[];return a.isRenamed||a.isReplaced?S({doneOnclick:()=>this._setSelectedAttachment(null),messages:e.footerButtons,resetOnclick:()=>this._resetSelectedAttachmentChanges(),resetDisabled:this._disableAttachmentModification(t.input)}):E({deleteDisabled:this._disableAttachmentModification(t.input),deleteOnclick:()=>this._deleteSelectedAttachment(),doneOnclick:()=>this._setSelectedAttachment(null),messages:e.footerButtons})}return"viewing-associated-features"===a?O({messages:t,purpose:"cancel-viewing-associated-features",onclick:()=>this.goBack()}):"viewing-associated-layers"===a?O({messages:t,purpose:"cancel-viewing-associated-layers",onclick:()=>this.goBack()}):"viewing-attachments"===a||"viewing-related-records"===a?[]:T({disabled:i||!this.valid,formId:this._formId,messages:e,callback:()=>this.submit()})}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get maximumFeatureCount(){return this.viewModel.maximumFeatureCount}set maximumFeatureCount(e){this.viewModel.maximumFeatureCount=e}get maximumFeatureCountWithComplexForms(){return this.viewModel.maximumFeatureCountWithComplexForms}set maximumFeatureCountWithComplexForms(e){this.viewModel.maximumFeatureCountWithComplexForms=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get icon(){return"edit-attributes"}set icon(e){this._overrideIfSome("icon",e)}get page(){return this.viewModel.page}get readOnly(){return this.viewModel.readOnly}set readOnly(e){this.viewModel.readOnly=e}get showPrompt(){return e=>{this._prompt?.cancel?.(),this._prompt=e}}set showPrompt(e){this._overrideIfSome("showPrompt",e)}get clearPrompt(){return()=>this._prompt=null}set clearPrompt(e){this._overrideIfSome("clearPrompt",e)}get selectedAttachment(){return this.viewModel.selectedAttachment}get selectedAttachmentDetails(){return this.viewModel.selectedAttachmentDetails}get valid(){return this.viewModel.valid}get _formHeaderVisible(){return!("batch"===this.viewModel.mode||!this.viewModel.activeFeature)&&!(!this.viewModel.formDescription&&!this.viewModel.formTitle)}get _associationsEnabled(){const{callbacks:e}=this;return!(!e?.addAssociation&&!e?.editAssociatedFeature)}get _formId(){return`${this.id}-form`}get _relatedRecordsEnabled(){const{callbacks:e}=this;return!(!e||!e.addRelatedRecord&&!e.editRelatedRecord)}async goBack(){return this.viewModel.goBack()}async goHome(){return this.viewModel.goHome()}goToFirstError(){const e=this.viewModel.getFirstVisibleInvalidFieldInput();if(!e)return;const{groupInput:t}=e;t&&(t.open||(t.open=!0)),this._setFocusableInput(e.input),this.scheduleRender()}render(){return ue("div",{class:this.classes(D.base,le.widget,le.panel),ondragover:this._handleDragAndDrop,ondrop:this._handleDragAndDrop},this._renderContent(),this._renderAttachmentDialog(),this._prompt?ue(X,{...this._prompt,headingLevel:this.headingLevel}):void 0)}setActiveAssociationsInput(e){this.viewModel.setActiveAssociationsInput(e)}setActiveAssociationsLayer(e){this.viewModel.setActiveAssociationsLayer(e)}setActiveAssociationType(e){this.viewModel.setActiveAssociationType(e)}submit(){return this.viewModel.submit()}get test(){return{saveInput:this._saveInput.bind(this),pendingSubtypeChoice:this._pendingSubtypeChoice}}_setDateTimeTimeZoneMap(e){const{datePart:t,elementId:a}=e.dataset,i=n(this._dateComponentMap,`${a}`,()=>({}));switch(t){case"date":i.date=e;break;case"time":i.time=e;break;case"timeZone":i.timeZone=e}}_renderContent(){const{messages:e,viewModel:a}=this,{status:i}=a;return"failed"===i?a.hasTooManyComplexFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyComplexFeatures,{num:a.maximumFeatureCountWithComplexForms})):a.hasTooManyFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyFeatures,{num:a.maximumFeatureCount})):e.formFailedToLoad:a.hasLayersWithContingentValues&&this.viewModel.features.length>1?this._renderErrorNotice(e.unsupportedContingentValues):"loading"===i&&this.visibleElements.loadingIndicator?ue("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):0!==this.features.length?this._renderForm():void 0}_renderErrorNotice(e,t="warning"){return ue("calcite-notice",{class:D.noticeError,icon:!0,kind:t,open:!0},ue("div",{slot:"message"},e))}_renderForm(){return ue("form",{class:D.form,id:this._formId,inert:!!this._prompt,onsubmit:this._onFormSubmit},this.viewModel.expressionEvaluationFailed&&this.visibleElements.expressionsErrorNotice&&this._renderErrorNotice(this.messages.expressionEvaluationFailed),this._renderInvisibleFieldsError(),this._renderPage())}_renderPage(){switch(this.page){case"adding-attachments":return this._renderAttachmentAddPage();case"viewing-attachment-details":case"replacing-attachment":return this._renderAttachmentDetailPage();case"viewing-attachments":return this._renderAttachmentListPage();case"viewing-associated-layers":case"viewing-associated-features":return this._renderViewingAssociationsPage();case"viewing-related-categories":case"viewing-related-records":return this._renderRelationshipListPage();default:return this._renderDefaultPage()}}_renderInvisibleFieldsError(){const{viewModel:e}=this,{hasNonActiveInvalidFeatures:t,activeForm:a}=e;let i;if(!e.submitHasBeenAttempted)return null;if(a.invalidHiddenInputs.length>0)if(i=I(a,e.mode,this.messages),"batch"===this.viewModel.mode){const e=a.invalidHiddenInputs.filter(e=>"hidden:group-visibility-expression:all-features"===e.effectiveVisibilityCode||"hidden:visibility-expression:all-features"===e.visibilityCode);e.length>0?i+=` (${e.map(e=>e.label).join(", ")})`:i=null}else i=null;else if(t)return null;return i?this._renderErrorNotice(i,"danger"):null}_renderDefaultPage(){return[this._renderReadOnlyNotice(),this._renderFormHeader(),this._renderFormContent()]}_renderReadOnlyNotice(){if((this.disabled||this.readOnly)&&this.visibleElements.readOnlyNotice)return ue("calcite-notice",{class:D.disabledNotice,"data-testid":"read-only-notice",icon:"read-only-non-editable",kind:"brand",open:!0,scale:"s",width:"full"},ue("div",{slot:"message"},this.featureFormMessages.disabledForm))}_renderFormHeader(){const{formTitle:e,formDescription:t}=this.viewModel;if(!this._formHeaderVisible)return;const a=e?ue(re,{key:"title",level:this.headingLevel},e):void 0,i=t?ue("p",{class:D.description,key:"description"},t):void 0;return ue("div",{class:D.formHeader},a,i)}_renderFormContent(){return this.viewModel.hasVisibleInputs?this.viewModel.activeForm.inputs.filter(e=>e.visible).map(e=>this._renderInput(e)):this._renderErrorNotice(this.messages.noVisibleFields[this.viewModel.noVisibleElementsReason])}_renderInput(e){return N(e)?this._renderGroupInput(e):U(e)?this._renderLabeledField(e):P(e)?this._renderTextComponent(e):B(e)?this._renderRelationshipElementInput(e):$(e)?this._renderAttachmentElementInput(e):z(e)?this._renderUtilityNetworkAssociationsElementInput(e):void 0}_renderGroupInput(e){const{inputs:t,template:a,open:i}=e,n=t.filter(e=>e.visible),s=e.label??"",o=this._focusedFieldInput?.group===e,l="sequential"===this.groupDisplay;return ue("calcite-block",{class:this.classes(D.group,l?D.groupSequential:null,o?D.groupActive:null,this.disabled?D.inputDisabled:null),collapsible:!0,description:e.description??void 0,expanded:i,heading:s,headingLevel:this.headingLevel,key:`{${a.elementId}-key}`,label:s,onCalciteBlockClose:()=>{e.open=!1},onCalciteBlockOpen:()=>{e.open=!0},onCalciteBlockToggle:({currentTarget:t})=>this._onGroupToggle(t,e)},n.map(e=>this._renderInput(e)))}_renderLabeledField(e){const{elementId:a}=e.template,{label:i,required:n,dataType:s}=e,o=n?t(this.messages.requiredFieldLabel,{name:i}):i;return ue("calcite-label",{"aria-label":o,class:D.label,key:`field--${a}`},ue("div",{class:D.labelTextContent,key:"labelTextContainer"},i,n?ue("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==s?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){const t=this.getCommonInputProps(e),{dataType:a}=e;return V(e.inputController)?this._renderDynamicChoiceComponent({input:e,props:t,controller:e.inputController}):"coded-value"===e.domain?.type?this._renderCodedInputs({input:e,props:t}):R(e.inputController)?this._renderMultipleChoiceComponent({input:e,props:t}):"date"===a?this._renderDateComponents(e,t):(t.disabled=this.disabled,t.readOnly=t.readOnly||this.viewModel.updating,"number"===a?this._renderNumberComponent(e,t):this._renderStringComponent(e,t))}_renderAuxiliaryText(e){const{description:t}=e,a=this._getErrorToDisplay(e),i=a?w(e,a,this.messages):null;return i?ue("calcite-input-message",{icon:!0,status:"invalid"},i):e.valueIsOutOfDomain&&(this._touchedInputs.has(e.template.elementId)||this.viewModel.submitHasBeenAttempted)?ue("calcite-input-message",{icon:!0,status:"idle"},this.messages.subtypes.fieldOutOfSubtypeDomainWarning):t?ue("calcite-input-message",{class:D.description,icon:!1,status:"idle"},t):null}_renderCodedInputs({input:e,props:t}){const a=e.input?.type??null,i=e.codedValueOptions;switch(a){case"switch":return this._renderSwitchField({input:e,props:t});case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:i,props:t});default:return this._renderComboBoxComponent({options:i,props:t,input:e})}}_renderDynamicChoiceComponent({input:e,props:t,controller:a}){const i=a.filteredChoices,n=e.showNoValueLabel||this.messages.empty,s=t=>{this._saveInput(e,t)},o=(e,t)=>{this._dynamicChoiceItemSelections.delete(a);const i=e.closest("calcite-autocomplete");if(i){const e=null==t?"":a.getLabel(t);a.filterValue=e,i.inputValue=e}s(t)},l=({currentTarget:t})=>{const i=t.inputValue??"";a.filterValue=i,i||null==e.value||s(null)},r=e.showNoValueOptionEnabled?ue("calcite-autocomplete-item",{heading:n,key:"dynamic-choice-empty",selected:null==e.value,value:"",onCalciteAutocompleteItemSelect:({currentTarget:e})=>o(e,null),onpointerdown:()=>{this._dynamicChoiceItemSelections.add(a)}}):null,c=t=>{const i=e.value===j?this.messages.differentValuesPlaceholder:null==e.value?"":a.inputValue;t.inputValue=i};return ue("calcite-autocomplete",{...t,afterCreate:c,loading:a.evaluating,placeholder:null==e.value?n:t.placeholder,value:String(t.value),onblur:e=>this._onDynamicChoiceBlur(e,a),onCalciteAutocompleteBeforeOpen:()=>a.beginInteraction(),onCalciteAutocompleteTextInput:l},r,i.map(t=>ue("calcite-autocomplete-item",{heading:t.name,key:`dynamic-choice-${t.code}`,selected:t.code===e.value,value:String(t.code),onCalciteAutocompleteItemSelect:({currentTarget:e})=>o(e,t.code),onpointerdown:()=>{this._dynamicChoiceItemSelections.add(a)}})))}_renderMultipleChoiceComponent({input:e,props:t}){const{messages:a}=this,i=this._getMultipleChoiceController(e);if(!i)return null;const{input:n}=i,s=!0===n.includeSelectAllChoices,{checkboxStatesByValue:o,selectAllState:l}=i.selectionState,r=l.checked?a.deselectAllLabel:a.selectAllLabel,c=i.otherChoiceRenderState,d=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:!0})},m=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t})},u=t=>{const{fieldName:a}=c;a&&this._saveOtherChoiceCheckboxValue({input:e,isChecked:t.checked,otherChoiceFieldName:a})},h=t=>{this._saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:c.fieldName??void 0})};return ue("div",{class:D.multipleChoiceInput,key:`${t.key}-multiple-choice-group`},s?this._renderMultipleChoiceSelectAllCheckbox({props:t,selectAllState:l,selectAllLabel:r,handleSelectAllCheckboxChange:d}):null,this._renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:o,handleChoiceCheckboxChange:m}),c.shouldShow?this._renderMultipleChoiceOtherChoice({props:t,includeSelectAllChoices:s,otherChoiceRenderState:c,handleOtherChoiceCheckboxChange:u,handleOtherChoiceInputChange:h,differentValuesPlaceholder:a.differentValuesPlaceholder}):null)}_renderMultipleChoiceSelectAllCheckbox({props:e,selectAllState:t,selectAllLabel:a,handleSelectAllCheckboxChange:i}){return ue("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:t.checked,class:D.multipleChoiceSelectAll,"data-element-id":e[ve],disabled:e.readOnly||e.disabled,indeterminate:t.indeterminate,key:`${e.key}-select-all`,label:a,labelText:a,value:fe,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:e.onfocus})}_renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:a,handleChoiceCheckboxChange:i}){const n=this._getMultipleChoiceController(e);if(!n)return[];const{choices:s}=n;return s.map(e=>{const n=a.get(e.value)??{checked:!1,indeterminate:!1};return ue("calcite-checkbox",{afterCreate:t.afterCreate,afterUpdate:t.afterUpdate,"aria-invalid":t["aria-invalid"],checked:n.checked,class:t.class,"data-element-id":t[ve],disabled:t.readOnly||t.disabled,indeterminate:n.indeterminate,key:`${t.key}-${e.value}`,label:e.label,labelText:e.label,value:e.value,onblur:t.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:t.onfocus})})}_renderMultipleChoiceOtherChoice({props:e,includeSelectAllChoices:t,otherChoiceRenderState:a,handleOtherChoiceCheckboxChange:i,handleOtherChoiceInputChange:n,differentValuesPlaceholder:s}){const o=a.label??this.messages.otherOptionLabel;return ue("div",{class:this.classes(D.multipleChoiceOtherChoice,t?D.multipleChoiceOtherChoiceWithSelectAll:null),key:`${e.key}-other-choice`},ue("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:a.checkboxState.checked,class:e.class,"data-element-id":e[ve],disabled:e.readOnly||e.disabled,indeterminate:a.checkboxState.indeterminate,key:`${e.key}-other-choice-checkbox`,label:o,labelText:o,value:_e,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:e.onfocus}),a.checkboxState.checked?ue("calcite-input",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],"aria-label":o,class:D.textElementInput,"data-element-id":e[ve],disabled:e.readOnly||e.disabled,key:`${e.key}-other-choice-input`,maxLength:a.maxLength,placeholder:a.value===j?s:a.hint,status:a.status,type:"text",value:a.normalizedValue===j?"":a.normalizedValue?String(a.normalizedValue):"",onblur:e.onblur,onCalciteInputInput:({currentTarget:e})=>n(e),onfocus:e.onfocus}):null)}async _saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:a=!1}){this._markFieldInputTouched(e);const i=this._getMultipleChoiceController(e);if(!i)return;if(i.input&&!a&&"batch"===this.viewModel.mode)return void await this._saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t});const n=e.value,s=this._parseValue(t,e,a);s!==n&&await this.viewModel.setValue(e.template.elementId,s)}async _saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:a}){if(!a)return;const i=t.value,n=null==i||""===i?null:i,s=this._getMultipleChoiceController(e);if(!s)return;s.initializeExplicitOtherChoiceCheckedState(),s.stashOtherChoiceDraftValueForFeatures(e.features,n);const o=H(e,a);o&&await this.viewModel.setValueForFieldName(o,n,Array.from(e.features,e=>e.source))}async _saveOtherChoiceCheckboxValue({input:e,isChecked:t,otherChoiceFieldName:a}){const i=this._getMultipleChoiceController(e);if(!i)return;i.setExplicitOtherChoiceCheckedState(t),this._markFieldInputTouched(e),t||i.setOtherChoiceDraftValuesFromFeatures(e.features.toArray());const n=H(e,a);if(!n)return;const s=new Map;for(const o of e.features){const e=o.getAttribute(a);if(t){if(!pe(e))continue;const t=i.getOtherChoiceDraftValue(o),a=q(t)?t:Z;s.set(o,a);continue}null!=e&&s.set(o,null)}0!==s.size&&await this.viewModel.setValuePerFeatureForFieldName(n,new Map(Array.from(s,([e,t])=>[e.source,t])))}async _saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t}){const a=this._getMultipleChoiceController(e);if(!a)return;const i=new Map(e.features.map(i=>[i,a.getUpdatedValueForFeature({choiceValue:t.value,currentValue:i.getAttribute(e.fieldName),isChecked:t.checked})]));0!==i.size&&await this.viewModel.setFieldInputValuePerFeature(e,i)}_renderSwitchField({input:e,props:t}){if((this._batchSwitchInputInitialValues.get(e)===j||e.value===j)&&"batch"===this.viewModel.mode){const a={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,[ve]:t[ve]},trigger:{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral",slot:"trigger",label:t.label},group:{mode:"single"}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:a,options:[{name:this.messages.differentValuesPlaceholder,value:j,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return ue("calcite-switch",{...t,checked:!!F(e.template,"switch")&&e.value===e.template.input.onValue,class:D.inputSwitch,disabled:t.readOnly||t.disabled,onblur:()=>{this._focusedFieldInput=null},onCalciteSwitchChange:({currentTarget:e})=>this._saveInputFromElement(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:a}){const{trigger:i,dropdown:n,group:s}=a;return ue("calcite-dropdown",{...n,topLayerDisabled:this.topLayerDisabled,onblur:()=>{this._focusedFieldInput=null},onCalciteDropdownSelect:({currentTarget:e})=>this._saveInputFromElement(e),onfocus:this._onComponentFocus},ue("calcite-button",{...i},e===j?this.messages.differentValuesPlaceholder:e),ue("calcite-dropdown-group",{selectionMode:s.mode},t.map(t=>ue("calcite-dropdown-item",{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name))))}_renderComboBoxComponent({input:e,options:t,props:a}){const i="INSERT"===this.viewModel.editType,n=this._touchedInputs.has(e?.template?.elementId),s=i&&e.showNoValueOptionEnabled&&!n?()=>{}:a.onblur,o={...a,onblur:s};return ue("calcite-combobox",{...o,clearDisabled:e.isSubtypeField,selectionMode:"single",topLayerDisabled:this.topLayerDisabled,value:a.placeholder===this.messages.differentValuesPlaceholder?j:String(a.value),onCalciteComboboxChange:({currentTarget:t})=>{t.value!==j&&(e.isSubtypeField&&0===t.selectedItems.length?t.value=`${e.value}`:this._saveInputFromElement(t))}},this.renderComboboxOptionsList({input:e,options:t,props:a}))}renderComboboxOptionsList({input:e,options:t,props:a}){const i=e=>e.map(e=>{const{value:t}=e,i=pe(e.value)?this.messages.empty:e.name;return ue("calcite-combobox-item",{heading:i,key:`#${t}`,selected:a.value===t,value:`${t}`})});let n=[];const{messages:s}=this;t.other.length>0&&n.push(ue("calcite-combobox-item-group",{key:"other",label:s.other},i(t.other))),t.unsupported.length>0&&n.push(ue("calcite-combobox-item-group",{key:"unsupported",label:s.unsupported},i(t.unsupported)));const o=i(t.recommended);n.length>0?n.unshift(ue("calcite-combobox-item-group",{key:"recommended",label:s.recommended},o)):n=o;const l=a.placeholder===this.messages.differentValuesPlaceholder,r=!l&&pe(a.value);return e.showNoValueOptionEnabled&&!t.containsEmptyOption&&n.unshift(ue("calcite-combobox-item",{heading:e.showNoValueLabel||this.messages.empty,key:"empty-option",selected:r,value:""})),l&&n.unshift(ue("calcite-combobox-item",{heading:this.messages.differentValuesPlaceholder,key:j,selected:!0,value:j})),n}_renderRadioButtonGroupComponent({input:e,options:t,props:a}){const i=[...t.recommended,...t.other,...t.unsupported].map(({name:t,value:i})=>this._renderRadioButtons({label:t,value:i,selected:i===e.value,props:a}));if(e.showNoValueOptionEnabled&&!t.containsEmptyOption){const t="",n=e.showNoValueLabel||this.messages.empty,s=pe(e.value);i.unshift(this._renderRadioButtons({label:n,value:t,selected:s,props:a}))}return ue("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:D.inputRadioGroup,"data-field-name":a[be],disabled:a.readOnly||a.disabled,key:`${a.key}-radio-group`,layout:"vertical",name:`${a.name}-${this.id}`,required:a.required},i,a.placeholder===this.messages.differentValuesPlaceholder?ue("calcite-label",{class:D.placeholderRadio,key:a.label,layout:"inline"},ue("calcite-radio-button",{checked:!0,class:D.inputRadio,disabled:!0,value:a.placeholder}),a.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:a,props:i}){return ue("calcite-label",{class:D.inputRadioLabel,key:i.label,layout:"inline"},ue("calcite-radio-button",{...i,afterCreate:void 0,afterUpdate:void 0,checked:t,class:D.inputRadio,disabled:i.readOnly||i.disabled,name:void 0,value:e,onblur:()=>{this._focusedFieldInput=null},onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInputFromElement(e)}}),a)}_renderStringComponent(e,t){const{template:a}=e;return!a.field.editable||this.readOnly?this._renderReadOnlyComponent(e):"text-area"===a.input?.type?ue("calcite-text-area",{...t,class:this.classes(D.individualElement),resize:"vertical",value:t.value?String(t.value):"",onblur:a=>{t.onblur(a),e.userHasChangedValue&&this._saveInputFromElement(a.currentTarget)},onCalciteTextAreaInput:t=>{e.userHasChangedValue=!0,""===t.currentTarget.value&&this._saveInputFromElement(t.currentTarget)}}):ue("calcite-input",{...t,class:this.classes(D.individualElement),type:"text",value:t.value?String(t.value):"",onblur:a=>{t.onblur(a),e.userHasChangedValue&&this._saveInputFromElement(a.currentTarget)},onCalciteInputInput:t=>{e.userHasChangedValue=!0,""===t.currentTarget.value&&this._saveInputFromElement(t.currentTarget)}})}_renderNumberComponent(e,t){const a=g(e.field);return ue("calcite-input-number",{...t,integer:a,step:a?1:"any",type:"number",value:a&&""!==t.value?Math.round(parseFloat(String(t.value))).toString():String(t.value),onblur:a=>{t.onblur(a),e.userHasChangedValue&&this._saveInputFromElement(a.currentTarget)},onCalciteInputNumberInput:t=>{e.userHasChangedValue=!0,""===t.currentTarget.value&&this._saveInputFromElement(t.currentTarget)}})}_renderReadOnlyComponent(e,t){const a=this.getCommonInputProps(e);return ue("calcite-input",{...a,class:this.classes(D.fieldInput,D.inputDisabled,D.individualElement),readOnly:!0,type:"text",value:String(t??a.value??"")})}_renderDateComponents(e,t){const{field:a}=e;let i;switch(a.type){case"date":i=this._renderDateFieldComponents(e,t);break;case"date-only":i=this._renderDateOnlyFieldComponent(e,t);break;case"time-only":i=this._renderTimeOnlyFieldComponent(e,t);break;case"timestamp-offset":i=this._renderTimestampOffsetFieldComponents(e,t);break;default:i=this._renderReadOnlyComponent(e,ee(a,t.value,{timeZone:e.effectiveTimeZone,...te(e.template.field)}))}return e.value===j?[i,ue("calcite-input-message",{icon:"information",key:"diff-values-message",status:"idle"},this.messages.differentValues)]:i}_renderDateOnlyFieldComponent(e,t){const{class:a,disabled:i,key:n,readOnly:s}=t,{rawMax:o,rawMin:l}=e.range;return ue("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,class:a,"data-date-part":"date","data-element-id":t[ve],"data-field-name":t[be],disabled:i,key:`${n}-date-input`,max:v(o)?o:void 0,min:v(l)?l:void 0,overlayPositioning:"fixed",readOnly:s,topLayerDisabled:this.topLayerDisabled,value:e.value===j?"":e.value?String(e.value):"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:this._onComponentFocus})}_renderTimeOnlyFieldComponent(e,t){const{class:a,disabled:i,key:n,readOnly:s}=t;return ue("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,class:a,"data-date-part":"time","data-element-id":t[ve],"data-field-name":t[be],disabled:i,key:`${n}-time-input`,overlayPositioning:"fixed",readOnly:s,step:e.timeStep,value:e.value===j?"":e.value?String(e.value):"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:this._onComponentFocus})}_renderTimestampOffsetFieldComponents(e,t){const{class:a,disabled:i,key:n,readOnly:s}=t,{rawMax:o,rawMin:l}=e.range,r=e.effectiveTimeZone,c=ae(o,r),d=ae(l,r),m=ae(e.value===j?"":e.value,r),u=e.includeTimeOffset,h={afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,disabled:i,[ve]:t[ve],[be]:t[be],onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:s};return ue("div",{class:D.dateInputContainer,key:`${n}-date-time-container`},ue("calcite-input-date-picker",{...h,class:a,"data-date-part":"date",key:`${n}-date-input`,max:c?.date??void 0,min:d?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:m.date??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),ue("calcite-input-time-picker",{...h,class:a,"data-date-part":"time",key:`${n}-time-input`,step:e.timeStep,value:m.time??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),u?ue("calcite-input-time-zone",{...h,class:a,clearable:e.value===j||null==e.value,"data-date-part":"timeZone",key:`${n}-timezone-input`,value:m.timeZoneOffset||"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:a,disabled:i,key:n,readOnly:s,min:o,max:l}=t,r=e.effectiveTimeZone,c=ie(e.value===j?"":e.value,r),d=ie(l,r),m=ie(o,r),u=e.includeTime,h={afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,disabled:i,[ve]:t[ve],[be]:t[be],onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:s};return ue("div",{class:D.dateInputContainer,key:`${n}-date-time-container`},ue("calcite-input-date-picker",{...h,class:a,"data-date-part":"date",key:`${n}-date-input`,max:d?.date??void 0,min:m?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:c.date??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),u?ue("calcite-input-time-picker",{...h,"data-date-part":"time",key:`${n}-time-input`,step:1,value:c.time??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}_renderRelationshipElementInput(e){return this._relatedRecordsEnabled?ue(Y,{afterObserverCreated:this._afterListObserverCreated,afterObserverRemoved:this._afterListObserverRemoved,input:e,messages:this.messages,messagesCommon:this.messagesCommon,viewModel:this.viewModel}):null}_renderRelationshipListPage(){const{activeRelationshipInput:e}=this.viewModel;if(e)return this._renderRelationshipElementInput(e)}_renderAttachmentElementInput(e){if(!this.attachmentsEnabled)return;const{allAttachmentsVisibleOnDefaultPage:t,attachments:a,defaultPageAttachments:i,template:{description:n,elementId:s,label:o}}=e,l=t?a:i;return ue("div",{class:D.attachmentElementInput,"data-testid":`attachment-element-${s}`,key:`attachment-element-${s}`},o?ue("div",{class:D.attachmentElementLabel,key:`attachment-element-label-${s}`},o):null,n?ue("div",{class:D.description,key:`attachment-element-description-${s}`},n):null,a.length?this._renderAttachmentList(e,l,{label:o||this.messagesCommon.details,viewAllCount:t?null:a.length}):ue("div",{class:D.attachmentElementEmptyState,key:`attachment-element-empty-state-${s}`},this.messages.attachments.noAttachments),this._renderAttachmentAddAction(e))}_renderAttachmentListPage(){const e=this.viewModel.selectedAttachmentListInput;if(e)return ue("div",{class:D.attachmentElementAllPanel,key:`attachment-element-all-panel-${e.template.elementId}`},this._renderAttachmentList(e,e.attachments,{filterEnabled:!0,label:this.messages.titles.attachments}))}_renderAttachmentList(e,t,a){const{filterEnabled:i,label:n,viewAllCount:s}=a;return ue("calcite-list",{class:D.attachmentElementList,filterEnabled:i,filterPlaceholder:i?this.messages.attachments.searchAttachments:void 0,filterProps:i?ce:void 0,filterText:i?this._attachmentListFilterText:void 0,label:n,selectionAppearance:"border",selectionMode:"none",onCalciteListFilter:i?e=>{this._attachmentListFilterText=e.currentTarget.filterText??""}:void 0},this._renderAttachmentListItems(e,t),null!=s?this._renderViewAllAttachmentsItem(e,s):null)}_renderAttachmentListItems(e,t){const{elementId:a}=e.template;return t.map((t,i)=>{const n=this._formatAttachmentSize(t.size),s=this._getAttachmentLabel(t,i,n,e.displayFilename),o=s===n?void 0:n,l=C(t),r=e.isStagedAttachmentAddition(t),c=e.getAttachmentEditState(t),d=c.isDeleted,m=!d&&(r||c.isRenamed||c.isReplaced);return ue("calcite-list-item",{class:D.attachmentElementListItem,description:o,key:`attachment-item-${l}`,label:s,onCalciteListItemSelect:r||d?void 0:()=>this._setSelectedAttachment({attachmentKey:l,elementId:a})},ue("div",{class:D.attachmentElementListItemStart,slot:"content-start"},this._renderAttachmentPreviewThumbnail(t,s,e)),m?ue("span",{class:D.attachmentElementListItemStagedIndicator,slot:"content-end"}):null,r?[ue("calcite-action",{disabled:this._disableAttachmentModification(e),icon:"x",scale:"s",slot:"actions-end",text:this.messagesCommon.delete,title:this.messagesCommon.delete,onclick:()=>this.viewModel.stageDeleteAttachment(a,C(t))})]:d?ue("calcite-chip",{label:this.messages.attachments.deleted,scale:"s",slot:"content-end"},this.messages.attachments.deleted):ue("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))})}_renderViewAllAttachmentsItem(e,a){const{elementId:i}=e.template,{viewAll:n}=this.messages.attachments;return ue("calcite-list-item",{class:D.attachmentElementListItem,description:t(this.messages.attachments.count,{count:a}),key:`attachment-item-view-all-${i}`,label:n,onCalciteListItemSelect:()=>this._setAttachmentListElementId(i)},ue("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderAttachmentAddAction(e){const{elementId:t}=e.template,a=this.effectiveDisabled||e.addDisabled,i=this._renderAttachmentCountLimitsLabel(e),n=this._getAttachmentNoticeMessage(e),s=e.hasMinimumAttachmentCountNotMet||e.hasExceededAttachmentLimit?"danger":"info",o=e.canUploadFiles,l=e.isCaptureOnly&&!this.effectiveDisabled&&!n;return ue("div",{class:D.attachmentElementAddActions,key:`attachment-element-add-actions-${t}`},o?ue("calcite-button",{appearance:"outline",disabled:a,iconStart:"attachment",kind:"neutral",round:!0,scale:"s",onclick:()=>this._setAttachmentAddElementId(t)},this.messages.attachments.attach):null,this._renderAttachmentCaptureButton(e),l?this._renderAttachmentCaptureDisabledNotice(t):null,i?ue("div",{class:D.attachmentElementEmptyActionHint},i):null,!this.effectiveDisabled&&n?ue("calcite-notice",{closable:!1,icon:"danger"===s?"exclamation-mark-circle":"lightbulb",kind:s,open:!0,scale:"s",width:"full"},ue("div",{slot:"message"},n)):null)}_renderAttachmentCaptureButton(e){if(!e.hasCaptureInputs)return null;const t=e.captureMediaType;return ue("calcite-button",{appearance:"outline",disabled:!0,iconStart:ye(t),kind:"neutral",round:!0,scale:"s"},this._getCaptureButtonLabel(t))}_getAttachmentNoticeMessage(e){const t=this.messages.attachments;return e.hasUnsupportedFileTypeValidationError?this._getUnsupportedFileTypeMessage():e.hasMinimumAttachmentCountNotMet&&this._shouldShowMinimumAttachmentNotice(e)?t.minimumNotMet:e.hasExceededAttachmentLimit?t.attachmentLimitExceeded:e.hasReachedAttachmentLimit?t.attachmentLimitReached:null}_shouldShowMinimumAttachmentNotice(e){return e.hasAttachmentChanges||this.viewModel.submitHasBeenAttempted||this._touchedInputs.has(e.template.elementId)}_getCaptureButtonLabel(e){const{capture:t,recordAudio:a,takePhoto:i,takeVideo:n}=this.messages.attachments;switch(e){case"image":return i||t;case"video":return n||t;case"audio":return a||t;default:return t}}_renderAttachmentAddPage(){const e=this.viewModel.selectedAttachmentAddInput;return e?this._renderAttachmentAddPanel(e):null}_renderAttachmentAddPanel(e){const{maxAttachmentCount:t}=e,{elementId:a}=e.template;if(e.isCaptureOnly)return this._renderAttachmentCaptureDisabledNotice(a);const i=null==t||t-e.attachments.length>1,n=this.effectiveDisabled||e.addDisabled,s=this.messages.attachments,o=s.dragAndDropFile,l="upload",r=e=>{this._attachmentFileInputMap.set(a,e)};return ue("div",{class:D.attachmentElementAddPanel,key:`attachment-element-add-panel-${a}`},ue("input",{accept:e.accept,afterCreate:r,afterRemoved:()=>{this._attachmentFileInputMap.delete(a)},afterUpdate:r,class:D.attachmentElementFileInput,"data-element-id":a,disabled:n,multiple:i,type:"file",onchange:e=>{const t=e.currentTarget,i=t.files?Array.from(t.files):[];this._stageAttachmentFiles(a,i),t.value=""}}),ue("div",{class:D.attachmentElementAddDropzone,"data-disabled":n?"true":"false",ondragover:e=>{e.stopPropagation(),e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")},ondrop:e=>{if(e.preventDefault(),e.stopPropagation(),n)return;const t=e.dataTransfer?.files?Array.from(e.dataTransfer.files):[];this._stageAttachmentFiles(a,t)}},ue("calcite-icon",{class:D.attachmentElementAddDropzoneIcon,icon:l,scale:"l"}),ue("div",{class:D.attachmentElementAddDropzoneHeading},s.addFile),ue("div",{class:D.attachmentElementAddDropzoneDetail,title:o},o),ue("calcite-button",{appearance:"transparent",disabled:n,iconStart:"folder-open",kind:"brand",scale:"s",type:"button",onclick:e=>{e.stopPropagation(),this._openAttachmentFilePicker(a,n)}},s.selectFile)),this._renderAttachmentValidationCriteria(e,{includeCountCriteria:!0}))}_renderAttachmentCaptureDisabledNotice(e){return ue("calcite-notice",{class:D.attachmentElementCaptureNotice,icon:!0,key:`attachment-element-capture-disabled-notice-${e}`,kind:"warning",open:!0,scale:"s"},ue("div",{slot:"message"},this.messages.attachments.captureMethodNotSupported))}async _stageAttachmentFiles(e,t){if(0===t.length)return;const a=this.viewModel.selectedAttachmentAddInput;let i=!0;try{i=(await this.viewModel.stageAddAttachments(e,t)).length>0&&!a?.hasInvalidValidationCriteria&&!a?.hasUnsupportedFileTypeValidationError}finally{i&&this.viewModel.setSelectedAttachmentAddElementId(null)}}_openAttachmentFilePicker(e,t){t||this._attachmentFileInputMap.get(e)?.click()}_renderAttachmentDetailPage(){const e=this.selectedAttachmentDetails;if(!e)return;if("replacing-attachment"===this.page)return this._renderAttachmentReplacePanel(e);const{attachment:t,input:a}=e,i=C(t),n=!!a.getAttachmentPreviewUrl(t),s=!this._disableAttachmentModification(a)&&a.canUploadFiles,o=a.getAttachmentEditState(t);return ue("div",{class:D.attachmentElementDetail,key:`attachment-detail-panel-${a.template.elementId}-${i}`},ue("div",{class:D.attachmentElementDetailPreview},this._renderAttachmentPreviewImageForInput(t,a)),ue("div",{class:D.attachmentElementDetailActions},y(t)?ue("calcite-button",{appearance:"outline",disabled:!n,iconStart:"expand",kind:"neutral",label:this.messages.attachments.maximize,scale:"m",title:this.messages.attachments.maximize,onclick:this._maximizeSelectedAttachment}):null,ue("calcite-button",{appearance:"outline",disabled:!n||o.isReplaced,iconStart:"download",kind:"neutral",label:this.messages.attachments.download,scale:"m",title:this.messages.attachments.download,onclick:()=>{this._downloadAttachment(t)}}),ue("calcite-button",{appearance:"outline",disabled:!s,iconStart:"upload-to",kind:"neutral",label:this.messages.attachments.replace,scale:"m",title:this.messages.attachments.replace,onclick:this._enterAttachmentReplaceView})),ue("div",{class:D.attachmentElementDetailMetadata},ue("div",{class:D.attachmentElementDetailMetadataGroup},ue("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.fileName),this._renderFileNameContent(t,a)),ue("div",{class:D.attachmentElementDetailMetadataGroup},ue("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.size),ue("span",{class:D.attachmentElementDetailMetadataValue},this._formatAttachmentSize(t.size))),ue("div",{class:D.attachmentElementDetailMetadataGroup},ue("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.type),ue("span",{class:D.attachmentElementDetailMetadataValue},this._getLabelForAttachmentType(t)))))}_renderFileNameContent(e,t){if(!t.allowUserRename)return ue("span",{class:D.attachmentElementDetailMetadataValue},e.name);const a=t.getAttachmentEditState(e),{baseName:i,extension:n}=A(e.name),s=this._disableAttachmentModification(t),o=!s&&0===e.name.trim().length;return[ue("div",{class:D.attachmentElementDetailFileNameRow,key:"file-name-row"},ue("calcite-input",{class:D.attachmentElementDetailFileNameInput,disabled:s,scale:"m",status:o?"invalid":"idle",suffixText:n,value:i,onCalciteInputInput:({currentTarget:e})=>this._renameSelectedAttachment(e.value)}),ue("calcite-button",{appearance:"transparent",disabled:s||null==a.initialName||!a.isRenamed,iconStart:"reset",kind:"neutral",label:this.messages.footerButtons.reset,scale:"m",title:this.messages.footerButtons.reset,onclick:this._resetSelectedAttachmentName})),o?ue("calcite-input-message",{icon:!0,key:"file-name-message",status:"invalid"},this.messages.validationErrors.cannotBeNull):null]}_renderAttachmentReplacePanel(e){const{attachment:t,input:a}=e,i=this._disableAttachmentModification(a)||!a.canUploadFiles,n=a.template.elementId;return ue("div",{class:D.attachmentElementAddPanel,key:`attachment-replace-panel-${n}-${C(t)}`},ue("input",{accept:a.accept,afterCreate:this._setSelectedAttachmentReplaceFileInput,afterRemoved:()=>{this._selectedAttachmentReplaceFileInput=null},afterUpdate:this._setSelectedAttachmentReplaceFileInput,class:D.attachmentElementFileInput,disabled:i,type:"file",onchange:e=>{const t=e.currentTarget,a=t.files?.[0];a&&this._stageSelectedAttachmentReplacement(a),t.value=""}}),ue("div",{class:D.attachmentElementAddDropzone,"data-disabled":i?"true":"false",ondragover:e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")},ondrop:e=>{if(e.preventDefault(),e.stopPropagation(),i)return;const t=e.dataTransfer?.files?.[0];t&&this._stageSelectedAttachmentReplacement(t)}},ue("calcite-icon",{class:D.attachmentElementAddDropzoneIcon,icon:"refresh",scale:"l"}),ue("div",{class:D.attachmentElementAddDropzoneHeading},this.messages.attachments.replace),ue("div",{class:D.attachmentElementAddDropzoneDetail,title:this.messages.attachments.dragAndDropFile},this.messages.attachments.dragAndDropFile),ue("calcite-button",{appearance:"transparent",disabled:i,iconStart:"folder-open",kind:"brand",scale:"s",onclick:e=>{e.stopPropagation(),this._openSelectedAttachmentReplaceFilePicker()}},this.messages.attachments.selectFile)),this._renderAttachmentValidationCriteria(a,{includeCountCriteria:!1}),ue("div",{class:D.attachmentElementDetailMetadata},ue("div",{class:D.attachmentElementDetailMetadataGroup},ue("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.fileToBeReplaced),ue("span",{class:D.attachmentElementDetailMetadataValue},t.name))))}_renderAttachmentDialog(){const e=this._attachmentDialogInfo;if(!e)return null;const{attachment:t,input:a}=e;return ue("calcite-dialog",{heading:t.name||this.messagesCommon.details,key:"attachment-preview-dialog",modal:!0,open:!0,placement:"cover",width:"l",onCalciteDialogClose:this._closeAttachmentDialog},ue("div",{class:D.attachmentElementDialogPreview},this._renderAttachmentPreviewImageForInput(t,a)))}_setSelectedAttachment(e){e?.elementId&&this._touchedInputs.add(e.elementId),this.viewModel.setSelectedAttachment(e),e||this.hideAttachmentDialog()}_setAttachmentAddElementId(e){e&&this._touchedInputs.add(e),this.viewModel.setSelectedAttachmentAddElementId(e),this.viewModel.selectedAttachmentAddInput?.clearValidationCriteriaState(),this.hideAttachmentDialog()}_setAttachmentListElementId(e){e&&this._touchedInputs.add(e),this.viewModel.setSelectedAttachmentListElementId(e),this.hideAttachmentDialog()}_getAttachmentLabel(e,a,i,n){return!1!==n&&v(e.name)&&e.name.length>0?e.name:i!==this.messagesCommon.notApplicable?i:t(this.messages.attachments.attachmentNumberedLabel,{index:a+1})}_renderAttachmentCountLimitsLabel(e){const t=this.messages.attachments,a=null!=e.minAttachmentCount&&e.minAttachmentCount>0?this._renderAttachmentCountLimitLabel(t.minAttachmentsShort,e.minAttachmentCount,"min"):null,i=null!=e.maxAttachmentCount?this._renderAttachmentCountLimitLabel(t.maxAttachmentsShort,e.maxAttachmentCount,"max"):null;return a||i?[a,a&&i?ue("span",{key:"attachment-count-limits-separator"},", "):null,i]:null}_renderAttachmentCountLimitLabel(e,a,i){const n="__count__",[s,o]=t(e,{count:n}).split(n);return ue("span",{key:i},s,ue("span",{class:D.attachmentElementEmptyActionHintValue},a),o)}_renderAttachmentValidationCriteria(e,{includeCountCriteria:t}){const a=this._getAttachmentValidationCriteria(e,{includeCountCriteria:t}),i=`attachment-validation-criteria-${e.template.elementId}`;return 0===a.length?null:ue("div",{class:D.attachmentElementValidationCriteria,key:i},a.map(({key:e,message:t,state:a})=>ue("calcite-notice",{appearance:"danger"===a?"outline-fill":"transparent",closable:!1,icon:!0,key:e,kind:a,open:!0,scale:"s",width:"full"},ue("div",{slot:"message"},t))))}_getAttachmentValidationCriteria(e,{includeCountCriteria:a}){const i=[],n=e.validationCriterionStates,s=this.messages.attachments,o=this._getNestableAttachmentInputs(e.input);e.hasUnsupportedFileTypeValidationError&&i.push({key:"unsupported-file-type",message:this._getUnsupportedFileTypeMessage(),state:"danger"});for(const l of o)"document"===l.type&&null!=l.maxFileSize&&i.push({key:"maximum-file-size",message:t(s.maximumFileSize,{maxSize:this._formatAttachmentSizeLimitInMegabytes(l.maxFileSize)}),state:n.get("maximum-file-size")??"info"}),"audio"===l.type&&null!=l.maxDuration&&i.push({key:"maximum-audio-length",message:t(s.maximumAudioLength,{maxDuration:this._formatAttachmentDurationLimit(l.maxDuration)}),state:n.get("maximum-audio-length")??"info"}),"video"===l.type&&null!=l.maxDuration&&i.push({key:"maximum-video-length",message:t(s.maximumVideoLength,{maxDuration:this._formatAttachmentDurationLimit(l.maxDuration)}),state:n.get("maximum-video-length")??"info"}),"image"===l.type&&null!=l.maxImageSize&&i.push({key:"maximum-image-size",message:t(s.attachmentMustBeSmallerThan,{maxSize:`${l.maxImageSize}px`}),state:n.get("maximum-image-size")??"info"});return a&&null!=e.minAttachmentCount&&e.minAttachmentCount>0&&i.push({key:"minimum-number-of-files",message:t(s.minimumNumberOfFiles,{count:e.minAttachmentCount}),state:n.get("minimum-number-of-files")??"info"}),a&&null!=e.maxAttachmentCount&&i.push({key:"maximum-number-of-files",message:t(s.maximumNumberOfFiles,{count:e.maxAttachmentCount}),state:n.get("maximum-number-of-files")??"info"}),i}_getNestableAttachmentInputs(e){return null==e?[]:"attachment"===e.type?e.inputTypes?.slice()??[]:[e]}_getUnsupportedFileTypeMessage(){return this.featureTableMessages.errorFileUnsupported}_formatAttachmentSize(e){return null==e||Number.isNaN(e)?this.messagesCommon.notApplicable:m(this.messagesUnits,e)}_formatAttachmentSizeLimitInMegabytes(e){return m(this.messagesUnits,1048576*e)}_formatAttachmentDurationLimit(e){return p(1e3*Math.round(e),{...e>=3600?{hour:"2-digit",hourCycle:"h23"}:{},minute:"2-digit",second:"2-digit",timeZone:"UTC"})}_getLabelForAttachmentType({contentType:e}){if(!e)return this.messagesCommon.notApplicable;const t=this.messages.attachments.attachmentTypes,a=f(e);return t?.[a]||e}_renderAttachmentPreviewThumbnail(e,t,a){const i=a.getAttachmentPreviewUrl(e,64);return i&&y(e)?ue("img",{alt:t,class:D.attachmentElementListItemThumb,src:i}):ue("calcite-icon",{class:D.attachmentElementListItemIcon,icon:_(e.contentType),scale:"s"})}_renderAttachmentPreviewImageForInput(e,t){const a=t.getAttachmentPreviewUrl(e),i=e.name||this.messagesCommon.details;return a&&y(e)?ue("img",{alt:i,class:D.attachmentElementDetailPreviewImage,src:a,title:i}):[ue("calcite-icon",{class:D.attachmentElementDetailPreviewIcon,icon:_(e.contentType),scale:"l",textLabel:i,title:i}),this.messages.attachments.noPreviewAvailable]}async _downloadAttachment(e){await J(e)}_canReplaceSelectedAttachment(){return!this.effectiveDisabled&&!!this.selectedAttachmentDetails?.input.canUploadFiles}_exitAttachmentReplaceView(){this.viewModel.setShowingSelectedAttachmentReplacePage(!1),this._selectedAttachmentReplaceFileInput=null}async _stageSelectedAttachmentReplacement(e){const t=this.selectedAttachmentDetails;if(!t?.attachment)return;const a=t.input.template.elementId,i=C(t.attachment);let n=!1;try{n=await this.viewModel.stageReplaceAttachment(a,i,e)}finally{n&&this._exitAttachmentReplaceView()}}_renameSelectedAttachment(e){const t=this.selectedAttachmentDetails;if(!t?.attachment)return;const a=t.input.template.elementId,i=C(t.attachment);this.viewModel.stageRenameAttachment(a,i,e)}_resetSelectedAttachmentChanges(){const e=this.selectedAttachmentDetails;e?.attachment&&this.viewModel.resetAttachmentChanges(e.input.template.elementId,C(e.attachment))}_deleteSelectedAttachment(){const e=this.selectedAttachmentDetails;if(!e?.attachment||this._disableAttachmentModification(e.input))return;const t=e.input.template.elementId,a=C(e.attachment);this.viewModel.stageDeleteAttachment(t,a),this._setSelectedAttachment(null)}_disableAttachmentModification(e){return this.disabledOrReadOnly||!e.editable}hideAttachmentDialog(){this._attachmentDialogInfo=null}_renderTextComponent(e){const{elementId:t}=e.template;return ue("div",{class:D.textElementInput,"data-testid":`text-element-${t}`,innerHTML:e.text,key:`text-element-${t}`})}_renderUtilityNetworkAssociationsElementInput(e){if(!this._associationsEnabled)return;const{elementId:t}=e.template;return ue("div",{class:D.utilityNetworkAssociationsElementInput,"data-testid":t,key:t},this._associationsWidgetsMap.get(e)?.render())}getCommonInputProps(e){const{template:t,valid:a,value:i,minLength:n,maxLength:s,required:o,fieldName:l,editable:r,userHasChangedValue:c,range:{max:d,min:m}}=e,u=!r||this.readOnly,h=this.disabled||this.viewModel.updating;let p=t.hint??void 0,g=!1;return i===j&&(p=this.messages.differentValuesPlaceholder,g=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":a?"false":"true",class:this.classes(D.fieldInput,u?D.inputDisabled:null),status:!c&&!this.viewModel.submitHasBeenAttempted||a?"idle":"invalid",maxLength:s&&s>-1?s:void 0,minLength:n&&n>-1?n:void 0,key:t.elementId,label:l,name:l,max:null!=d?d:void 0,min:null!=m?m:void 0,disabled:h,readOnly:u,onblur:this._onComponentBlur,required:o,placeholder:p,value:g?"":i??"",[ve]:t.elementId,[be]:l,onfocus:this._onComponentFocus}}_onObserverChange(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode);const e=this.viewModel.activeRelationshipInput;e&&this._listObserverNode&&e.showAllEnabled&&this._listObserver.observe(this._listObserverNode)}_onFormSubmit(e){e.preventDefault()}_handleDragAndDrop(e){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none")}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(ve))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,a=e.querySelector("calcite-radio-button"),i=t||a;i&&this._afterComponentCreateOrUpdate(i)}_onComponentFocus(e){const t=e.target,a=this._getFieldInputFromHTMLElement(t);this._isMultipleChoiceCheckbox(t,a)||this._markFieldInputTouched(a),this._focusedFieldInput=a}_markFieldInputTouched(e){this._touchedInputs.add(e.template.elementId)}_isMultipleChoiceCheckbox(e,t){const a=this._getMultipleChoiceController(t);return"CALCITE-CHECKBOX"===e.tagName&&null!=a?.input}_afterComponentCreateOrUpdate(e){const t=this._getFieldInputFromHTMLElement(e),a=this._focusedFieldInput;this._attemptFocusOnNextRender&&a===t&&(this._attemptFocusOnNextRender=!1,he(e))}_onComponentBlur(){this._focusedFieldInput=null}_onDynamicChoiceBlur(e,t){const a=e.currentTarget;if(this._dynamicChoiceItemSelections.delete(t))return;const i=e.relatedTarget;i instanceof Node&&a.contains(i)||(t.endInteraction(),a.inputValue=t.inputValue,this._onComponentBlur())}_resetTransientFormState(){this._attemptFocusOnNextRender=!1,this._focusedFieldInput=null,this._attachmentDialogInfo=null,this._selectedAttachmentReplaceFileInput=null,this._attachmentListFilterText="",this._attachmentFileInputMap.clear(),this._touchedInputs.clear()}_parseValue(e,t,a=!1){const i=this._getMultipleChoiceController(t);if(i){const{input:t,values:n}=i;if(t&&n){const t=e;return i.getValueFromCheckboxChange({choiceValue:t.value,isChecked:t.checked,isSelectAllCheckbox:a})}}if(F(t.template,"switch")){if("calcite-dropdown"===e.localName&&t.domain)for(const a of t.domain.codedValues)if(a.name===e.selectedItems[0].textContent)return a.code;return e.checked?t.template.input.onValue:t.template.input.offValue}const n=e.value;return null==n||""===n?null:"number"===t.dataType?"-0"===n||"-0."===n||"-0,"===n?n:parseFloat(n):"date"===t.field.type?parseFloat(n):n}_getMultipleChoiceController(e){return R(e.inputController)?e.inputController:null}_saveInputFromElement(e){const t=this._getFieldInputFromHTMLElement(e);if(!t)return;const a=this._parseValue(e,t);this._saveInput(t,a)}_saveInput(e,t){const{elementId:a}=e.template,i=e?.value,{viewModel:s}=this;if(F(e.template,"switch")&&"single"!==s.mode){const t=n(this._batchSwitchInputInitialValues,e,()=>e.value);this._batchSwitchInputInitialValues.set(e,null===t?i:t)}t!==i&&(e.isSubtypeField&&"batch"!==s.mode&&k(s.activeLayer,i,t)?this._pendingSubtypeChoice||(this._pendingSubtypeChoice=this._handleSubtypeChoice(e,t)):s.setValue(a,t))}async _handleSubtypeChoice(e,a){const{value:i,template:n}=e,{elementId:s}=n,{messages:o,viewModel:l,messagesCommon:r}=this,{subtypes:c,activeFeatureIndex:d}=l;if(await l.setValue(s,a),!c?.length)return;const m=c.find(e=>e.code===a),u=c.find(e=>e.code===i)?.name??`${i}`;if(!m)return;const h=Promise.withResolvers();l.pendingSubtypeChoice=h;let p="update-fields";const g=[{label:o.subtypes.useDefaultValuesOption,value:"update-fields"},{label:o.subtypes.keepCurrentValuesOption,value:"keep-existing"}],v={context:"info",title:o.subtypes.changeWarningTitle,message:t(o.subtypes.changeWarning,{originalType:u,newType:m.name}),radios:g,defaultRadioSelection:"update-fields",onRadioSelection:e=>{p=e},actions:{primary:{label:r.apply,action:()=>h.resolve(p),type:"positive"},secondary:{label:r.cancel,type:"neutral",action:()=>h.resolve("undo")}},cancel:()=>h.reject()};try{this.showPrompt(v);switch(await h.promise){case"update-fields":await l.applySubtypeDefaults(m),await l.handleSubtypeChanged(d);break;case"keep-existing":await l.handleSubtypeChanged(d);break;case"undo":await this.viewModel.setValue(s,i)}}finally{l.pendingSubtypeChoice=null,this.clearPrompt(),this._pendingSubtypeChoice=null}}_afterDateComponentCreateOrUpdate(e){this._setDateTimeTimeZoneMap(e),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:a}=e.template,i=e.field.type,n=this._dateComponentMap.get(`${a}`);if(!n)return;const s=e.effectiveTimeZone;let o=e.value===j?void 0:e.value,l=null;"date-only"===i?l=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===i?(o=ne(o),l=ne(t.value)):l="timestamp-offset"===i?null!=t.value?se({dateComponent:n.date,timeComponent:n.time,oldValue:o,timeZoneComponent:n.timeZone,defaultTimeZone:s}):null:null!=t.value?oe({oldValue:o,dateComponent:n.date,timeZone:s,timeComponent:n.time?.value===j?void 0:n.time}):null,o!==l&&(null!==l&&t.value?this.viewModel.setValue(`${a}`,l):this.viewModel.setValue(`${a}`,null))}_getErrorToDisplay(e){const t=e.compositeError;return e.valid||!t?null:t===ge.CONTINGENCY_VIOLATION_ERROR||t===ge.CONTINGENCY_VIOLATION_WARNING||this._touchedInputs.has(e.template.elementId)||this.viewModel.submitHasBeenAttempted?t:null}_renderViewingAssociationsPage(){return this._associationsList?.render()}_onActiveAssociationsInputChange(e){const t=this._associationsList;t&&(e?(t.associationInput=e,t.viewModel=e.viewModel):t.associationInput=null)}async _setUpAssociationsWidgets(){const e=this.viewModel.activeForm.allUtilityNetworkAssociationsElementInputs;if(this._associationsEnabled&&0!==e.length){await this._setUpUtilityNetworkAssociationList();for(const t of e)this._associationsWidgetsMap.set(t,await this._createAssociationsWidget(t))}}async _setUpUtilityNetworkAssociationList(){if(this._associationsList)return;const e=(await(import("./FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js"))).default;this._associationsList=new e({onSelectLayer:this._onSelectAssociatedLayer.bind(this),onSelectFeature:this._onEditAssociatedFeature.bind(this),onAddAssociation:this._onAddAssociation.bind(this)});const t=this.viewModel.activeAssociationsInput;t&&(this._associationsList.associationInput=t,this._associationsList.viewModel=t.viewModel)}async _createAssociationsWidget(e){return new(0,(await(import("./Feature/FeatureUtilityNetworkAssociations.js"))).default)({viewModel:e.viewModel,onSelectAssociationType:t=>this._onSelectAssociationType(e,t)})}_destroyAssociationsWidgets(){this._associationsWidgetsMap.forEach(e=>s(e)),this._associationsWidgetsMap.clear()}_onSelectAssociationType(e,{listType:t}){this.setActiveAssociationsInput(e),this.setActiveAssociationType(t)}_onSelectAssociatedLayer({layer:e}){this.setActiveAssociationsLayer(e)}async _onEditAssociatedFeature(e){const t=this.callbacks?.editAssociatedFeature,a=this.viewModel.activeAssociationsInput;if(!t||!a?.feature)return;const{association:i,feature:n}=e;await t({parentFeature:a.feature.plainGraphic,association:i,feature:n})}_onAddAssociation(e){const t=this.callbacks?.addAssociation,a=this.viewModel.activeAssociationsInput;if(!t||!a?.feature)return;const{associationType:i,utilityNetwork:n}=e;t({feature:a.feature.plainGraphic,associationType:i,utilityNetwork:n})}_setFocusableInput(e){const t=e&&U(e)?e:this._findFocusableInput(e);this._syncGroupInputStates(),this._focusedFieldInput=t,this._attemptFocusOnNextRender=!0}_findFocusableInput(e){const t=this.viewModel.activeForm.inputs;if(!t.length)return;const a=M(t);let i;if(e)if(N(e)){const t=e.inputs.find(e=>e.visible);i=t?a.indexOf(t):0}else{let n;if(W(e)&&!e.group.open){n=e.group.inputs.filter(U)[t.length-1]}else n=e;i=a.indexOf(n)+1}else i=0;for(let n=i;n<a.length;n++){const e=a[n];if(e.visible&&U(e)){if(this.disabledOrReadOnly&&("switch"===e?.inputType||"radio-buttons"===e?.inputType))continue;return e}}return null}_onGroupToggle(e,t){e.expanded?(t.open=!0,this._setFocusableInput(t),"sequential"===this.groupDisplay&&this.viewModel.activeForm.allGroupInputs.forEach(e=>{e!==t&&(e.open=!1)})):t.open=!1,this.scheduleRender()}_syncGroupInputStates(){if("sequential"!==this.groupDisplay)return;const e=this.viewModel.activeForm?.allGroupInputs;if(!e.length)return;const t=e.filter(e=>e.open);0===t.length?e[0].open=!0:t.length>1&&t.slice(1).forEach(e=>e.open=!1)}};function ye(e){switch(e){case"audio":return _("audio/mpeg");case"video":return _("video/mp4");case"image":return _("image/png");default:return"camera"}}e([u()],Ce.prototype,"activeFeatureIndex",null),e([u()],Ce.prototype,"attachmentsEnabled",null),e([u()],Ce.prototype,"callbacks",null),e([u()],Ce.prototype,"disabled",null),e([u()],Ce.prototype,"effectiveTitle",null),e([u()],Ce.prototype,"effectiveDisabled",null),e([u()],Ce.prototype,"disabledOrReadOnly",null),e([u()],Ce.prototype,"features",null),e([u()],Ce.prototype,"footerButtonInfos",null),e([u()],Ce.prototype,"map",null),e([u()],Ce.prototype,"maximumFeatureCount",null),e([u()],Ce.prototype,"maximumFeatureCountWithComplexForms",null),e([u()],Ce.prototype,"spatialReference",null),e([u()],Ce.prototype,"layerInfos",null),e([u()],Ce.prototype,"timeZone",null),e([u()],Ce.prototype,"headingLevel",void 0),e([u()],Ce.prototype,"icon",null),e([u(),de("esri/t9n/common")],Ce.prototype,"messagesCommon",void 0),e([u(),de("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],Ce.prototype,"messages",void 0),e([u(),de("esri/widgets/FeatureForm/t9n/FeatureForm")],Ce.prototype,"featureFormMessages",void 0),e([u(),de("esri/widgets/FeatureTable/t9n/FeatureTable")],Ce.prototype,"featureTableMessages",void 0),e([u(),de("esri/core/t9n/Units")],Ce.prototype,"messagesUnits",void 0),e([u()],Ce.prototype,"page",null),e([u()],Ce.prototype,"readOnly",null),e([u()],Ce.prototype,"showPrompt",null),e([u()],Ce.prototype,"clearPrompt",null),e([u()],Ce.prototype,"selectedAttachment",null),e([u()],Ce.prototype,"selectedAttachmentDetails",null),e([u()],Ce.prototype,"valid",null),e([u({type:x}),me(["attachments-change","value-change","values-change","submit"])],Ce.prototype,"viewModel",void 0),e([u({type:L,nonNullable:!0})],Ce.prototype,"visibleElements",void 0),e([u()],Ce.prototype,"groupDisplay",void 0),e([u()],Ce.prototype,"_formHeaderVisible",null),e([u()],Ce.prototype,"_associationsEnabled",null),e([u()],Ce.prototype,"_associationsList",void 0),e([u()],Ce.prototype,"_attemptFocusOnNextRender",void 0),e([u()],Ce.prototype,"_formId",null),e([u()],Ce.prototype,"_focusedFieldInput",void 0),e([u()],Ce.prototype,"_pendingSubtypeChoice",void 0),e([u()],Ce.prototype,"_relatedRecordsEnabled",null),e([u()],Ce.prototype,"_listObserverNode",void 0),e([u()],Ce.prototype,"_attachmentDialogInfo",void 0),e([u()],Ce.prototype,"_attachmentListFilterText",void 0),e([u()],Ce.prototype,"_prompt",void 0),e([u()],Ce.prototype,"test",null),Ce=e([h("esri.widgets.BatchAttributeForm")],Ce);const Ae=Ce;export{Ae as default};
|
package/widgets/Bookmarks.js
CHANGED
|
@@ -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{deprecateWidget as o}from"../core/deprecate.js";import{IdentifiableMixin as i}from"../core/Identifiable.js";import r from"../core/Logger.js";import{property as a,subclass as s}from"../core/accessorSupport/decorators.js";import{formatDate as n,convertDateFormatToIntlOptions as l}from"../intl/date.js";import{system as d}from"../time/constants.js";import m from"../webdoc/support/SlideThumbnail.js";import c from"./Widget.js";import u from"./Bookmarks/BookmarksUserState.js";import k from"./Bookmarks/BookmarksViewModel.js";import h from"./Bookmarks/BookmarksVisibleElements.js";import{css as p}from"./Bookmarks/css.js";import{loadCalciteComponents as b}from"./support/componentsUtils.js";import{globalCss as _}from"./support/globalCss.js";import{Heading as g}from"./support/Heading.js";import{calciteListFilterProps as f}from"./support/listUtils.js";import{tsx as v,messageBundle as B,vmEvent as w}from"./support/widget.js";import{setFocus as E}from"./support/widgetUtils.js";let I=class extends(i(c)){constructor(e,t){super(e,t),this._addInputNode=null,this._editInputNode=null,this._urlEditInputNode=null,this._lastDragDetail=null,this._selectedDragBookmarkUid=null,this._editIncludeTimeExtent=void 0,this._userState=null,this._focusRootFlowItem=!1,this._focusAddFlowItem=!1,this._focusEditFlowItem=!1,this.disabled=!1,this.dragEnabled=!1,this.filterPlaceholder="",this.filterText="",this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.viewModel=new k({suppressDeprecationWarning:!0}),this.visibleElements=new h,this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t,bookmarks:o}=this,{toEl:i,fromEl:r,dragEl:a,newIndex:s}=e;if(!o.length)return;if(!r||!i||t?.newIndex===s&&t?.dragEl===a&&t?.toEl===i&&t?.fromEl===r)return;this._lastDragDetail=e;const n=Array.from(r.children).filter(e=>e?.matches("calcite-list-item")).map(e=>e.value);o.sort((e,t)=>{const o=n.indexOf(e.uid),i=n.indexOf(t.uid);return o>i?1:o<i?-1:0}),this._selectedDragBookmarkUid=a.value},o(r.getLogger(this),"Bookmarks","arcgis-bookmarks",{version:"4.34"})}loadDependencies(){return b({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),"chip-group":()=>import("@esri/calcite-components/dist/components/calcite-chip-group"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),fab:()=>import("@esri/calcite-components/dist/components/calcite-fab"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),table:()=>import("@esri/calcite-components/dist/components/calcite-table"),"table-cell":()=>import("@esri/calcite-components/dist/components/calcite-table-cell"),"table-header":()=>import("@esri/calcite-components/dist/components/calcite-table-header"),"table-row":()=>import("@esri/calcite-components/dist/components/calcite-table-row")})}get defaultCreateOptions(){return this.viewModel.defaultCreateOptions}set defaultCreateOptions(e){this.viewModel.defaultCreateOptions=e}get defaultEditOptions(){return this.viewModel.defaultEditOptions}set defaultEditOptions(e){this.viewModel.defaultEditOptions=e}get bookmarks(){return this.viewModel.bookmarks}set bookmarks(e){this.viewModel.bookmarks=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get icon(){return"bookmark"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}endAddBookmark(){this._userState=null}goTo(e){return this.viewModel.goTo(e)}render(){return v("div",{class:this.classes(p.base,_.widget,_.panel)},this._renderBookmarksContainer())}startAddBookmark(){this._userState=new u({state:"add"}),this._focusAddFlowItem=!0}_renderNoBookmarksContainer(e){const{messages:t,viewModel:{state:o}}=this;return e.length||"loading"===o?null:v("div",{class:_.empty,key:"no-bookmarks"},v("calcite-icon",{icon:"bookmark",scale:"l"}),v(g,{class:this.classes(_.heading,p.noBookmarksHeader),level:this.headingLevel},t?.noBookmarksHeading),v("p",{class:p.noBookmarksDescription},t.noBookmarksDescription))}_renderEditBookmarkFlowItems(){const{_userState:e}=this,t=e?.editedBookmark;return t&&"edit"===e?.state?this._renderEditingBookmark(t):[]}_renderBookmarkItems(e){return e?e.toArray().map(e=>this._renderBookmark(e)):[]}_handleCalciteListDragEnd({fromEl:e,dragEl:t,oldIndex:o}){null!=o&&e.insertBefore(t,e.children[o])}_renderBookmarksContainer(){const{viewModel:{state:e,bookmarks:o},dragEnabled:i,messages:r,disabled:a,filterPlaceholder:s,filterText:n,visible:l,headingLevel:d,visibleElements:{closeButton:m,collapseButton:c,filter:u,heading:k,flow:h},uid:b}=this,_=o.filter(t),g=_.length?v("calcite-list",{class:p.list,displayMode:"flat",dragEnabled:i,filterEnabled:u,filterPlaceholder:s,filterProps:f,filterText:n,group:`bookmarks-${b}`,key:"bookmark-list",label:r.widgetLabel,selectionAppearance:"border",selectionMode:"none",onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this.filterText=e.currentTarget?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},this._renderBookmarkItems(_),u?v("div",{class:p.filterNoResults,slot:"filter-no-results"},v("calcite-notice",{kind:"info",open:!0,width:"full"},v("div",{slot:"message"},r.noBookmarksHeading),";")):null):null,B=[v("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:m,closed:!l,collapsible:c,disabled:a,heading:k?r.widgetLabel:void 0,headingLevel:d,loading:"loading"===e,selected:!this._userState?.state,onCalciteFlowItemClose:()=>this.visible=!1},this._renderNoBookmarksContainer(_),g,this._renderAddBookmarkButton()),this._renderAddingBookmark(),this._renderEditBookmarkFlowItems()];return l?h?v("calcite-flow",{key:"root-flow"},B):B:null}_renderAddBookmarkButton(){const{messages:e,_userState:t,disabled:o,viewModel:{view:i,state:r},visibleElements:{addBookmarkButton:a}}=this,s=t?.loading??!1;return i&&"loading"!==r&&a?v("calcite-fab",{appearance:"outline-fill",bind:this,class:p.addBookmarkButton,disabled:o||s,icon:"plus",key:"add-bookmark-item",kind:"neutral",loading:s,slot:"fab",text:e.addBookmark,textEnabled:!0,title:e.addBookmark,type:"button",onclick:this.startAddBookmark}):null}_renderEditContainer(e){const{messagesCommon:t,visibleElements:{editBookmarkButton:o}}=this,i=`${t.edit} ${this._getBookmarkTitle(e)}`;return o?v("calcite-action",{icon:"pencil",key:"edit-action",slot:"actions-end",text:i,title:i,onclick:()=>this._showEditBookmarkForm(e)}):null}_renderBookmarkImage(e,t){return t?v("img",{alt:"",class:p.bookmarkImage,key:"bookmark-image",src:e.thumbnail?.url}):null}_renderBookmarkTimeSwitch(e){const{messages:t,viewModel:{view:o}}=this,{timeExtent:i}=e;return o?.timeExtent??i?v("calcite-label",{layout:"inline-space-between"},t.includeTimeExtent,v("calcite-switch",{checked:!!i,onCalciteSwitchChange:e=>{this._editIncludeTimeExtent=!!e.currentTarget.checked}})):null}_renderEditBookmarkTimeExtent(e){return this._editIncludeTimeExtent?this._renderBookmarkTimeExtent(e):null}_getTimeExtentStrings(e){const{visibleElements:t}=this,{timeExtent:o}=e;if(!o)return{};const{start:i,end:r}=o,a=null!=r&&(null==i||i.getTime()!==r.getTime()),s=i?this._formatDate(i):"",n=i&&t.time?this._formatTime(i):"";if(!a)return{startDate:s,startTime:n};return{startDate:s,startTime:n,endDate:this._formatDate(r),endTime:t.time?this._formatTime(r):""}}_renderTimeExtentDescription(e){const{startDate:t,startTime:o,endDate:i,endTime:r}=this._getTimeExtentStrings(e);if(!t)return"";const a=`${t} ${o}`;return i?`${a} - ${`${i} ${r}`}`:a}_renderBookmarkTimeExtent(e,t=!1){const{messages:o}=this,{startDate:i,startTime:r,endDate:a,endTime:s}=this._getTimeExtentStrings(e),n=t?null:v("calcite-table-row",{slot:"table-header"},v("calcite-table-header",{heading:o.startDate}),a?v("calcite-table-header",{heading:o.endDate}):null);return i?v("calcite-table",{caption:o.timeExtent,scale:"s"},n,v("calcite-table-row",null,v("calcite-table-cell",null,i," ",r?[v("br",null),r]:null),a?v("calcite-table-cell",null,a,s?[v("br",null),s]:null):null)):null}_renderBookmarkActiveScrim(e,t){return this.viewModel.activeBookmark===e&&t?v("calcite-scrim",{key:"bookmark-active-scrim",loading:!0}):null}_renderBookmarkActiveLoader(e,t){return this.viewModel.activeBookmark!==e||t?null:v("calcite-loader",{class:p.loader,inline:!0,key:"bookmark-active-loader",label:this.messagesCommon.loading})}_renderBookmarkImageIcon(e,t){return this.viewModel.activeBookmark===e||t?null:v("calcite-icon",{icon:"bookmark",key:"bookmark-icon",scale:"s"})}_renderBookmarkThumbnail(e){const t=this.visibleElements.thumbnail&&!!e.thumbnail?.url;return v("div",{class:p.bookmarkImageContainer,slot:"content-start"},this._renderBookmarkActiveScrim(e,t),this._renderBookmarkImage(e,t),this._renderBookmarkActiveLoader(e,t),this._renderBookmarkImageIcon(e,t))}_focusSelectedDragEl(e,t){this._selectedDragBookmarkUid===t.uid&&(E(e),this._selectedDragBookmarkUid=null)}_renderBookmark(e){return v("calcite-list-item",{afterCreate:t=>this._focusSelectedDragEl(t,e),afterUpdate:t=>this._focusSelectedDragEl(t,e),class:this.classes({[p.dragEnabled]:this.dragEnabled}),description:this._renderTimeExtentDescription(e),key:e.uid,label:this._getBookmarkTitle(e),value:e.uid,onCalciteListItemSelect:()=>this._goToBookmark(e)},this._renderBookmarkThumbnail(e),this._renderBookmarkContent(e),this._renderEditContainer(e))}_renderBookmarkContent(e){return v("div",{class:p.bookmarkContent,slot:"content"},v("span",{class:p.bookmarkContentLabel},this._getBookmarkTitle(e)),this._renderBookmarkTimeExtent(e,!0))}_renderEditingBookmarkName(e){const{messages:t,_userState:o}=this,i="name-required"===o?.validationState;return v("calcite-label",null,t.title,v("calcite-input",{afterCreate:this._storeEditInput,bind:this,class:p.editBookmarkInput,name:"bookmark-name",placeholder:t.titlePlaceholder,required:!0,type:"text",value:e.name}),i?v("calcite-input-message",{icon:"exclamation-mark-triangle",status:"invalid"},t.invalidTitle):null)}_renderEditingBookmarkActions(){const{messagesCommon:e,_userState:t}=this,o=t?.bookmark;return[v("calcite-button",{appearance:"transparent",kind:"danger",slot:"footer",type:"button",width:"full",onclick:()=>this._deleteBookmark(o)},e.delete),v("calcite-button",{appearance:"outline",bind:this,slot:"footer",type:"button",width:"full",onclick:this._closeEditBookmarkForm},e.cancel),v("calcite-button",{slot:"footer",type:"submit",width:"full"},e.save)]}_handleUrlEditInputChange(){const{_userState:e,_urlEditInputNode:t}=this,o=t?.value;if(!e?.editedBookmark||!o)return;e.validationState=void 0,e.editedBookmark.thumbnail?.isDataURI&&(e.screenshotUrl=e.editedBookmark.thumbnail?.url);const i=new m({url:o});i.isSecureUrl&&(e.customUrl=o,e.editedBookmark.thumbnail=i)}_renderEditingTimeExtent(e){const{capabilities:t,view:o}=this.viewModel,{timeExtent:i}=e;return t.time&&(o?.timeExtent??i)?v("div",{key:"edit-bookmark-time-container"},this._renderBookmarkTimeSwitch(e),this._renderEditBookmarkTimeExtent(e)):null}_renderEditingBookmarkImage(e){const{_userState:t}=this,o=t?.thumbnailState,i=e.thumbnail?.isSecureUrl?"url"===o:e.thumbnail?.isDataURI?"screenshot"===o:null;if(i)return this._renderBookmarkImage(e,i)}_renderEditingThumbnail(e){const{_userState:t,visibleElements:o}=this,i=t?.thumbnailState;return o.thumbnail&&"none"!==i?v("div",{class:p.authoringImageContainer},this._renderEditingBookmarkImage(e)):null}_renderUpdateThumbnailButton(){const{visibleElements:e,messages:t,_userState:o}=this,i=o?.thumbnailState;return e.thumbnail&&"screenshot"===i?v("calcite-button",{appearance:"outline",class:p.authoringRefreshThumbnailButton,iconStart:"refresh",key:"update-thumbnail",kind:"neutral",width:"full",onclick:()=>{this._updateThumbnail()}},t.updateThumbnail):null}_renderEditingBookmarkUrlInput(e){const{messages:t,_userState:o}=this,i=e.thumbnail?.url,r=e.thumbnail?.isSecureUrl?i:void 0,a=i&&"absolute-url-required"===o?.validationState,s=o?.thumbnailState;return"url"===s?v("calcite-label",{key:"thumbnail-url-input"},v("calcite-input",{afterCreate:this._storeUrlEditInput,bind:this,name:"bookmark-thumbnail-url",pattern:"https://.*",placeholder:t?`https://<${t.imageUrlPlaceholder}>`:void 0,required:!0,title:t.imageUrlTooltip,type:"text",value:r,onCalciteInputChange:this._handleUrlEditInputChange,onCalciteInputInput:this._handleUrlEditInputChange}),a?v("calcite-input-message",{icon:"exclamation-mark-triangle",status:"invalid"},t.invalidImageUrl):null):null}_renderThumbnailSelector(){const{visibleElements:e,messages:t,_userState:o}=this,i=o?.thumbnailState;return e.thumbnail?v("calcite-label",{key:"thumbnail-chip-group"},t.thumbnail,v("calcite-chip-group",{label:t.thumbnail,selectionMode:"single-persist",onCalciteChipGroupSelect:e=>this._handleThumbnailTypeSelect(e.currentTarget.selectedItems[0].value)},v("calcite-chip",{label:t.screenshot,selected:"screenshot"===i,value:"screenshot"},t.screenshot),v("calcite-chip",{label:t.url,selected:"url"===i,value:"url"},t.url),v("calcite-chip",{label:t.none,selected:"none"===i,value:"none"},t.none))):null}_renderEditingBookmark(e){const{disabled:t,messagesCommon:o,headingLevel:i}=this;return e?v("form",{bind:this,class:p.form,disabled:this.disabled,onsubmit:this._editBookmarkSubmit},v("calcite-flow-item",{afterCreate:this._focusEditFlowItemNode,afterUpdate:this._focusEditFlowItemNode,bind:this,disabled:t,heading:o.edit,headingLevel:i,key:"edit-bookmark-form",selected:"edit"===this._userState?.state,onCalciteFlowItemBack:e=>{e.preventDefault(),this._closeEditBookmarkForm()}},v("div",{class:p.formContent},v("div",{class:p.authoring},this._renderEditingBookmarkName(e),this._renderThumbnailSelector(),this._renderEditingThumbnail(e),this._renderEditingBookmarkUrlInput(e),this._renderUpdateThumbnailButton(),this._renderEditingTimeExtent(e))),this._renderEditingBookmarkActions())):null}_renderAddingBookmarkName(){const{_userState:e,messages:t}=this,o="name-required"===e?.validationState;return v("calcite-label",null,t.title,v("calcite-input",{afterCreate:this._storeAddInput,bind:this,class:p.addBookmarkInput,name:"bookmark-name",placeholder:t.titlePlaceholder,required:!0,type:"text",value:""}),o?v("calcite-input-message",{icon:"exclamation-mark-triangle",status:"invalid"},t.invalidTitle):null)}_renderAddingBookmarkActions(){const{messagesCommon:e}=this;return[v("calcite-button",{appearance:"outline",bind:this,slot:"footer",type:"button",width:"full",onclick:this._endAddBookmark},e.cancel),v("calcite-button",{slot:"footer",type:"submit",width:"full"},e.add)]}_renderAddingBookmark(){const{disabled:e,messages:t,headingLevel:o,_userState:i}=this;return"add"===i?.state?v("form",{bind:this,class:p.form,disabled:e,onsubmit:this._addBookmarkSubmitClick},v("calcite-flow-item",{afterCreate:this._focusAddFlowItemNode,afterUpdate:this._focusAddFlowItemNode,bind:this,disabled:e,heading:t.addBookmark,headingLevel:o,key:"add-bookmark-form",selected:"add"===this._userState?.state,onCalciteFlowItemBack:e=>{e.preventDefault(),this._endAddBookmark()}},v("div",{class:p.formContent},this._renderAddingBookmarkName()),this._renderAddingBookmarkActions())):null}_getBookmarkTitle(e){return e?.name||this.messagesCommon.untitled}_formatDate(e){return e?n(e,{...l("short-date"),timeZone:this.viewModel.view?.timeZone??d}):""}_formatTime(e){return e?n(e,{...l("long-time"),timeZone:this.viewModel.view?.timeZone??d}):""}_endAddBookmark(){this.endAddBookmark(),this._focusRootFlowItem=!0}_showEditBookmarkForm(e){e&&(this._editIncludeTimeExtent=!!e.timeExtent,this._userState=new u({bookmark:e,state:"edit"}),this._focusEditFlowItem=!0,this.viewModel.goTo(e))}async _createNewScreenshotUrl(){const e=await this.viewModel.createBookmark();return e.thumbnail?.url??null}_storeCurrentUrl(){const{_userState:e}=this,t=e?.editedBookmark?.thumbnail?.url;t&&(e?.editedBookmark?.thumbnail?.isSecureUrl?e.customUrl=t:e?.editedBookmark?.thumbnail?.isDataURI&&(e.screenshotUrl=t))}async _handleThumbnailTypeSelect(e){const{_userState:t}=this;if(!t)return;const{screenshotUrl:o,customUrl:i,editedBookmark:r}=t,a="screenshot"===e?o??await this._createNewScreenshotUrl():"url"===e&&i?i:null;this._storeCurrentUrl(),r&&a&&(r.thumbnail=new m({url:a})),t.validationState=void 0,t.thumbnailState=e}_closeEditBookmarkForm(){this._userState=null,this._focusRootFlowItem=!0}_addBookmarkSubmitClick(e){e.preventDefault(),this._addBookmarkSubmit()}async _addBookmarkSubmit(){const{_addInputNode:e,_userState:t,viewModel:o,viewModel:{bookmarks:i}}=this;if(!t)return;const r=e?e.value.trim():null;if(!r)return void(t.validationState="name-required");t.loading=!0;const a=await o.createBookmark();a.name=r,i.add(a),this._endAddBookmark()}async _editBookmarkAndClose(e,t){const{viewModel:o,viewModel:{defaultEditOptions:i}}=this;await o.editBookmark(e,{...i,...t}),this._closeEditBookmarkForm()}_editBookmarkSubmit(e){e.preventDefault();const{_editInputNode:t,_userState:o,_editIncludeTimeExtent:i,_urlEditInputNode:r}=this;if(!o?.bookmark||!o.editedBookmark)return;o.validationState=void 0,o.customUrl=void 0,o.screenshotUrl=void 0;const a=t?.value.trim();if(!a)return void(o.validationState="name-required");o.bookmark.name=a,o.bookmark.thumbnail=o.editedBookmark.thumbnail,i||(o.bookmark.timeExtent=null);const s=o.thumbnailState;if("url"===s&&r){const e=r.value,t=new m({url:e});if(!t.isSecureUrl)return void(o.validationState="absolute-url-required");o.bookmark.thumbnail=t}else"none"===s&&(o.bookmark.thumbnail=null);this._editBookmarkAndClose(o.bookmark,{takeScreenshot:!1,captureTimeExtent:i})}_storeEditInput(e){this._editInputNode=e}_storeAddInput(e){this._addInputNode=e}_storeUrlEditInput(e){this._urlEditInputNode=e}_deleteBookmark(e){this._closeEditBookmarkForm(),e&&(this.viewModel.bookmarks.remove(e),e.destroy())}_goToBookmark(e){this.endAddBookmark(),this.viewModel.goTo(e)}async _updateThumbnail(){const{_userState:e,viewModel:t}=this;e&&(e.validationState=void 0,await t.editBookmark(e.editedBookmark,{takeScreenshot:!0,captureViewpoint:!1,captureRotation:!1,captureScale:!1,captureTimeExtent:!1}))}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,E(e))}_focusEditFlowItemNode(e){this._focusEditFlowItem&&(this._focusEditFlowItem=!1,E(e))}_focusAddFlowItemNode(e){this._focusAddFlowItem&&(this._focusAddFlowItem=!1,E(e))}};e([a()],I.prototype,"_editIncludeTimeExtent",void 0),e([a({type:u})],I.prototype,"_userState",void 0),e([a()],I.prototype,"_focusRootFlowItem",void 0),e([a()],I.prototype,"_focusAddFlowItem",void 0),e([a()],I.prototype,"_focusEditFlowItem",void 0),e([a()],I.prototype,"defaultCreateOptions",null),e([a()],I.prototype,"defaultEditOptions",null),e([a()],I.prototype,"bookmarks",null),e([a()],I.prototype,"disabled",void 0),e([a()],I.prototype,"dragEnabled",void 0),e([a()],I.prototype,"filterPlaceholder",void 0),e([a()],I.prototype,"filterText",void 0),e([a()],I.prototype,"headingLevel",void 0),e([a()],I.prototype,"goToOverride",null),e([a()],I.prototype,"icon",null),e([a()],I.prototype,"label",null),e([a(),B("esri/widgets/Bookmarks/t9n/Bookmarks")],I.prototype,"messages",void 0),e([a(),B("esri/t9n/common")],I.prototype,"messagesCommon",void 0),e([a()],I.prototype,"uiStrings",void 0),e([a()],I.prototype,"view",null),e([a({type:k}),w(["select-bookmark","bookmark-edit","bookmark-select"])],I.prototype,"viewModel",void 0),e([a({type:h,nonNullable:!0})],I.prototype,"visibleElements",void 0),e([a()],I.prototype,"endAddBookmark",null),e([a()],I.prototype,"startAddBookmark",null),I=e([s("esri.widgets.Bookmarks")],I);const S=I;export{S as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{isSome as t}from"../core/arrayUtils.js";import{deprecateWidget as o}from"../core/deprecate.js";import{IdentifiableMixin as i}from"../core/Identifiable.js";import r from"../core/Logger.js";import{property as a,subclass as s}from"../core/accessorSupport/decorators.js";import{formatDate as n,convertDateFormatToIntlOptions as l}from"../intl/date.js";import{system as d}from"../time/constants.js";import m from"../webdoc/support/SlideThumbnail.js";import c from"./Widget.js";import u from"./Bookmarks/BookmarksUserState.js";import k from"./Bookmarks/BookmarksViewModel.js";import h from"./Bookmarks/BookmarksVisibleElements.js";import{css as p}from"./Bookmarks/css.js";import{loadCalciteComponents as b}from"./support/componentsUtils.js";import{globalCss as _}from"./support/globalCss.js";import{Heading as g}from"./support/Heading.js";import{calciteListFilterProps as f}from"./support/listUtils.js";import{tsx as v,messageBundle as B,vmEvent as w}from"./support/widget.js";import{setFocus as E}from"./support/widgetUtils.js";let I=class extends(i(c)){constructor(e,t){super(e,t),this._addInputNode=null,this._editInputNode=null,this._urlEditInputNode=null,this._lastDragDetail=null,this._selectedDragBookmarkUid=null,this._editIncludeTimeExtent=void 0,this._userState=null,this._focusRootFlowItem=!1,this._focusAddFlowItem=!1,this._focusEditFlowItem=!1,this.disabled=!1,this.dragEnabled=!1,this.filterPlaceholder="",this.filterText="",this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.viewModel=new k({suppressDeprecationWarning:!0}),this.visibleElements=new h,this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t,bookmarks:o}=this,{toEl:i,fromEl:r,dragEl:a,newIndex:s}=e;if(!o.length)return;if(!r||!i||t?.newIndex===s&&t?.dragEl===a&&t?.toEl===i&&t?.fromEl===r)return;this._lastDragDetail=e;const n=Array.from(r.children).filter(e=>e?.matches("calcite-list-item")).map(e=>e.value);o.sort((e,t)=>{const o=n.indexOf(e.uid),i=n.indexOf(t.uid);return o>i?1:o<i?-1:0}),this._selectedDragBookmarkUid=a.value},o(r.getLogger(this),"Bookmarks","arcgis-bookmarks",{version:"4.34"})}loadDependencies(){return b({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),"chip-group":()=>import("@esri/calcite-components/dist/components/calcite-chip-group"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),fab:()=>import("@esri/calcite-components/dist/components/calcite-fab"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),table:()=>import("@esri/calcite-components/dist/components/calcite-table"),"table-cell":()=>import("@esri/calcite-components/dist/components/calcite-table-cell"),"table-header":()=>import("@esri/calcite-components/dist/components/calcite-table-header"),"table-row":()=>import("@esri/calcite-components/dist/components/calcite-table-row")})}get defaultCreateOptions(){return this.viewModel.defaultCreateOptions}set defaultCreateOptions(e){this.viewModel.defaultCreateOptions=e}get defaultEditOptions(){return this.viewModel.defaultEditOptions}set defaultEditOptions(e){this.viewModel.defaultEditOptions=e}get bookmarks(){return this.viewModel.bookmarks}set bookmarks(e){this.viewModel.bookmarks=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get icon(){return"bookmark"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}endAddBookmark(){this._userState=null}goTo(e){return this.viewModel.goTo(e)}render(){return v("div",{class:this.classes(p.base,_.widget,_.panel)},this._renderBookmarksContainer())}startAddBookmark(){this._userState=new u({state:"add"}),this._focusAddFlowItem=!0}_renderNoBookmarksContainer(e){const{messages:t,viewModel:{state:o}}=this;return e.length||"loading"===o?null:v("div",{class:_.empty,key:"no-bookmarks"},v("calcite-icon",{icon:"bookmark",scale:"l"}),v(g,{class:this.classes(_.heading,p.noBookmarksHeader),level:this.headingLevel},t?.noBookmarksHeading),v("p",{class:p.noBookmarksDescription},t.noBookmarksDescription))}_renderEditBookmarkFlowItems(){const{_userState:e}=this,t=e?.editedBookmark;return t&&"edit"===e?.state?this._renderEditingBookmark(t):[]}_renderBookmarkItems(e){return e?e.toArray().map(e=>this._renderBookmark(e)):[]}_handleCalciteListDragEnd({fromEl:e,dragEl:t,oldIndex:o}){null!=o&&e.insertBefore(t,e.children[o])}_renderBookmarksContainer(){const{viewModel:{state:e,bookmarks:o},dragEnabled:i,messages:r,disabled:a,filterPlaceholder:s,filterText:n,visible:l,headingLevel:d,visibleElements:{closeButton:m,collapseButton:c,filter:u,heading:k,flow:h},uid:b}=this,_=o.filter(t),g=_.length?v("calcite-list",{class:p.list,displayMode:"flat",dragEnabled:i,filterEnabled:u,filterPlaceholder:s,filterProps:f,filterText:n,group:`bookmarks-${b}`,key:"bookmark-list",label:r.widgetLabel,selectionAppearance:"border",selectionMode:"none",onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this.filterText=e.currentTarget?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},this._renderBookmarkItems(_),u?v("div",{class:p.filterNoResults,slot:"filter-no-results"},v("calcite-notice",{kind:"info",open:!0,width:"full"},v("div",{slot:"message"},r.noBookmarksHeading),";")):null):null,B=[v("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:m,closed:!l,collapsible:c,disabled:a,heading:k?r.widgetLabel:void 0,headingLevel:d,loading:"loading"===e,selected:!this._userState?.state,onCalciteFlowItemClose:()=>this.visible=!1},this._renderNoBookmarksContainer(_),g,this._renderAddBookmarkButton()),this._renderAddingBookmark(),this._renderEditBookmarkFlowItems()],w=h?v("calcite-flow",{key:"root-flow"},B):B;if(!l)return null;const E="add"===this._userState?.state?this._addBookmarkSubmitClick:"edit"===this._userState?.state?this._editBookmarkSubmit:null;return E?v("form",{bind:this,class:p.form,disabled:a,onsubmit:E},w):w}_renderAddBookmarkButton(){const{messages:e,_userState:t,disabled:o,viewModel:{view:i,state:r},visibleElements:{addBookmarkButton:a}}=this,s=t?.loading??!1;return i&&"loading"!==r&&a?v("calcite-fab",{appearance:"outline-fill",bind:this,class:p.addBookmarkButton,disabled:o||s,icon:"plus",key:"add-bookmark-item",kind:"neutral",loading:s,slot:"fab",text:e.addBookmark,textEnabled:!0,title:e.addBookmark,type:"button",onclick:this.startAddBookmark}):null}_renderEditContainer(e){const{messagesCommon:t,visibleElements:{editBookmarkButton:o}}=this,i=`${t.edit} ${this._getBookmarkTitle(e)}`;return o?v("calcite-action",{icon:"pencil",key:"edit-action",slot:"actions-end",text:i,title:i,onclick:()=>this._showEditBookmarkForm(e)}):null}_renderBookmarkImage(e,t){return t?v("img",{alt:"",class:p.bookmarkImage,key:"bookmark-image",src:e.thumbnail?.url}):null}_renderBookmarkTimeSwitch(e){const{messages:t,viewModel:{view:o}}=this,{timeExtent:i}=e;return o?.timeExtent??i?v("calcite-label",{layout:"inline-space-between"},t.includeTimeExtent,v("calcite-switch",{checked:!!i,onCalciteSwitchChange:e=>{this._editIncludeTimeExtent=!!e.currentTarget.checked}})):null}_renderEditBookmarkTimeExtent(e){return this._editIncludeTimeExtent?this._renderBookmarkTimeExtent(e):null}_getTimeExtentStrings(e){const{visibleElements:t}=this,{timeExtent:o}=e;if(!o)return{};const{start:i,end:r}=o,a=null!=r&&(null==i||i.getTime()!==r.getTime()),s=i?this._formatDate(i):"",n=i&&t.time?this._formatTime(i):"";if(!a)return{startDate:s,startTime:n};return{startDate:s,startTime:n,endDate:this._formatDate(r),endTime:t.time?this._formatTime(r):""}}_renderTimeExtentDescription(e){const{startDate:t,startTime:o,endDate:i,endTime:r}=this._getTimeExtentStrings(e);if(!t)return"";const a=`${t} ${o}`;return i?`${a} - ${`${i} ${r}`}`:a}_renderBookmarkTimeExtent(e,t=!1){const{messages:o}=this,{startDate:i,startTime:r,endDate:a,endTime:s}=this._getTimeExtentStrings(e),n=t?null:v("calcite-table-row",{slot:"table-header"},v("calcite-table-header",{heading:o.startDate}),a?v("calcite-table-header",{heading:o.endDate}):null);return i?v("calcite-table",{caption:o.timeExtent,scale:"s"},n,v("calcite-table-row",null,v("calcite-table-cell",null,i," ",r?[v("br",null),r]:null),a?v("calcite-table-cell",null,a,s?[v("br",null),s]:null):null)):null}_renderBookmarkActiveScrim(e,t){return this.viewModel.activeBookmark===e&&t?v("calcite-scrim",{key:"bookmark-active-scrim",loading:!0}):null}_renderBookmarkActiveLoader(e,t){return this.viewModel.activeBookmark!==e||t?null:v("calcite-loader",{class:p.loader,inline:!0,key:"bookmark-active-loader",label:this.messagesCommon.loading})}_renderBookmarkImageIcon(e,t){return this.viewModel.activeBookmark===e||t?null:v("calcite-icon",{icon:"bookmark",key:"bookmark-icon",scale:"s"})}_renderBookmarkThumbnail(e){const t=this.visibleElements.thumbnail&&!!e.thumbnail?.url;return v("div",{class:p.bookmarkImageContainer,slot:"content-start"},this._renderBookmarkActiveScrim(e,t),this._renderBookmarkImage(e,t),this._renderBookmarkActiveLoader(e,t),this._renderBookmarkImageIcon(e,t))}_focusSelectedDragEl(e,t){this._selectedDragBookmarkUid===t.uid&&(E(e),this._selectedDragBookmarkUid=null)}_renderBookmark(e){return v("calcite-list-item",{afterCreate:t=>this._focusSelectedDragEl(t,e),afterUpdate:t=>this._focusSelectedDragEl(t,e),class:this.classes({[p.dragEnabled]:this.dragEnabled}),description:this._renderTimeExtentDescription(e),key:e.uid,label:this._getBookmarkTitle(e),value:e.uid,onCalciteListItemSelect:()=>this._goToBookmark(e)},this._renderBookmarkThumbnail(e),this._renderBookmarkContent(e),this._renderEditContainer(e))}_renderBookmarkContent(e){return v("div",{class:p.bookmarkContent,slot:"content"},v("span",{class:p.bookmarkContentLabel},this._getBookmarkTitle(e)),this._renderBookmarkTimeExtent(e,!0))}_renderEditingBookmarkName(e){const{messages:t,_userState:o}=this,i="name-required"===o?.validationState;return v("calcite-label",null,t.title,v("calcite-input",{afterCreate:this._storeEditInput,bind:this,class:p.editBookmarkInput,name:"bookmark-name",placeholder:t.titlePlaceholder,required:!0,type:"text",value:e.name}),i?v("calcite-input-message",{icon:"exclamation-mark-triangle",status:"invalid"},t.invalidTitle):null)}_renderEditingBookmarkActions(){const{messagesCommon:e,_userState:t}=this,o=t?.bookmark;return[v("calcite-button",{appearance:"transparent",kind:"danger",slot:"footer",type:"button",width:"full",onclick:()=>this._deleteBookmark(o)},e.delete),v("calcite-button",{appearance:"outline",bind:this,slot:"footer",type:"button",width:"full",onclick:this._closeEditBookmarkForm},e.cancel),v("calcite-button",{slot:"footer",type:"submit",width:"full"},e.save)]}_handleUrlEditInputChange(){const{_userState:e,_urlEditInputNode:t}=this,o=t?.value;if(!e?.editedBookmark||!o)return;e.validationState=void 0,e.editedBookmark.thumbnail?.isDataURI&&(e.screenshotUrl=e.editedBookmark.thumbnail?.url);const i=new m({url:o});i.isSecureUrl&&(e.customUrl=o,e.editedBookmark.thumbnail=i)}_renderEditingTimeExtent(e){const{capabilities:t,view:o}=this.viewModel,{timeExtent:i}=e;return t.time&&(o?.timeExtent??i)?v("div",{key:"edit-bookmark-time-container"},this._renderBookmarkTimeSwitch(e),this._renderEditBookmarkTimeExtent(e)):null}_renderEditingBookmarkImage(e){const{_userState:t}=this,o=t?.thumbnailState,i=e.thumbnail?.isSecureUrl?"url"===o:e.thumbnail?.isDataURI?"screenshot"===o:null;if(i)return this._renderBookmarkImage(e,i)}_renderEditingThumbnail(e){const{_userState:t,visibleElements:o}=this,i=t?.thumbnailState;return o.thumbnail&&"none"!==i?v("div",{class:p.authoringImageContainer},this._renderEditingBookmarkImage(e)):null}_renderUpdateThumbnailButton(){const{visibleElements:e,messages:t,_userState:o}=this,i=o?.thumbnailState;return e.thumbnail&&"screenshot"===i?v("calcite-button",{appearance:"outline",class:p.authoringRefreshThumbnailButton,iconStart:"refresh",key:"update-thumbnail",kind:"neutral",width:"full",onclick:()=>{this._updateThumbnail()}},t.updateThumbnail):null}_renderEditingBookmarkUrlInput(e){const{messages:t,_userState:o}=this,i=e.thumbnail?.url,r=e.thumbnail?.isSecureUrl?i:void 0,a=i&&"absolute-url-required"===o?.validationState,s=o?.thumbnailState;return"url"===s?v("calcite-label",{key:"thumbnail-url-input"},v("calcite-input",{afterCreate:this._storeUrlEditInput,bind:this,name:"bookmark-thumbnail-url",pattern:"https://.*",placeholder:t?`https://<${t.imageUrlPlaceholder}>`:void 0,required:!0,title:t.imageUrlTooltip,type:"text",value:r,onCalciteInputChange:this._handleUrlEditInputChange,onCalciteInputInput:this._handleUrlEditInputChange}),a?v("calcite-input-message",{icon:"exclamation-mark-triangle",status:"invalid"},t.invalidImageUrl):null):null}_renderThumbnailSelector(){const{visibleElements:e,messages:t,_userState:o}=this,i=o?.thumbnailState;return e.thumbnail?v("calcite-label",{key:"thumbnail-chip-group"},t.thumbnail,v("calcite-chip-group",{label:t.thumbnail,selectionMode:"single-persist",onCalciteChipGroupSelect:e=>this._handleThumbnailTypeSelect(e.currentTarget.selectedItems[0].value)},v("calcite-chip",{label:t.screenshot,selected:"screenshot"===i,value:"screenshot"},t.screenshot),v("calcite-chip",{label:t.url,selected:"url"===i,value:"url"},t.url),v("calcite-chip",{label:t.none,selected:"none"===i,value:"none"},t.none))):null}_renderEditingBookmark(e){const{disabled:t,messagesCommon:o,headingLevel:i}=this;return e?v("calcite-flow-item",{afterCreate:this._focusEditFlowItemNode,afterUpdate:this._focusEditFlowItemNode,bind:this,disabled:t,heading:o.edit,headingLevel:i,key:"edit-bookmark-form",selected:"edit"===this._userState?.state,onCalciteFlowItemBack:e=>{e.preventDefault(),this._closeEditBookmarkForm()}},v("div",{class:p.formContent},v("div",{class:p.authoring},this._renderEditingBookmarkName(e),this._renderThumbnailSelector(),this._renderEditingThumbnail(e),this._renderEditingBookmarkUrlInput(e),this._renderUpdateThumbnailButton(),this._renderEditingTimeExtent(e))),this._renderEditingBookmarkActions()):null}_renderAddingBookmarkName(){const{_userState:e,messages:t}=this,o="name-required"===e?.validationState;return v("calcite-label",null,t.title,v("calcite-input",{afterCreate:this._storeAddInput,bind:this,class:p.addBookmarkInput,name:"bookmark-name",placeholder:t.titlePlaceholder,required:!0,type:"text",value:""}),o?v("calcite-input-message",{icon:"exclamation-mark-triangle",status:"invalid"},t.invalidTitle):null)}_renderAddingBookmarkActions(){const{messagesCommon:e}=this;return[v("calcite-button",{appearance:"outline",bind:this,slot:"footer",type:"button",width:"full",onclick:this._endAddBookmark},e.cancel),v("calcite-button",{slot:"footer",type:"submit",width:"full"},e.add)]}_renderAddingBookmark(){const{disabled:e,messages:t,headingLevel:o,_userState:i}=this;return"add"===i?.state?v("calcite-flow-item",{afterCreate:this._focusAddFlowItemNode,afterUpdate:this._focusAddFlowItemNode,bind:this,disabled:e,heading:t.addBookmark,headingLevel:o,key:"add-bookmark-form",selected:"add"===this._userState?.state,onCalciteFlowItemBack:e=>{e.preventDefault(),this._endAddBookmark()}},v("div",{class:p.formContent},this._renderAddingBookmarkName()),this._renderAddingBookmarkActions()):null}_getBookmarkTitle(e){return e?.name||this.messagesCommon.untitled}_formatDate(e){return e?n(e,{...l("short-date"),timeZone:this.viewModel.view?.timeZone??d}):""}_formatTime(e){return e?n(e,{...l("long-time"),timeZone:this.viewModel.view?.timeZone??d}):""}_endAddBookmark(){this.endAddBookmark(),this._focusRootFlowItem=!0}_showEditBookmarkForm(e){e&&(this._editIncludeTimeExtent=!!e.timeExtent,this._userState=new u({bookmark:e,state:"edit"}),this._focusEditFlowItem=!0,this.viewModel.goTo(e))}async _createNewScreenshotUrl(){const e=await this.viewModel.createBookmark();return e.thumbnail?.url??null}_storeCurrentUrl(){const{_userState:e}=this,t=e?.editedBookmark?.thumbnail?.url;t&&(e?.editedBookmark?.thumbnail?.isSecureUrl?e.customUrl=t:e?.editedBookmark?.thumbnail?.isDataURI&&(e.screenshotUrl=t))}async _handleThumbnailTypeSelect(e){const{_userState:t}=this;if(!t)return;const{screenshotUrl:o,customUrl:i,editedBookmark:r}=t,a="screenshot"===e?o??await this._createNewScreenshotUrl():"url"===e&&i?i:null;this._storeCurrentUrl(),r&&a&&(r.thumbnail=new m({url:a})),t.validationState=void 0,t.thumbnailState=e}_closeEditBookmarkForm(){this._userState=null,this._focusRootFlowItem=!0}_addBookmarkSubmitClick(e){e.preventDefault(),this._addBookmarkSubmit()}async _addBookmarkSubmit(){const{_addInputNode:e,_userState:t,viewModel:o,viewModel:{bookmarks:i}}=this;if(!t)return;const r=e?e.value.trim():null;if(!r)return void(t.validationState="name-required");t.loading=!0;const a=await o.createBookmark();a.name=r,i.add(a),this._endAddBookmark()}async _editBookmarkAndClose(e,t){const{viewModel:o,viewModel:{defaultEditOptions:i}}=this;await o.editBookmark(e,{...i,...t}),this._closeEditBookmarkForm()}_editBookmarkSubmit(e){e.preventDefault();const{_editInputNode:t,_userState:o,_editIncludeTimeExtent:i,_urlEditInputNode:r}=this;if(!o?.bookmark||!o.editedBookmark)return;o.validationState=void 0,o.customUrl=void 0,o.screenshotUrl=void 0;const a=t?.value.trim();if(!a)return void(o.validationState="name-required");o.bookmark.name=a,o.bookmark.thumbnail=o.editedBookmark.thumbnail,i||(o.bookmark.timeExtent=null);const s=o.thumbnailState;if("url"===s&&r){const e=r.value,t=new m({url:e});if(!t.isSecureUrl)return void(o.validationState="absolute-url-required");o.bookmark.thumbnail=t}else"none"===s&&(o.bookmark.thumbnail=null);this._editBookmarkAndClose(o.bookmark,{takeScreenshot:!1,captureTimeExtent:i})}_storeEditInput(e){this._editInputNode=e}_storeAddInput(e){this._addInputNode=e}_storeUrlEditInput(e){this._urlEditInputNode=e}_deleteBookmark(e){this._closeEditBookmarkForm(),e&&(this.viewModel.bookmarks.remove(e),e.destroy())}_goToBookmark(e){this.endAddBookmark(),this.viewModel.goTo(e)}async _updateThumbnail(){const{_userState:e,viewModel:t}=this;e&&(e.validationState=void 0,await t.editBookmark(e.editedBookmark,{takeScreenshot:!0,captureViewpoint:!1,captureRotation:!1,captureScale:!1,captureTimeExtent:!1}))}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,E(e))}_focusEditFlowItemNode(e){this._focusEditFlowItem&&(this._focusEditFlowItem=!1,E(e))}_focusAddFlowItemNode(e){this._focusAddFlowItem&&(this._focusAddFlowItem=!1,E(e))}};e([a()],I.prototype,"_editIncludeTimeExtent",void 0),e([a({type:u})],I.prototype,"_userState",void 0),e([a()],I.prototype,"_focusRootFlowItem",void 0),e([a()],I.prototype,"_focusAddFlowItem",void 0),e([a()],I.prototype,"_focusEditFlowItem",void 0),e([a()],I.prototype,"defaultCreateOptions",null),e([a()],I.prototype,"defaultEditOptions",null),e([a()],I.prototype,"bookmarks",null),e([a()],I.prototype,"disabled",void 0),e([a()],I.prototype,"dragEnabled",void 0),e([a()],I.prototype,"filterPlaceholder",void 0),e([a()],I.prototype,"filterText",void 0),e([a()],I.prototype,"headingLevel",void 0),e([a()],I.prototype,"goToOverride",null),e([a()],I.prototype,"icon",null),e([a()],I.prototype,"label",null),e([a(),B("esri/widgets/Bookmarks/t9n/Bookmarks")],I.prototype,"messages",void 0),e([a(),B("esri/t9n/common")],I.prototype,"messagesCommon",void 0),e([a()],I.prototype,"uiStrings",void 0),e([a()],I.prototype,"view",null),e([a({type:k}),w(["select-bookmark","bookmark-edit","bookmark-select"])],I.prototype,"viewModel",void 0),e([a({type:h,nonNullable:!0})],I.prototype,"visibleElements",void 0),e([a()],I.prototype,"endAddBookmark",null),e([a()],I.prototype,"startAddBookmark",null),I=e([s("esri.widgets.Bookmarks")],I);const S=I;export{S as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{substitute as e}from"../../intl.js";import{isSome as t}from"../../core/arrayUtils.js";import{equalsShallow as r}from"../../core/lang.js";import n from"../../core/Logger.js";import{templateHasKey as o,replace as i}from"../../core/string.js";import{isFieldElement as l}from"../../form/support/formUtils.js";import{convertDateTimeFieldFormatToIntlOptions as
|
|
2
|
+
import{substitute as e}from"../../intl.js";import{isSome as t}from"../../core/arrayUtils.js";import{equalsShallow as r}from"../../core/lang.js";import n from"../../core/Logger.js";import{templateHasKey as o,replace as i}from"../../core/string.js";import{isFieldElement as l}from"../../form/support/formUtils.js";import{convertDateTimeFieldFormatToIntlOptions as s}from"../../intl/date.js";import{DomainValidationError as a}from"../../layers/support/domainUtils.js";import{defaultFieldFormat as u}from"../../layers/support/fieldFormatUtils.js";import{isTimeOnlyField as m,NumericRangeValidationError as p,TypeValidationError as f}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as d,supportsFieldConfiguration as c,getSubtypesFromLayer as y}from"../../layers/support/layerUtils.js";import{isAnyDateField as g}from"../../smartMapping/support/utils.js";import{getLabelForDateFieldValue as b,getIntlOptionsForField as j}from"../support/dateUtils.js";import{InputValidationError as F,getRangeErrorMessage as T,shouldUseScientificNotation as x,scientificNumberFormatOptions as N,numberFormatOptions as O}from"../support/forms/formUtils.js";const V=e=>"field"===e?.type,h=e=>"group"===e?.type,v=e=>"relationship"===e?.type,E=e=>"text"===e.type,U=e=>"utilityNetworkAssociations"===e.type,_=e=>!h(e)&&null!=e.group,L=(e,t)=>_(e)&&e.group===t,A=e=>e.reduce((e,t)=>h(t)?[...e,...t.inputs]:[...e,t],[]),I=e=>A(e).filter(V),$=e=>A(e).filter(v),C=e=>A(e).filter(U),w=e=>null!=e&&(Z(e,"combo-box")||Z(e,"radio-buttons")),Z=(e,t)=>null!=e&&e.input?.type===t,D=({domain:e,inputType:t="text-box",dataType:r})=>"number"===r&&"text-box"===t&&(!e||"coded-value"!==e.type);function G(e){const{attributes:r,layer:n,label:i,timeZone:l}=e;if(!r||"object"!=typeof r)return i;const s=Object.keys(r).filter(e=>o(i,e)),a=s.map(e=>r[e]),u=s.map(e=>n.fieldsIndex.get(e)).filter(t);return z(i,H({fields:u,layer:n,timeZone:l,values:a}))}const R="expression/",S="expr/",k="field/";function B(e){const[t,r]=e.split(R);return""===t&&r?r:(n.getLogger("esri.widgets.FeatureForm/featureFormUtils").error("extractExpressionNameFromString:invalid-input",`The string ${e} is not a valid expression reference of the form '${R}/expressionName'`),"")}function M(e){return`${R}${e}`}function P(e){return`${k}${e}`}function W(e){return e.startsWith(R)}function Y(e){return e.startsWith(S)}function H(e){const{layer:t,values:r}=e,n=e.fields??t.fields??[],o=e.timeZone??void 0,i=n.map((e,n)=>{let i=r[n];if("coded-value"===e.domain?.type){const t=e.domain.codedValues.find(e=>e.code===i);t?.name&&(i=t.name)}return(g(e)||m(e))&&(i=b(e,i,{timeZone:o,...q(t,e)})),[e.name,i]});return Object.fromEntries(i)}function q(e,t){if(c(e)){const r=e.getFieldConfiguration(t.name)?.fieldFormat??u(t);if("date-time"===r?.type)return s(r)}return j(t)}function z(e,t){return i(i(e,e=>`{${e.toLowerCase()}}`),Object.fromEntries(Object.entries(t).map(([e,t])=>[e.toLowerCase(),t])))}const J=e=>{const t={typeFieldName:null,types:[]};return e?(d(e)?(t.typeFieldName=e.parent?.subtypeField,t.types=e.parent?.subtypes??[]):"subtype-group"===e.type||"feature"===e.type&&e.subtypes?.length?(t.typeFieldName=e.subtypeField,t.types=e.subtypes??[]):"types"in e&&e.types&&(t.typeFieldName=e.typeIdField,t.types=e.types.map(({id:e,name:t,domains:r})=>({code:e,name:t,domains:r}))),null!=t.typeFieldName&&(t.typeFieldName=e.getField(t.typeFieldName)?.name??t.typeFieldName),t):t},K=(t,r,n)=>{const{dataType:o,error:i,minLength:l}=t,s=r?.validationErrors;if(!s||!i)return null;if(i===F.CANNOT_BE_EMPTY)return s.cannotBeNull;if(i===a.VALUE_OUT_OF_RANGE||i===p.OUT_OF_RANGE){const{field:r,range:i}=t,l={type:"date",intlOptions:{timeZone:"date"===r.type&&n?n:void 0,...j(r)}},a=T(i,s);return e(a,i,{format:{max:"date"===o?l:null!=i.max&&x(i.max)?N:O,min:"date"===o?l:null!=i.min&&x(i.min)?N:O}})}return i===a.INVALID_CODED_VALUE?s.invalidCodedValue:i===f.INVALID_TYPE?s.invalidType:i===F.TOO_SHORT?e(s.tooShort,{min:l}):(F.TOO_LONG,null)},Q=e=>{if(!e)return;const t=e.layer,r=t&&"geometryType"in t?t.geometryType:void 0,n=e.geometry?.type;return"polyline"===n||"polyline"===r?"line":"mesh"===n||"mesh"===r||"multipatch"===r?"cube":"multipoint"===n||"multipoint"===r?"point":n||r||"table"},X=e=>{const t=[];if(e.formTemplate){const{description:r,title:n}=e.formTemplate;e.fields?.forEach(e=>{const i=n&&o(n,e.name),l=r&&o(r,e.name);(i||l)&&t.push(e.name)})}return t};function ee(e,t){const r=t??("formTemplate"in e&&e.formTemplate);if(r){return(r.elements?.filter(l)??[]).some(({fieldName:t})=>!e.fieldsIndex.get(t))}return!1}function te(e,t){return null==e||t.onValue!==e&&t.offValue!==e}function re(e,t){switch(t.objectType){case"any":return!0;case"null":return null==e;case"code":return e===t.codedValue?.code;case"range":return null!=e&&null!=t.minValue&&null!=t.maxValue&&+e>=t.minValue&&+e<=t.maxValue;default:return t.objectType,!1}}function ne(e,t,n){const o=y(e),i=o?.find(e=>e.code===n);if(!i)return!1;const l=o?.find(e=>e.code===t);return!r(i.defaultValues,l?.defaultValues)&&Object.values(i.defaultValues).some(e=>null!=e)}export{B as extractExpressionNameFromString,C as flattenAssociationInputs,I as flattenFieldInputs,A as flattenInputs,$ as flattenRelationshipInputs,ee as formTemplateHasInvalidFields,H as getComputedAttributes,q as getDateTimeFormatOptions,K as getErrorMessageForFieldInput,X as getFieldsInTitleAndDesc,Q as getIconForFeature,J as getNormalizedFeatureTypeInfo,W as isExpressionReference,Z as isFieldElementWithInputType,w as isFieldElementWithShowNoValueOptionInput,V as isFieldInput,h as isGroupInput,_ as isInputInGroupInput,L as isInputInThisGroupInput,Y as isLegacyFieldMapsExpressionReference,D as isNumberFieldInput,v as isRelationshipInput,E as isTextElementInput,U as isUtilityNetworkAssociationInput,G as parseFormTemplateString,M as prependExpressionPrefix,P as prependFieldPrefix,z as substituteFieldTemplatesInString,ne as subtypeChangeShouldPrompt,te as valueIsInvalidSwitchValue,re as valueIsValidContingentValue};
|