@arcgis/core 5.2.0-next.21 → 5.2.0-next.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Graphic.d.ts +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{eccbddaec4be44c86f79.js → 1040bce57ea63a6dbca4.js} +2 -2
- package/assets/esri/core/workers/chunks/1a7c0a1dc6ecc93ea03a.js +1 -0
- package/assets/esri/core/workers/chunks/292498a9c7d462d215c6.js +1 -0
- package/assets/esri/core/workers/chunks/2d6d01913096f7cb5ff8.js +1 -0
- package/assets/esri/core/workers/chunks/30298f84bd414f9dea64.js +1 -0
- package/assets/esri/core/workers/chunks/353c67da4b25c29360db.js +2 -0
- package/assets/esri/core/workers/chunks/3b4fc67f6cb7393fbd97.js +1 -0
- package/assets/esri/core/workers/chunks/47948c72bc01bd173c20.js +2 -0
- package/assets/esri/core/workers/chunks/{f0519b06987471456b69.js → 502464c4eab7667f6566.js} +1 -1
- package/assets/esri/core/workers/chunks/{d7acbc2ddff4cee8a465.js → 5ee887fc6e1e0e70e02f.js} +1 -1
- package/assets/esri/core/workers/chunks/6c0c77de1934f35dc45f.js +1 -0
- package/assets/esri/core/workers/chunks/{f7f820483e45c05ab9e4.js → 75df436e6e9773bdcfc2.js} +1 -1
- package/assets/esri/core/workers/chunks/780519b60aa674a61a74.js +1 -0
- package/assets/esri/core/workers/chunks/7dbaa089c7472825b80c.js +1 -0
- package/assets/esri/core/workers/chunks/7dec8c453fdee1968d12.js +1 -0
- package/assets/esri/core/workers/chunks/{a2247f4c3116efb16c4f.js → 7e23de8d9b2d938808f6.js} +1 -1
- package/assets/esri/core/workers/chunks/7e4093f42795ba2f8cfd.js +1 -0
- package/assets/esri/core/workers/chunks/{6649acaceab00ad30e7f.js → 8ba3e0462a9bdaae5f40.js} +1 -1
- package/assets/esri/core/workers/chunks/928b18e13e015330d44b.js +1 -0
- package/assets/esri/core/workers/chunks/9434c76ad39c936dba90.js +1 -0
- package/assets/esri/core/workers/chunks/{909e67dee8c30e391d69.js → a8310f55de4749f973d0.js} +1 -1
- package/assets/esri/core/workers/chunks/{ac16016964be3b684e98.js → aded4e704e09a28edc8f.js} +1 -1
- package/assets/esri/core/workers/chunks/{7175f0c6a6e56b685d20.js → b419fd36337e76e2d4a3.js} +6 -6
- package/assets/esri/core/workers/chunks/{05d597dd117766beadd8.js → b91a15522692781560b4.js} +1 -1
- package/assets/esri/core/workers/chunks/c86d388d216adbb15a05.js +1 -0
- package/assets/esri/core/workers/chunks/{f1ff33584680d8718400.js → c9ce408675dae6a0edd1.js} +1 -1
- package/assets/esri/core/workers/chunks/{0b522e05668bef729b1b.js → ceb5bd9f2afaa2ea0808.js} +1 -1
- package/assets/esri/core/workers/chunks/d07068c44d560e4ce02e.js +1 -0
- package/assets/esri/core/workers/chunks/{da47fdffb5969694a2ae.js → d41eed41916ed0422059.js} +1 -1
- package/assets/esri/core/workers/chunks/{19493c9c7e1d2ac0f80f.js → d4e0346209fabc58f929.js} +1 -1
- package/assets/esri/core/workers/chunks/{b375abfb2a2d9c63e20a.js → db90fb8ac96579259566.js} +1 -1
- package/assets/esri/core/workers/chunks/{44b30bce8e9a75b9e1b3.js → dd0acd0f8b96839b4f24.js} +2 -2
- package/assets/esri/core/workers/chunks/{5809e70a8e57e9b05959.js → dd795c95cdc3812b5b49.js} +1 -1
- package/assets/esri/core/workers/chunks/f7344d855f1092383abe.js +1 -0
- package/assets/esri/core/workers/chunks/{2dbd88566abac030e965.js → f859c53432f258af77e3.js} +2 -2
- package/assets/esri/core/workers/chunks/{ecbf84a1f42e6188faab.js → fd629872b5c07853f695.js} +1 -1
- package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
- package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +5 -1
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/GaussianSplat.glsl.js +4 -4
- package/chunks/GaussianSplatShadow.glsl.js +1 -1
- package/config.d.ts +9 -2
- package/config.js +1 -1
- package/core/date.js +1 -1
- package/form/FormTemplate.d.ts +15 -20
- package/form/elements/AttachmentElement.d.ts +38 -11
- package/form/elements/Element.d.ts +9 -6
- package/form/elements/FieldElement.d.ts +0 -1
- package/form/elements/GroupElement.d.ts +4 -6
- package/form/elements/RelationshipElement.d.ts +8 -8
- package/form/elements/inputs/attachments/AttachmentInput.d.ts +34 -18
- package/form/elements/inputs/attachments/AudioInput.d.ts +4 -3
- package/form/elements/inputs/attachments/DocumentInput.d.ts +2 -6
- package/form/elements/inputs/attachments/ImageInput.d.ts +4 -3
- package/form/elements/inputs/attachments/Input.d.ts +6 -3
- package/form/elements/inputs/attachments/SignatureInput.d.ts +3 -3
- package/form/elements/inputs/attachments/VideoInput.d.ts +4 -3
- package/form/elements.d.ts +6 -12
- package/form/types.d.ts +0 -4
- package/kernel.js +1 -1
- package/layers/AnnotationFeatureLayer.d.ts +2 -1
- package/layers/DimensionFeatureLayer.d.ts +2 -1
- package/layers/OrientedImageryLayer.d.ts +20 -2
- package/layers/OrientedImageryLayer.js +1 -1
- package/layers/ParquetLayer.js +1 -1
- package/layers/graphics/sources/ParquetSource.js +1 -1
- package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
- package/layers/graphics/sources/geojson/geojson.js +1 -1
- package/layers/graphics/sources/parquet/FileProvider.js +1 -1
- package/layers/graphics/sources/parquet/PortalParquetLayerFileProvider.js +1 -1
- package/layers/graphics/sources/parquet/fileProviderChangedError.js +2 -0
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/mixins/EditBusLayer.js +1 -1
- package/layers/orientedImagery/core/utils.js +1 -1
- package/layers/orientedImagery/types.d.ts +4 -1
- package/layers/support/RasterBandInfo.js +1 -1
- package/layers/types.d.ts +1 -0
- package/package.json +3 -3
- package/rest/support/AttachmentQuery.d.ts +13 -1
- package/rest/support/AttachmentQuery.js +1 -1
- package/rest/support/OutDistance.d.ts +5 -1
- package/rest/support/PrintParameters.d.ts +2 -1
- package/rest/support/Query.d.ts +2 -0
- package/support/basemapUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/SimpleMarkerSymbol.d.ts +2 -2
- package/views/2d/engine/AFeatureContainer.js +1 -1
- package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/graph/ShaderGraphContext.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/graph/glsl.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/features/FeatureContainer.js +1 -1
- package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
- package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
- package/views/2d/layers/support/annodime/DimensionInfo.js +1 -1
- package/views/2d/layers/support/annodime/cimAnnotations.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightReshapeTool3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool2.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedComputedData.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSnappingController.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeTool3D.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/layers/GaussianSplatLayerViewPerformanceInfo.js +1 -1
- package/views/3d/layers/graphics/tessellationUtils.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatAtlasPages.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatHeaderTexture.js +2 -0
- package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +4 -4
- package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatTextureFetch.glsl.js +13 -12
- package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatShadowRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +1 -1
- package/views/PopupView.d.ts +3 -0
- package/views/View2D.d.ts +2 -2
- package/views/layers/AnnotationFeatureLayerView.d.ts +9 -1
- package/views/layers/DimensionFeatureLayerView.d.ts +9 -1
- package/views/layers/FeatureLikeLayerView.js +1 -1
- package/widgets/BasemapGallery.js +1 -1
- package/widgets/BatchAttributeForm/attachmentUtils.js +1 -1
- package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
- package/widgets/BatchAttributeForm/css.js +1 -1
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
- package/widgets/BatchAttributeForm/types.d.ts +0 -7
- package/widgets/BatchAttributeForm.d.ts +7 -9
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.d.ts +12 -2
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor/compatibilityAdapters.js +2 -0
- package/widgets/Editor/components/PendingFeatureList.js +1 -1
- package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
- package/widgets/Editor/legacy/AddAssociationWorkflow.js +2 -0
- package/widgets/Editor/legacy/AddAssociationWorkflowData.js +2 -0
- package/widgets/Editor/legacy/CreateFeaturesWorkflow.js +2 -0
- package/widgets/Editor/legacy/CreateFeaturesWorkflowData.js +2 -0
- package/widgets/Editor/legacy/MergeFeaturesWorkflow.js +2 -0
- package/widgets/Editor/legacy/MergeFeaturesWorkflowData.js +2 -0
- package/widgets/Editor/legacy/SplitFeatureWorkflow.js +2 -0
- package/widgets/Editor/legacy/SplitFeatureWorkflowData.js +2 -0
- package/widgets/Editor/legacy/UpdateFeatureWorkflow.js +2 -0
- package/widgets/Editor/legacy/UpdateFeatureWorkflowData.js +2 -0
- package/widgets/Editor/legacy/UpdateFeaturesWorkflow.js +2 -0
- package/widgets/Editor/legacy/UpdateFeaturesWorkflowData.js +2 -0
- package/widgets/Editor/legacy/UpdateRecordWorkflow.js +2 -0
- package/widgets/Editor/legacy/UpdateRecordWorkflowData.js +2 -0
- package/widgets/Editor/legacy/UpdateWorkflow.js +2 -0
- package/widgets/Editor/legacy/UpdateWorkflowData.js +2 -0
- package/widgets/Editor/legacy/Workflow.js +2 -0
- package/widgets/Editor/legacy/workflowUtils.js +2 -0
- package/widgets/Editor/types.d.ts +12 -0
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.d.ts +16 -12
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm.d.ts +14 -16
- package/widgets/FeatureTable/FeatureTableViewModel.d.ts +2 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable/Grid/GridViewModel.d.ts +3 -0
- package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/types.d.ts +20 -0
- package/widgets/FeatureTable.d.ts +14 -2
- package/widgets/FeatureTable.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageLocationWidget.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/navigation/queries.js +1 -1
- package/widgets/OrientedImageryViewer/navigation/utils.js +1 -1
- package/widgets/OrientedImageryViewer/support/panConstraint.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/057d288d795b853295f1.js +0 -2
- package/assets/esri/core/workers/chunks/26aa8190ac439f634c5b.js +0 -1
- package/assets/esri/core/workers/chunks/3192586ec7fc73ed1165.js +0 -1
- package/assets/esri/core/workers/chunks/33866e6e6de1bab64599.js +0 -1
- package/assets/esri/core/workers/chunks/360fd810d70d21c092d9.js +0 -1
- package/assets/esri/core/workers/chunks/3e89f487c5851c954d8b.js +0 -1
- package/assets/esri/core/workers/chunks/5aa375b0c6a205134703.js +0 -1
- package/assets/esri/core/workers/chunks/5f0bc019add4aff3130c.js +0 -1
- package/assets/esri/core/workers/chunks/630ad47857de3cf726d1.js +0 -1
- package/assets/esri/core/workers/chunks/754f7ed62afc4e0a1972.js +0 -2
- package/assets/esri/core/workers/chunks/7ee76504e7fea389a1c9.js +0 -1
- package/assets/esri/core/workers/chunks/8331e04ebe0a54b04ab6.js +0 -1
- package/assets/esri/core/workers/chunks/8c64c6b8d7376a9d1c91.js +0 -1
- package/assets/esri/core/workers/chunks/c30ca771dd3f7198142b.js +0 -1
- package/assets/esri/core/workers/chunks/e5fcd8e7a4a660ef6ad6.js +0 -1
- package/assets/esri/core/workers/chunks/f47319d36f1527277923.js +0 -1
- package/assets/esri/core/workers/chunks/ff00ac01f0baaecaa890.js +0 -1
- /package/assets/esri/core/workers/chunks/{eccbddaec4be44c86f79.js.LICENSE.txt → 1040bce57ea63a6dbca4.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{057d288d795b853295f1.js.LICENSE.txt → 353c67da4b25c29360db.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{44b30bce8e9a75b9e1b3.js.LICENSE.txt → 47948c72bc01bd173c20.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{754f7ed62afc4e0a1972.js.LICENSE.txt → dd0acd0f8b96839b4f24.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{2dbd88566abac030e965.js.LICENSE.txt → f859c53432f258af77e3.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{substitute as e}from"../../intl.js";import{equalsShallow as t}from"../../core/lang.js";import{isSubtypeSublayer as n,getSubtypesFromLayer as
|
|
2
|
+
import{substitute as e}from"../../intl.js";import{equalsShallow as t}from"../../core/lang.js";import{isLayerWithHistoricMoment as i}from"../../layers/mixins/EditBusLayer.js";import{isSubtypeSublayer as n,getSubtypesFromLayer as r}from"../../layers/support/layerUtils.js";import o from"../../rest/support/AttachmentQuery.js";import{unknown as a,utc as s}from"../../time/constants.js";import{ReactiveGraphic as l}from"./ReactiveGraphic.js";import{isMultipleChoiceFieldInput as u,isGroupInput as c}from"./inputs/support/inputUtils.js";import{getIntlOptionsForField as d}from"../support/dateUtils.js";import{isEmptyValue as p,getRangeErrorMessage as f,shouldUseScientificNotation as m,scientificNumberFormatOptions as y,numberFormatOptions as h}from"../support/forms/formUtils.js";const v=(e,t)=>null!=e&&e.input?.type===t;function b(e){return new l({source:e})}function g(t,i,n,r){const{dataType:o,minLength:a}=t,s=n?.validationErrors;if(!s||!i)return null;if("batch-attribute-form-validation::features-have-different-errors"===i)return s.invalidBatchFormType;if("input-validation-error::cannot-be-empty"===i)return s.cannotBeNull;if("domain-validation-error::value-out-of-range"===i||"numeric-range-validation-error::out-of-range"===i){const{field:i,range:n}=t,a={type:"date",intlOptions:{timeZone:"date"===i.type&&r?r:void 0,...d(i)}},l=f(n,s);return e(l,n,{format:{max:"date"===o?a:null!=n.max&&m(n.max)?y:h,min:"date"===o?a:null!=n.min&&m(n.min)?y:h}})}return"domain-validation-error::invalid-coded-value"===i?s.invalidCodedValue:"type-validation-error::invalid-type"===i?s.invalidType:"length-validation-error::too-short"===i?e(s.tooShort,{min:a}):"multiple-choice-validation-error::too-few-selected-choices"===i&&u(t)?e(s.tooFewSelectedChoices,{min:t.input.minimumChoices}):"multiple-choice-validation-error::too-many-selected-choices"===i&&u(t)?e(s.tooManySelectedChoices,{max:t.input.maximumChoices}):"length-validation-error::too-long"===i?null:"contingent-values-validation-error::contingency-violation-warning"===i||"contingent-values-validation-error::contingency-violation-error"===i?s.valuesIncompatible:null}function w(e,t,i){const n=i?.validationErrors;if(!n)return null;let r=null;for(const o of e.invalidHiddenInputs)switch(o.effectiveVisibilityCode){case"hidden:visibility-expression:all-features":case"hidden:group-visibility-expression:all-features":case"hidden:field-definition":return"single"===t?n.nonVisibleError_changeValues:n.nonVisibleError_checkIndividualFeatures;case"hidden:no-domain-in-common":case"hidden:visibility-expression:some-features":case"hidden:group-visibility-expression:some-features":case"hidden:not-in-all-layers":r=n.nonVisibleError_checkIndividualFeatures;break;case"visible":continue;default:o.effectiveVisibilityCode}return r}function j(e){return null!=e&&"object"==typeof e&&"type"in e&&("feature"===e.type||"geojson"===e.type||"knowledge-graph-sublayer"===e.type||"oriented-imagery"===e.type||"scene"===e.type||"subtype-sublayer"===e.type)}function x(e){return!!j(e)||!!(null!=e&&"object"==typeof e&&"type"in e&&e.type&&"id"in e&&e.id&&"fields"in e&&e.fields&&"fieldsIndex"in e&&e.fieldsIndex&&"objectIdField"in e&&e.objectIdField&&"capabilities"in e&&"getField"in e&&e.getField)}function C(e){return x(e)&&"queryAttachments"in e}function I(e){return null!=e&&"object"==typeof e&&"type"in e&&("feature"===e.type||"subtype-sublayer"===e.type)}function k(e){if(!C(e))return!1;const t=e?.effectiveCapabilities??e?.capabilities;return!(!t?.data?.supportsAttachment||!t.operations.supportsQueryAttachments)}async function T(e,t,r){const a=new Set;let s=!1;for(const i of r){if("attachment"===i.input?.type&&("any"===i.input.attachmentAssociationType||"exactOrNone"===i.input.attachmentAssociationType)){s=!0;break}if(p(i.attachmentKeyword)){s=!0;break}a.add(i.attachmentKeyword)}const l=a.size&&!s?Array.from(a):void 0,u=new o({objectIds:[t],where:"1=1",returnMetadata:!0,keywords:l});e.capabilities?.query?.supportsCacheHint&&(u.cacheHint=!0);const c=n(e)?e.parent:e;i(c)&&c.historicMoment&&(u.historicMoment=c.historicMoment);return(await e.queryAttachments(u))[t]??[]}function V(e,t,i,n){const r=e.get(t)?.get(i)??[];if(!n?.length)return r;const o=new Set(n.map(e=>e.toLowerCase()));return r.filter(e=>o.has(e.keywords.toLowerCase()))}function A(e,i,n){const o=r(e),a=o?.find(e=>e.code===n);if(!a)return!1;const s=o?.find(e=>e.code===i);return!t(a.defaultValues,s?.defaultValues)&&Object.values(a.defaultValues).some(e=>null!=e)}function F(e){return e.reduce((e,t)=>c(t)?[...e,...t.inputs]:[...e,t],[])}function E(e){return n(e)&&e.parent&&(e=e.parent),e&&"datesInUnknownTimezone"in e&&e.datesInUnknownTimezone?a:e&&"preferredTimeZone"in e&&e.preferredTimeZone?e.preferredTimeZone:null}function U(e,t){return e||t?t===a?s:e&&e!==a?e:t??"system":"system"}export{b as createReactiveGraphic,F as flattenInputs,V as getAttachmentsForKeywords,U as getEffectiveTimeZone,w as getHiddenFieldsValidationErrorMessage,E as getLayerTimeZone,g as getVisibleFieldInputValidationErrorMessage,I as isAssociationsLayerUnion,x as isAttributeFormSupportedLayer,j as isAttributeFormSupportedLayerUnion,C as isAttributeFormSupportedLayerWithAttachments,v as isElementTemplateWithInputType,k as layerSupportsQueryAttachments,T as queryAttachmentsForElements,A as subtypeChangeShouldPrompt};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
const t="esri-batch-attribute-form",e=`${t}__group`,a=`${t}__input`,i=`${t}__attachment-element`,n=`${t}__relationship-element-input`,l=`${t}__multiple-choice-input`,m={base:t,form:`${t}__form`,formHeader:`${t}__form-header`,noticeError:`${t}__notice-error`,disabledNotice:`${t}__disabled-notice`,label:`${t}__label`,labelTextContent:`${t}__label-text-content`,fieldInput:`${a}`,inputRadio:`${a}--radio`,placeholderRadio:`${a}--radio-placeholder`,inputRadioGroup:`${a}--radio-group`,inputRadioLabel:`${a}--radio-label`,inputDisabled:`${a}--disabled`,inputSwitch:`${a}--switch`,dateInputContainer:`${`${t}__date`}-input-container`,textElementInput:`${t}__text-element-input`,attachmentElementInput:`${i}-input`,attachmentElementLabel:`${i}-label`,attachmentElementList:`${i}-list`,attachmentElementListItem:`${i}-list-item`,attachmentElementListItemStart:`${i}-list-item-start`,attachmentElementListItemStagedIndicator:`${i}-list-item-staged-indicator`,attachmentElementListItemThumb:`${i}-list-item-thumb`,attachmentElementListItemIcon:`${i}-list-item-icon`,attachmentElementEmptyState:`${i}-empty-state`,attachmentElementAddActions:`${i}-add-actions`,attachmentElementEmptyActionHint:`${i}-empty-action-hint`,attachmentElementEmptyActionHintValue:`${i}-empty-action-hint-value`,attachmentElementAllPanel:`${i}-all-panel`,attachmentElementAddPanel:`${i}-add-panel`,attachmentElementFileInput:`${i}-file-input`,attachmentElementAddDropzone:`${i}-add-dropzone`,attachmentElementAddDropzoneIcon:`${i}-add-dropzone-icon`,attachmentElementAddDropzoneHeading:`${i}-add-dropzone-heading`,attachmentElementAddDropzoneDetail:`${i}-add-dropzone-detail`,attachmentElementCaptureNotice:`${i}-capture-notice`,attachmentElementValidationCriteria:`${i}-validation-criteria`,attachmentElementDetail:`${i}-detail`,attachmentElementDetailPreview:`${i}-detail-preview`,attachmentElementDetailPreviewImage:`${i}-detail-preview-image`,attachmentElementDetailPreviewIcon:`${i}-detail-preview-icon`,attachmentElementDetailActions:`${i}-detail-actions`,attachmentElementDetailMetadata:`${i}-detail-metadata`,attachmentElementDetailMetadataGroup:`${i}-detail-metadata-group`,attachmentElementDetailFileNameRow:`${i}-detail-file-name-row`,attachmentElementDetailFileNameInput:`${i}-detail-file-name-input`,attachmentElementDetailMetadataLabel:`${i}-detail-metadata-label`,attachmentElementDetailMetadataValue:`${i}-detail-metadata-value`,relationshipElementInput:`${n}`,relationshipElementInputShowingAll:`${n}_showing-all`,relatedRecordsHeader:`${n}_header`,relatedRecordsDescription:`${n}_description`,relatedRecordsList:`${n}_list`,relatedRecordsListObserver:`${n}_list-observer`,relatedRecordsAddButton:`${n}_add-button`,utilityNetworkAssociationsElementInput:`${t}__utility-network-associations-element-input`,centeredButton:`${t}__centered-button`,description:`${t}__description-text`,group:e,groupSequential:`${e}--sequential`,individualElement:`${e}__individual-element`,multipleChoiceInput:`${l}`,multipleChoiceSelectAll:`${l}__select-all`,multipleChoiceOtherChoice:`${l}__other-choice`,multipleChoiceOtherChoiceWithSelectAll:`${l}__other-choice--with-select-all`};export{m as css};
|
|
2
|
+
const t="esri-batch-attribute-form",e=`${t}__group`,a=`${t}__input`,i=`${t}__attachment-element`,n=`${t}__relationship-element-input`,l=`${t}__multiple-choice-input`,m={base:t,form:`${t}__form`,formHeader:`${t}__form-header`,noticeError:`${t}__notice-error`,disabledNotice:`${t}__disabled-notice`,label:`${t}__label`,labelTextContent:`${t}__label-text-content`,fieldInput:`${a}`,inputRadio:`${a}--radio`,placeholderRadio:`${a}--radio-placeholder`,inputRadioGroup:`${a}--radio-group`,inputRadioLabel:`${a}--radio-label`,inputDisabled:`${a}--disabled`,inputSwitch:`${a}--switch`,dateInputContainer:`${`${t}__date`}-input-container`,textElementInput:`${t}__text-element-input`,attachmentElementInput:`${i}-input`,attachmentElementLabel:`${i}-label`,attachmentElementList:`${i}-list`,attachmentElementListItem:`${i}-list-item`,attachmentElementListItemStart:`${i}-list-item-start`,attachmentElementListItemStagedIndicator:`${i}-list-item-staged-indicator`,attachmentElementListItemThumb:`${i}-list-item-thumb`,attachmentElementListItemIcon:`${i}-list-item-icon`,attachmentElementEmptyState:`${i}-empty-state`,attachmentElementAddActions:`${i}-add-actions`,attachmentElementEmptyActionHint:`${i}-empty-action-hint`,attachmentElementEmptyActionHintValue:`${i}-empty-action-hint-value`,attachmentElementAllPanel:`${i}-all-panel`,attachmentElementAddPanel:`${i}-add-panel`,attachmentElementFileInput:`${i}-file-input`,attachmentElementAddDropzone:`${i}-add-dropzone`,attachmentElementAddDropzoneIcon:`${i}-add-dropzone-icon`,attachmentElementAddDropzoneHeading:`${i}-add-dropzone-heading`,attachmentElementAddDropzoneDetail:`${i}-add-dropzone-detail`,attachmentElementCaptureNotice:`${i}-capture-notice`,attachmentElementValidationCriteria:`${i}-validation-criteria`,attachmentElementDetail:`${i}-detail`,attachmentElementDetailPreview:`${i}-detail-preview`,attachmentElementDetailPreviewImage:`${i}-detail-preview-image`,attachmentElementDetailPreviewIcon:`${i}-detail-preview-icon`,attachmentElementDetailActions:`${i}-detail-actions`,attachmentElementDetailMetadata:`${i}-detail-metadata`,attachmentElementDetailMetadataGroup:`${i}-detail-metadata-group`,attachmentElementDetailFileNameRow:`${i}-detail-file-name-row`,attachmentElementDetailFileNameInput:`${i}-detail-file-name-input`,attachmentElementDetailMetadataLabel:`${i}-detail-metadata-label`,attachmentElementDetailMetadataValue:`${i}-detail-metadata-value`,relationshipElementInput:`${n}`,relationshipElementInputShowingAll:`${n}_showing-all`,relatedRecordsHeader:`${n}_header`,relatedRecordsDescription:`${n}_description`,relatedRecordsList:`${n}_list`,relatedRecordsListObserver:`${n}_list-observer`,relatedRecordsAddButton:`${n}_add-button`,utilityNetworkAssociationsElementInput:`${t}__utility-network-associations-element-input`,centeredButton:`${t}__centered-button`,description:`${t}__description-text`,group:e,groupActive:`${e}--active`,groupSequential:`${e}--sequential`,individualElement:`${e}__individual-element`,multipleChoiceInput:`${l}`,multipleChoiceSelectAll:`${l}__select-all`,multipleChoiceOtherChoice:`${l}__other-choice`,multipleChoiceOtherChoiceWithSelectAll:`${l}__other-choice--with-select-all`};export{m as css};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import e from"../../../request.js";import a from"../../../core/Collection.js";import n from"../../../core/Logger.js";import{isAbortError as i}from"../../../core/promiseUtils.js";import s from"../../../core/ReactiveMap.js";import r from"../../../core/ReactiveSet.js";import{generateBracedUUID as o}from"../../../core/uuid.js";import{property as d,subclass as l}from"../../../core/accessorSupport/decorators.js";import{getEffectiveLayerCapabilities as h}from"../../../layers/support/layerUtils.js";import c from"../../../rest/query/support/AttachmentInfo.js";import{getAttachmentCategoryForFile as m,getAttachmentCategoryForAttachment as p}from"../../Attachments/support/attachmentUtils.js";import{getAttachmentKey as u,getAttachmentUrl as g,preserveAttachmentFilenameExtension as y,attachmentValidationUtils as f}from"../attachmentUtils.js";import _ from"./EditableInput.js";import A from"./SingleFeatureInputAdapter.js";let U=-1;const v=["maximum-audio-length","maximum-file-size","maximum-image-size","minimum-number-of-files","maximum-number-of-files","maximum-video-length"];let S=class extends _{constructor(t){super(t),this.attachments=[],this.displayCount=3,this.group=null,this.single=new A({input:this}),this.type="attachment",this._initialAttachments=[],this._stagedAdds=new a,this._stagedDeletes=new r,this._stagedUpdates=new s,this._failedStagedUpdateHydrations=new r,this._pendingStagedUpdateHydrations=new s,this._temporaryAttachmentUrls=new s,this._validationCriterionStates=new s,this._hasUnsupportedFileTypeValidationError=!1}get allowUserRename(){return this.template.allowUserRename}get addDisabled(){const t=this.maxAttachmentCount,e=this.effectiveAttachmentCount;return null!=t&&e>=t}get effectiveAttachmentCount(){return this._initialAttachments.length-this._stagedDeletes.size+this._stagedAdds.length}get accept(){const{categories:t}=this;if(!t.size)return;const e=[];return t.has("image")&&e.push("image/*"),t.has("audio")&&e.push("audio/*"),t.has("video")&&e.push("video/*"),t.has("document")&&e.push("text/*","application/*","model/*"),e.length>0?e.join(","):void 0}get categories(){const t=new Set;for(const e of this._nestableInputs)T(t,e.type);return t}get _nestableInputs(){const{input:t}=this;return null==t?[]:"attachment"===t.type?t.inputTypes??[]:[t]}get attachmentKeyword(){return this.template.attachmentKeyword?.trim()}get displayFilename(){return this.template.displayFilename}get allAttachmentsVisibleOnDefaultPage(){return this.defaultPageAttachments.length===this.attachments.length}get canUploadFiles(){const t=this._nestableInputs;return!t.length||t.some(x)}get hasCaptureInputs(){return this._nestableInputs.some(b)}get captureMediaType(){const t=new Set;for(const e of this._nestableInputs)if(b(e))switch(e.type){case"audio":t.add("audio");break;case"video":t.add("video");break;case"image":case"signature":t.add("image")}return 1===t.size?Array.from(t)[0]:null}get isCaptureOnly(){const t=this._nestableInputs;return!!t.length&&t.every(w)}get defaultPageAttachments(){return this.attachments.slice(0,this.displayCount)}get feature(){return this.single.feature}get hasAttachmentChanges(){return this._stagedAdds.length>0||this._stagedUpdates.size>0||this._stagedDeletes.size>0}get hasInvalidAttachmentName(){return!!this.allowUserRename&&this.attachments.some(t=>0===t.name.trim().length)}get attachmentCount(){return this.attachments.length}get hasMinimumAttachmentCountNotMet(){const t=this.minAttachmentCount,e=this.effectiveAttachmentCount;return null!=t&&e<t}get hasReachedAttachmentLimit(){const t=this.maxAttachmentCount,e=this.effectiveAttachmentCount;return null!=t&&e===t}get hasExceededAttachmentLimit(){const t=this.maxAttachmentCount,e=this.effectiveAttachmentCount;return null!=t&&e>t}get hasPendingAttachmentUpdateData(){return this._pendingStagedUpdateHydrations.size>0}get input(){return this.template.input}get layer(){return this.single.layer}get maxAttachmentCount(){return this.template.maxAttachmentCount}get minAttachmentCount(){return this.template.minAttachmentCount}get supportsResize(){const{layer:t}=this;if(!t)return!1;const e=h(t);return!!e&&("attachment"in e&&!!e.attachment?.supportsResize)}get useOriginalFilename(){return this.template.useOriginalFilename}get valid(){const t=this.effectiveAttachmentCount,e=this.minAttachmentCount??-1/0,a=this.maxAttachmentCount??1/0,n=this.hasAttachmentChanges;return!(this._failedStagedUpdateHydrations.size>0||this.hasInvalidAttachmentName)&&(!(t<e||t>a)||!n)}get _expressionLayer(){const t=this.layer;if(t)return"scene"===t.type&&"associatedLayer"in t&&null!=t.associatedLayer?t.associatedLayer:"feature"===t.type?t:void 0}destroy(){this._clearTemporaryAttachmentUrls()}applyFetchedAttachments(t){for(const e of t)this._normalizeAttachmentName(e);this._initialAttachments=t,this._failedStagedUpdateHydrations.clear(),this._recomputeAttachments()}applyStashedEdits(t){const{adds:e,deletes:a,updates:n}=t;for(const i of e){const t=this._getAttachmentKey(i.info);this._stagedAdds.add({data:i.data,globalId:i.globalId??o(),info:i.info,key:t}),this._setTemporaryAttachmentUrl(t,i.data)}for(const i of n){const t=this._getAttachmentKey(i.info);this._stagedUpdates.set(t,{contentType:i.contentType,data:i.data,info:i.info,key:t,name:i.name,size:F(i)}),this._setTemporaryAttachmentUrl(t,i.data)}for(const i of a){const t=this._getAttachmentKey(i.info);this._stagedDeletes.add(t)}this._recomputeAttachments()}clearAttachmentChanges(){this.clearValidationCriteriaState(),this._clearTemporaryAttachmentUrls(),this._stagedAdds.removeAll(),this._stagedUpdates.clear(),this._stagedDeletes.clear(),this._failedStagedUpdateHydrations.clear(),this._pendingStagedUpdateHydrations.clear(),this._recomputeAttachments()}clearValidationCriteriaState(){this._validationCriterionStates.clear(),this._hasUnsupportedFileTypeValidationError=!1}get hasInvalidValidationCriteria(){for(const t of this._validationCriterionStates.values())if("danger"===t)return!0;return!1}get hasUnsupportedFileTypeValidationError(){return this._hasUnsupportedFileTypeValidationError}get validationCriterionStates(){return this._validationCriterionStates}getValidationCriterionState(t){return this._validationCriterionStates.get(t)??null}stageAddAttachment(t){const{contentType:e,data:a,name:n}=t,i=t.globalId??o(),s=a instanceof Blob?a.size:void 0,r=n.trim(),d=new c({contentType:e??void 0,globalId:i,id:U--,keywords:this.attachmentKeyword??void 0,name:r,size:s});return this._setTemporaryAttachmentUrl(i,a),this._stagedAdds.add({key:i,globalId:i,info:d,data:a}),this._recomputeAttachments(),d}async stageAddAttachments(t,e){this.clearValidationCriteriaState();const a=t.filter(t=>this.isFileAllowed(t));if(this._setUnsupportedFileTypeValidationError(a.length!==t.length),0===a.length)return[];const n=[],i=new Map,s=Date.now(),r={},o=this.attachmentCount,d=o+a.length;if(null!=this.minAttachmentCount&&this.minAttachmentCount>0&&this._setValidationCriterionState(r,"minimum-number-of-files",d>=this.minAttachmentCount?"success":"danger"),null!=this.maxAttachmentCount){const t=d<=this.maxAttachmentCount;if(this._setValidationCriterionState(r,"maximum-number-of-files",t?"success":"danger"),!t)return this._setValidationCriteriaState(r),[]}for(let l=0;l<a.length;l++){const t=a[l];if(!await this._validateAttachmentFile(t,o+n.length+1,r))continue;const d=t instanceof File?t.name:`attachment-${s}_${l+1}`,h=await this._resolveAttachmentFilename(d,e),c=this._makeUniqueFilenameForOperation(i,h);n.push(this.stageAddAttachment({contentType:t.type,data:t,name:c}))}return this._setValidationCriteriaState(r),n}findAttachment(t){if(t)return this.attachments.find(e=>u(e)===t)}getAttachmentEditState(t){const e=this._getAttachmentKey(t),a=e?this._initialAttachments.find(t=>this._getAttachmentKey(t)===e):void 0,n=a?.name??null,i=e?this._stagedUpdates.get(e):void 0,s=i?.name??t.name??null;return{initialName:n,isDeleted:!!e&&this._stagedDeletes.has(e),isRenamed:null!=s&&null!=n&&s!==n,isReplaced:!0===i?.isReplacement}}getAttachmentPreviewUrl(t,e){const a=this._getAttachmentKey(t);return(a?this._temporaryAttachmentUrls.get(a):void 0)??g(t,this.supportsResize,e)}async ensureStagedUpdateData(t){const e=this._getAttachmentKey(t);if(!e)return!1;const a=this._stagedUpdates.get(e);if(!a||a.data||this._stagedDeletes.has(e))return this._failedStagedUpdateHydrations.delete(e),!1;const n=this._pendingStagedUpdateHydrations.get(e);if(n)return await n;const i=this._hydrateStagedUpdateData(t);this._pendingStagedUpdateHydrations.set(e,i);try{return await i}finally{this._pendingStagedUpdateHydrations.get(e)===i&&this._pendingStagedUpdateHydrations.delete(e)}}async waitForPendingAttachmentUpdateData(){await Promise.allSettled(Array.from(this._pendingStagedUpdateHydrations.values()))}discardStagedEdits(t){const e=this._getAttachmentKey(t);if(!e)return;const a=this._stagedAdds.findIndex(t=>t.key===e);if(a>-1)return this._clearTemporaryAttachmentUrl(e),this._stagedAdds.removeAt(a),this._failedStagedUpdateHydrations.delete(e),this._pendingStagedUpdateHydrations.delete(e),void this._recomputeAttachments();this._clearTemporaryAttachmentUrl(e),this._stagedDeletes.delete(e),this._clearStagedUpdateTracking(e),this._recomputeAttachments()}isFileAllowed(t){const{categories:e}=this;if(!e.size)return!0;const a=m(t);return null!=a&&e.has(a)}isStagedAttachmentAddition(t){return"number"==typeof t.id&&t.id<0}stageDeleteAttachment(t){const e=this._getAttachmentKey(t);if(!e)return;const a=this._stagedAdds.findIndex(t=>t.key===e);if(a>-1)return this._clearTemporaryAttachmentUrl(e),this._stagedAdds.removeAt(a),this._failedStagedUpdateHydrations.delete(e),this._pendingStagedUpdateHydrations.delete(e),void this._recomputeAttachments();this._clearTemporaryAttachmentUrl(e),this._stagedDeletes.add(e),this._clearStagedUpdateTracking(e),this._recomputeAttachments()}stageRenameAttachment(t,e){const a=this._getAttachmentKey(t);if(!a)return;const n=this._stagedAdds.find(t=>t.key===a);if(n){const a=y(t.name,e);return n.info.name=a,void this._recomputeAttachments()}const i=this._stagedUpdates.get(a),s=this._getInitialAttachment(a)?.name??null,r=0===t.name.trim().length?s??t.name:t.name,o=y(r,e),d=null!=s&&o===s;if(d&&!0!==i?.isReplacement)return this._stagedUpdates.delete(a),this._failedStagedUpdateHydrations.delete(a),this._pendingStagedUpdateHydrations.delete(a),void this._recomputeAttachments();const l={key:a,...i,info:t};d?delete l.name:l.name=o,this._stagedUpdates.set(a,l),this._recomputeAttachments(),this.ensureStagedUpdateData(t)}async stageReplaceAttachment(t,e,a){if(this.clearValidationCriteriaState(),!this._isReplacementFileAllowed(t,e))return this._setUnsupportedFileTypeValidationError(!0),!1;const n={},i=await this._validateAttachmentFile(e,void 0,n);if(this._setValidationCriteriaState(n),!i)return!1;const s=e instanceof File?e.name:t.name,r=await this._resolveAttachmentFilename(s,a);return this._stageReplaceAttachment(t,e,r),!0}toSubmitEdits(){const t=[],e=[],a=[],n=this.feature?.plainGraphic;if(!n||0===this._stagedAdds.length&&0===this._stagedUpdates.size&&0===this._stagedDeletes.size)return null;const i=this.attachmentKeyword;for(const s of this._stagedAdds)null!=s.data&&t.push({feature:n,contentType:s.info.contentType,data:s.data,info:s.info,globalId:s.info.globalId,keywords:i,name:s.info.name});for(const s of this._stagedUpdates.values()){const t=null==s.name||s.name.trim().length>0;null!=s.data&&t&&e.push({feature:n,contentType:s.contentType,data:s.data,globalId:s.info.globalId,id:s.info.id,info:s.info,keywords:i,name:s.name})}for(const s of this._stagedDeletes.values()){const t=this._getInitialAttachment(s);t&&a.push({feature:n,contentType:t.contentType,globalId:t.globalId,id:t.id,info:t,keywords:i,name:t.name})}return 0===t.length&&0===e.length&&0===a.length?null:{label:this.template.label,keywords:i,adds:t,deletes:a,updates:e}}_recomputeAttachments(){const t=[];for(const e of this._stagedAdds)t.push(e.info);for(const e of this._initialAttachments){const a=this._getAttachmentKey(e);if(a&&this._stagedUpdates.has(a)){const n=this._stagedUpdates.get(a),i=e.clone();null!=n.name&&(i.name=n.name),null!=n.contentType&&(i.contentType=n.contentType),null!=n.size&&(i.size=n.size),t.push(i);continue}t.push(e)}this.attachments=t}async _computeAttachmentFilename(t,e){const a=this.template.filenameExpressionExecutor;if(!a)return t;const s=this.single.feature,r=s?.plainGraphic,o=this._expressionLayer,{attachmentKeyword:d,description:l,label:h}=this.template,c={$originalfeature:s?.original,$editcontext:{editType:e.editType},$layer:o,$featureset:o,$datastore:o?.url,$feature:r,$map:e.map,$formElement:{attachmentKeyword:d,description:l,label:h}},m={rawOutput:!0,spatialReference:e.spatialReference,timeZone:e.timeZone};try{const e=a.isAsync?await a.executeAsync(c,m):a.execute(c,m);if("string"==typeof e&&e.trim().length>0){const{extension:a}=I(t);return z(e.trim(),a)}}catch(p){i(p)||n.getLogger(this).error("Failed evaluating attachment filename expression",p)}return t}async _resolveAttachmentFilename(t,e){return!1===this.useOriginalFilename?await this._computeAttachmentFilename(t,e):t}_makeUniqueFilenameForOperation(t,e){const a=e.toLowerCase(),n=t.get(a)??0;if(t.set(a,n+1),0===n)return e;const{base:i,extension:s}=I(e);return z(`${i}_${n}`,s)}_setValidationCriteriaState(t){this._validationCriterionStates.clear();for(const e of v){const a=t[e];a&&this._validationCriterionStates.set(e,a)}}_setUnsupportedFileTypeValidationError(t){this._hasUnsupportedFileTypeValidationError!==t&&(this._hasUnsupportedFileTypeValidationError=t)}_setValidationCriterionState(t,e,a){"danger"!==t[e]&&(t[e]=a)}_isReplacementFileAllowed(t,e){const a=m(e);if(!this.isFileAllowed(e))return!1;const n=p(t);return null==n||n===a}async _validateAttachmentFile(t,e,a){let n=!0;const i=m(t);for(const s of this._nestableInputs){const e=f.getAttachmentCategoryForInputType(s.type);if(null==i||e===i){if("document"===s.type&&null!=s.maxFileSize){const e=t.size<=1048576*s.maxFileSize;this._setValidationCriterionState(a,"maximum-file-size",e?"success":"danger"),n=n&&e}if(("audio"===s.type||"video"===s.type)&&null!=s.maxDuration){const e=await f.getMediaDurationInSeconds(t,s.type),i=null!=e&&e<=s.maxDuration;this._setValidationCriterionState(a,"audio"===s.type?"maximum-audio-length":"maximum-video-length",i?"success":"danger"),n=n&&i}if("image"===s.type&&null!=s.maxImageSize){const e=await f.getImageDimensionsInPixels(t),i=e?Math.max(e.width,e.height):null,r=null==i||i<=s.maxImageSize;this._setValidationCriterionState(a,"maximum-image-size",r?"success":"danger"),n=n&&r}}}if(null!=e&&null!=this.maxAttachmentCount){const t=e<=this.maxAttachmentCount;this._setValidationCriterionState(a,"maximum-number-of-files",t?"success":"danger"),n=n&&t}return n}_stageReplaceAttachment(t,e,a){const n=this._getAttachmentKey(t);if(!n)return;const i=this._stagedAdds.find(t=>t.key===n);if(i)return i.data=e,i.info.name=a,i.info.contentType=e.type,i.info.size=e.size,this._setTemporaryAttachmentUrl(n,e),void this._recomputeAttachments();const s=this._stagedUpdates.get(n);this._setTemporaryAttachmentUrl(n,e),this._failedStagedUpdateHydrations.delete(n),this._pendingStagedUpdateHydrations.delete(n),this._stagedUpdates.set(n,{...s,key:n,info:t,isReplacement:!0,contentType:e.type||s?.contentType||t.contentType,data:e,name:a,size:e.size}),this._recomputeAttachments()}_getInitialAttachment(t){return this._initialAttachments.find(e=>this._getAttachmentKey(e)===t)}_normalizeAttachmentName(t){const{name:e}=t;"string"==typeof e&&(t.name=e.trim())}_getAttachmentKey(t){return u(t)}_clearStagedUpdateTracking(t){this._stagedUpdates.delete(t),this._failedStagedUpdateHydrations.delete(t),this._pendingStagedUpdateHydrations.delete(t)}async _hydrateStagedUpdateData(t){const a=this._getAttachmentKey(t),s=t.url;if(!a||!s)return!1;try{const{data:n}=await e(s,{responseType:"blob"});this._failedStagedUpdateHydrations.delete(a);const i=this._stagedUpdates.get(a);return!(!i||i.data||this._stagedDeletes.has(a))&&(this._stagedUpdates.set(a,{...i,info:t,isReplacement:i.isReplacement??!1,contentType:i.contentType??t.contentType??n.type,data:n}),!0)}catch(r){const t=this._stagedUpdates.get(a);return!t||t.data||this._stagedDeletes.has(a)||this._failedStagedUpdateHydrations.add(a),i(r)||n.getLogger(this).error("Failed to fetch attachment data for staged update",r),!1}}_setTemporaryAttachmentUrl(t,e){if(this._clearTemporaryAttachmentUrl(t),!(e instanceof Blob))return;const a=URL.createObjectURL(e);return this._temporaryAttachmentUrls.set(t,a),a}_clearTemporaryAttachmentUrl(t){const e=this._temporaryAttachmentUrls.get(t);e&&(URL.revokeObjectURL(e),this._temporaryAttachmentUrls.delete(t))}_clearTemporaryAttachmentUrls(){for(const t of this._temporaryAttachmentUrls.values())URL.revokeObjectURL(t);this._temporaryAttachmentUrls.clear()}};t([d()],S.prototype,"allowUserRename",null),t([d()],S.prototype,"addDisabled",null),t([d()],S.prototype,"effectiveAttachmentCount",null),t([d()],S.prototype,"accept",null),t([d()],S.prototype,"categories",null),t([d()],S.prototype,"attachmentKeyword",null),t([d()],S.prototype,"attachments",void 0),t([d()],S.prototype,"displayFilename",null),t([d({readOnly:!0})],S.prototype,"allAttachmentsVisibleOnDefaultPage",null),t([d()],S.prototype,"canUploadFiles",null),t([d()],S.prototype,"hasCaptureInputs",null),t([d()],S.prototype,"captureMediaType",null),t([d()],S.prototype,"isCaptureOnly",null),t([d({readOnly:!0})],S.prototype,"defaultPageAttachments",null),t([d()],S.prototype,"displayCount",void 0),t([d()],S.prototype,"feature",null),t([d()],S.prototype,"group",void 0),t([d()],S.prototype,"hasAttachmentChanges",null),t([d()],S.prototype,"hasInvalidAttachmentName",null),t([d()],S.prototype,"attachmentCount",null),t([d()],S.prototype,"hasMinimumAttachmentCountNotMet",null),t([d()],S.prototype,"hasReachedAttachmentLimit",null),t([d()],S.prototype,"hasExceededAttachmentLimit",null),t([d({readOnly:!0})],S.prototype,"hasPendingAttachmentUpdateData",null),t([d()],S.prototype,"input",null),t([d()],S.prototype,"layer",null),t([d()],S.prototype,"maxAttachmentCount",null),t([d()],S.prototype,"minAttachmentCount",null),t([d({readOnly:!0})],S.prototype,"single",void 0),t([d({readOnly:!0})],S.prototype,"type",void 0),t([d({readOnly:!0})],S.prototype,"supportsResize",null),t([d()],S.prototype,"useOriginalFilename",null),t([d({readOnly:!0})],S.prototype,"valid",null),t([d()],S.prototype,"_initialAttachments",void 0),t([d()],S.prototype,"_expressionLayer",null),t([d()],S.prototype,"_stagedAdds",void 0),t([d()],S.prototype,"_stagedDeletes",void 0),t([d()],S.prototype,"_stagedUpdates",void 0),t([d()],S.prototype,"_failedStagedUpdateHydrations",void 0),t([d()],S.prototype,"_pendingStagedUpdateHydrations",void 0),t([d()],S.prototype,"_temporaryAttachmentUrls",void 0),t([d()],S.prototype,"_hasUnsupportedFileTypeValidationError",void 0),t([d()],S.prototype,"hasInvalidValidationCriteria",null),t([d()],S.prototype,"hasUnsupportedFileTypeValidationError",null),t([d()],S.prototype,"validationCriterionStates",null),S=t([l("esri.widgets.BatchAttributeForm.inputs.AttachmentElementInput")],S);const C=S;function T(t,e){switch(e){case"audio":t.add("audio");break;case"document":t.add("document");break;case"image":case"signature":t.add("image");break;case"video":t.add("video")}}function w(t){return"document"!==t.type&&"capture"===t.inputMethod}function b(t){return w(t)}function x(t){return"document"===t.type||"capture"!==t.inputMethod}function F(t){return t.data&&"string"!=typeof t.data?t.data.size:t.info.size}function I(t){const e=t.lastIndexOf(".");return-1===e?{base:t,extension:null}:{base:t.slice(0,e),extension:t.slice(e+1)}}function z(t,e){return e?`${t}.${e}`:t}export{C as default};
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../../request.js";import a from"../../../core/Collection.js";import n from"../../../core/Logger.js";import{isAbortError as i}from"../../../core/promiseUtils.js";import s from"../../../core/ReactiveMap.js";import r from"../../../core/ReactiveSet.js";import{generateBracedUUID as o}from"../../../core/uuid.js";import{property as d,subclass as l}from"../../../core/accessorSupport/decorators.js";import{getEffectiveLayerCapabilities as h}from"../../../layers/support/layerUtils.js";import c from"../../../rest/query/support/AttachmentInfo.js";import{getAttachmentCategoryForFile as m,getAttachmentCategoryForAttachment as p}from"../../Attachments/support/attachmentUtils.js";import{getAttachmentKey as u,getAttachmentUrl as g,preserveAttachmentFilenameExtension as y,attachmentValidationUtils as f}from"../attachmentUtils.js";import _ from"./EditableInput.js";import A from"./SingleFeatureInputAdapter.js";let U=-1;const v=["maximum-audio-length","maximum-file-size","maximum-image-size","minimum-number-of-files","maximum-number-of-files","maximum-video-length"];let S=class extends _{constructor(t){super(t),this.attachments=[],this.displayCount=3,this.group=null,this.single=new A({input:this}),this.type="attachment",this._initialAttachments=[],this._stagedAdds=new a,this._stagedDeletes=new r,this._stagedUpdates=new s,this._failedStagedUpdateHydrations=new r,this._pendingStagedUpdateHydrations=new s,this._temporaryAttachmentUrls=new s,this._validationCriterionStates=new s,this._hasUnsupportedFileTypeValidationError=!1}get allowUserRename(){return this.template.allowUserRename}get addDisabled(){const t=this.maxAttachmentCount,e=this.effectiveAttachmentCount;return null!=t&&e>=t}get effectiveAttachmentCount(){return this._initialAttachments.length-this._stagedDeletes.size+this._stagedAdds.length}get accept(){const{categories:t}=this;if(!t.size)return;const e=[];return t.has("image")&&e.push("image/*"),t.has("audio")&&e.push("audio/*"),t.has("video")&&e.push("video/*"),t.has("document")&&e.push("text/*","application/*","model/*"),e.length>0?e.join(","):void 0}get categories(){const t=new Set;for(const e of this._nestableInputs)T(t,e.type);return t}get _nestableInputs(){const{input:t}=this;return null==t?[]:"attachment"===t.type?t.inputTypes??[]:[t]}get attachmentKeyword(){return this.template.attachmentKeyword?.trim()}get displayFilename(){return this.template.displayFilename}get allAttachmentsVisibleOnDefaultPage(){return this.defaultPageAttachments.length===this.attachments.length}get canUploadFiles(){const t=this._nestableInputs;return!t.length||t.some(x)}get hasCaptureInputs(){return this._nestableInputs.some(b)}get captureMediaType(){const t=new Set;for(const e of this._nestableInputs)if(b(e))switch(e.type){case"audio":t.add("audio");break;case"video":t.add("video");break;case"image":case"signature":t.add("image")}return 1===t.size?Array.from(t)[0]:null}get isCaptureOnly(){const t=this._nestableInputs;return!!t.length&&t.every(w)}get defaultPageAttachments(){return this.attachments.slice(0,this.displayCount)}get feature(){return this.single.feature}get hasAttachmentChanges(){return this._stagedAdds.length>0||this._stagedUpdates.size>0||this._stagedDeletes.size>0}get hasInvalidAttachmentName(){return!!this.allowUserRename&&this.attachments.some(t=>0===t.name.trim().length)}get attachmentCount(){return this.attachments.length}get hasMinimumAttachmentCountNotMet(){const t=this.minAttachmentCount;return null!=t&&(this.effectiveAttachmentCount<t&&!this.isCaptureOnly)}get hasReachedAttachmentLimit(){const t=this.maxAttachmentCount,e=this.effectiveAttachmentCount;return null!=t&&e===t}get hasExceededAttachmentLimit(){const t=this.maxAttachmentCount,e=this.effectiveAttachmentCount;return null!=t&&e>t}get hasPendingAttachmentUpdateData(){return this._pendingStagedUpdateHydrations.size>0}get input(){return this.template.input}get layer(){return this.single.layer}get maxAttachmentCount(){return this.template.maxAttachmentCount}get minAttachmentCount(){return this.template.minAttachmentCount}get supportsResize(){const{layer:t}=this;if(!t)return!1;const e=h(t);return!!e&&("attachment"in e&&!!e.attachment?.supportsResize)}get useOriginalFilename(){return this.template.useOriginalFilename}get valid(){return!(this._failedStagedUpdateHydrations.size>0||this.hasInvalidAttachmentName||this.hasExceededAttachmentLimit||this.hasMinimumAttachmentCountNotMet)}get _expressionLayer(){const t=this.layer;if(t)return"scene"===t.type&&"associatedLayer"in t&&null!=t.associatedLayer?t.associatedLayer:"feature"===t.type?t:void 0}destroy(){this._clearTemporaryAttachmentUrls()}applyFetchedAttachments(t){for(const e of t)this._normalizeAttachmentName(e);this._initialAttachments=t,this._failedStagedUpdateHydrations.clear(),this._recomputeAttachments()}applyStashedEdits(t){const{adds:e,deletes:a,updates:n}=t;for(const i of e){const t=this._getAttachmentKey(i.info);this._stagedAdds.add({data:i.data,globalId:i.globalId??o(),info:i.info,key:t}),this._setTemporaryAttachmentUrl(t,i.data)}for(const i of n){const t=this._getAttachmentKey(i.info);this._stagedUpdates.set(t,{contentType:i.contentType,data:i.data,info:i.info,key:t,name:i.name,size:F(i)}),this._setTemporaryAttachmentUrl(t,i.data)}for(const i of a){const t=this._getAttachmentKey(i.info);this._stagedDeletes.add(t)}this._recomputeAttachments()}clearAttachmentChanges(){this.clearValidationCriteriaState(),this._clearTemporaryAttachmentUrls(),this._stagedAdds.removeAll(),this._stagedUpdates.clear(),this._stagedDeletes.clear(),this._failedStagedUpdateHydrations.clear(),this._pendingStagedUpdateHydrations.clear(),this._recomputeAttachments()}clearValidationCriteriaState(){this._validationCriterionStates.clear(),this._hasUnsupportedFileTypeValidationError=!1}get hasInvalidValidationCriteria(){for(const t of this._validationCriterionStates.values())if("danger"===t)return!0;return!1}get hasUnsupportedFileTypeValidationError(){return this._hasUnsupportedFileTypeValidationError}get validationCriterionStates(){return this._validationCriterionStates}getValidationCriterionState(t){return this._validationCriterionStates.get(t)??null}stageAddAttachment(t){const{contentType:e,data:a,name:n}=t,i=t.globalId??o(),s=a instanceof Blob?a.size:void 0,r=n.trim(),d=new c({contentType:e??void 0,globalId:i,id:U--,keywords:this.attachmentKeyword??void 0,name:r,size:s});return this._setTemporaryAttachmentUrl(i,a),this._stagedAdds.add({key:i,globalId:i,info:d,data:a}),this._recomputeAttachments(),d}async stageAddAttachments(t,e){this.clearValidationCriteriaState();const a=t.filter(t=>this.isFileAllowed(t));if(this._setUnsupportedFileTypeValidationError(a.length!==t.length),0===a.length)return[];const n=[],i=new Map,s=Date.now(),r={},o=this.effectiveAttachmentCount,d=o+a.length;if(null!=this.minAttachmentCount&&this.minAttachmentCount>0&&this._setValidationCriterionState(r,"minimum-number-of-files",d>=this.minAttachmentCount?"success":"danger"),null!=this.maxAttachmentCount){const t=d<=this.maxAttachmentCount;if(this._setValidationCriterionState(r,"maximum-number-of-files",t?"success":"danger"),!t)return this._setValidationCriteriaState(r),[]}for(let l=0;l<a.length;l++){const t=a[l];if(!await this._validateAttachmentFile(t,o+n.length+1,r))continue;const d=t instanceof File?t.name:`attachment-${s}_${l+1}`,h=await this._resolveAttachmentFilename(d,e),c=this._makeUniqueFilenameForOperation(i,h);n.push(this.stageAddAttachment({contentType:t.type,data:t,name:c}))}return this._setValidationCriteriaState(r),n}findAttachment(t){if(t)return this.attachments.find(e=>u(e)===t)}getAttachmentEditState(t){const e=this._getAttachmentKey(t),a=e?this._initialAttachments.find(t=>this._getAttachmentKey(t)===e):void 0,n=a?.name??null,i=e?this._stagedUpdates.get(e):void 0,s=i?.name??t.name??null;return{initialName:n,isDeleted:!!e&&this._stagedDeletes.has(e),isRenamed:null!=s&&null!=n&&s!==n,isReplaced:!0===i?.isReplacement}}getAttachmentPreviewUrl(t,e){const a=this._getAttachmentKey(t);return(a?this._temporaryAttachmentUrls.get(a):void 0)??g({attachment:t,supportsResizeAttachments:this.supportsResize,layer:this.layer,thumbnailSize:e})}async ensureStagedUpdateData(t){const e=this._getAttachmentKey(t);if(!e)return!1;const a=this._stagedUpdates.get(e);if(!a||a.data||this._stagedDeletes.has(e))return this._failedStagedUpdateHydrations.delete(e),!1;const n=this._pendingStagedUpdateHydrations.get(e);if(n)return await n;const i=this._hydrateStagedUpdateData(t);this._pendingStagedUpdateHydrations.set(e,i);try{return await i}finally{this._pendingStagedUpdateHydrations.get(e)===i&&this._pendingStagedUpdateHydrations.delete(e)}}async waitForPendingAttachmentUpdateData(){await Promise.allSettled(Array.from(this._pendingStagedUpdateHydrations.values()))}discardStagedEdits(t){const e=this._getAttachmentKey(t);if(!e)return;const a=this._stagedAdds.findIndex(t=>t.key===e);if(a>-1)return this._clearTemporaryAttachmentUrl(e),this._stagedAdds.removeAt(a),this._failedStagedUpdateHydrations.delete(e),this._pendingStagedUpdateHydrations.delete(e),void this._recomputeAttachments();this._clearTemporaryAttachmentUrl(e),this._stagedDeletes.delete(e),this._clearStagedUpdateTracking(e),this._recomputeAttachments()}isFileAllowed(t){const{categories:e}=this;if(!e.size)return!0;const a=m(t);return null!=a&&e.has(a)}isStagedAttachmentAddition(t){return"number"==typeof t.id&&t.id<0}stageDeleteAttachment(t){const e=this._getAttachmentKey(t);if(!e)return;const a=this._stagedAdds.findIndex(t=>t.key===e);if(a>-1)return this._clearTemporaryAttachmentUrl(e),this._stagedAdds.removeAt(a),this._failedStagedUpdateHydrations.delete(e),this._pendingStagedUpdateHydrations.delete(e),void this._recomputeAttachments();this._clearTemporaryAttachmentUrl(e),this._stagedDeletes.add(e),this._clearStagedUpdateTracking(e),this._recomputeAttachments()}stageRenameAttachment(t,e){const a=this._getAttachmentKey(t);if(!a)return;const n=this._stagedAdds.find(t=>t.key===a);if(n){const a=y(t.name,e);return n.info.name=a,void this._recomputeAttachments()}const i=this._stagedUpdates.get(a),s=this._getInitialAttachment(a)?.name??null,r=0===t.name.trim().length?s??t.name:t.name,o=y(r,e),d=null!=s&&o===s;if(d&&!0!==i?.isReplacement)return this._stagedUpdates.delete(a),this._failedStagedUpdateHydrations.delete(a),this._pendingStagedUpdateHydrations.delete(a),void this._recomputeAttachments();const l={key:a,...i,info:t};d?delete l.name:l.name=o,this._stagedUpdates.set(a,l),this._recomputeAttachments(),this.ensureStagedUpdateData(t)}async stageReplaceAttachment(t,e,a){if(this.clearValidationCriteriaState(),!this._isReplacementFileAllowed(t,e))return this._setUnsupportedFileTypeValidationError(!0),!1;const n={},i=await this._validateAttachmentFile(e,void 0,n);if(this._setValidationCriteriaState(n),!i)return!1;const s=e instanceof File?e.name:t.name,r=await this._resolveAttachmentFilename(s,a);return this._stageReplaceAttachment(t,e,r),!0}toSubmitEdits(){const t=[],e=[],a=[],n=this.feature?.plainGraphic;if(!n||0===this._stagedAdds.length&&0===this._stagedUpdates.size&&0===this._stagedDeletes.size)return null;const i=this.attachmentKeyword;for(const s of this._stagedAdds)null!=s.data&&t.push({feature:n,contentType:s.info.contentType,data:s.data,info:s.info,globalId:s.info.globalId,keywords:i,name:s.info.name});for(const s of this._stagedUpdates.values()){const t=null==s.name||s.name.trim().length>0;null!=s.data&&t&&e.push({feature:n,contentType:s.contentType,data:s.data,globalId:s.info.globalId,id:s.info.id,info:s.info,keywords:i,name:s.name})}for(const s of this._stagedDeletes.values()){const t=this._getInitialAttachment(s);t&&a.push({feature:n,contentType:t.contentType,globalId:t.globalId,id:t.id,info:t,keywords:i,name:t.name})}return 0===t.length&&0===e.length&&0===a.length?null:{label:this.template.label,keywords:i,adds:t,deletes:a,updates:e}}_recomputeAttachments(){const t=[];for(const e of this._stagedAdds)t.push(e.info);for(const e of this._initialAttachments){const a=this._getAttachmentKey(e);if(a&&this._stagedUpdates.has(a)){const n=this._stagedUpdates.get(a),i=e.clone();null!=n.name&&(i.name=n.name),null!=n.contentType&&(i.contentType=n.contentType),null!=n.size&&(i.size=n.size),t.push(i);continue}t.push(e)}this.attachments=t}async _computeAttachmentFilename(t,e){const a=this.template.filenameExpressionExecutor;if(!a)return t;const s=this.single.feature,r=s?.plainGraphic,o=this._expressionLayer,{attachmentKeyword:d,description:l,label:h}=this.template,c={$originalfeature:s?.original,$editcontext:{editType:e.editType},$layer:o,$featureset:o,$datastore:o?.url,$feature:r,$map:e.map,$formElement:{attachmentKeyword:d,description:l,label:h}},m={rawOutput:!0,spatialReference:e.spatialReference,timeZone:e.timeZone};try{const e=a.isAsync?await a.executeAsync(c,m):a.execute(c,m);if("string"==typeof e&&e.trim().length>0){const{extension:a}=I(t);return z(e.trim(),a)}}catch(p){i(p)||n.getLogger(this).error("Failed evaluating attachment filename expression",p)}return t}async _resolveAttachmentFilename(t,e){return!1===this.useOriginalFilename?await this._computeAttachmentFilename(t,e):t}_makeUniqueFilenameForOperation(t,e){const a=e.toLowerCase(),n=t.get(a)??0;if(t.set(a,n+1),0===n)return e;const{base:i,extension:s}=I(e);return z(`${i}_${n}`,s)}_setValidationCriteriaState(t){this._validationCriterionStates.clear();for(const e of v){const a=t[e];a&&this._validationCriterionStates.set(e,a)}}_setUnsupportedFileTypeValidationError(t){this._hasUnsupportedFileTypeValidationError!==t&&(this._hasUnsupportedFileTypeValidationError=t)}_setValidationCriterionState(t,e,a){"danger"!==t[e]&&(t[e]=a)}_isReplacementFileAllowed(t,e){const a=m(e);if(!this.isFileAllowed(e))return!1;const n=p(t);return null==n||n===a}async _validateAttachmentFile(t,e,a){let n=!0;const i=m(t);for(const s of this._nestableInputs){const e=f.getAttachmentCategoryForInputType(s.type);if(null==i||e===i){if("document"===s.type&&null!=s.maxFileSize){const e=t.size<=1048576*s.maxFileSize;this._setValidationCriterionState(a,"maximum-file-size",e?"success":"danger"),n=n&&e}if(("audio"===s.type||"video"===s.type)&&null!=s.maxDuration){const e=await f.getMediaDurationInSeconds(t,s.type),i=null!=e&&e<=s.maxDuration;this._setValidationCriterionState(a,"audio"===s.type?"maximum-audio-length":"maximum-video-length",i?"success":"danger"),n=n&&i}if("image"===s.type&&null!=s.maxImageSize){const e=await f.getImageDimensionsInPixels(t),i=e?Math.max(e.width,e.height):null,r=null==i||i<=s.maxImageSize;this._setValidationCriterionState(a,"maximum-image-size",r?"success":"danger"),n=n&&r}}}if(null!=e&&null!=this.maxAttachmentCount){const t=e<=this.maxAttachmentCount;this._setValidationCriterionState(a,"maximum-number-of-files",t?"success":"danger"),n=n&&t}return n}_stageReplaceAttachment(t,e,a){const n=this._getAttachmentKey(t);if(!n)return;const i=this._stagedAdds.find(t=>t.key===n);if(i)return i.data=e,i.info.name=a,i.info.contentType=e.type,i.info.size=e.size,this._setTemporaryAttachmentUrl(n,e),void this._recomputeAttachments();const s=this._stagedUpdates.get(n);this._setTemporaryAttachmentUrl(n,e),this._failedStagedUpdateHydrations.delete(n),this._pendingStagedUpdateHydrations.delete(n),this._stagedUpdates.set(n,{...s,key:n,info:t,isReplacement:!0,contentType:e.type||s?.contentType||t.contentType,data:e,name:a,size:e.size}),this._recomputeAttachments()}_getInitialAttachment(t){return this._initialAttachments.find(e=>this._getAttachmentKey(e)===t)}_normalizeAttachmentName(t){const{name:e}=t;"string"==typeof e&&(t.name=e.trim())}_getAttachmentKey(t){return u(t)}_clearStagedUpdateTracking(t){this._stagedUpdates.delete(t),this._failedStagedUpdateHydrations.delete(t),this._pendingStagedUpdateHydrations.delete(t)}async _hydrateStagedUpdateData(t){const a=this._getAttachmentKey(t),s=t.url;if(!a||!s)return!1;try{const{data:n}=await e(s,{responseType:"blob"});this._failedStagedUpdateHydrations.delete(a);const i=this._stagedUpdates.get(a);return!(!i||i.data||this._stagedDeletes.has(a))&&(this._stagedUpdates.set(a,{...i,info:t,isReplacement:i.isReplacement??!1,contentType:i.contentType??t.contentType??n.type,data:n}),!0)}catch(r){const t=this._stagedUpdates.get(a);return!t||t.data||this._stagedDeletes.has(a)||this._failedStagedUpdateHydrations.add(a),i(r)||n.getLogger(this).error("Failed to fetch attachment data for staged update",r),!1}}_setTemporaryAttachmentUrl(t,e){if(this._clearTemporaryAttachmentUrl(t),!(e instanceof Blob))return;const a=URL.createObjectURL(e);return this._temporaryAttachmentUrls.set(t,a),a}_clearTemporaryAttachmentUrl(t){const e=this._temporaryAttachmentUrls.get(t);e&&(URL.revokeObjectURL(e),this._temporaryAttachmentUrls.delete(t))}_clearTemporaryAttachmentUrls(){for(const t of this._temporaryAttachmentUrls.values())URL.revokeObjectURL(t);this._temporaryAttachmentUrls.clear()}};t([d()],S.prototype,"allowUserRename",null),t([d()],S.prototype,"addDisabled",null),t([d()],S.prototype,"effectiveAttachmentCount",null),t([d()],S.prototype,"accept",null),t([d()],S.prototype,"categories",null),t([d()],S.prototype,"attachmentKeyword",null),t([d()],S.prototype,"attachments",void 0),t([d()],S.prototype,"displayFilename",null),t([d({readOnly:!0})],S.prototype,"allAttachmentsVisibleOnDefaultPage",null),t([d()],S.prototype,"canUploadFiles",null),t([d()],S.prototype,"hasCaptureInputs",null),t([d()],S.prototype,"captureMediaType",null),t([d()],S.prototype,"isCaptureOnly",null),t([d({readOnly:!0})],S.prototype,"defaultPageAttachments",null),t([d()],S.prototype,"displayCount",void 0),t([d()],S.prototype,"feature",null),t([d()],S.prototype,"group",void 0),t([d()],S.prototype,"hasAttachmentChanges",null),t([d()],S.prototype,"hasInvalidAttachmentName",null),t([d()],S.prototype,"attachmentCount",null),t([d()],S.prototype,"hasMinimumAttachmentCountNotMet",null),t([d()],S.prototype,"hasReachedAttachmentLimit",null),t([d()],S.prototype,"hasExceededAttachmentLimit",null),t([d({readOnly:!0})],S.prototype,"hasPendingAttachmentUpdateData",null),t([d()],S.prototype,"input",null),t([d()],S.prototype,"layer",null),t([d()],S.prototype,"maxAttachmentCount",null),t([d()],S.prototype,"minAttachmentCount",null),t([d({readOnly:!0})],S.prototype,"single",void 0),t([d({readOnly:!0})],S.prototype,"type",void 0),t([d({readOnly:!0})],S.prototype,"supportsResize",null),t([d()],S.prototype,"useOriginalFilename",null),t([d({readOnly:!0})],S.prototype,"valid",null),t([d()],S.prototype,"_initialAttachments",void 0),t([d()],S.prototype,"_expressionLayer",null),t([d()],S.prototype,"_stagedAdds",void 0),t([d()],S.prototype,"_stagedDeletes",void 0),t([d()],S.prototype,"_stagedUpdates",void 0),t([d()],S.prototype,"_failedStagedUpdateHydrations",void 0),t([d()],S.prototype,"_pendingStagedUpdateHydrations",void 0),t([d()],S.prototype,"_temporaryAttachmentUrls",void 0),t([d()],S.prototype,"_hasUnsupportedFileTypeValidationError",void 0),t([d()],S.prototype,"hasInvalidValidationCriteria",null),t([d()],S.prototype,"hasUnsupportedFileTypeValidationError",null),t([d()],S.prototype,"validationCriterionStates",null),S=t([l("esri.widgets.BatchAttributeForm.inputs.AttachmentElementInput")],S);const C=S;function T(t,e){switch(e){case"audio":t.add("audio");break;case"document":t.add("document");break;case"image":case"signature":t.add("image");break;case"video":t.add("video")}}function w(t){return"document"!==t.type&&"capture"===t.inputMethod}function b(t){return w(t)}function x(t){return"document"===t.type||"capture"!==t.inputMethod}function F(t){return t.data&&"string"!=typeof t.data?t.data.size:t.info.size}function I(t){const e=t.lastIndexOf(".");return-1===e?{base:t,extension:null}:{base:t.slice(0,e),extension:t.slice(e+1)}}function z(t,e){return e?`${t}.${e}`:t}export{C as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{createArcadeProfile as e,createArcadeExecutor as t}from"../../../../arcade.js";import r from"../../../../core/Error.js";import
|
|
2
|
+
import{createArcadeProfile as e,createArcadeExecutor as t}from"../../../../arcade.js";import r from"../../../../core/Error.js";import o from"../../../../core/Logger.js";import{getEffectiveFieldAlias as n}from"../../../../editing/fieldUtils.js";import i from"../../../../form/ExpressionInfo.js";import s from"../../../../form/elements/AttachmentElement.js";import{isMultipleChoiceInput as a}from"../../../../form/elements/inputs/inputUtils.js";import{isAttachmentElement as l,isFieldElement as m,isGroupElement as c,isRelationshipElement as d,isTextElement as p,isUtilityNetworkAssociationsElement as f}from"../../../../form/support/formUtils.js";import{getLowerCaseEditTrackingFields as u,isFieldVisibleByDefault as x}from"../../../../layers/support/fieldUtils.js";import{isNumber as y}from"../../../../support/guards.js";import{layerSupportsQueryAttachments as h,getLayerTimeZone as E}from"../../batchAttributeFormUtils.js";import{makeExpressionInfosMap as w,makeExecutorSetForFormElement as T}from"../../expressions/expressionUtils.js";import{AttachmentElementTemplate as v}from"../AttachmentElementTemplate.js";import b from"../BatchFormTemplate.js";import{FieldElementTemplate as I}from"../FieldElementTemplate.js";import{GroupElementTemplate as j}from"../GroupElementTemplate.js";import{RelationshipElementTemplate as P}from"../RelationshipElementTemplate.js";import{TextElementTemplate as g}from"../TextElementTemplate.js";import{UtilityNetworkAssociationsElementTemplate as Z}from"../UtilityNetworkAssociationsElementTemplate.js";import{isGroupElementTemplate as F}from"./templateUtils.js";import{compileTextElementMarkdownToHTML as A}from"./textElementTemplateUtils.js";const U="expression/dea57012-47ca4b55a000-8df62742ed0c",C=e("form-attachment-filename-calculation"),L=()=>o.getLogger("esri.widgets.BatchAttributeForm.templates.templateUtils");async function B(e,t,r=e.formTemplate){return await e.load(),r?.elements&&r.elements.length>0?S(r,e,t):H(e,t)}async function H(e,{arcadeExecutorProvider:t,attachmentsEnabled:r,formTimeZone:o}){const n=new Set(u(e)),i={arcadeExecutorProvider:t,formTimeZone:o,layer:e},s=[];for(const l of e.fields)z(l,e,n)&&s.push(q(l,i));const a=await Promise.all(s);return r&&await R(a,{arcadeExecutorProvider:t,expressionInfos:w(void 0),layer:e}),new b({elements:a,title:e.formTemplate?.title,preserveFieldValuesWhenHidden:!0})}function N(e,t){for(const r of e??[])if("group"!==r.type){if("field"===r.type&&!1===r.editable&&!r.editableExpression)return!0}else if(N(r.elements??[]))return!0;return!1}async function R(e,{arcadeExecutorProvider:t,expressionInfos:r,layer:o}){if(!h(o))return;const n=await V(new s({displayFilename:!0}),{arcadeExecutorProvider:t,expressionInfos:r,layer:o});e.push(n)}async function S(e,t,r){let o=null;N(e.elements??[])&&(o=new i({title:"",name:U,expression:"false"}));const n=w(o?[...e.expressionInfos??[],o]:e.expressionInfos),s={description:e.description,elements:new Array,title:e.title,preserveFieldValuesWhenHidden:e.preserveFieldValuesWhenHidden,supportsAttachmentElements:e.supportsAttachmentElements},{elements:a}=e;if(!a)return new b(s);let l=!1;const{arcadeExecutorProvider:m,formTimeZone:c}=r;for(const i of a){const e=await W(i,{arcadeExecutorProvider:m,expressionInfos:n,layer:t,formTimeZone:c});if(e){if(s.elements.push(e),l)continue;"attachment"===e.type&&(l=!0),F(e)&&e.elements.some(e=>("attachment"===e.type&&(l=!0),l))}}return e.supportsAttachmentElements||!r.attachmentsEnabled||l||await R(s.elements,{arcadeExecutorProvider:m,expressionInfos:n,layer:t}),new b(s)}async function V(e,{arcadeExecutorProvider:r,expressionInfos:o,layer:n}){let i=null;if(e.filenameExpression)try{i=await t(e.filenameExpression,C)}catch(l){L().error("Failed to compile attachment filename expression",l)}const s=new v({allowUserRename:e.allowUserRename,attachmentKeyword:e.attachmentKeyword,description:e.description,displayFilename:e.displayFilename,filenameExpressionExecutor:i,input:e.input,label:e.label,maxAttachmentCount:e.maxAttachmentCount,minAttachmentCount:e.minAttachmentCount,useOriginalFilename:e.useOriginalFilename}),a=await T({element:e,expressionInfos:o,provider:r});return s.addLayer(n,a),s}async function W(e,t){return l(e)?V(e,{arcadeExecutorProvider:t.arcadeExecutorProvider,expressionInfos:t.expressionInfos,layer:t.layer}):m(e)?k(e,t):c(e)?K(e,t):d(e)?O(e,t):p(e)?G(e,t):f(e)?$(e,t):null}async function k(e,{arcadeExecutorProvider:t,expressionInfos:o,layer:n,formTimeZone:i}){const{fieldsIndex:s}=n,{description:l,domain:m,fieldName:c,hint:d,input:p,label:f}=e;if(null==c||!s.has(c))return L().warn(new r("batch-attribute-form:invalid-form-element-field",`Field element with label '${f}' does not refer to a valid field`)),null;if(!1!==e.editable||e.editableExpression||((e=e.clone()).editableExpression=U),p&&a(p)&&p.otherChoice){const e=p.otherChoice.fieldName,t=s.get(e);t&&t.name!==e&&(p.otherChoice=p.otherChoice.clone(),p.otherChoice.fieldName=t.name)}const u=new I({description:l,domain:m,field:s.get(c),hint:d,input:p,formTimeZone:i,layerTimeZone:E(n),label:f}),x=await T({element:e,expressionInfos:o,provider:t});return u.addLayer(n,x),u}async function K(e,t){const{arcadeExecutorProvider:r,expressionInfos:o,layer:n}=t,{description:i,label:s,initialState:a}=e,l=[];for(const d of e.elements){const e=await W(d,t);e&&l.push(e)}const m=new j({description:i,elements:l,label:s,initialState:a??"expanded"}),c=await T({element:e,expressionInfos:o,provider:r});return m.addLayer(n,c),m}async function O(e,t){const{description:r,label:o,displayCount:n,displayType:i,orderByFields:s,relationshipId:a}=e,{arcadeExecutorProvider:l,expressionInfos:m,layer:c,formTimeZone:d}=t,p=new P({description:r,...y(n)&&{displayCount:n},displayType:i,formTimeZone:d,label:o,layerTimeZone:E(c),orderByFields:s,relationshipId:a}),f=await T({element:e,expressionInfos:m,provider:l});return p.addLayer(c,f),p}async function G(e,{arcadeExecutorProvider:t,expressionInfos:r,layer:o,formTimeZone:n}){const{description:i,label:s,text:a,textFormat:l}=e,{fieldsIndex:m}=o,c=a&&"markdown"===l?await A(a):a,d=new g({compiledText:c,description:i,fieldsIndex:m,formTimeZone:n,label:s,layerTimeZone:E(o)}),p=await T({element:e,expressionInfos:r,provider:t}),{expressionParts:f}=d;if(f.length){const e=await Promise.all(f.map(e=>{const o=r.get(e)?.expression??e;return t.getArcadeExecutor(o)}));p.textExpressions=e}return d.addLayer(o,p),d}async function $(e,t){const{associationTypes:r,description:o,label:n}=e,{arcadeExecutorProvider:i,expressionInfos:s,formTimeZone:a,layer:l}=t,m=new Z({associationTypes:r,description:o,formTimeZone:a,label:n,layerTimeZone:E(l)}),c=await T({element:e,expressionInfos:s,provider:i});return m.addLayer(l,c),m}async function q(e,{arcadeExecutorProvider:t,layer:r,formTimeZone:o}){const i=n(e,r)||e.name,s=new I({field:e,formTimeZone:o,label:i,layerTimeZone:E(r)}),a={};return e.editable&&r.userHasUpdateItemPrivileges&&(a.editableExpression=await t.getArcadeExecutor("true")),s.addLayer(r,a),s}function z(e,t,r){return!r.has(e.name.toLowerCase())&&x(e,t)}export{B as createBatchFormTemplate,H as createBatchFormTemplateFromFields};
|
|
@@ -393,13 +393,6 @@ export type AssociationsLayerUnion = FeatureLayer | SubtypeSublayer;
|
|
|
393
393
|
*/
|
|
394
394
|
export interface FooterButtonInfo {}
|
|
395
395
|
|
|
396
|
-
/**
|
|
397
|
-
* Configuration information needed to render a notice in the BatchAttributeForm footer.
|
|
398
|
-
*
|
|
399
|
-
* @internal
|
|
400
|
-
*/
|
|
401
|
-
export interface FooterNoticeInfo {}
|
|
402
|
-
|
|
403
396
|
/**
|
|
404
397
|
* Valid types of pages that can be displayed by the Batch Attribute Form.
|
|
405
398
|
*
|
|
@@ -9,7 +9,7 @@ import type UtilityNetworkAssociationsElementInput from "./BatchAttributeForm/in
|
|
|
9
9
|
import type { Icon } from "@esri/calcite-components/components/calcite-icon";
|
|
10
10
|
import type { WidgetProperties } from "./Widget.js";
|
|
11
11
|
import type { BatchAttributeFormViewModelEvents, BatchAttributeFormViewModelProperties } from "./BatchAttributeForm/BatchAttributeFormViewModel.js";
|
|
12
|
-
import type { AssociationsLayerUnion, AttributeFormSupportedLayerInfo, FooterButtonInfo,
|
|
12
|
+
import type { AssociationsLayerUnion, AttributeFormSupportedLayerInfo, FooterButtonInfo, Page, SelectedAttachmentDetails, SelectedAttachmentIdentifier } from "./BatchAttributeForm/types.js";
|
|
13
13
|
import type { HeadingLevel } from "./support/types.js";
|
|
14
14
|
import type { VisibleElementsProperties } from "./BatchAttributeForm/VisibleElements.js";
|
|
15
15
|
|
|
@@ -105,6 +105,12 @@ export default class BatchAttributeForm extends Widget<BatchAttributeFormPropert
|
|
|
105
105
|
* @default false
|
|
106
106
|
*/
|
|
107
107
|
accessor disabled: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Indicates the component is in a disabled or readOnly state, disregarding updating
|
|
110
|
+
*
|
|
111
|
+
* @internal
|
|
112
|
+
*/
|
|
113
|
+
get disabledOrReadOnly(): boolean;
|
|
108
114
|
/**
|
|
109
115
|
* Indicates the component is currently in a disabled state, accounting for when the
|
|
110
116
|
* viewModel is in the process of updating.
|
|
@@ -140,14 +146,6 @@ export default class BatchAttributeForm extends Widget<BatchAttributeFormPropert
|
|
|
140
146
|
* @internal
|
|
141
147
|
*/
|
|
142
148
|
get footerButtonInfos(): FooterButtonInfo[];
|
|
143
|
-
/**
|
|
144
|
-
* Configuration information about notices displayed in the footer. Only a single notice can be displayed at a time.
|
|
145
|
-
* If more than one notice is generated, only the latest notice in this array will be displayed.
|
|
146
|
-
* This can be used to replicate notice behavior in an external panel (e.g. Editor).
|
|
147
|
-
*
|
|
148
|
-
* @internal
|
|
149
|
-
*/
|
|
150
|
-
get footerNoticeInfos(): FooterNoticeInfo[];
|
|
151
149
|
/**
|
|
152
150
|
* Defines how groups will be displayed to the user.
|
|
153
151
|
*
|