@arcgis/core 5.2.0-next.113 → 5.2.0-next.114
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Ground.d.ts +5 -4
- package/arcgisGlobal.d.ts +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/e164acd876bbd42ed658.js +1 -0
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ar.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.bg.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.bs.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ca.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.cs.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.da.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.de.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.el.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.es.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.et.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.fi.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.fr.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.he.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.hr.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.hu.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.id.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.it.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ja.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ko.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.lt.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.lv.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.nl.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.no.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.pl.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.pt-BR.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ro.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ru.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.sk.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.sl.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.sr.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.sv.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.th.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.tr.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.uk.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.vi.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.zh-CN.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.zh-HK.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.zh-TW.json +1 -1
- package/assets/esri/views/3d/analysis/VolumeMeasurement/t9n/messages.ja.json +1 -1
- package/assets/esri/views/3d/environment/resources/milkyway-band.ktx2 +0 -0
- package/assets/esri/widgets/DistanceMeasurement2D/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/DistanceMeasurement2D/t9n/messages.ro.json +1 -1
- package/assets/esri/widgets/Expand/t9n/messages.id.json +1 -1
- package/assets/esri/widgets/Features/t9n/messages.he.json +1 -1
- package/assets/esri/widgets/Features/t9n/messages.uk.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.bs.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.et.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.fi.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.hr.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.hu.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.id.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.lv.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.nl.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.th.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.tr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/Print/t9n/messages.es.json +1 -1
- package/assets/esri/widgets/Print/t9n/messages.it.json +1 -1
- package/assets/esri/widgets/Print/t9n/messages.lt.json +1 -1
- package/assets/esri/widgets/Print/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/widgets/Print/t9n/messages.sl.json +1 -1
- package/assets/esri/widgets/Print/t9n/messages.sr.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.bs.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.es.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.et.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.fi.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.he.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.hr.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.it.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.lv.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.ar.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.ca.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.cs.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.el.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.es.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.fi.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.he.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.it.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.lt.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.lv.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.pl.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.ro.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.ru.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.sl.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.uk.json +1 -1
- package/assets/esri/widgets/support/GridControls/t9n/messages.pt-BR.json +1 -1
- package/chunks/DeepSky.glsl.js +1 -1
- package/config.js +1 -1
- package/core/Evented.d.ts +1 -1
- package/form/elements/AttachmentElement.d.ts +5 -5
- package/form/elements/inputs/attachments/AttachmentInput.d.ts +1 -1
- package/kernel.js +1 -1
- package/layers/FeatureLayer.d.ts +2 -2
- package/layers/support/FeatureReductionBinning.d.ts +2 -2
- package/layers/support/FeatureReductionCluster.d.ts +2 -2
- package/layers/support/SubtypeSublayer.d.ts +1 -1
- package/package.json +3 -3
- package/popup/FeatureContent.d.ts +7 -7
- package/portal/schemas/definitions.js +1 -1
- package/portal/types.d.ts +1 -1
- package/renderers/DotDensityRenderer.d.ts +2 -2
- package/rest/knowledgeGraph/ReplicaDefinition.d.ts +1 -1
- package/rest/knowledgeGraphService.d.ts +2 -2
- package/rest/support/Query.d.ts +1 -3
- package/rest/support/RelationshipQuery.d.ts +1 -1
- package/support/revision.js +1 -1
- package/symbols/LineSymbol3D.js +1 -1
- package/symbols/cim/types.d.ts +32 -0
- package/views/3d/analysis/ShadowCastAnalysisView3D.d.ts +1 -1
- package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/webgl-engine/effects/glow/BlurEmission.js +1 -1
- package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
- package/views/BreakpointsOwner.d.ts +2 -2
- package/views/SceneView.js +1 -1
- package/views/SelectionManager.d.ts +24 -24
- package/views/View.js +1 -1
- package/views/View2D.js +1 -1
- package/views/interactive/support/types.d.ts +0 -1
- package/views/support/DefaultsFromMap.js +1 -1
- package/widgets/Attachments/support/attachmentUtils.d.ts +8 -0
- package/widgets/BasemapLayerList/BasemapLayerListViewModel.d.ts +1 -0
- package/widgets/BasemapLayerList/BasemapLayerListViewModel.js +1 -1
- package/widgets/BasemapLayerList/BasemapLayerListVisibleElements.d.ts +5 -1
- package/widgets/BasemapLayerList/types.d.ts +15 -2
- package/widgets/BasemapLayerList.d.ts +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.d.ts +14 -0
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/BatchFormInputs.js +1 -1
- package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +29 -2
- package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/MultipleChoiceController.d.ts +1 -5
- package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
- package/widgets/BatchAttributeForm/inputs/types.d.ts +8 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.d.ts +2 -2
- package/widgets/Editor.d.ts +2 -2
- package/widgets/FeatureTable/FeatureTableViewModel.d.ts +6 -6
- package/widgets/FeatureTable/support/FeatureStore.d.ts +2 -2
- package/widgets/FeatureTable.d.ts +5 -5
- package/widgets/LayerList/LayerListVisibleElements.d.ts +4 -1
- package/widgets/support/SelectionList/SelectionListViewModel.d.ts +1 -1
- package/assets/esri/core/workers/chunks/f9b29d2ce1cd31c0fce1.js +0 -1
- package/graphic/graphicOrigins.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{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};
|
|
@@ -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"../../Graphic.js";import a from"../../core/Collection.js";import i from"../../core/Error.js";import{makeHandle as r,handlesGroup as s,abortHandle as n}from"../../core/handleUtils.js";import"../../core/has.js";import o from"../../core/Logger.js";import{removeMaybe as l,destroyMaybe as d}from"../../core/maybe.js";import{isPromiseLike as c,debounce as u}from"../../core/promiseUtils.js";import{whenOnce as p,watch as h,initial as m,sync as f,syncAndInitial as g}from"../../core/reactiveUtils.js";import{generateBracedUUID as w}from"../../core/uuid.js";import{property as y,subclass as v}from"../../core/accessorSupport/decorators.js";import{isSharedTemplateOrMetadata as F,isSharedTemplate as _,getCreationAttributes as M,isStandardFeatureTemplate as b}from"../../editing/templateUtils.js";import{getFullTemplate as I}from"../../editing/sharedTemplates/templateLoader.js";import V from"../../layers/GraphicsLayer.js";import{isSceneLayer as k,isTable as S}from"../../layers/support/layerUtils.js";import{isNumber as T}from"../../support/guards.js";import{getDisplayedSymbol as P}from"../../symbols/support/symbolUtils.js";import{updateGraphicSymbolWhenRequired as E}from"../../views/draw/support/editingSessionUtils.js";import{getDrawHelpMessage as U}from"../../views/draw/support/helpMessageUtils.js";import A from"../../views/draw/support/HighlightHelper.js";import H from"../../views/interactive/sketch/SketchOptions.js";import C from"../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{temporaryHighlightName as L}from"../../views/support/HighlightDefaults.js";import O from"../BatchAttributeForm/BatchAttributeFormViewModel.js";import j from"./CreateFeaturesWorkflowData.js";import{isModelUpload as x,handleModelUpload as D}from"./modelUploadUtils.js";import z from"./Workflow.js";import{activeSketchToolDrawsUnsupportedCurve as R,createToolFromGeometryType as G,containsUnsupportedCurve as W,findEditorItemForLayer as N,getServiceEditsFromWorkflowData as B,getServiceInfoForLayer as K,orderEditsByRelationshipDependencies as q,getServiceLayersById as Z,startCreatingNewFeature as J,syncUpdateOptions as Q,findLayerInfo as X,handleFormValuesChangeEvent as Y,isTerminalUpdateEventType as $,getVisualVariableAttributes as ee,startUpdatingFeatureGeometry as te,createWorkflowSteps as ae,avoidFeatureTemplateSelectionWithOnlyOneItem as ie,setUpSketchCreateWatchers as re,setRelationshipFields as se,showProgressCursor as ne,setVisualVariablesAndElevationInfoForUpdate as oe,visualVariableInteractiveUpdate as le}from"./workflowUtils.js";import{makeServiceEditsWithAttachments as de,makeEditsWithAttachments as ce,parseEditResultsAndCollectAddAttachmentData as ue}from"./support/attachmentUtils.js";import pe from"../Sketch/SketchViewModel.js";var he;const me=Symbol(),fe=Symbol(),ge=Symbol(),we=Symbol(),ye={point:["point"],multipoint:["multipoint"],polygon:["polygon","freehandPolygon","rectangle","circle"],polyline:["polyline","freehandPolyline"],mesh:[],multipatch:[]};let ve=he=class extends z{constructor(e){super(e),this.type="create-features",this.createFeatureState="create-new",this.data=void 0,this.isNested=!1,this._getDrawMeshHelpMessage=void 0,this._featureFormHandle=null,this._visualVariableAttributes={rotation:null,size:null},this._formViewModel=new O({attachmentsEnabled:!0}),this._sketchLayer=null,this._sketchViewModel=null,this._isActive=!0}initialize(){this.isNested&&(this._isActive=!1),this._initializeSketchViewModel()}destroy(){this._sketchViewModel.destroy()}get allowSave(){return!this.updating}get curveResizeDisabled(){return this.data.curveResizeDisabled}get curveUpdatesDisabled(){return this.data.curveUpdatesDisabled}get formViewModel(){return this._formViewModel}get hasInvalidFormTemplate(){return!!this.data.editorItem?.hasInvalidFormTemplate}get hasPendingEdits(){if(this.pendingFeatures.some(e=>!!this.data.getEditsForPendingFeature(e)?.modified))return!0;const{creationInfo:e,upload:t}=this.data,{activeComponent:a,createGraphic:i}=this._sketchViewModel,r=i?.geometry?.type;return!("polyline"!==r&&"polygon"!==r&&"multipoint"!==r||"draw-2d"!==a?.type&&"draw-3d"!==a?.type)&&a.drawOperation.committedVertices.length>0||(!(!t||"pending"!==t.state&&"success"!==t.state)||!!e?.geometryToPlace)}get hasPreviousStep(){return this.formViewModel.canGoBack||this._stepIndex>0||"update-pending"===this.createFeatureState&&!!this.data.selectedPendingFeature&&!this.parent&&!x(this.data.creationInfo)}get helpMessage(){const{creationInfo:e,viewModel:t}=this.data;if("creating-features"!==this.stepId||!e)return;const{_sketchViewModel:a}=this,{drawTool:i,isUsingLegacyCreateTools:r}=a;if(!r)return i?.helpMessageKey??"noTool";const s=e.layer.geometryType,n=a.createGraphic;if("mesh"===s){this._getDrawMeshHelpMessage||import("../../views/draw/support/helpMessageUtils3d.js").then(e=>{this._getDrawMeshHelpMessage=e.getDrawMeshHelpMessage});const{view:e}=t;return"3d"===e?.type?this._getDrawMeshHelpMessage?.(n,e):void 0}const{activeCreateToolDrawMode:o,activeTool:l}=a;return U("rectangle"===l||"circle"===l?l:s,n?.geometry,o)}get noticeMessage(){if(R(this._sketchViewModel,this.data.editorItem))return"curveToolDensifyWarning"}get layer(){return this.data.creationInfo?.layer}get numPendingFeatures(){return this.pendingFeatures.length}get numPendingFeaturesExcludingHidden(){return this.pendingFeatures.filter(e=>this.data.isDisplayable(e)).length}get parent(){return this.data.parent}get pendingFeatures(){return this.data.pendingFeatures}get keyboardCancellationEnabled(){return 0===this.numPendingFeatures}get reliesOnOwnerAdminPrivileges(){return this.data.editorItem?.capabilities.create.reliesOnOwnerAdminPrivileges??!1}get saveActionLabel(){return"create"}get shouldShowAttachments(){return(this.data.selectedPendingFeature&&this.data.editorItem?.capabilities.create.attachments.enabled)??!1}get shouldAllowAttachmentEditing(){return this.shouldShowAttachments}get sketchUpdateOptions(){const{editorItem:e}=this.data;return{enableScaling:!this.curveResizeDisabled,multipleSelectionEnabled:!1,reshapeOptions:{enableCreateCurveFromStraightEdge:!k(e?.layer)&&!!e?.capabilities.supportsTrueCurve}}}get sketchViewModel(){return this._sketchViewModel}get test(){}get availableCreateTools(){const e=this.data.creationInfo?.layer.geometryType,t=this.data.viewModel.view;if(!e)return[];if(this.data.creationInfo?.maxFeatures&&this.data.creationInfo.maxFeatures<=this.numPendingFeatures)return[];if(F(this.data.fullTemplate)){const{tool:t}=G(e,this.data.fullTemplate);return[t]}return"2d"!==t?.type&&"multipoint"===e?[]:[...ye[e]]}getUpdating(){return!!this._sketchViewModel?.updating}async enter(){this._isActive=!0,"awaiting-feature-creation-info"!==this.stepId&&await this._updatingHandles.addPromise(this._setUpCreatingFeaturesStep())}exit(){this._isActive=!1,this.removeHandles([ge])}async updatePendingFeature(e){if(e!==this.data.selectedPendingFeature)return this._sketchViewModel.cancel(),this._startUpdating({feature:e})}async start(){return await super.start(),S(this.data.creationInfo?.layer)?null:{enter:async()=>{},exit:async()=>{},viewModel:this._sketchViewModel}}async save(e){const{formViewModel:t}=this;if(t.pendingSubtypeChoice)return;await t.submit(),this._stashValidationState();const a=this.data.selectedPendingFeature,i=this._hasValidationErrors(a)?a:this.data.pendingFeatures.find(e=>this._hasValidationErrors(e));if(i)return await this._startUpdating({feature:i}),void await(t?.submit());const{pendingFeatures:r,editorItem:s}=this.data;if(s&&e&&W(r.toArray(),s)){if(!await e("curveEditingDensifyPrompt"))return this.reset()}return super.save()}back(e){return this._formViewModel.canGoBack?this._formViewModel.goBack():"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||x(this.data.creationInfo)||this.parent?super.back(e):this._clearSelectedFeature()}previous(e){return this._formViewModel.canGoBack?this._formViewModel.goBack():"update-pending"===this.createFeatureState&&this.data.selectedPendingFeature&&!x(this.data.creationInfo)?this._clearSelectedFeature():super.previous(e)}cancelFeature(e){this.data.isSharedTemplateWorkflow?o.getLogger(this).warn("Cannot cancel individual features created by shared templates."):(this.data.removePendingFeature(e),this.sketchViewModel.removeGraphic(e))}static create(e){const{applyEdits:t,applyEditsFeatureService:a,addAttachmentsCallback:i,isNested:r,creationInfo:s,parent:n,snappingManager:o,startAt:l,viewModel:d}=e,c=e.sketchOptions??new H,u=s?.layer,p=u?N(d.editorItems,u):void 0,h=new he({data:new j({creationInfo:s,editorItem:p,parent:n,sketchOptions:c,snappingManager:o,viewModel:d}),isNested:r,onCommit:async e=>{const{creationInfo:r}=e;if(!r)return;h._sketchViewModel.cancel();const s=e.pendingFeatures.toArray(),{layer:n}=r,o=n.capabilities?.editing.supportsGlobalId&&"globalIdField"in n,{fullTemplate:l}=e,c=B(h.data),u=_(l)&&c;if(o){if(Me(s),u){let t=de(c,e);const i=await(K(n,d.view)?.load());i&&(t=q({edits:t,serviceInfo:i,view:d.view,findOriginalFeature:t=>e.getEditsForPendingFeature(t)?.initialFeature??t})),await a(l.featureService,t,{globalIdUsed:!0,honorSequenceOfEdits:!0,gdbVersion:l.layer.gdbVersion??void 0})}else await t(n,ce(s,e),{globalIdUsed:!0});return}const p=u?await a(l.featureService,c,{gdbVersion:l.layer.gdbVersion??void 0}):[await t(n,{addFeatures:s})];p?.length&&e.attachmentsModified&&!o&&await Promise.all(p.map(t=>{if(!t?.addFeatureResults)return;const a=ue(s,t.addFeatureResults,n,e);return i(n,a)}))}});return h._set("steps",this._createWorkflowSteps(h,l)),h}_fadeExistingFeatures(e){if("effect"in e){const t=e.effect;return e.effect="saturate(0.6) opacity(0.8)",r(()=>e.effect=t)}const t=e.opacity;return e.opacity=.7,r(()=>e.opacity=t)}async _initializeFullTemplateAndExecutorInfo(e){const{creationInfo:t}=e,{view:a}=e.viewModel;if(!t||!a)return null;const i=await I(a,t.template);if(e.fullTemplate=i,i&&_(i)){const{createTemplateExecutor:r}=await(import("../../editing/sharedTemplates/executor/createTemplateExecutor.js")),s={completionResults:[],executor:await r(i),serviceLayersById:Z(t.layer,a)};e.templateExecutorInfo=s}return i}async _startCreating(){this.removeHandles(fe);const{data:e}=this;if(!e.creationInfo)return;const t=this.data.creationInfo?.maxFeatures;if(t&&this.numPendingFeatures>=t)return this.sketchViewModel.cancel(),void(this.numPendingFeatures&&await this._startUpdating({feature:this.pendingFeatures.at(-1)}));this.createFeatureState="create-new",await J(this._sketchViewModel,this._sketchLayer,e)}async _clearSelectedFeature(){const e=this._formViewModel.pendingSubtypeChoice;e&&(e.resolve("undo"),await e.promise),this._stashValidationState(),this.sketchViewModel.cancel(),this.data.selectedPendingFeature=null,this._featureFormHandle=l(this._featureFormHandle),this._formViewModel.features=new a,this._formViewModel.activeFeatureIndex=-1}_stashValidationState(){const e=this._formViewModel.activeFeature,t=e&&this.data.getEditsForPendingFeature(e);t&&(t.submittable=this._formViewModel.valid)}async _selectFeatureForUpdate({feature:e,initialFeature:t=e}){this._stashValidationState();const{data:i,pendingFeatures:r}=this;r.includes(e)||i.addPendingFeature(e,t),i.selectedPendingFeature=e;const{_formViewModel:n,_sketchViewModel:o,sketchUpdateOptions:d}=this,{creationInfo:c,viewModel:u}=i,{layerInfos:m,view:f}=u;if(!f||!c)return;Q(o,d),l(this._featureFormHandle);const g=e.sourceLayer,w=X(m,g),y=f.spatialReference;n.set({editType:"INSERT",features:new a([e]),activeFeatureIndex:0,layerInfos:w?[w]:null,spatialReference:y,view:f}),await p(()=>!1===n.updating),await E(e,"2d"===f.type?f.scale:null);const v=i.getEditsForPendingFeature(e);v?.attachmentsModified&&n.applyStashedAttachmentEdits(v.attachmentEdits),this._featureFormHandle=s([n.on("values-change",Y({filter:e=>e===v?.feature,forEachValueChange:(e,t)=>{if(T(t)){const a=this._visualVariableAttributes;a.size&&!a.size.isUpdatingInteractively&&e===a.size.field&&a.size.setInitialValue(t),a.rotation&&!a.rotation.isUpdatingInteractively&&e===a.rotation.field&&a.rotation.setInitialValue(t)}},forEachFeature:e=>{v?.updateAttributes(n.getValues(e)),E(e,"2d"===f.type?f.scale:null)}})),n.on("attachments-change",e=>v?.setAttachmentEdits(e.attachmentEdits)),o.on(["update","undo","redo"],t=>{("undo"===t.type||"redo"===t.type||"update"===t.type&&null!=t.toolEventInfo&&$(t.toolEventInfo.type))&&n.notifyGeometriesChanged([e])}),h(()=>n.activeFeature?.sourceLayer,t=>e.sourceLayer=t),h(()=>[n.activeFeature,n.valid],()=>this._stashValidationState())]),this.createFeatureState="update-pending"}async _startUpdating({feature:e,initialFeature:t=e}){await this._selectFeatureForUpdate({feature:e,initialFeature:t});const{_sketchLayer:a,_sketchViewModel:i,data:r}=this,{creationInfo:s,viewModel:n}=r,{view:o}=n;if(!o||!s)return;const l=e.sourceLayer??s.layer;return S(l)?void 0:(this._visualVariableAttributes=ee(e),te({graphic:e,sketchLayer:a,sketchViewModel:i,sourceLayer:l,updateOptions:this.sketchUpdateOptions,visualVariables:this._visualVariableAttributes}))}static _createWorkflowSteps(e,t="awaiting-feature-creation-info"){const{data:a}=e,i=ae(["awaiting-feature-creation-info","creating-features","adding-attachment","editing-attachment"],t,{"awaiting-feature-creation-info":()=>({id:"awaiting-feature-creation-info",async setUp(){const{creationInfo:t,viewModel:i}=a,{view:r}=i;r&&(x(t)?e.addHandles(await D({view:r,data:a,next:()=>e.next(),cancel:()=>i.cancelWorkflow({warnIfNoWorkflow:!1})}),this.id):(a.parent&&t&&e.addHandles(i.restrictFeatureTemplatesViewModelToLayer(t.layer),this.id),e.addHandles(i.featureTemplatesViewModel.on("select",({item:t})=>{t&&(a.creationInfo={...a.creationInfo,layer:t.layer,template:t.template},e.next())}),this.id)))},async tearDown(){e.removeHandles(this.id)}}),"creating-features":()=>({id:"creating-features",async setUp(){e._isActive&&await e._setUpCreatingFeaturesStep()},async tearDown(t){t.canceled&&e.removeHandles([ge,me,fe,we])}}),"adding-attachment":()=>({id:"adding-attachment",parent:"creating-features",async setUp(){},async tearDown(){}}),"editing-attachment":()=>({id:"editing-attachment",parent:"creating-features",async setUp(){},async tearDown(){}})});return ie(a,i)}static _configureSketchViewModel(e){const{data:t,_sketchLayer:a,_sketchViewModel:i}=e,{creationInfo:n,viewModel:o}=t,{view:l}=o,d=[];if(!l)return r();if("2d"===l.type){n&&d.push(e._fadeExistingFeatures(n.layer));const t=u((e,t)=>Promise.all(e.map(e=>E(e,t))));d.push(h(()=>l.scale,e=>t(a.graphics,e)))}const c=M(t.fullTemplate,n?.attributeOverrides,n?.layer),p=h(()=>i.createGraphic&&i.activeComponent,()=>{i.createGraphic&&i.activeComponent&&!e.hasHandles(fe)&&e._updatingHandles.consumePromise(re({creationAttributes:c,data:t,sketchViewModel:i,view:l}).then(t=>e.addHandles(t,fe)))}),m=async t=>{if("cancel"!==t.state&&"complete"!==t.state||e.removeHandles(fe),"cancel"===t.state&&null!==l.activeTool&&l.activeTool!==e.sketchViewModel.activeComponent&&(await e._waitForActiveToolCleared(),await e._startCreating()),"complete"===t.state&&t.graphic){const a=await e._processEdits(t.graphic,{scale:"2d"===l.type?l.scale:null,useSourceLayer:!0});a&&(await e._waitForActiveToolCleared(),await e._startUpdating({feature:a}))}},f=async r=>{const{_formViewModel:s}=e;if(r.graphics.length>1)return void await e._clearSelectedFeature();const o=r.graphics[0];if("complete"===r.state){if(e.numPendingFeatures!==n?.maxFeatures&&s.valid||s.submit(),await e._clearSelectedFeature(),null==e.data.selectedPendingFeature&&(null==l.activeTool||l.activeTool===e.sketchViewModel.activeComponent)&&(await e.sketchViewModel.wait(),"ready"===e.sketchViewModel.state&&"mesh"!==e.data.creationInfo?.layer.geometryType))return e._startCreating()}else{if("start"===r.state)return o.sourceLayer??=t.creationInfo?.layer,await oe({graphic:o,sketchLayer:a,sketchViewModel:i,visualVariables:e._visualVariableAttributes,sourceLayer:o.sourceLayer}),e._selectFeatureForUpdate({feature:o});if("active"===r.state){await e.updatePendingFeature(o);const t=e._visualVariableAttributes;le(l,o,r,t)&&await E(o,"2d"===l.type?l.scale:null);const a=o.attributes,{rotation:i,size:n}=t;if(null!=i){const{field:t}=i;e._updatingHandles.consumePromise(s.setFieldValue(t,a[t]))}if(null!=n){const{field:t}=n;e._updatingHandles.consumePromise(s.setFieldValue(t,a[t]))}}}},g=async a=>{if(a.graphics.forEach(e=>{t.removePendingFeature(e)}),!x(t.creationInfo))return e._startCreating()},w=async()=>{if(x(t.creationInfo))try{await e.data.viewModel.back()}catch{}return e._startCreating()};d.push(p,i.on("create",t=>e._updatingHandles.addPromise(m(t))),i.on("update",t=>e._updatingHandles.addPromise(f(t))),i.on("delete",t=>e._updatingHandles.addPromise(g(t))),e._updatingHandles.addWhen(()=>!e.numPendingFeatures,()=>e._updatingHandles.addPromise(w())),r(()=>{i.cancel()}),Fe(i,a,t),..._e(t));const y=s(d);return i.addHandles(y),y}_initializeSketchViewModel(){const{data:e}=this,{view:t}=e.viewModel,a=new V({elevationInfo:e.creationInfo?.layer.elevationInfo,internal:!0,listMode:"hide",title:"createFeaturesWorkflow-internal"}),i=new pe({layer:a,creationMode:"single",sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,useLegacyCreateTools:e.viewModel.useLegacyCreateTools,updateOnGraphicClick:!1,defaultUpdateOptions:this.sketchUpdateOptions,view:t});this._sketchLayer=a,this._sketchViewModel=i,t?.map.add(a),this.addHandles([r(()=>{t?.destroyed||t?.map.remove(a),d(a)}),h(()=>this.numPendingFeatures>0,e=>this._sketchViewModel.updateOnGraphicClick=e,m),h(()=>this.sketchUpdateOptions,e=>{i.defaultUpdateOptions=e,Q(i,e)},f)])}_hasValidationErrors(e){return!!e&&!this.data.isSubmittable(e)}async _processEdits(e,t){const{data:i,_formViewModel:r,_sketchLayer:s}=this,{layerInfos:n,view:o}=i.viewModel;r.editType="INSERT",r.spatialReference=o?.spatialReference,r.view=o;const{templateExecutorInfo:l}=i;if(!l){const t=e.clone();return t.geometry=null,await this._addAndInitializeEdits(e,t),e}s.remove(e);const{executor:d}=l,u=d(e.geometry,"completion"),h=c(u)?await u:u;l.completionResults.push(h),se(h.relationships),r.editType="INSERT",r.spatialReference=o?.spatialReference,r.view=o,h.primary&&i.creationInfo?.attributeOverrides&&(h.primary.graphic.attributes={...h.primary.graphic.attributes,...i.creationInfo.attributeOverrides});for(const a of h.edits){let e=null;if(a.addFeatures)for(const i of a.addFeatures){const a=i.clone();a.geometry=null,null!=i.geometry&&(i.symbol=await P(i,t),s.add(i)),i.sourceLayer!==e?.layer&&(e=X(n,i.sourceLayer));const r=!!h.associationGraphics?.has(i);await this._addAndInitializeEdits(i,a,e,r)}}r.features=new a,r.activeFeatureIndex=-1,await p(()=>!r.updating);return h.edits.reduce((e,t)=>e+(t.addFeatures?.length??0),0)>1?null:h.primary?.graphic}async _addAndInitializeEdits(e,t,i,r=!1){const{data:s,_formViewModel:n}=this,{layerInfos:o}=s.viewModel,l=s.addPendingFeature(e,t,{isAssociation:r});i??=X(o,e.sourceLayer),n.features=new a([e]),n.activeFeatureIndex=0,n.layerInfos=i?[i]:null,await p(()=>!n.updating),l.updateAttributes(n.getValues(e)),l.submittable=n.valid}async _setUpCreatingFeaturesStep(){if(this.hasHandles(ge))return;const{data:e,sketchViewModel:a}=this,{creationInfo:n,viewModel:o}=e,{view:d}=o;if(!d||!n?.layer)throw new i("missing-parameters","CreateFeaturesWorkflow requires a view and creationInfo.");const{initialFeature:c,layer:u}=n,p=[],f=[];this._featureFormHandle=l(this._featureFormHandle),this._visualVariableAttributes={rotation:null,size:null},e.editorItem=N(o.editorItems,n.layer),n.template&&(null==e.fullTemplate&&await this._initializeFullTemplateAndExecutorInfo(e),f.push(r(()=>{e.templateExecutorInfo&&(e.templateExecutorInfo.completionResults=[])}))),a.allowDeleteKey=!e.isSharedTemplateWorkflow;const g=ne(d);p.push(g);const w=S(n.layer),{template:y}=n,v=!y||b(y)||F(y)&&"feature"===y.type,_=w&&v;try{if(_){const a=c??new t({attributes:M(e.fullTemplate,n.attributeOverrides,u),sourceLayer:u}),i=await this._processEdits(a);i&&await this._startUpdating({feature:i})}else p.push(he._configureSketchViewModel(this)),c?(x(n)&&n.geometryToPlace&&(c.attributes=M(e.fullTemplate,n.attributeOverrides,u)),a.addGraphic(c),await this._startUpdating({feature:c})):await this._startCreating()}finally{g.remove()}const I=r(()=>{for(const t of e.pendingFeatures)a.removeGraphic(t),e.removePendingFeature(t)}),V=h(()=>d?.timeZone,e=>this.data.timeZone=e,m),k=r(()=>{x(n)&&o.cancelWorkflow({warnIfNoWorkflow:!1})});this._featureFormHandle&&p.push(this._featureFormHandle),this.addHandles(p,this._handleKeys.beforeCommit),this.addHandles(f,this._handleKeys.afterCommit),this.addHandles([s(p),s(f),k,I,V],ge)}async _waitForActiveToolCleared(){const e=this.data.viewModel.view;if(null==e?.activeTool)return;const t=new AbortController;this.addHandles(n(t),we),await p(()=>null==e?.activeTool,t.signal),t.abort()}};function Fe(e,t,a){let i=null;const n=()=>e.snappingOptions.featureSources,o=()=>(i=new C({layer:t}),n().add(i),i),l=()=>{null!=i&&(n().remove(i),i=d(i))};return s([h(()=>{const e=a.creationInfo?.layer,t=n().find(t=>t.layer===e);return{hasFeatureLayerSource:!!t,enabled:t?.enabled??!1}},({hasFeatureLayerSource:e,enabled:t})=>{if(!e)return l();i??=o(),i.enabled=t},g),r(l)])}function _e(e){const t=e.viewModel.view;if(!t)return[];const a=[];if("3d"===t.type){const i=new A({view:t});a.push(h(()=>e.selectedPendingFeature,(e,t)=>{i.remove(e),i.add(t)}),r(()=>i.destroy()))}const i=new A({view:t,highlightName:L});return a.push(h(()=>e.temporaryHighlightFeature,e=>{i.removeAll(),i.add(e)}),r(()=>i.destroy())),a}function Me(e){for(const t of e){const{sourceLayer:e}=t;e&&"globalIdField"in e&&null!=e.globalIdField&&(t.attributes[e.globalIdField]??=w())}}e([y()],ve.prototype,"allowSave",null),e([y()],ve.prototype,"createFeatureState",void 0),e([y()],ve.prototype,"curveResizeDisabled",null),e([y()],ve.prototype,"curveUpdatesDisabled",null),e([y()],ve.prototype,"data",void 0),e([y({constructOnly:!0})],ve.prototype,"isNested",void 0),e([y()],ve.prototype,"formViewModel",null),e([y()],ve.prototype,"hasInvalidFormTemplate",null),e([y()],ve.prototype,"hasPendingEdits",null),e([y()],ve.prototype,"hasPreviousStep",null),e([y()],ve.prototype,"_getDrawMeshHelpMessage",void 0),e([y()],ve.prototype,"helpMessage",null),e([y()],ve.prototype,"noticeMessage",null),e([y()],ve.prototype,"layer",null),e([y()],ve.prototype,"parent",null),e([y()],ve.prototype,"keyboardCancellationEnabled",null),e([y()],ve.prototype,"reliesOnOwnerAdminPrivileges",null),e([y()],ve.prototype,"saveActionLabel",null),e([y()],ve.prototype,"shouldShowAttachments",null),e([y()],ve.prototype,"shouldAllowAttachmentEditing",null),e([y()],ve.prototype,"sketchUpdateOptions",null),e([y()],ve.prototype,"sketchViewModel",null),e([y()],ve.prototype,"availableCreateTools",null),ve=he=e([v("esri.widgets.Editor.CreateFeaturesWorkflow")],ve);const be=ve;export{be as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import a from"../../core/Collection.js";import i from"../../core/Error.js";import{makeHandle as r,handlesGroup as s,abortHandle as n}from"../../core/handleUtils.js";import"../../core/has.js";import o from"../../core/Logger.js";import{removeMaybe as l,destroyMaybe as d}from"../../core/maybe.js";import{isPromiseLike as c,debounce as u}from"../../core/promiseUtils.js";import{whenOnce as p,watch as h,initial as m,sync as f,syncAndInitial as g}from"../../core/reactiveUtils.js";import{generateBracedUUID as w}from"../../core/uuid.js";import{property as y,subclass as v}from"../../core/accessorSupport/decorators.js";import{isSharedTemplateOrMetadata as F,isSharedTemplate as _,getCreationAttributes as M,isStandardFeatureTemplate as b}from"../../editing/templateUtils.js";import{getFullTemplate as I}from"../../editing/sharedTemplates/templateLoader.js";import V from"../../layers/GraphicsLayer.js";import{isSceneLayer as k,isTable as S}from"../../layers/support/layerUtils.js";import{isNumber as T}from"../../support/guards.js";import{getDisplayedSymbol as P}from"../../symbols/support/symbolUtils.js";import{updateGraphicSymbolWhenRequired as E}from"../../views/draw/support/editingSessionUtils.js";import{getDrawHelpMessage as A}from"../../views/draw/support/helpMessageUtils.js";import U from"../../views/draw/support/HighlightHelper.js";import H from"../../views/interactive/sketch/SketchOptions.js";import C from"../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{temporaryHighlightName as L}from"../../views/support/HighlightDefaults.js";import O from"../BatchAttributeForm/BatchAttributeFormViewModel.js";import j from"./CreateFeaturesWorkflowData.js";import{isModelUpload as x,handleModelUpload as D}from"./modelUploadUtils.js";import z from"./Workflow.js";import{activeSketchToolDrawsUnsupportedCurve as R,createToolFromGeometryType as G,containsUnsupportedCurve as W,findEditorItemForLayer as N,getServiceEditsFromWorkflowData as B,getServiceInfoForLayer as K,orderEditsByRelationshipDependencies as q,getServiceLayersById as Z,startCreatingNewFeature as J,syncUpdateOptions as Q,findLayerInfo as X,handleFormValuesChangeEvent as Y,isTerminalUpdateEventType as $,getVisualVariableAttributes as ee,startUpdatingFeatureGeometry as te,createWorkflowSteps as ae,avoidFeatureTemplateSelectionWithOnlyOneItem as ie,setUpSketchCreateWatchers as re,setRelationshipFields as se,showProgressCursor as ne,setVisualVariablesAndElevationInfoForUpdate as oe,visualVariableInteractiveUpdate as le}from"./workflowUtils.js";import{makeServiceEditsWithAttachments as de,makeEditsWithAttachments as ce,parseEditResultsAndCollectAddAttachmentData as ue}from"./support/attachmentUtils.js";import pe from"../Sketch/SketchViewModel.js";var he;const me=Symbol(),fe=Symbol(),ge=Symbol(),we=Symbol(),ye={point:["point"],multipoint:["multipoint"],polygon:["polygon","freehandPolygon","rectangle","circle"],polyline:["polyline","freehandPolyline"],mesh:[],multipatch:[]};let ve=he=class extends z{constructor(e){super(e),this.type="create-features",this.createFeatureState="create-new",this.data=void 0,this.isNested=!1,this._getDrawMeshHelpMessage=void 0,this._featureFormHandle=null,this._visualVariableAttributes={rotation:null,size:null},this._formViewModel=new O({attachmentsEnabled:!0}),this._sketchLayer=null,this._sketchViewModel=null,this._isActive=!0}initialize(){this.isNested&&(this._isActive=!1),this._initializeSketchViewModel()}destroy(){this._sketchViewModel.destroy()}get allowSave(){return!this.updating}get curveResizeDisabled(){return this.data.curveResizeDisabled}get curveUpdatesDisabled(){return this.data.curveUpdatesDisabled}get formViewModel(){return this._formViewModel}get hasInvalidFormTemplate(){return!!this.data.editorItem?.hasInvalidFormTemplate}get hasPendingEdits(){if(this.pendingFeatures.some(e=>!!this.data.getEditsForPendingFeature(e)?.modified))return!0;const{creationInfo:e,upload:t}=this.data,{activeComponent:a,createGraphic:i}=this._sketchViewModel,r=i?.geometry?.type;return!("polyline"!==r&&"polygon"!==r&&"multipoint"!==r||"draw-2d"!==a?.type&&"draw-3d"!==a?.type)&&a.drawOperation.committedVertices.length>0||(!(!t||"pending"!==t.state&&"success"!==t.state)||!!e?.geometryToPlace)}get hasPreviousStep(){return this.formViewModel.canGoBack||this._stepIndex>0||"update-pending"===this.createFeatureState&&!!this.data.selectedPendingFeature&&!this.parent&&!x(this.data.creationInfo)}get helpMessage(){const{creationInfo:e,viewModel:t}=this.data;if("creating-features"!==this.stepId||!e)return;const{_sketchViewModel:a}=this,{drawTool:i,isUsingLegacyCreateTools:r}=a;if(!r)return i?.helpMessageKey??"noTool";const s=e.layer.geometryType,n=a.createGraphic;if("mesh"===s){this._getDrawMeshHelpMessage||import("../../views/draw/support/helpMessageUtils3d.js").then(e=>{this._getDrawMeshHelpMessage=e.getDrawMeshHelpMessage});const{view:e}=t;return"3d"===e?.type?this._getDrawMeshHelpMessage?.(n,e):void 0}const{activeCreateToolDrawMode:o,activeTool:l}=a;return A("rectangle"===l||"circle"===l?l:s,n?.geometry,o)}get noticeMessage(){if(R(this._sketchViewModel,this.data.editorItem))return"curveToolDensifyWarning"}get layer(){return this.data.creationInfo?.layer}get numPendingFeatures(){return this.pendingFeatures.length}get numPendingFeaturesExcludingHidden(){return this.pendingFeatures.filter(e=>this.data.isDisplayable(e)).length}get parent(){return this.data.parent}get pendingFeatures(){return this.data.pendingFeatures}get keyboardCancellationEnabled(){return 0===this.numPendingFeatures}get reliesOnOwnerAdminPrivileges(){return this.data.editorItem?.capabilities.create.reliesOnOwnerAdminPrivileges??!1}get saveActionLabel(){return"create"}get shouldShowAttachments(){return(this.data.selectedPendingFeature&&this.data.editorItem?.capabilities.create.attachments.enabled)??!1}get shouldAllowAttachmentEditing(){return this.shouldShowAttachments}get sketchUpdateOptions(){const{editorItem:e}=this.data;return{enableScaling:!this.curveResizeDisabled,multipleSelectionEnabled:!1,reshapeOptions:{enableCreateCurveFromStraightEdge:!k(e?.layer)&&!!e?.capabilities.supportsTrueCurve}}}get sketchViewModel(){return this._sketchViewModel}get test(){}get availableCreateTools(){const e=this.data.creationInfo?.layer.geometryType,t=this.data.viewModel.view;if(!e)return[];if(this.data.creationInfo?.maxFeatures&&this.data.creationInfo.maxFeatures<=this.numPendingFeatures)return[];if(F(this.data.fullTemplate)){const{tool:t}=G(e,this.data.fullTemplate);return[t]}return"2d"!==t?.type&&"multipoint"===e?[]:[...ye[e]]}getUpdating(){return!!this._sketchViewModel?.updating}async enter(){this._isActive=!0,"awaiting-feature-creation-info"!==this.stepId&&await this._updatingHandles.addPromise(this._setUpCreatingFeaturesStep())}exit(){this._isActive=!1,this.removeHandles([ge])}async updatePendingFeature(e){if(e!==this.data.selectedPendingFeature)return this._sketchViewModel.cancel(),this._startUpdating({feature:e})}async start(){return await super.start(),S(this.data.creationInfo?.layer)?null:{enter:async()=>{},exit:async()=>{},viewModel:this._sketchViewModel}}async save(e){const{formViewModel:t}=this;if(t.pendingSubtypeChoice)return;await t.submit(),this._stashValidationState();const a=this.data.selectedPendingFeature,i=this._hasValidationErrors(a)?a:this.data.pendingFeatures.find(e=>this._hasValidationErrors(e));if(i)return await this._startUpdating({feature:i}),void await(t?.submit());const{pendingFeatures:r,editorItem:s}=this.data;if(s&&e&&W(r.toArray(),s)){if(!await e("curveEditingDensifyPrompt"))return this.reset()}return super.save()}back(e){return this._formViewModel.canGoBack?this._formViewModel.goBack():"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||x(this.data.creationInfo)||this.parent?super.back(e):this._clearSelectedFeature()}previous(e){return this._formViewModel.canGoBack?this._formViewModel.goBack():"update-pending"===this.createFeatureState&&this.data.selectedPendingFeature&&!x(this.data.creationInfo)?this._clearSelectedFeature():super.previous(e)}cancelFeature(e){this.data.isSharedTemplateWorkflow?o.getLogger(this).warn("Cannot cancel individual features created by shared templates."):(this.data.removePendingFeature(e),this.sketchViewModel.removeGraphic(e))}static create(e){const{applyEdits:t,applyEditsFeatureService:a,addAttachmentsCallback:i,isNested:r,creationInfo:s,parent:n,snappingManager:o,startAt:l,viewModel:d}=e,c=e.sketchOptions??new H,u=s?.layer,p=u?N(d.editorItems,u):void 0,h=new he({data:new j({creationInfo:s,editorItem:p,parent:n,sketchOptions:c,snappingManager:o,viewModel:d}),isNested:r,onCommit:async e=>{const{creationInfo:r}=e;if(!r)return;h._sketchViewModel.cancel();const s=e.pendingFeatures.toArray(),{layer:n}=r,o=n.capabilities?.editing.supportsGlobalId&&"globalIdField"in n,{fullTemplate:l}=e,c=B(h.data),u=_(l)&&c;if(o){if(Me(s),u){let t=de(c,e);const i=await(K(n,d.view)?.load());i&&(t=q({edits:t,serviceInfo:i,view:d.view,findOriginalFeature:t=>e.getEditsForPendingFeature(t)?.initialFeature??t})),await a(l.featureService,t,{globalIdUsed:!0,honorSequenceOfEdits:!0,gdbVersion:l.layer.gdbVersion??void 0})}else await t(n,ce(s,e),{globalIdUsed:!0});return}const p=u?await a(l.featureService,c,{gdbVersion:l.layer.gdbVersion??void 0}):[await t(n,{addFeatures:s})];p?.length&&e.attachmentsModified&&!o&&await Promise.all(p.map(t=>{if(!t?.addFeatureResults)return;const a=ue(s,t.addFeatureResults,n,e);return i(n,a)}))}});return h._set("steps",this._createWorkflowSteps(h,l)),h}_fadeExistingFeatures(e){if("effect"in e){const t=e.effect;return e.effect="saturate(0.6) opacity(0.8)",r(()=>e.effect=t)}const t=e.opacity;return e.opacity=.7,r(()=>e.opacity=t)}async _initializeFullTemplateAndExecutorInfo(e){const{creationInfo:t}=e,{view:a}=e.viewModel;if(!t||!a)return null;const i=await I(a,t.template);if(e.fullTemplate=i,i&&_(i)){const{createTemplateExecutor:r}=await(import("../../editing/sharedTemplates/executor/createTemplateExecutor.js")),s={completionResults:[],executor:await r(i),serviceLayersById:Z(t.layer,a)};e.templateExecutorInfo=s}return i}async _startCreating(){this.removeHandles(fe);const{data:e}=this;if(!e.creationInfo)return;const t=this.data.creationInfo?.maxFeatures;if(t&&this.numPendingFeatures>=t)return this.sketchViewModel.cancel(),void(this.numPendingFeatures&&await this._startUpdating({feature:this.pendingFeatures.at(-1)}));this.createFeatureState="create-new",await J(this._sketchViewModel,this._sketchLayer,e)}async _clearSelectedFeature(){const e=this._formViewModel.pendingSubtypeChoice;e&&(e.resolve("undo"),await e.promise),this._stashValidationState(),this.sketchViewModel.cancel(),this.data.selectedPendingFeature=null,this._featureFormHandle=l(this._featureFormHandle),this._formViewModel.features=new a,this._formViewModel.activeFeatureIndex=-1}_stashValidationState(){const e=this._formViewModel.activeFeature,t=e&&this.data.getEditsForPendingFeature(e);t&&(t.submittable=this._formViewModel.valid)}async _selectFeatureForUpdate({feature:e,initialFeature:t=e}){this._stashValidationState();const{data:i,pendingFeatures:r}=this;r.includes(e)||i.addPendingFeature(e,t),i.selectedPendingFeature=e;const{_formViewModel:n,_sketchViewModel:o,sketchUpdateOptions:d}=this,{creationInfo:c,viewModel:u}=i,{layerInfos:m,view:f}=u;if(!f||!c)return;Q(o,d),l(this._featureFormHandle);const g=e.sourceLayer,w=X(m,g),y=f.spatialReference;n.set({editType:"INSERT",features:new a([e]),activeFeatureIndex:0,layerInfos:w?[w]:null,spatialReference:y,view:f}),await p(()=>!1===n.updating),await E(e,"2d"===f.type?f.scale:null);const v=i.getEditsForPendingFeature(e);v?.attachmentsModified&&n.applyStashedAttachmentEdits(v.attachmentEdits),this._featureFormHandle=s([n.on("values-change",Y({filter:e=>e===v?.feature,forEachValueChange:(e,t)=>{if(T(t)){const a=this._visualVariableAttributes;a.size&&!a.size.isUpdatingInteractively&&e===a.size.field&&a.size.setInitialValue(t),a.rotation&&!a.rotation.isUpdatingInteractively&&e===a.rotation.field&&a.rotation.setInitialValue(t)}},forEachFeature:e=>{v?.updateAttributes(n.getValues(e)),E(e,"2d"===f.type?f.scale:null)}})),n.on("attachments-change",e=>v?.setAttachmentEdits(e.attachmentEdits)),o.on(["update","undo","redo"],t=>{("undo"===t.type||"redo"===t.type||"update"===t.type&&null!=t.toolEventInfo&&$(t.toolEventInfo.type))&&n.notifyGeometriesChanged([e])}),h(()=>n.activeFeature?.sourceLayer,t=>e.sourceLayer=t),h(()=>[n.activeFeature,n.valid],()=>this._stashValidationState())]),this.createFeatureState="update-pending"}async _startUpdating({feature:e,initialFeature:t=e}){await this._selectFeatureForUpdate({feature:e,initialFeature:t});const{_sketchLayer:a,_sketchViewModel:i,data:r}=this,{creationInfo:s,viewModel:n}=r,{view:o}=n;if(!o||!s)return;const l=e.sourceLayer??s.layer;return S(l)?void 0:(this._visualVariableAttributes=ee(e),te({graphic:e,sketchLayer:a,sketchViewModel:i,sourceLayer:l,updateOptions:this.sketchUpdateOptions,visualVariables:this._visualVariableAttributes}))}static _createWorkflowSteps(e,t="awaiting-feature-creation-info"){const{data:a}=e,i=ae(["awaiting-feature-creation-info","creating-features","adding-attachment","editing-attachment"],t,{"awaiting-feature-creation-info":()=>({id:"awaiting-feature-creation-info",async setUp(){const{creationInfo:t,viewModel:i}=a,{view:r}=i;r&&(x(t)?e.addHandles(await D({view:r,data:a,next:()=>e.next(),cancel:()=>i.cancelWorkflow({warnIfNoWorkflow:!1})}),this.id):(a.parent&&t&&e.addHandles(i.restrictFeatureTemplatesViewModelToLayer(t.layer),this.id),e.addHandles(i.featureTemplatesViewModel.on("select",({item:t})=>{t&&(a.creationInfo={...a.creationInfo,layer:t.layer,template:t.template},e.next())}),this.id)))},async tearDown(){e.removeHandles(this.id)}}),"creating-features":()=>({id:"creating-features",async setUp(){e._isActive&&await e._setUpCreatingFeaturesStep()},async tearDown(t){t.canceled&&e.removeHandles([ge,me,fe,we])}}),"adding-attachment":()=>({id:"adding-attachment",parent:"creating-features",async setUp(){},async tearDown(){}}),"editing-attachment":()=>({id:"editing-attachment",parent:"creating-features",async setUp(){},async tearDown(){}})});return ie(a,i)}static _configureSketchViewModel(e){const{data:t,_sketchLayer:a,_sketchViewModel:i}=e,{creationInfo:n,viewModel:o}=t,{view:l}=o,d=[];if(!l)return r();if("2d"===l.type){n&&d.push(e._fadeExistingFeatures(n.layer));const t=u((e,t)=>Promise.all(e.map(e=>E(e,t))));d.push(h(()=>l.scale,e=>t(a.graphics,e)))}const c=M(t.fullTemplate,n?.attributeOverrides,n?.layer),p=h(()=>i.createGraphic&&i.activeComponent,()=>{i.createGraphic&&i.activeComponent&&!e.hasHandles(fe)&&e._updatingHandles.consumePromise(re({creationAttributes:c,data:t,sketchViewModel:i,view:l}).then(t=>e.addHandles(t,fe)))}),m=async t=>{if("cancel"!==t.state&&"complete"!==t.state||e.removeHandles(fe),"cancel"===t.state&&null!==l.activeTool&&l.activeTool!==e.sketchViewModel.activeComponent&&(await e._waitForActiveToolCleared(),await e._startCreating()),"complete"===t.state&&t.graphic){const a=await e._processEdits(t.graphic,{scale:"2d"===l.type?l.scale:null,useSourceLayer:!0});a&&(await e._waitForActiveToolCleared(),await e._startUpdating({feature:a}))}},f=async r=>{const{_formViewModel:s}=e;if(r.graphics.length>1)return void await e._clearSelectedFeature();const o=r.graphics[0];if("complete"===r.state){if(e.numPendingFeatures!==n?.maxFeatures&&s.valid||s.activeForm.touchAll(),await e._clearSelectedFeature(),null==e.data.selectedPendingFeature&&(null==l.activeTool||l.activeTool===e.sketchViewModel.activeComponent)&&(await e.sketchViewModel.wait(),"ready"===e.sketchViewModel.state&&"mesh"!==e.data.creationInfo?.layer.geometryType))return e._startCreating()}else{if("start"===r.state)return o.sourceLayer??=t.creationInfo?.layer,await oe({graphic:o,sketchLayer:a,sketchViewModel:i,visualVariables:e._visualVariableAttributes,sourceLayer:o.sourceLayer}),e._selectFeatureForUpdate({feature:o});if("active"===r.state){await e.updatePendingFeature(o);const t=e._visualVariableAttributes;le(l,o,r,t)&&await E(o,"2d"===l.type?l.scale:null);const a=o.attributes,{rotation:i,size:n}=t;if(null!=i){const{field:t}=i;e._updatingHandles.consumePromise(s.setFieldValue(t,a[t]))}if(null!=n){const{field:t}=n;e._updatingHandles.consumePromise(s.setFieldValue(t,a[t]))}}}},g=async a=>{if(a.graphics.forEach(e=>{t.removePendingFeature(e)}),!x(t.creationInfo))return e._startCreating()},w=async()=>{if(x(t.creationInfo))try{await e.data.viewModel.back()}catch{}return e._startCreating()};d.push(p,i.on("create",t=>e._updatingHandles.addPromise(m(t))),i.on("update",t=>e._updatingHandles.addPromise(f(t))),i.on("delete",t=>e._updatingHandles.addPromise(g(t))),e._updatingHandles.addWhen(()=>!e.numPendingFeatures,()=>e._updatingHandles.addPromise(w())),r(()=>{i.cancel()}),Fe(i,a,t),..._e(t));const y=s(d);return i.addHandles(y),y}_initializeSketchViewModel(){const{data:e}=this,{view:t}=e.viewModel,a=new V({elevationInfo:e.creationInfo?.layer.elevationInfo,internal:!0,listMode:"hide",title:"createFeaturesWorkflow-internal"}),i=new pe({layer:a,creationMode:"single",sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,useLegacyCreateTools:e.viewModel.useLegacyCreateTools,updateOnGraphicClick:!1,defaultUpdateOptions:this.sketchUpdateOptions,view:t});this._sketchLayer=a,this._sketchViewModel=i,t?.map.add(a),this.addHandles([r(()=>{t?.destroyed||t?.map.remove(a),d(a)}),h(()=>this.numPendingFeatures>0,e=>this._sketchViewModel.updateOnGraphicClick=e,m),h(()=>this.sketchUpdateOptions,e=>{i.defaultUpdateOptions=e,Q(i,e)},f)])}_hasValidationErrors(e){return!!e&&!this.data.isSubmittable(e)}async _processEdits(e,t){const{data:i,_formViewModel:r,_sketchLayer:s}=this,{layerInfos:n,view:o}=i.viewModel;r.editType="INSERT",r.spatialReference=o?.spatialReference,r.view=o;const{templateExecutorInfo:l}=i;if(!l){const t=e.clone();return t.geometry=null,await this._addAndInitializeEdits(e,t),e}s.remove(e);const{executor:d}=l,u=d(e.geometry,"completion"),h=c(u)?await u:u;l.completionResults.push(h),se(h.relationships),r.editType="INSERT",r.spatialReference=o?.spatialReference,r.view=o,h.primary&&i.creationInfo?.attributeOverrides&&(h.primary.graphic.attributes={...h.primary.graphic.attributes,...i.creationInfo.attributeOverrides});for(const a of h.edits){let e=null;if(a.addFeatures)for(const i of a.addFeatures){const a=i.clone();a.geometry=null,null!=i.geometry&&(i.symbol=await P(i,t),s.add(i)),i.sourceLayer!==e?.layer&&(e=X(n,i.sourceLayer));const r=!!h.associationGraphics?.has(i);await this._addAndInitializeEdits(i,a,e,r)}}r.features=new a,r.activeFeatureIndex=-1,await p(()=>!r.updating);return h.edits.reduce((e,t)=>e+(t.addFeatures?.length??0),0)>1?null:h.primary?.graphic}async _addAndInitializeEdits(e,t,i,r=!1){const{data:s,_formViewModel:n}=this,{layerInfos:o}=s.viewModel,l=s.addPendingFeature(e,t,{isAssociation:r});i??=X(o,e.sourceLayer),n.features=new a([e]),n.activeFeatureIndex=0,n.layerInfos=i?[i]:null,await p(()=>!n.updating),l.updateAttributes(n.getValues(e)),l.submittable=n.valid}async _setUpCreatingFeaturesStep(){if(this.hasHandles(ge))return;const{data:e,sketchViewModel:a}=this,{creationInfo:n,viewModel:o}=e,{view:d}=o;if(!d||!n?.layer)throw new i("missing-parameters","CreateFeaturesWorkflow requires a view and creationInfo.");const{initialFeature:c,layer:u}=n,p=[],f=[];this._featureFormHandle=l(this._featureFormHandle),this._visualVariableAttributes={rotation:null,size:null},e.editorItem=N(o.editorItems,n.layer),n.template&&(null==e.fullTemplate&&await this._initializeFullTemplateAndExecutorInfo(e),f.push(r(()=>{e.templateExecutorInfo&&(e.templateExecutorInfo.completionResults=[])}))),a.allowDeleteKey=!e.isSharedTemplateWorkflow;const g=ne(d);p.push(g);const w=S(n.layer),{template:y}=n,v=!y||b(y)||F(y)&&"feature"===y.type,_=w&&v;try{if(_){const a=c??new t({attributes:M(e.fullTemplate,n.attributeOverrides,u),sourceLayer:u}),i=await this._processEdits(a);i&&await this._startUpdating({feature:i})}else p.push(he._configureSketchViewModel(this)),c?(x(n)&&n.geometryToPlace&&(c.attributes=M(e.fullTemplate,n.attributeOverrides,u)),a.addGraphic(c),await this._startUpdating({feature:c})):await this._startCreating()}finally{g.remove()}const I=r(()=>{for(const t of e.pendingFeatures)a.removeGraphic(t),e.removePendingFeature(t)}),V=h(()=>d?.timeZone,e=>this.data.timeZone=e,m),k=r(()=>{x(n)&&o.cancelWorkflow({warnIfNoWorkflow:!1})});this._featureFormHandle&&p.push(this._featureFormHandle),this.addHandles(p,this._handleKeys.beforeCommit),this.addHandles(f,this._handleKeys.afterCommit),this.addHandles([s(p),s(f),k,I,V],ge)}async _waitForActiveToolCleared(){const e=this.data.viewModel.view;if(null==e?.activeTool)return;const t=new AbortController;this.addHandles(n(t),we),await p(()=>null==e?.activeTool,t.signal),t.abort()}};function Fe(e,t,a){let i=null;const n=()=>e.snappingOptions.featureSources,o=()=>(i=new C({layer:t}),n().add(i),i),l=()=>{null!=i&&(n().remove(i),i=d(i))};return s([h(()=>{const e=a.creationInfo?.layer,t=n().find(t=>t.layer===e);return{hasFeatureLayerSource:!!t,enabled:t?.enabled??!1}},({hasFeatureLayerSource:e,enabled:t})=>{if(!e)return l();i??=o(),i.enabled=t},g),r(l)])}function _e(e){const t=e.viewModel.view;if(!t)return[];const a=[];if("3d"===t.type){const i=new U({view:t});a.push(h(()=>e.selectedPendingFeature,(e,t)=>{i.remove(e),i.add(t)}),r(()=>i.destroy()))}const i=new U({view:t,highlightName:L});return a.push(h(()=>e.temporaryHighlightFeature,e=>{i.removeAll(),i.add(e)}),r(()=>i.destroy())),a}function Me(e){for(const t of e){const{sourceLayer:e}=t;e&&"globalIdField"in e&&null!=e.globalIdField&&(t.attributes[e.globalIdField]??=w())}}e([y()],ve.prototype,"allowSave",null),e([y()],ve.prototype,"createFeatureState",void 0),e([y()],ve.prototype,"curveResizeDisabled",null),e([y()],ve.prototype,"curveUpdatesDisabled",null),e([y()],ve.prototype,"data",void 0),e([y({constructOnly:!0})],ve.prototype,"isNested",void 0),e([y()],ve.prototype,"formViewModel",null),e([y()],ve.prototype,"hasInvalidFormTemplate",null),e([y()],ve.prototype,"hasPendingEdits",null),e([y()],ve.prototype,"hasPreviousStep",null),e([y()],ve.prototype,"_getDrawMeshHelpMessage",void 0),e([y()],ve.prototype,"helpMessage",null),e([y()],ve.prototype,"noticeMessage",null),e([y()],ve.prototype,"layer",null),e([y()],ve.prototype,"parent",null),e([y()],ve.prototype,"keyboardCancellationEnabled",null),e([y()],ve.prototype,"reliesOnOwnerAdminPrivileges",null),e([y()],ve.prototype,"saveActionLabel",null),e([y()],ve.prototype,"shouldShowAttachments",null),e([y()],ve.prototype,"shouldAllowAttachmentEditing",null),e([y()],ve.prototype,"sketchUpdateOptions",null),e([y()],ve.prototype,"sketchViewModel",null),e([y()],ve.prototype,"availableCreateTools",null),ve=he=e([v("esri.widgets.Editor.CreateFeaturesWorkflow")],ve);const be=ve;export{be as default};
|
|
@@ -239,7 +239,7 @@ export default class EditorViewModel extends EventedAccessor {
|
|
|
239
239
|
*/
|
|
240
240
|
accessor layerInfos: LayerInfo[] | null | undefined;
|
|
241
241
|
/**
|
|
242
|
-
* Use this property to supply a custom selection manager that overrides the default selection manager. This property is ignored if [syncViewSelection](
|
|
242
|
+
* Use this property to supply a custom selection manager that overrides the default selection manager. This property is ignored if [syncViewSelection](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/EditorViewModel/#syncViewSelection) is `true`.
|
|
243
243
|
* This is useful when applications want to share selection sets between components, without relying on the view's selection manager.
|
|
244
244
|
*
|
|
245
245
|
* @since 5.0
|
|
@@ -281,7 +281,7 @@ export default class EditorViewModel extends EventedAccessor {
|
|
|
281
281
|
* Indicates whether the Editor should sync with the view's [selection manager](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/).
|
|
282
282
|
* Enabling this does not automatically inherit the [selection sources](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/#sources) from the [SelectionManager](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/), (e.g. which layers or graphics collections the view listens to for selections). If you need specific selection sources, configure them separately via [SelectionManager.sources](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/#sources).
|
|
283
283
|
*
|
|
284
|
-
* Setting this property takes precedence over the [selectionManager](
|
|
284
|
+
* Setting this property takes precedence over the [selectionManager](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/EditorViewModel/#selectionManager) property.
|
|
285
285
|
*
|
|
286
286
|
* @default false
|
|
287
287
|
* @since 5.0
|
package/widgets/Editor.d.ts
CHANGED
|
@@ -485,7 +485,7 @@ export default class Editor extends Widget {
|
|
|
485
485
|
accessor layerInfos: LayerInfo[] | null | undefined;
|
|
486
486
|
/**
|
|
487
487
|
* Use this property to supply a custom selection manager that overrides the default selection manager.
|
|
488
|
-
* This is useful when applications want to share selection sets between components, without relying on the view's selection manager. This property is ignored if [syncViewSelection](
|
|
488
|
+
* This is useful when applications want to share selection sets between components, without relying on the view's selection manager. This property is ignored if [syncViewSelection](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/#syncViewSelection) is `true`.
|
|
489
489
|
*
|
|
490
490
|
* @since 5.0
|
|
491
491
|
*/
|
|
@@ -530,7 +530,7 @@ export default class Editor extends Widget {
|
|
|
530
530
|
* Indicates whether the Editor should sync with the view's [selection manager](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/).
|
|
531
531
|
* Enabling this does not automatically inherit the [selection sources](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/#sources) from the [SelectionManager](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/), (e.g. which layers or graphics collections the view listens to for selections). If you need specific selection sources, configure them separately via [SelectionManager.sources](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/#sources).
|
|
532
532
|
*
|
|
533
|
-
* Setting this property takes precedence over the [selectionManager](
|
|
533
|
+
* Setting this property takes precedence over the [selectionManager](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/#selectionManager) property.
|
|
534
534
|
*
|
|
535
535
|
* @default false
|
|
536
536
|
* @since 5.0
|
|
@@ -434,8 +434,8 @@ export default class FeatureTableViewModel extends GridViewModel {
|
|
|
434
434
|
*/
|
|
435
435
|
get columns(): Collection<SupportedColumn>;
|
|
436
436
|
/**
|
|
437
|
-
* A reference to the internal [selection manager](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/) used when a custom selection manager is not provided, and [syncViewSelection](
|
|
438
|
-
* When 'syncViewSelection' is true and a [view](
|
|
437
|
+
* A reference to the internal [selection manager](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/) used when a custom selection manager is not provided, and [syncViewSelection](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/FeatureTableViewModel/#syncViewSelection) is false.
|
|
438
|
+
* When 'syncViewSelection' is true and a [view](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/FeatureTableViewModel/#view) has been provided, the table will use that view's selection manager.
|
|
439
439
|
*
|
|
440
440
|
* @since 5.1
|
|
441
441
|
*/
|
|
@@ -601,7 +601,7 @@ export default class FeatureTableViewModel extends GridViewModel {
|
|
|
601
601
|
set hiddenFields(value: ReadonlyArrayOrCollection<string>);
|
|
602
602
|
/**
|
|
603
603
|
* Indicates whether to highlight the associated feature when a row is selected by checking the corresponding checkbox. This property is only applicable when working with a map and the [FeatureTable.view](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/#view) property is set.
|
|
604
|
-
* This property has no effect if [syncViewSelection](
|
|
604
|
+
* This property has no effect if [syncViewSelection](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/FeatureTableViewModel/#syncViewSelection) is `true` or a custom [selectionManager](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/FeatureTableViewModel/#selectionManager) has been provided.
|
|
605
605
|
*
|
|
606
606
|
* @since 4.25
|
|
607
607
|
*/
|
|
@@ -906,7 +906,7 @@ export default class FeatureTableViewModel extends GridViewModel {
|
|
|
906
906
|
/**
|
|
907
907
|
* Use this property to supply a custom selection manager that overrides the default selection manager.
|
|
908
908
|
* This is useful when applications want to share selection sets between components, without relying on the view's selection manager.
|
|
909
|
-
* This property is ignored if [syncViewSelection](
|
|
909
|
+
* This property is ignored if [syncViewSelection](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/FeatureTableViewModel/#syncViewSelection) is `true` and a 'view' has been provided.
|
|
910
910
|
*
|
|
911
911
|
* @since 5.0
|
|
912
912
|
*/
|
|
@@ -979,7 +979,7 @@ export default class FeatureTableViewModel extends GridViewModel {
|
|
|
979
979
|
* Enabling this does not automatically inherit the [selection sources](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/#sources) from the [SelectionManager](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/), (e.g. which layers or graphics collections the view listens to for selections).
|
|
980
980
|
* If you need specific selection sources, configure them separately via [SelectionManager.sources](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/#sources).
|
|
981
981
|
*
|
|
982
|
-
* This property takes precedence over the [selectionManager](
|
|
982
|
+
* This property takes precedence over the [selectionManager](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/FeatureTableViewModel/#selectionManager) property.
|
|
983
983
|
*
|
|
984
984
|
* @since 5.0
|
|
985
985
|
*/
|
|
@@ -993,7 +993,7 @@ export default class FeatureTableViewModel extends GridViewModel {
|
|
|
993
993
|
/**
|
|
994
994
|
* A reference to the instance of a table widget that is directly associated with this table. This only applies if this table is nested within another table widget. The parent table is responsible for creating this child table instance. The child table reacts to state changes on the parent table, including row selection.
|
|
995
995
|
*
|
|
996
|
-
* The parent table that this property references may also be nested, meaning it would refer to a different parent table. The top-level table can always be referenced via the [tableController](
|
|
996
|
+
* The parent table that this property references may also be nested, meaning it would refer to a different parent table. The top-level table can always be referenced via the [tableController](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/FeatureTableViewModel/#tableController) property. If only one nested table exists, then the values of [tableController](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/FeatureTableViewModel/#tableController) and `tableParent` are the same.
|
|
997
997
|
*
|
|
998
998
|
* @since 5.0
|
|
999
999
|
*/
|
|
@@ -342,7 +342,7 @@ export default class FeatureStore extends Accessor {
|
|
|
342
342
|
/**
|
|
343
343
|
* This property can be used to provide a custom selection manager that overrides the default selection manager.
|
|
344
344
|
* This is useful when applications want to share selection sets between components, without relying on the view's selection manager.
|
|
345
|
-
* This property is ignored if [syncViewSelection](
|
|
345
|
+
* This property is ignored if [syncViewSelection](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/support/FeatureStore/#syncViewSelection) is `true` and a 'view' has been provided.
|
|
346
346
|
*
|
|
347
347
|
* @internal
|
|
348
348
|
*/
|
|
@@ -467,7 +467,7 @@ export default class FeatureStore extends Accessor {
|
|
|
467
467
|
* Enabling this does not automatically inherit the [selection sources](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/#sources) from the [SelectionManager](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/), (e.g. which layers or graphics collections the view listens to for selections).
|
|
468
468
|
* If you need specific selection sources, configure them separately via [SelectionManager.sources](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/#sources).
|
|
469
469
|
*
|
|
470
|
-
* This property takes precedence over the [selectionManager](
|
|
470
|
+
* This property takes precedence over the [selectionManager](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/support/FeatureStore/#selectionManager) property.
|
|
471
471
|
*
|
|
472
472
|
* @default false
|
|
473
473
|
* @internal
|