@arcgis/core 5.2.0-next.113 → 5.2.0-next.115
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/Graphic.d.ts +5 -3
- package/Ground.d.ts +5 -4
- package/applications/Urban/LineImagePattern3D.js +1 -1
- package/arcgisGlobal.d.ts +2 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/02f94f9d704f03ddb5c6.js +1 -0
- package/assets/esri/core/workers/chunks/{c517e732cab41093b2e0.js → 0312c40d94b248ad71e3.js} +1 -1
- package/assets/esri/core/workers/chunks/0463c807b37f01bbc35c.js +1 -0
- package/assets/esri/core/workers/chunks/0ff13f7a18b0123d253e.js +1 -0
- package/assets/esri/core/workers/chunks/2e0fd0536408053ac6f5.js +1 -0
- package/assets/esri/core/workers/chunks/{6b264006b96cbf93d8ed.js → 48d3da636be15581fd7d.js} +1 -1
- package/assets/esri/core/workers/chunks/515fe302743c0b46f7e0.js +1 -0
- package/assets/esri/core/workers/chunks/{982a396bd4fffa62e911.js → 526cc64ae46dec3fbeda.js} +1 -1
- package/assets/esri/core/workers/chunks/{d13cf2e8b24e978ea77c.js → 7243d5721bb6a7329055.js} +1 -1
- package/assets/esri/core/workers/chunks/{785206da3962ba23de16.js → 84b89c523d3e16a5ee46.js} +1 -1
- package/assets/esri/core/workers/chunks/{484b3e2a220c440ccbb4.js → 9b92c41907e2da80c288.js} +1 -1
- package/assets/esri/core/workers/chunks/{4d2553219ffd223b0e90.js → a774006be107e449bc29.js} +1 -1
- package/assets/esri/core/workers/chunks/b45ebb1b64ee7314375e.js +1 -0
- package/assets/esri/core/workers/chunks/{e0f417992889a6c41095.js → baa8bce361a2677533ec.js} +1 -1
- package/assets/esri/core/workers/chunks/{96ebf76661b12128ddd5.js → be4de7111bc21bc69de1.js} +1 -1
- package/assets/esri/core/workers/chunks/f18ee2eaa96d103627a6.js +1 -0
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ar.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.bg.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.bs.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ca.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.cs.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.da.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.de.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.el.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.es.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.et.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.fi.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.fr.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.he.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.hr.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.hu.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.id.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.it.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ja.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ko.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.lt.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.lv.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.nl.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.no.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.pl.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.pt-BR.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ro.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ru.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.sk.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.sl.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.sr.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.sv.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.th.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.tr.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.uk.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.vi.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.zh-CN.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.zh-HK.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.zh-TW.json +1 -1
- package/assets/esri/views/3d/analysis/VolumeMeasurement/t9n/messages.ja.json +1 -1
- package/assets/esri/views/3d/environment/resources/milkyway-band.ktx2 +0 -0
- package/assets/esri/widgets/DistanceMeasurement2D/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/DistanceMeasurement2D/t9n/messages.ro.json +1 -1
- package/assets/esri/widgets/Expand/t9n/messages.id.json +1 -1
- package/assets/esri/widgets/Features/t9n/messages.he.json +1 -1
- package/assets/esri/widgets/Features/t9n/messages.uk.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.bs.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.et.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.fi.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.hr.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.hu.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.id.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.lv.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.nl.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.th.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.tr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/Print/t9n/messages.es.json +1 -1
- package/assets/esri/widgets/Print/t9n/messages.it.json +1 -1
- package/assets/esri/widgets/Print/t9n/messages.lt.json +1 -1
- package/assets/esri/widgets/Print/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/widgets/Print/t9n/messages.sl.json +1 -1
- package/assets/esri/widgets/Print/t9n/messages.sr.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.bs.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.es.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.et.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.fi.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.he.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.hr.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.it.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.lv.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.ar.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.ca.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.cs.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.el.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.es.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.fi.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.he.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.it.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.lt.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.lv.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.pl.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.ro.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.ru.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.sl.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.uk.json +1 -1
- package/assets/esri/widgets/support/GridControls/t9n/messages.pt-BR.json +1 -1
- package/chunks/DeepSky.glsl.js +1 -1
- package/chunks/RibbonLine.glsl.js +63 -58
- package/config.js +1 -1
- package/core/Evented.d.ts +1 -1
- package/core/screenUtils.js +1 -1
- package/core/units.js +1 -1
- package/form/elements/AttachmentElement.d.ts +5 -5
- package/form/elements/inputs/attachments/AttachmentInput.d.ts +1 -1
- package/graphic/getGraphicOriginTitle.d.ts +10 -0
- package/graphic/getGraphicOriginTitle.js +2 -0
- package/kernel.js +1 -1
- package/layers/FeatureLayer.d.ts +2 -2
- package/layers/MapNotesLayer.js +1 -1
- package/layers/raster/functions/rasterProjectionHelper.js +1 -1
- package/layers/support/FeatureReductionBinning.d.ts +2 -2
- package/layers/support/FeatureReductionCluster.d.ts +2 -2
- package/layers/support/Field.js +1 -1
- package/layers/support/SubtypeSublayer.d.ts +1 -1
- package/layers/support/TimeSeriesInfo.d.ts +1 -1
- package/layers/support/featurePopupQueryUtils.js +1 -1
- package/layers/support/timeSeriesUtils.js +1 -1
- package/layers/support/types.d.ts +1 -1
- package/layers/types.d.ts +1 -2
- package/package.json +3 -3
- package/popup/FeatureContent.d.ts +7 -7
- package/portal/schemas/definitions.js +1 -1
- package/portal/types.d.ts +1 -1
- package/renderers/DotDensityRenderer.d.ts +2 -2
- package/rest/knowledgeGraph/ReplicaDefinition.d.ts +1 -1
- package/rest/knowledgeGraphService.d.ts +2 -2
- package/rest/support/OutDistance.d.ts +19 -18
- package/rest/support/Query.d.ts +49 -21
- package/rest/support/RelationshipQuery.d.ts +1 -1
- package/smartMapping/renderers/support/utils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/LineSymbol3D.js +1 -1
- package/symbols/cim/types.d.ts +32 -0
- package/symbols/patterns/LinePattern3D.js +1 -1
- package/symbols/patterns/LineStylePattern3D.js +1 -1
- package/symbols/patterns/LineTemplatePattern3D.js +1 -1
- package/symbols/patterns/utils.js +1 -1
- package/views/2d/engine/webgl/util/DimensionMatcher.js +1 -1
- package/views/2d/layers/graphics/GraphicStore.js +1 -1
- package/views/2d/layers/support/annodime/DimensionInfo.js +1 -1
- package/views/2d/support/clippingUtils.js +1 -1
- package/views/2d/support/hitTestUtils.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.d.ts +1 -1
- package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/support/buffer/InterleavedLayout.js +1 -1
- package/views/3d/webgl-engine/effects/glow/BlurEmission.js +1 -1
- package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
- package/views/3d/webgl-engine/lib/AttributeView.js +2 -0
- package/views/3d/webgl-engine/lib/attributeViewUtils.js +2 -0
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterialBaseInstance.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
- package/views/BreakpointsOwner.d.ts +2 -2
- package/views/PopupView.d.ts +64 -2
- package/views/SceneView.js +1 -1
- package/views/SelectionManager.d.ts +24 -24
- package/views/View.js +1 -1
- package/views/View2D.js +1 -1
- package/views/interactive/support/types.d.ts +0 -1
- package/views/layers/FeatureLikeLayerView.js +1 -1
- package/views/layers/support/MapServiceLayerViewHelper.js +1 -1
- package/views/support/DefaultsFromMap.js +1 -1
- package/widgets/Attachments/support/attachmentUtils.d.ts +8 -0
- package/widgets/BasemapLayerList/BasemapLayerListViewModel.d.ts +1 -0
- package/widgets/BasemapLayerList/BasemapLayerListViewModel.js +1 -1
- package/widgets/BasemapLayerList/BasemapLayerListVisibleElements.d.ts +5 -1
- package/widgets/BasemapLayerList/types.d.ts +15 -2
- package/widgets/BasemapLayerList.d.ts +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.d.ts +14 -0
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/BatchFormInputs.js +1 -1
- package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +29 -2
- package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/MultipleChoiceController.d.ts +1 -5
- package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
- package/widgets/BatchAttributeForm/inputs/types.d.ts +8 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/CatalogLayerList/CatalogLayerListViewModel.d.ts +2 -1
- package/widgets/CatalogLayerList/CatalogLayerListViewModel.js +1 -1
- package/widgets/CatalogLayerList/CatalogLayerListVisibleElements.d.ts +5 -1
- package/widgets/CatalogLayerList/types.d.ts +12 -1
- package/widgets/CatalogLayerList.d.ts +2 -1
- package/widgets/CatalogLayerList.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.d.ts +2 -2
- package/widgets/Editor.d.ts +2 -2
- package/widgets/FeatureTable/FeatureTableViewModel.d.ts +6 -6
- package/widgets/FeatureTable/support/FeatureStore.d.ts +2 -2
- package/widgets/FeatureTable.d.ts +5 -5
- package/widgets/LayerList/LayerListVisibleElements.d.ts +4 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/TableList/ListItem.d.ts +2 -0
- package/widgets/TableList/ListItemPanel.d.ts +4 -0
- package/widgets/TableList/TableListViewModel.d.ts +4 -0
- package/widgets/TableList/TableListViewModel.js +1 -1
- package/widgets/TableList/TableListVisibleElements.d.ts +6 -1
- package/widgets/TableList/types.d.ts +12 -1
- package/widgets/TableList.d.ts +3 -0
- package/widgets/TableList.js +1 -1
- package/widgets/support/SelectionList/SelectionListViewModel.d.ts +1 -1
- package/assets/esri/core/workers/chunks/078ed48eb055dd213ee6.js +0 -1
- package/assets/esri/core/workers/chunks/1004e77593dfa506cd5d.js +0 -1
- package/assets/esri/core/workers/chunks/510a190a6f0a60ae38c3.js +0 -1
- package/assets/esri/core/workers/chunks/cd0f5cd0fefe7f49e3d8.js +0 -1
- package/assets/esri/core/workers/chunks/e6fb7b93cf73b05b1079.js +0 -1
- package/assets/esri/core/workers/chunks/f86ea5cf4814b458d50b.js +0 -1
- package/assets/esri/core/workers/chunks/f9b29d2ce1cd31c0fce1.js +0 -1
- package/graphic/graphicOrigins.js +0 -2
|
@@ -4,11 +4,7 @@ import type Choice from "../../../../form/elements/inputs/multipleChoice/Choice.
|
|
|
4
4
|
import type FieldInput from "../FieldInput.js";
|
|
5
5
|
import type { FieldValue } from "../../../../layers/support/fieldUtils.js";
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* Represents the current render state for inline multiple-choice "Other" controls.
|
|
9
|
-
*
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
7
|
+
/** Represents the current render state for inline multiple-choice "Other" controls. */
|
|
12
8
|
export interface MultipleChoiceOtherChoiceRenderState {}
|
|
13
9
|
|
|
14
10
|
/** @internal */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{isNumericField as t,isStringField as n,isTimeOnlyField as
|
|
2
|
+
import{isNumericField as t,isStringField as n,isTimeOnlyField as r}from"../../../../layers/support/fieldUtils.js";import{isAnyDateField as e}from"../../../../smartMapping/support/utils.js";import{ContingentValuesValidationError as u}from"../../../support/forms/formUtils.js";const o="esri_BatchAttributeForm_different_values";function i(t){return"visible"===t}function s(t){return"batch-attribute-form-validation::out-of-subtype-domain"===t}function c(t){return"field"===t.type}function p(t){return c(t)&&"multiple-choice"===t.input?.type}function f(t){return"group"===t.type}function l(t){return"relationship"===t.type}function a(t){return"text"===t.type}function m(t){return"attachment"===t.type}function d(t){return c(t)||m(t)||l(t)||N(t)}function y(t){return c(t)||m(t)||l(t)||N(t)||a(t)}function x(t){return y(t)&&null!=t.group}function N(t){return"utilityNetworkAssociations"===t.type}function I(t){const n=`${t.elementId}:${t.executorPurpose}`;return null!=t.textExpressionIndex?`${n}:${t.textExpressionIndex}`:n}const b=t=>null!=t&&(h(t,"combo-box")||h(t,"dynamic-choice")||h(t,"radio-buttons"));function h(t,n){return t?.type===n}function O(t,n,r=[]){for(const e of t)n(e)?r.push(e):f(e)&&O(e.inputs,n,r);return r}function _(t,n){return t.layers[0]?.getField(n)?.name??n}function A(u){return t(u)?"number":n(u)?"text":e(u)||r(u)?"date":"unsupported"}function E(t){return t===u.CONTINGENCY_VIOLATION_ERROR||t===u.CONTINGENCY_VIOLATION_WARNING}export{O as deepFilterInputs,o as differentValuesString,A as getFieldInputDataType,_ as getNormalizedFieldName,m as isAttachmentElementInput,E as isContingentValuesError,d as isEditableInput,c as isFieldInput,b as isFieldInputWithShowNoValueOptionInput,f as isGroupInput,y as isGroupableInput,x as isGroupedInput,h as isInputWithInputType,p as isMultipleChoiceFieldInput,l as isRelationshipElementInput,a as isTextElementInput,N as isUtilityNetworkAssociationsElementInput,s as isWarning,I as makeUseId,i as visibilityCodeToBoolean};
|
|
@@ -29,4 +29,11 @@ export type FormInput = GroupInput | FieldInput | RelationshipElementInput | Att
|
|
|
29
29
|
*
|
|
30
30
|
* @internal
|
|
31
31
|
*/
|
|
32
|
-
export interface AttachmentEditState {}
|
|
32
|
+
export interface AttachmentEditState {}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Various categories that attachments belong to based on the content type.
|
|
36
|
+
*
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export type AttachmentTypeCategory = "audio" | "document" | "image" | "unknown" | "video";
|
|
@@ -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 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};
|
|
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 w,getMessageString as F,isElementTemplateWithInputType as I,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._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=w(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=F(e,e.validationMessage,this.messages);return a?ue("calcite-input-message",{icon:!0,status:e.status},a):t?ue("calcite-input-message",{class:D.description,icon:!1,status:e.status},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,disabled:t.readOnly||t.disabled,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}){e.touch();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),e.touch(),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,onblur:t.onblur,onfocus:t.onfocus,[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:!!I(e.template,"switch")&&e.value===e.template.input.onValue,class:D.inputSwitch,disabled:t.readOnly||t.disabled,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,onCalciteDropdownSelect:({currentTarget:e})=>this._saveInputFromElement(e)},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&&e.showNoValueOptionEnabled&&!e.touched?()=>{}:a.onblur,n={...a,onblur:i};return ue("calcite-combobox",{...n,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,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:t.onblur,onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:t.onfocus})}_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:t.onblur,onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:t.onfocus})}_renderTimestampOffsetFieldComponents(e,t){const{class:a,disabled:i,key:n,readOnly:s,onblur:o,onfocus:l}=t,{rawMax:r,rawMin:c}=e.range,d=e.effectiveTimeZone,m=ae(r,d),u=ae(c,d),h=ae(e.value===j?"":e.value,d),p=e.includeTimeOffset,g={afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,disabled:i,[ge]:t[ge],[ve]:t[ve],onblur:o,onfocus:l,overlayPositioning:"fixed",readOnly:s};return ue("div",{class:D.dateInputContainer,key:`${n}-date-time-container`},ue("calcite-input-date-picker",{...g,class:a,"data-date-part":"date",key:`${n}-date-input`,max:m?.date??void 0,min:u?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:h.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),ue("calcite-input-time-picker",{...g,class:a,"data-date-part":"time",key:`${n}-time-input`,step:e.timeStep,value:h.time??"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),p?ue("calcite-input-time-zone",{...g,class:a,clearable:e.value===j||null==e.value,"data-date-part":"timeZone",key:`${n}-timezone-input`,value:h.timeZoneOffset||"",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],onblur:t.onblur,onfocus:t.onfocus,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??"",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??"",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||e.touched}_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,t){t?.touch(),this.viewModel.setSelectedAttachment(e),e||this.hideAttachmentDialog()}_setAttachmentAddElementId(e){const{viewModel:t}=this;t.setSelectedAttachmentAddElementId(e),t.selectedAttachmentAddInput?.touch(),t.selectedAttachmentAddInput?.clearValidationCriteriaState(),this.hideAttachmentDialog()}_setAttachmentListElementId(e){const{viewModel:t}=this;t.setSelectedAttachmentListElementId(e),t.selectedAttachmentListInput?.touch(),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,status: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,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._focusedFieldInput=a}_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(e){const t=e.target,a=this._getFieldInputFromHTMLElement(t);this._isMultipleChoiceCheckbox(t,a)||a.touch(),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(e))}_resetTransientFormState(){this._attemptFocusOnNextRender=!1,this._focusedFieldInput=null,this._attachmentDialogInfo=null,this._selectedAttachmentReplaceFileInput=null,this._attachmentListFilterText="",this._attachmentFileInputMap.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(I(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(I(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.touch(),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&&(e.touch(),null!==l&&t.value?this.viewModel.setValue(a,l):this.viewModel.setValue(a,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};
|
|
@@ -12,8 +12,9 @@ export interface CatalogLayerListViewModelProperties extends Partial<Pick<Catalo
|
|
|
12
12
|
export interface CatalogLayerListViewModelEvents extends LayerListViewModelEvents {}
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* Provides the logic for the [CatalogLayerList](https://developers.arcgis.com/javascript/latest/references/core/widgets/CatalogLayerList/) widget and [component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-catalog-layer-list/).
|
|
15
|
+
* Provides the logic for the [CatalogLayerList](https://developers.arcgis.com/javascript/latest/references/core/widgets/CatalogLayerList/) widget and [Catalog Layer List component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-catalog-layer-list/).
|
|
16
16
|
*
|
|
17
|
+
* @deprecated since version 5.2. Use the [Catalog Layer List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-catalog-layer-list-next/) component instead.
|
|
17
18
|
* @since 4.30
|
|
18
19
|
* @see [CatalogLayerList](https://developers.arcgis.com/javascript/latest/references/core/widgets/CatalogLayerList/) widget
|
|
19
20
|
* @see [Catalog Layer List component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-catalog-layer-list/)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import e from"../../core/Collection.js";import{
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../core/Collection.js";import{deprecateUnnecessaryViewModel as s}from"../../core/deprecate.js";import{EventedAccessor as i}from"../../core/Evented.js";import o from"../../core/Logger.js";import{watch as r,initial as a,on as l}from"../../core/reactiveUtils.js";import{property as c,subclass as d}from"../../core/accessorSupport/decorators.js";import n from"../LayerList/ListItem.js";import{findLayerListMode as m}from"../LayerList/support/layerListUtils.js";const h={layerListMode:"layer-list-mode"},p="hide",y=e.ofType(n);let u=class extends i{constructor(t){super(t),this.catalogItems=new y,this.checkPublishStatusEnabled=!1,this.catalogLayer=null,this.listItemCreatedFunction=null,this.listModeDisabled=!1,this.view=null,t?.suppressDeprecationWarning||s(o.getLogger(this),"Catalog Layer List (Next)","arcgis-catalog-layer-list-next",{version:"5.2"})}normalizeCtorArgs(t){const{suppressDeprecationWarning:e,...s}=t??{};return s}initialize(){this.addHandles([r(()=>[this.catalogLayer?.loaded,this.view?.ready],()=>this._compileList(),a),l(()=>this.catalogLayer?.dynamicGroupLayer.layers,"change",()=>this._compileList()),r(()=>[this.listItemCreatedFunction,this.checkPublishStatusEnabled,this.listModeDisabled],()=>this._recompileList())])}destroy(){this.view=null,this._removeAllItems()}get state(){const{view:t,catalogLayer:e}=this;return t?.ready&&e?.loaded?"ready":t&&e?"loading":"disabled"}get totalItems(){return this.catalogItems.flatten(t=>t.children).length}triggerAction(t,e){t&&!t.disabled&&this.emit("trigger-action",{action:t,item:e})}_createListItem(t){const{view:e,listItemCreatedFunction:s,checkPublishStatusEnabled:i,listModeDisabled:o}=this;return new n({checkPublishStatusEnabled:i,listModeDisabled:o,layer:t,listItemCreatedFunction:s,view:e})}_removeAllItems(){this.catalogItems.destroyAll()}_getViewableLayers(t){return t?this.listModeDisabled?t:t.filter(t=>m(t)!==p):void 0}_watchLayersListMode(t){this.removeHandles(h.layerListMode),t&&!this.listModeDisabled&&this.addHandles(r(()=>t.filter(t=>"listMode"in t).map(t=>t.listMode).toArray(),()=>this._compileList()),h.layerListMode)}_compileList(){const{catalogLayer:t}=this;if(!t?.loaded)return;const e=t?.dynamicGroupLayer.layers;this._watchLayersListMode(e);const s=this._getViewableLayers(e);s?.length?(this._createNewItems(s),this._removeItems(s),this._sortItems(s)):this._removeAllItems()}_createNewItems(t){const{catalogItems:e}=this;t.forEach(t=>{e.some(e=>e.layer===t)||e.add(this._createListItem(t))})}_removeItems(t){const{catalogItems:e}=this,s=[];e.forEach(e=>{e&&t?.includes(e.layer)||s.push(e)}),e.destroyMany(s)}_sortItems(t){const{catalogItems:e}=this;e.sort((e,s)=>{const i=t.indexOf(e.layer),o=t.indexOf(s.layer);return i>o?-1:i<o?1:0})}_recompileList(){this._removeAllItems(),this._compileList()}};t([c({type:y})],u.prototype,"catalogItems",void 0),t([c()],u.prototype,"checkPublishStatusEnabled",void 0),t([c()],u.prototype,"catalogLayer",void 0),t([c()],u.prototype,"listItemCreatedFunction",void 0),t([c({nonNullable:!0})],u.prototype,"listModeDisabled",void 0),t([c({readOnly:!0})],u.prototype,"state",null),t([c()],u.prototype,"totalItems",null),t([c()],u.prototype,"view",void 0),u=t([d("esri.widgets.CatalogLayerList.CatalogLayerListViewModel")],u);export{u as default};
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type Accessor from "../../core/Accessor.js";
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated since version 5.2. Use the [Catalog Layer List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-catalog-layer-list-next/) component instead.
|
|
5
|
+
* @since 5.0
|
|
6
|
+
*/
|
|
4
7
|
export interface CatalogLayerListVisibleElementsProperties extends Partial<Pick<CatalogLayerListVisibleElements, "closeButton" | "collapseButton" | "errors" | "filter" | "flow" | "heading" | "statusIndicators" | "temporaryLayerIndicators">> {}
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
* The visible elements that are displayed within the catalog layer list.
|
|
8
11
|
* This provides the ability to turn on/off individual elements of the catalog layer list.
|
|
9
12
|
*
|
|
13
|
+
* @deprecated since version 5.2. Use the [Catalog Layer List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-catalog-layer-list-next/) component instead.
|
|
10
14
|
* @since 5.0
|
|
11
15
|
*/
|
|
12
16
|
export default class CatalogLayerListVisibleElements extends Accessor {
|
|
@@ -1,6 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the CatalogLayerList widget.
|
|
3
|
+
*
|
|
4
|
+
* @deprecated since version 5.2. Use the [Catalog Layer List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-catalog-layer-list-next/) component instead.
|
|
5
|
+
*/
|
|
6
|
+
import type CatalogLayerListViewModel from "./CatalogLayerListViewModel.js";
|
|
7
|
+
|
|
1
8
|
/**
|
|
2
9
|
* * Describes the current state of the list items in the [CatalogLayerListViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/CatalogLayerList/CatalogLayerListViewModel/).
|
|
3
10
|
*
|
|
11
|
+
* @deprecated since version 5.2. Use the [Catalog Layer List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-catalog-layer-list-next/) component instead.
|
|
4
12
|
* @since 5.0
|
|
5
13
|
*/
|
|
6
|
-
export type CatalogLayerListState = "ready" | "loading" | "disabled";
|
|
14
|
+
export type CatalogLayerListState = "ready" | "loading" | "disabled";
|
|
15
|
+
|
|
16
|
+
/** @deprecated since version 5.2. Use the [Catalog Layer List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-catalog-layer-list-next/) component instead. */
|
|
17
|
+
export type CatalogLayerListViewModelParams = Partial<Pick<CatalogLayerListViewModel, "catalogItems" | "listItemCreatedFunction" | "view">>;
|
|
@@ -15,6 +15,7 @@ import type { ListItemProperties } from "./LayerList/ListItem.js";
|
|
|
15
15
|
import type { ReadonlyArrayOrCollection } from "../core/Collection.js";
|
|
16
16
|
import type { CatalogLayerListVisibleElementsProperties } from "./CatalogLayerList/CatalogLayerListVisibleElements.js";
|
|
17
17
|
|
|
18
|
+
/** @deprecated since version 5.2. Use the [Catalog Layer List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-catalog-layer-list-next/) component instead. For information on widget deprecation, read about [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/). */
|
|
18
19
|
export interface CatalogLayerListProperties extends WidgetProperties, IdentifiableMixinProperties, Partial<Pick<CatalogLayerList, "catalogItems" | "catalogLayer" | "collapsed" | "filterPlaceholder" | "filterPredicate" | "filterText" | "headingLevel" | "listItemCreatedFunction" | "minFilterItems" | "selectionMode" | "view" | "visibilityAppearance">> {
|
|
19
20
|
/**
|
|
20
21
|
* Icon which represents the widget. It is typically used when the widget is controlled by another
|
|
@@ -76,7 +77,7 @@ export interface CatalogLayerListEvents extends CatalogLayerListViewModelEvents
|
|
|
76
77
|
*
|
|
77
78
|
* 
|
|
78
79
|
*
|
|
79
|
-
* @deprecated since version 5.0. Use the [Catalog Layer List](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-catalog-layer-list/) component instead. For information on widget deprecation, read about [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/).
|
|
80
|
+
* @deprecated since version 5.0. Use the [Catalog Layer List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-catalog-layer-list-next/) component instead. For information on widget deprecation, read about [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/).
|
|
80
81
|
* @since 4.30
|
|
81
82
|
* @see [CatalogLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/CatalogLayer/)
|
|
82
83
|
* @see [CatalogLayerListViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/CatalogLayerList/CatalogLayerListViewModel/)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../core/Collection.js";import{deprecateWidget as o}from"../core/deprecate.js";import{IdentifiableMixin as i}from"../core/Identifiable.js";import s from"../core/Logger.js";import l from"../core/ReactiveMap.js";import{on as a,initial as r,watch as n}from"../core/reactiveUtils.js";import{property as p,subclass as d}from"../core/accessorSupport/decorators.js";import c from"./Widget.js";import m from"./CatalogLayerList/CatalogLayerListViewModel.js";import h from"./CatalogLayerList/CatalogLayerListVisibleElements.js";import{css as y}from"./CatalogLayerList/css.js";import u from"./LayerList/LayerListItem.js";import g from"./LayerList/ListItem.js";import{minFilterItems as L,getItem as f,removeDestroyedListItems as _,setFilterPredicate as v}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as I}from"./support/componentsUtils.js";import{globalCss as w}from"./support/globalCss.js";import{calciteListFilterProps as b}from"./support/listUtils.js";import{tsx as C,messageBundle as F,vmEvent as M}from"./support/widget.js";import{setFocus as O}from"./support/widgetUtils.js";var T;const P=t.ofType(g),A="nested";let E=T=class extends(i(c)){constructor(e,i){super(e,i),this._rootListEl=null,this._activeItem=null,this._tooltipReferenceMap=new l,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusLayerFlowItem=null,this._layerListMap=new l,this._rootGroupUid=`operational-${this.uid}`,this._openedLayersController=null,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.filterPlaceholder="",this.filterPredicate=null,this.filterText="",this.headingLevel=2,this.knowledgeGraphOptions=null,this.layerTablesEnabled=new t(["knowledge-graph"]),this.mapImageOptions=null,this.messages=null,this.messagesCommon=null,this.minFilterItems=L,this.openedLayers=new t,this.openedLayerLists=new t,this.selectedItems=new P,this.selectionMode="none",this.tableList=null,this.tileOptions=null,this.viewModel=new m,this.visibilityAppearance="default",this.visibleElements=new h,this._onTablesOpen=e=>{this.onTablesOpen?this.onTablesOpen(e):(this.openedLayers.push(e.layer),this._focusLayerFlowItem=e.layer?.uid)},this._onCatalogOpen=e=>{this.onCatalogOpen?this.onCatalogOpen(e):(this.openedLayers.push(e.layer?.parent),this._focusLayerFlowItem=e.layer?.uid)},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find(e=>e.classList?.contains(y.item));this._activeItem=f(t)},this.announceDeprecation=()=>{o(s.getLogger(this),"Catalog Layer List","arcgis-catalog-layer-list",{version:"5.0"})}}initialize(){this.addHandles([a(()=>this.openedLayers,"change",()=>this._handleOpenedLayersChange(),r),a(()=>this.viewModel.catalogItems,"change",()=>_(this.selectedItems),r),n(()=>[this.filterPredicate,this._rootListEl],()=>v(this._rootListEl,this.filterPredicate))])}loadDependencies(){return I({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}destroy(){this._destroyOpenedLayerLists(),this._tooltipReferenceMap.clear()}get _filterEnabled(){return this.viewModel.totalItems>=this.minFilterItems&&this.visibleElements.filter}get _visibleItems(){return this.catalogItems?.filter(e=>!e.hidden&&(this.visibleElements.errors||!e.error))}get _openedPanelItems(){return this._visibleItems.flatten(e=>e.children).filter(({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled)}get _renderedOpenLayerFlowItems(){const{openedLayers:e}=this;return e.toArray().map((t,o)=>this._renderLayerFlowItem(t,o===e.length-1))}get catalogItems(){return this.viewModel.catalogItems}set catalogItems(e){this.viewModel.catalogItems=e}get catalogLayer(){return this.viewModel.catalogLayer}set catalogLayer(e){this.viewModel.catalogLayer=e}get icon(){return"catalog-dataset"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const e=this.viewModel?.state,t={[w.hidden]:"loading"===e,[w.disabled]:"disabled"===e};return C("div",{class:this.classes(y.base,w.widget,w.panel,t)},this._renderItemTooltips(),this._renderItems())}async _createFlowList(e,t){const{_layerListMap:o}=this,i=o.get(e);if(i)return i;const s="catalog"===e.type?this._createCatalogLayerList(e):await this._createTableList(e);return t.aborted||o.set(e,s),s}async _handleOpenedLayersChange(){const{_layerListMap:e,openedLayers:t,openedLayerLists:o}=this;this._openedLayersController?.abort();const i=new AbortController,{signal:s}=i;this._openedLayersController=i,e.forEach((o,i)=>{t.includes(i)||(o.destroy(),e.delete(i))});const l=await Promise.all(t.map(e=>this._createFlowList(e,s)));if(s.aborted)return;o.removeAll(),o.addMany(l);const a=o.at(-1);a?"catalogLayer"in a?(this._set("catalogLayerList",a),this._set("tableList",null)):(this._set("catalogLayerList",null),this._set("tableList",a)):(this._set("catalogLayerList",null),this._set("tableList",null))}_destroyOpenedLayerLists(){this.openedLayerLists.destroyAll(),this.openedLayers.removeAll(),this._layerListMap.forEach(e=>e.destroy()),this._layerListMap.clear()}_renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:o}=this;return e?.layer?C("calcite-tooltip",{key:`tooltip-${e.layer.uid}`,overlayPositioning:"fixed",referenceElement:t.get(e.layer.uid),topLayerDisabled:this.topLayerDisabled},o.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter(e=>!e.hidden).toArray().map(e=>this._renderItemTooltipNodes(e))}_renderItemTooltips(){return this._visibleItems?.toArray().map(e=>this._renderItemTooltipNodes(e))}_renderNoItemsMessage(){return C("div",{slot:"message"},this.messages.noItemsToDisplay)}_renderNoItems(){return C("div",{class:y.itemMessage,key:"esri-layer-list__no-items"},C("calcite-notice",{icon:"information",kind:"info",open:!0,width:"full"},this._renderNoItemsMessage()))}_renderPanelFlowItems(){const{_openedPanelItems:e,openedLayers:t}=this;return e.toArray().map(({title:o,panel:i},s)=>{const l=()=>this._handlePanelFlowItemBack(i);return C("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:o,heading:i.title,headingLevel:this.headingLevel,key:`flow-panel-${i.uid}`,selected:!t.length&&s===e.length-1,onCalciteFlowItemBack:e=>{e.preventDefault(),l()}},i.render(),C("calcite-button",{appearance:"transparent",slot:"footer-start",width:"full",onclick:l},this.messagesCommon.back))})}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,O(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,O(e))}_renderItems(){const{visible:e,collapsed:t,_visibleItems:o,_filterEnabled:i,_rootGroupUid:s,visibleElements:{closeButton:l,collapseButton:a,heading:r,flow:n},selectionMode:p,filterText:d,filterPlaceholder:c,messages:m,openedLayers:h,_openedPanelItems:u}=this,g=[C("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:l,closed:!e,collapsed:t,collapsible:a,heading:r?m.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",selected:!h.length&&!u.length,onCalciteFlowItemClose:()=>this.visible=!1},o?.length?null:this._renderNoItems(),C("calcite-list",{afterCreate:e=>{this._rootListEl=e,e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{this._rootListEl=null,e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},"data-layer-type":s,displayMode:A,filterEnabled:i,filterPlaceholder:c,filterProps:b,filterText:i?d:"",group:s,key:"root-list",label:m.widgetLabel,selectionAppearance:"border",selectionMode:p,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListFilter:e=>this.filterText=e.currentTarget?.filterText??"",onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem},o.toArray().map(e=>this._renderItem(e)),i?C("div",{class:y.filterNoResults,slot:"filter-no-results"},C("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoItemsMessage())):null)),this._renderPanelFlowItems(),this._renderedOpenLayerFlowItems];return e?n?C("calcite-flow",{key:"root-flow"},g):g:null}_focusLayerFlowItemNode(e){this._focusLayerFlowItem===e.dataset.layerUid&&(this._focusLayerFlowItem=null,O(e))}_renderLayerFlowItem(e,t){const{messages:o,openedLayers:i}=this,s=e.title||this.messages.untitledLayer;return C("calcite-flow-item",{afterCreate:this._focusLayerFlowItemNode,afterUpdate:this._focusLayerFlowItemNode,bind:this,"data-layer-uid":e.uid,description:s,heading:o["catalog"===e.type?"catalogLayers":"tables"],headingLevel:this.headingLevel,key:`flow-layer-list-${e.uid}`,selected:t,onCalciteFlowItemBack:e=>{e.preventDefault(),i.pop();const t=i.at(-1);t?this._focusLayerFlowItem=t.uid:this._focusRootFlowItem=!0}},this._layerListMap.get(e)?.render())}_createCatalogLayerList(e){const{headingLevel:t,catalogOptions:o,view:i,filterPlaceholder:s,listItemCreatedFunction:l,minFilterItems:a,selectionMode:r,visibilityAppearance:n,onCatalogOpen:p,onTablesOpen:d}=this;return new T({headingLevel:t,view:i,filterPlaceholder:s,listItemCreatedFunction:l,minFilterItems:a,selectionMode:r,visibilityAppearance:n,...o,catalogLayer:e,onCatalogOpen:p,onTablesOpen:d})}_getTableListParams(e){switch(e.type){case"knowledge-graph":return{...this.knowledgeGraphOptions,tables:e.tables};case"map-image":return{...this.mapImageOptions,tables:e.subtables};case"tile":return{...this.tileOptions,tables:e.subtables};default:return null}}async _createTableList(e){const{default:t}=await(import("./TableList.js")),{headingLevel:o,selectionMode:i}=this;return new t({headingLevel:o,selectionMode:i,...this._getTableListParams(e)})}_renderItem(e,t,o){return C(u,{activeItem:this._activeItem,css:y,displayMode:A,dragEnabled:!1,item:e,key:`layerListItem-${e.layer?.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:t,parentTitles:o,rootGroupUid:this._rootGroupUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:o}=this;if("none"===t)return;const i=e.target.selectedItems.map(e=>f(e)).filter(Boolean);o.removeAll(),o.addMany(i)}};e([p()],E.prototype,"_rootListEl",void 0),e([p()],E.prototype,"_activeItem",void 0),e([p()],E.prototype,"_tooltipReferenceMap",void 0),e([p()],E.prototype,"_focusRootFlowItem",void 0),e([p()],E.prototype,"_focusPanelFlowItem",void 0),e([p()],E.prototype,"_focusLayerFlowItem",void 0),e([p()],E.prototype,"_layerListMap",void 0),e([p()],E.prototype,"_filterEnabled",null),e([p()],E.prototype,"_visibleItems",null),e([p()],E.prototype,"_openedPanelItems",null),e([p()],E.prototype,"_renderedOpenLayerFlowItems",null),e([p()],E.prototype,"catalogItems",null),e([p()],E.prototype,"catalogLayer",null),e([p({readOnly:!0})],E.prototype,"catalogLayerList",void 0),e([p()],E.prototype,"catalogOptions",void 0),e([p()],E.prototype,"collapsed",void 0),e([p()],E.prototype,"filterPlaceholder",void 0),e([p()],E.prototype,"filterPredicate",void 0),e([p()],E.prototype,"filterText",void 0),e([p()],E.prototype,"headingLevel",void 0),e([p()],E.prototype,"icon",null),e([p()],E.prototype,"knowledgeGraphOptions",void 0),e([p()],E.prototype,"label",null),e([p()],E.prototype,"layerTablesEnabled",void 0),e([p()],E.prototype,"listItemCreatedFunction",null),e([p()],E.prototype,"mapImageOptions",void 0),e([p(),F("esri/widgets/CatalogLayerList/t9n/CatalogLayerList")],E.prototype,"messages",void 0),e([p(),F("esri/t9n/common")],E.prototype,"messagesCommon",void 0),e([p()],E.prototype,"minFilterItems",void 0),e([p({readOnly:!0})],E.prototype,"openedLayers",void 0),e([p({readOnly:!0})],E.prototype,"openedLayerLists",void 0),e([p()],E.prototype,"onCatalogOpen",void 0),e([p()],E.prototype,"onTablesOpen",void 0),e([p({type:P})],E.prototype,"selectedItems",void 0),e([p()],E.prototype,"selectionMode",void 0),e([p({readOnly:!0})],E.prototype,"tableList",void 0),e([p()],E.prototype,"tileOptions",void 0),e([p()],E.prototype,"view",null),e([M("trigger-action"),p({type:m})],E.prototype,"viewModel",void 0),e([p()],E.prototype,"visibilityAppearance",void 0),e([p({type:h,nonNullable:!0})],E.prototype,"visibleElements",void 0),E=T=e([d("esri.widgets.CatalogLayerList")],E);const k=E;export{k as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../core/Collection.js";import{deprecateWidget as o}from"../core/deprecate.js";import{IdentifiableMixin as i}from"../core/Identifiable.js";import s from"../core/Logger.js";import l from"../core/ReactiveMap.js";import{on as a,initial as r,watch as n}from"../core/reactiveUtils.js";import{property as p,subclass as d}from"../core/accessorSupport/decorators.js";import c from"./Widget.js";import m from"./CatalogLayerList/CatalogLayerListViewModel.js";import h from"./CatalogLayerList/CatalogLayerListVisibleElements.js";import{css as y}from"./CatalogLayerList/css.js";import u from"./LayerList/LayerListItem.js";import g from"./LayerList/ListItem.js";import{minFilterItems as L,getItem as f,removeDestroyedListItems as _,setFilterPredicate as v}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as I}from"./support/componentsUtils.js";import{globalCss as w}from"./support/globalCss.js";import{calciteListFilterProps as b}from"./support/listUtils.js";import{tsx as C,messageBundle as F,vmEvent as M}from"./support/widget.js";import{setFocus as O}from"./support/widgetUtils.js";var T;const P=t.ofType(g),A="nested";let E=T=class extends(i(c)){constructor(e,i){super(e,i),this._rootListEl=null,this._activeItem=null,this._tooltipReferenceMap=new l,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusLayerFlowItem=null,this._layerListMap=new l,this._rootGroupUid=`operational-${this.uid}`,this._openedLayersController=null,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.filterPlaceholder="",this.filterPredicate=null,this.filterText="",this.headingLevel=2,this.knowledgeGraphOptions=null,this.layerTablesEnabled=new t(["knowledge-graph"]),this.mapImageOptions=null,this.messages=null,this.messagesCommon=null,this.minFilterItems=L,this.openedLayers=new t,this.openedLayerLists=new t,this.selectedItems=new P,this.selectionMode="none",this.tableList=null,this.tileOptions=null,this.viewModel=new m({suppressDeprecationWarning:!0}),this.visibilityAppearance="default",this.visibleElements=new h,this._onTablesOpen=e=>{this.onTablesOpen?this.onTablesOpen(e):(this.openedLayers.push(e.layer),this._focusLayerFlowItem=e.layer?.uid)},this._onCatalogOpen=e=>{this.onCatalogOpen?this.onCatalogOpen(e):(this.openedLayers.push(e.layer?.parent),this._focusLayerFlowItem=e.layer?.uid)},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find(e=>e.classList?.contains(y.item));this._activeItem=f(t)},!0!==e?.suppressDeprecationWarning&&(this.announceDeprecation=()=>{o(s.getLogger(this),"Catalog Layer List","arcgis-catalog-layer-list-next",{version:"5.0"})})}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:t,...o}=e;return o}initialize(){this.addHandles([a(()=>this.openedLayers,"change",()=>this._handleOpenedLayersChange(),r),a(()=>this.viewModel.catalogItems,"change",()=>_(this.selectedItems),r),n(()=>[this.filterPredicate,this._rootListEl],()=>v(this._rootListEl,this.filterPredicate))])}loadDependencies(){return I({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}destroy(){this._destroyOpenedLayerLists(),this._tooltipReferenceMap.clear()}get _filterEnabled(){return this.viewModel.totalItems>=this.minFilterItems&&this.visibleElements.filter}get _visibleItems(){return this.catalogItems?.filter(e=>!e.hidden&&(this.visibleElements.errors||!e.error))}get _openedPanelItems(){return this._visibleItems.flatten(e=>e.children).filter(({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled)}get _renderedOpenLayerFlowItems(){const{openedLayers:e}=this;return e.toArray().map((t,o)=>this._renderLayerFlowItem(t,o===e.length-1))}get catalogItems(){return this.viewModel.catalogItems}set catalogItems(e){this.viewModel.catalogItems=e}get catalogLayer(){return this.viewModel.catalogLayer}set catalogLayer(e){this.viewModel.catalogLayer=e}get icon(){return"catalog-dataset"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const e=this.viewModel?.state,t={[w.hidden]:"loading"===e,[w.disabled]:"disabled"===e};return C("div",{class:this.classes(y.base,w.widget,w.panel,t)},this._renderItemTooltips(),this._renderItems())}async _createFlowList(e,t){const{_layerListMap:o}=this,i=o.get(e);if(i)return i;const s="catalog"===e.type?this._createCatalogLayerList(e):await this._createTableList(e);return t.aborted||o.set(e,s),s}async _handleOpenedLayersChange(){const{_layerListMap:e,openedLayers:t,openedLayerLists:o}=this;this._openedLayersController?.abort();const i=new AbortController,{signal:s}=i;this._openedLayersController=i,e.forEach((o,i)=>{t.includes(i)||(o.destroy(),e.delete(i))});const l=await Promise.all(t.map(e=>this._createFlowList(e,s)));if(s.aborted)return;o.removeAll(),o.addMany(l);const a=o.at(-1);a?"catalogLayer"in a?(this._set("catalogLayerList",a),this._set("tableList",null)):(this._set("catalogLayerList",null),this._set("tableList",a)):(this._set("catalogLayerList",null),this._set("tableList",null))}_destroyOpenedLayerLists(){this.openedLayerLists.destroyAll(),this.openedLayers.removeAll(),this._layerListMap.forEach(e=>e.destroy()),this._layerListMap.clear()}_renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:o}=this;return e?.layer?C("calcite-tooltip",{key:`tooltip-${e.layer.uid}`,overlayPositioning:"fixed",referenceElement:t.get(e.layer.uid),topLayerDisabled:this.topLayerDisabled},o.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter(e=>!e.hidden).toArray().map(e=>this._renderItemTooltipNodes(e))}_renderItemTooltips(){return this._visibleItems?.toArray().map(e=>this._renderItemTooltipNodes(e))}_renderNoItemsMessage(){return C("div",{slot:"message"},this.messages.noItemsToDisplay)}_renderNoItems(){return C("div",{class:y.itemMessage,key:"esri-layer-list__no-items"},C("calcite-notice",{icon:"information",kind:"info",open:!0,width:"full"},this._renderNoItemsMessage()))}_renderPanelFlowItems(){const{_openedPanelItems:e,openedLayers:t}=this;return e.toArray().map(({title:o,panel:i},s)=>{const l=()=>this._handlePanelFlowItemBack(i);return C("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:o,heading:i.title,headingLevel:this.headingLevel,key:`flow-panel-${i.uid}`,selected:!t.length&&s===e.length-1,onCalciteFlowItemBack:e=>{e.preventDefault(),l()}},i.render(),C("calcite-button",{appearance:"transparent",slot:"footer-start",width:"full",onclick:l},this.messagesCommon.back))})}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,O(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,O(e))}_renderItems(){const{visible:e,collapsed:t,_visibleItems:o,_filterEnabled:i,_rootGroupUid:s,visibleElements:{closeButton:l,collapseButton:a,heading:r,flow:n},selectionMode:p,filterText:d,filterPlaceholder:c,messages:m,openedLayers:h,_openedPanelItems:u}=this,g=[C("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:l,closed:!e,collapsed:t,collapsible:a,heading:r?m.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",selected:!h.length&&!u.length,onCalciteFlowItemClose:()=>this.visible=!1},o?.length?null:this._renderNoItems(),C("calcite-list",{afterCreate:e=>{this._rootListEl=e,e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{this._rootListEl=null,e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},"data-layer-type":s,displayMode:A,filterEnabled:i,filterPlaceholder:c,filterProps:b,filterText:i?d:"",group:s,key:"root-list",label:m.widgetLabel,selectionAppearance:"border",selectionMode:p,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListFilter:e=>this.filterText=e.currentTarget?.filterText??"",onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem},o.toArray().map(e=>this._renderItem(e)),i?C("div",{class:y.filterNoResults,slot:"filter-no-results"},C("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoItemsMessage())):null)),this._renderPanelFlowItems(),this._renderedOpenLayerFlowItems];return e?n?C("calcite-flow",{key:"root-flow"},g):g:null}_focusLayerFlowItemNode(e){this._focusLayerFlowItem===e.dataset.layerUid&&(this._focusLayerFlowItem=null,O(e))}_renderLayerFlowItem(e,t){const{messages:o,openedLayers:i}=this,s=e.title||this.messages.untitledLayer;return C("calcite-flow-item",{afterCreate:this._focusLayerFlowItemNode,afterUpdate:this._focusLayerFlowItemNode,bind:this,"data-layer-uid":e.uid,description:s,heading:o["catalog"===e.type?"catalogLayers":"tables"],headingLevel:this.headingLevel,key:`flow-layer-list-${e.uid}`,selected:t,onCalciteFlowItemBack:e=>{e.preventDefault(),i.pop();const t=i.at(-1);t?this._focusLayerFlowItem=t.uid:this._focusRootFlowItem=!0}},this._layerListMap.get(e)?.render())}_createCatalogLayerList(e){const{headingLevel:t,catalogOptions:o,view:i,filterPlaceholder:s,listItemCreatedFunction:l,minFilterItems:a,selectionMode:r,visibilityAppearance:n,onCatalogOpen:p,onTablesOpen:d}=this;return new T({headingLevel:t,view:i,filterPlaceholder:s,listItemCreatedFunction:l,minFilterItems:a,selectionMode:r,visibilityAppearance:n,...o,catalogLayer:e,onCatalogOpen:p,onTablesOpen:d,suppressDeprecationWarning:!0})}_getTableListParams(e){switch(e.type){case"knowledge-graph":return{...this.knowledgeGraphOptions,tables:e.tables};case"map-image":return{...this.mapImageOptions,tables:e.subtables};case"tile":return{...this.tileOptions,tables:e.subtables};default:return null}}async _createTableList(e){const{default:t}=await(import("./TableList.js")),{headingLevel:o,selectionMode:i}=this;return new t({headingLevel:o,selectionMode:i,...this._getTableListParams(e)})}_renderItem(e,t,o){return C(u,{activeItem:this._activeItem,css:y,displayMode:A,dragEnabled:!1,item:e,key:`layerListItem-${e.layer?.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:t,parentTitles:o,rootGroupUid:this._rootGroupUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:o}=this;if("none"===t)return;const i=e.target.selectedItems.map(e=>f(e)).filter(Boolean);o.removeAll(),o.addMany(i)}};e([p()],E.prototype,"_rootListEl",void 0),e([p()],E.prototype,"_activeItem",void 0),e([p()],E.prototype,"_tooltipReferenceMap",void 0),e([p()],E.prototype,"_focusRootFlowItem",void 0),e([p()],E.prototype,"_focusPanelFlowItem",void 0),e([p()],E.prototype,"_focusLayerFlowItem",void 0),e([p()],E.prototype,"_layerListMap",void 0),e([p()],E.prototype,"_filterEnabled",null),e([p()],E.prototype,"_visibleItems",null),e([p()],E.prototype,"_openedPanelItems",null),e([p()],E.prototype,"_renderedOpenLayerFlowItems",null),e([p()],E.prototype,"catalogItems",null),e([p()],E.prototype,"catalogLayer",null),e([p({readOnly:!0})],E.prototype,"catalogLayerList",void 0),e([p()],E.prototype,"catalogOptions",void 0),e([p()],E.prototype,"collapsed",void 0),e([p()],E.prototype,"filterPlaceholder",void 0),e([p()],E.prototype,"filterPredicate",void 0),e([p()],E.prototype,"filterText",void 0),e([p()],E.prototype,"headingLevel",void 0),e([p()],E.prototype,"icon",null),e([p()],E.prototype,"knowledgeGraphOptions",void 0),e([p()],E.prototype,"label",null),e([p()],E.prototype,"layerTablesEnabled",void 0),e([p()],E.prototype,"listItemCreatedFunction",null),e([p()],E.prototype,"mapImageOptions",void 0),e([p(),F("esri/widgets/CatalogLayerList/t9n/CatalogLayerList")],E.prototype,"messages",void 0),e([p(),F("esri/t9n/common")],E.prototype,"messagesCommon",void 0),e([p()],E.prototype,"minFilterItems",void 0),e([p({readOnly:!0})],E.prototype,"openedLayers",void 0),e([p({readOnly:!0})],E.prototype,"openedLayerLists",void 0),e([p()],E.prototype,"onCatalogOpen",void 0),e([p()],E.prototype,"onTablesOpen",void 0),e([p({type:P})],E.prototype,"selectedItems",void 0),e([p()],E.prototype,"selectionMode",void 0),e([p({readOnly:!0})],E.prototype,"tableList",void 0),e([p()],E.prototype,"tileOptions",void 0),e([p()],E.prototype,"view",null),e([M("trigger-action"),p({type:m})],E.prototype,"viewModel",void 0),e([p()],E.prototype,"visibilityAppearance",void 0),e([p({type:h,nonNullable:!0})],E.prototype,"visibleElements",void 0),E=T=e([d("esri.widgets.CatalogLayerList")],E);const k=E;export{k as default};
|