@arcgis/core 5.2.0-next.126 → 5.2.0-next.127
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/applications/Components/basemapToggleUtils.d.ts +53 -0
- package/applications/Components/basemapToggleUtils.js +2 -0
- package/arcgisGlobal.d.ts +1 -0
- package/assets/esri/core/libs/libtess/libtess-f32.wasm +0 -0
- package/assets/esri/core/libs/libtess/libtess-f64.wasm +0 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{e35eb93c0fb1f6de8db0.js → 00d9e41deecf5828975c.js} +1 -1
- package/assets/esri/core/workers/chunks/{ab8a1140bf31f46f8ebf.js → 1262918b2161d79851c0.js} +1 -1
- package/assets/esri/core/workers/chunks/{d3ef23923424ad8c5048.js → 1c2723f9630e7d597843.js} +1 -1
- package/assets/esri/core/workers/chunks/{9ca98fffd43e63d5ade3.js → 1c33aa349beea9a3792f.js} +1 -1
- package/assets/esri/core/workers/chunks/{54eeb4cac4fa092359ab.js → 2226c20c38e20713bcb5.js} +2 -2
- package/assets/esri/core/workers/chunks/{54eeb4cac4fa092359ab.js.LICENSE.txt → 2226c20c38e20713bcb5.js.LICENSE.txt} +2 -2
- package/assets/esri/core/workers/chunks/{fdbda3d2afea25142b86.js → 26995de0c18bef8db590.js} +1 -1
- package/assets/esri/core/workers/chunks/{806f96ad09e882be41af.js → 2c7fc24649d91552e68a.js} +1 -1
- package/assets/esri/core/workers/chunks/{4d18451e0ea6ca54101a.js → 2ebad7e588b26e74cefe.js} +1 -1
- package/assets/esri/core/workers/chunks/{a8258636096416c837a2.js → 3b7dff15a0058ea29886.js} +1 -1
- package/assets/esri/core/workers/chunks/{4716693eca44e8f89f5c.js → 3bf56c33876ba56c4b21.js} +1 -1
- package/assets/esri/core/workers/chunks/3c6ee445e49da0076ac1.js +1 -0
- package/assets/esri/core/workers/chunks/{5fe5ef5ccf480634d159.js → 50c29d10ec53f0e48e8a.js} +1 -1
- package/assets/esri/core/workers/chunks/{56acda1eed3a013430e2.js → 58fb92775d668cfd295c.js} +1 -1
- package/assets/esri/core/workers/chunks/{b013b70e40dfb6ce013e.js → 668ec0bdfb2095e90c9e.js} +1 -1
- package/assets/esri/core/workers/chunks/75879ae88fd87b089a87.js +1 -0
- package/assets/esri/core/workers/chunks/{24673aac70d6c949b6fa.js → 86d7a3ae672a51b75fcc.js} +1 -1
- package/assets/esri/core/workers/chunks/{30604a29df320d7a4c6b.js → 88e11b645a1361f1bdbe.js} +1 -1
- package/assets/esri/core/workers/chunks/{c692e583e87af58f6d91.js → 8b0d6205ceeec1ab446f.js} +1 -1
- package/assets/esri/core/workers/chunks/{57ab87e70ef85b9405f9.js → 8cb216404a6254bc695c.js} +1 -0
- package/assets/esri/core/workers/chunks/{b96358d475dc98034aa4.js → a15ed056e7493ddf3b4c.js} +1 -1
- package/assets/esri/core/workers/chunks/{25e212fe9a2ea37c9e81.js → a3a33ffa34f4d645ddfe.js} +1 -1
- package/assets/esri/core/workers/chunks/af0704494398f33aa315.js +1 -0
- package/assets/esri/core/workers/chunks/{ce1ccf9ec90b786591e5.js → b396c4b4bb144200acc7.js} +1 -1
- package/assets/esri/core/workers/chunks/{97602019a1ccad22a03a.js → bbfb80a6983574007ce5.js} +1 -1
- package/assets/esri/core/workers/chunks/{d5f72670634e73c0b53a.js → bcf2e5cf6b9c6d0442bb.js} +1 -1
- package/assets/esri/core/workers/chunks/{17218d714cb07b607c2f.js → c35e9dee87937f483a3d.js} +1 -1
- package/assets/esri/core/workers/chunks/{85739ed6af0f0a3cb302.js → c94bdfed831c775e04c0.js} +1 -1
- package/assets/esri/core/workers/chunks/{2e3fd81653dc0d86456c.js → cfeba0ffb7fdc2a9af05.js} +1 -1
- package/assets/esri/core/workers/chunks/{cb7cb7d57c4e7f76600f.js → dc92710a8fdfb9135e55.js} +1 -1
- package/assets/esri/core/workers/chunks/{e1ae83ff3e0225708d4d.js → f479b4a4cee4bb2e046c.js} +1 -1
- package/assets/esri/core/workers/chunks/{78abd6c42f39e6f6ffbb.js → f983296b6f4a62a911eb.js} +1 -1
- package/assets/esri/images/portal/gaussiansplatlayer16.png +0 -0
- package/assets/esri/images/portal/knowledgegraphlayer16.png +0 -0
- package/assets/esri/images/portal/propresentation16.png +0 -0
- package/assets/esri/images/portal/urbanproject16.png +0 -0
- package/assets/esri/images/support/loading-throb.gif +0 -0
- package/assets/esri/layers/raster/formats/lerc-wasm.wasm +0 -0
- package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02-arabic.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02-cyrillic.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02-ext.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02-georgian.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02-greek.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02-hebrew.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02-math.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02-thai.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02-vietnamese.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7-arabic.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7-cyrillic.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7-ext.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7-georgian.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7-greek.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7-hebrew.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7-math.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7-thai.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7-vietnamese.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688-arabic.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688-cyrillic.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688-ext.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688-georgian.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688-greek.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688-hebrew.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688-math.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688-thai.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688-vietnamese.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/3ae1e25e-3aa6-4061-a016-a079159f9d65.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/41331c3c-3759-4462-8695-33c9a21b6a5b.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/94aa531e-7746-4df0-bb6e-349891f2eda5.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939-arabic.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939-cyrillic.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939-ext.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939-georgian.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939-greek.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939-hebrew.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939-math.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939-thai.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939-vietnamese.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b9c5b839-db56-4419-8fcb-6ab661babb1d-cyrillic.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b9c5b839-db56-4419-8fcb-6ab661babb1d-ext.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b9c5b839-db56-4419-8fcb-6ab661babb1d-greek.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b9c5b839-db56-4419-8fcb-6ab661babb1d-hebrew.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b9c5b839-db56-4419-8fcb-6ab661babb1d-math.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b9c5b839-db56-4419-8fcb-6ab661babb1d-vietnamese.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts/b9c5b839-db56-4419-8fcb-6ab661babb1d.woff2 +0 -0
- package/assets/esri/themes/base/fonts/fonts.scss +0 -0
- package/assets/esri/themes/base/icons/style.scss +0 -0
- package/assets/esri/themes/base/icons/variables.scss +0 -0
- package/assets/esri/themes/base/images/files/archive-32.svg +0 -0
- package/assets/esri/themes/base/images/files/cad-32.svg +0 -0
- package/assets/esri/themes/base/images/files/code-32.svg +0 -0
- package/assets/esri/themes/base/images/files/csv-32.svg +0 -0
- package/assets/esri/themes/base/images/files/excel-32.svg +0 -0
- package/assets/esri/themes/base/images/files/generic-32.svg +0 -0
- package/assets/esri/themes/base/images/files/gpx-32.svg +0 -0
- package/assets/esri/themes/base/images/files/image-32.svg +0 -0
- package/assets/esri/themes/base/images/files/pdf-32.svg +0 -0
- package/assets/esri/themes/base/images/files/report-32.svg +0 -0
- package/assets/esri/themes/base/images/files/sound-32.svg +0 -0
- package/assets/esri/themes/base/images/files/text-32.svg +0 -0
- package/assets/esri/themes/base/images/files/video-32.svg +0 -0
- package/assets/esri/themes/base/images/files/word-32.svg +0 -0
- package/assets/esri/themes/base/images/files/zip-32.svg +0 -0
- package/assets/esri/themes/base/images/loading-throb.gif +0 -0
- package/assets/esri/themes/base/widgets/_Bookmarks.scss +0 -0
- package/assets/esri/themes/base/widgets/_Tooltip.scss +37 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.en.json +1 -1
- package/chunks/GlobalIllumination.glsl.js +1 -0
- package/config.js +1 -1
- package/core/Accessor.d.ts +1 -1
- package/core/lang.js +1 -1
- package/kernel.js +1 -1
- package/layers/ParquetLayer.d.ts +21 -13
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/layers/graphics/dehydratedFeatures.js +1 -1
- package/package.json +3 -3
- package/popup/FeatureContentCollection.d.ts +15 -25
- package/popup/FeatureContentCollection.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/callouts/calloutAnalysisUtils.js +2 -0
- package/symbols/cim/callouts/effects/BackgroundCallout.js +1 -1
- package/symbols/cim/callouts/effects/BalloonCallout.js +1 -1
- package/symbols/cim/callouts/effects/PointSymbolCallout.js +1 -1
- package/symbols/cim/callouts/effects/SimpleLineCallout.js +1 -1
- package/symbols/cim/callouts/effects/calloutUtils.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/views/2d/engine/webgl/ClipMesh.js +1 -1
- package/views/2d/engine/webgl/mesh/factories/CalloutMeshWriterCoordinator.js +1 -1
- package/views/2d/engine/webgl/mesh/factories/MeshWriterGroupCoordinator.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/templateUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedPolyMeshWriters.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/AFillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/ComputedMarkerParams.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/CalloutMeshWriterPolicy.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterReferences.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
- package/views/2d/engine/webgl/util/AnnotationMatcher.js +1 -1
- package/views/2d/engine/webgl/util/Matcher.js +1 -1
- package/views/2d/layers/LayerView2D.js +1 -1
- package/views/2d/layers/support/annodime/MatcherGeometryOverride.js +1 -1
- package/views/2d/layers/support/annodime/PrivateMatcherGeometryOverrideEffect.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightAuthoringUtils.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightItemManipulatedObject3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightPlacementController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRootPlugin.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTargetPlugin.js +1 -1
- package/views/3d/analysis/LineOfSight/lineOfSightPlacementUtils.js +1 -1
- package/views/3d/analysis/LineOfSightAnalysisView3D.d.ts +5 -3
- package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedPlacementRootPlugin.js +1 -1
- package/views/3d/interactive/editingTools/manipulatedObjectUtils.js +1 -1
- package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
- package/views/3d/interactive/editingTools/tooltipUtils3D.js +1 -1
- package/views/3d/layers/graphics/FeatureGraphics3DGraphicsPipeline.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
- package/views/3d/layers/support/FeatureMemory.js +2 -0
- package/views/3d/layers/support/FeatureTile.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/featureReference.js +1 -1
- package/views/3d/navigation/modes/GroundNavigationMode3D.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/state/utils/OffsetCorrectionController.js +1 -1
- package/views/3d/support/popupHitTest.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/materials/stippleTextureRepository.js +1 -1
- package/views/DOMContainer.d.ts +2 -2
- package/views/DOMContainer.js +1 -1
- package/views/PopupView.d.ts +1 -1
- package/views/interactive/tooltip/components/ElevationModeSelect.js +2 -0
- package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
- package/views/interactive/tooltip/content/TooltipContent.js +1 -1
- package/views/interactive/tooltip/infos/DynamicTooltipInfo.js +1 -1
- package/views/interactive/tooltip/infos/SketchTooltipInfo.js +1 -1
- package/views/support/hitTestSelectUtils.js +1 -1
- package/widgets/BasemapToggle/BasemapToggleViewModel.d.ts +1 -0
- package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
- package/widgets/BasemapToggle.js +1 -1
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.d.ts +9 -1
- package/widgets/DirectionalPad/DirectionalPadViewModel.d.ts +1 -0
- package/widgets/DirectionalPad/DirectionalPadViewModel.js +1 -1
- package/widgets/DirectionalPad.js +1 -1
- package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
- package/widgets/Editor/legacy/UpdateFeatureWorkflow.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Popup/types.d.ts +0 -7
- package/widgets/Popup.d.ts +7 -7
- package/widgets/TimeSlider/TimeSliderViewModel.d.ts +2 -0
- package/widgets/TimeSlider/TimeSliderViewModel.js +1 -1
- package/widgets/TimeSlider.js +1 -1
- package/assets/esri/core/workers/chunks/6c3535aa7250c08b9e5b.js +0 -1
- package/assets/esri/core/workers/chunks/dc52e036547612949d32.js +0 -1
- package/views/2d/engine/webgl/mesh/bufcut.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../Color.js";import t from"../../Graphic.js";import{isSome as r,equals as n,addMany as o}from"../../core/arrayUtils.js";import i from"../../core/Error.js";import{handlesGroup as a,makeHandle as s,abortHandle as l}from"../../core/handleUtils.js";import{clone as c}from"../../core/lang.js";import u from"../../core/Logger.js";import{getOrCreateMapValue as p}from"../../core/MapUtils.js";import{debounce as d,isPromiseLike as f,whenOrAbort as y}from"../../core/promiseUtils.js";import{watch as m,on as h,whenOnce as g,when as b}from"../../core/reactiveUtils.js";import{px2pt as w}from"../../core/screenUtils.js";import{addMany as I}from"../../core/SetUtils.js";import{isSharedTemplateOrMetadata as v,isSharedGroupTemplate as T,getCreationAttributes as F,isSharedPresetTemplate as j}from"../../editing/templateUtils.js";import{isCurvedGeometry as k,hasUnsupportedCurve as A}from"../../geometry/support/curves/curveUtils.js";import S from"../../layers/GraphicsLayer.js";import{featureHasFields as O,fixFields as U,getDisplayFieldName as L}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as V}from"../../layers/support/layerUtils.js";import{calculateTolerance as M}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as x}from"../../renderers/support/lengthUtils.js";import{isRenderer as q}from"../../renderers/support/typeUtils.js";import{getTransformationType as z}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import{isGraphic as E}from"../../support/graphicInstanceUtils.js";import P from"../../symbols/SimpleFillSymbol.js";import R from"../../symbols/SimpleLineSymbol.js";import C from"../../symbols/SimpleMarkerSymbol.js";import{to3D as D}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as G}from"../../symbols/support/symbolUtils.js";import{getServices as B}from"../../undoredo/support/Services.js";import{defaultDrawingMode as N}from"../../views/draw/drawingModes.js";import{updateGraphicSymbolWhenRequired as Z,fetchFullFeaturesByObjectId as W}from"../../views/draw/support/editingSessionUtils.js";import{createQueryGeometry as $}from"../../views/support/drapedUtils.js";import{filterGraphicHits as Q,hitTestSelectSimilarDistance as H}from"../../views/support/hitTestSelectUtils.js";import{isNextOrLegacyUpdateWorkflow as J,isNextOrLegacyUpdateFeaturesWorkflow as K}from"./compatibilityAdapters.js";import{dependencySort as X}from"./support/dependencySort.js";import{isDrawGraphicTool as Y,isDrawTool as _}from"../Sketch/support/sketchUtils.js";const ee=()=>u.getLogger("esri.widgets.Editor.workflowUtils");function te(e){return oe(e)||ne(e)}function re(e){return!!e&&"features"in e}function ne(e){return null!=e&&"update-features"===e.type}function oe(e){return null!=e&&e.type.includes("update-")&&"fullFeature"in e}function ie(e){return null!=e&&"merge-features"===e.type}function ae(e){return null!=e&&"split-feature"===e.type}function se(e){const t=e?.type;return"update-feature"===t||"update-table-record"===t||"update-features"===t||"split-feature"===t}function le(e){return"merge"===e?.type}function ce(e){return"split"===e?.type}function ue(e){return ie(e)||ae(e)}function pe(e){return"update-multiple"===e?.type}function de(e){const t=e&&"renderer"in e?e.renderer:null;if(!we(t))return{rotation:null,size:null};const r=t.getVisualVariablesForType("rotation").filter(e=>(!e.axis||"heading"===e.axis)&&e.field&&!e.valueExpression),n=t.getVisualVariablesForType("size").filter(e=>e.field&&!e.useSymbolValue&&!e.valueExpression&&"real-world-size"===z(e));return{rotation:1===r.length?r[0]:null,size:1===n.length?n[0]:null}}function fe(e){const t=e.sourceLayer;if(!(t&&"renderer"in t&&we(t.renderer)))return{rotation:null,size:null};const{rotation:r,size:n}=de(t);let o=null,i=null;if(r){const e=t.fields?.filter(e=>e.name===r.field),n=1===e?.length?e[0]:null;o=ye(r,n)}if(n){const e=t.fields?.filter(e=>e.name===n.field),r=1===e?.length?e[0]:null;i=ge(n,r)}return{rotation:o,size:i}}function ye(e,t){const r="heading"===(e.axis||"heading")&&"arithmetic"===e.rotationType?-1:1,n=t?.type??"double",o={initial:0,current:0};return{field:e.field,fieldType:n,getDefaultValue:()=>Promise.resolve(0),getValue:e=>(o.current=o.initial-r*e,be((o.current+360)%360,n)),setInitialValue:e=>{o.initial=e,o.current=0},isUpdatingInteractively:!1,rotationType:e.rotationType??"geographic"}}function me(e,t){switch(t){case"width":return e[0];case"depth":return e[1];case"height":return e[2];default:return e[2]||e[1]||e[0]}}async function he(e,t,r){if(null==t)return 0;const{symbol:n}=D(t);if(null==n||"web-style"===n.type||"cim"===n.type)return 0;const o=n.symbolLayers.at(0);if(!o)return 0;switch(o.type){case"icon":{const{computeIconLayerResourceSize:e}=await(import("../../symbols/support/symbolLayerUtils.js"));return Math.min(rt.icon,(await e(o,rt.icon))[0])||rt.icon}case"text":return rt.text;case"line":return rt.line;case"object":{const{computeObjectLayerResourceSize:t}=await(import("../../symbols/support/symbolLayerUtils.js"));return me(await t(o,e.scale/rt.viewScaleSizeFactor),r)}case"path":case"extrude":return e.scale/rt.viewScaleSizeFactor;default:return 0}}function ge(e,t){const r=e.axis,n=t?.type??"double",o={initial:0,current:0},i=x[e.valueUnit]??1;let a;return a="area"===e.valueRepresentation?e=>(e*i/2)**2*Math.PI:"radius"===e.valueRepresentation||"distance"===e.valueRepresentation?e=>e*i/2:e=>e*i,{field:e.field,fieldType:n,getDefaultValue:async(e,t)=>be(a(await he(t,e,r)),n),getValue:(e,t)=>(o.initial||(o.initial=t.pixelSizeAt(t.center)),o.current=o.initial*e,be(o.current,n)),setInitialValue:e=>{o.initial=e,o.current=0},isUpdatingInteractively:!1,displayUnit:it(e.valueUnit),axis:e.axis}}function be(e,t){switch(t){case"small-integer":case"integer":case"long":return Math.round(e);case"double":case"single":return e;default:return 0}}function we(e){if(!q(e))return!1;switch(e?.type){case"class-breaks":case"simple":case"unique-value":case"dot-density":case"dictionary":case"pie-chart":return!0;default:return!1}}function Ie(e,t){if(!e||!t)throw new Error("no geometry type");if("multipatch"===e)return{tool:"mesh",createOptions:{mode:"hybrid"}};const r=new Map;r.set("circle",{mode:"freehand"}),r.set("rectangle",{mode:"freehand"});const n={mode:N,optionsPerTool:r};if(v(t)){const o=t.defaultTool,i=T(t)?t.definition?.inputGeometryType??e:e;switch(o){case"freehand":case"stream-line":return{tool:"polyline"===i?"freehandPolyline":"freehandPolygon",createOptions:n};case"autocomplete-freehand-polygons":case"stream-polygon":return{tool:"freehandPolygon",createOptions:n};case"autocomplete-polygons":case"difference-polygon":case"create-structures":case"polygon":case"trace":return{tool:"polygon"===i?"polygon":"polyline",createOptions:n};case"circle":return r.get("circle").preserveAspectRatio=!0,{tool:"circle",createOptions:n};case"ellipse":return r.get("circle").preserveAspectRatio=!1,{tool:"circle",createOptions:n};case"create-points-along-line":case"multipoint":return{tool:"multipoint",createOptions:n};case"line":case"radial-line":case"right-angle-line":case"split":case"two-point-line":return{tool:"polyline",createOptions:n};case"rectangle":case"regular-polygon":case"right-angle-polygon":return{tool:"rectangle",createOptions:n};case"elevation-point-from-contour":case"elevation-point-from-dem":case"parcel-seed":case"point":case"point-and-rotation":case"point-at-end-of-line":return{tool:"point",createOptions:n}}}else{const o=t.drawingTool;if("circle"===o||"ellipse"===o)return r.get("circle").preserveAspectRatio="circle"===o,{tool:"circle",createOptions:n};if("rectangle"===o)return{tool:"rectangle",createOptions:n};if("freehand"===o)return{tool:"polygon"===e?"freehandPolygon":"freehandPolyline",createOptions:n}}return{tool:e,createOptions:n}}async function ve(e,t,r){const{creationInfo:n,fullTemplate:o}=r;if(!n)throw new i("featureworkflow","No creation info provided.");const a=n.layer,s=F(o,n.attributeOverrides,n.layer),{view:l}=e,c="2d"===l?.type;T(o)||j(o)||await Ce(e,a,s,c?l.scale:null);const{capabilities:u}=a;t.elevationInfo=a.elevationInfo;const p=Ie(a.geometryType,o);e.defaultCreateOptions={graphicProperties:{attributes:s,sourceLayer:a},mode:p.createOptions.mode,optionsPerTool:p.createOptions.optionsPerTool,preserveAspectRatio:p.createOptions.preserveAspectRatio,hasZ:u.data.supportsZ,defaultZ:(c?u.editing.zDefault:null)??e.defaultCreateOptions.defaultZ},null==n.geometryToPlace?await e.create(p.tool):await e.place(n.geometryToPlace,{graphicProperties:{attributes:s,sourceLayer:a}})}async function Te(e){return a([Fe(e),je(e)])}function Fe({creationAttributes:e,data:t,sketchViewModel:r,view:n}){const{creationInfo:o}=t,{fullTemplate:i}=t;if(!o||"2d"!==n?.type||T(i)||j(i))return null;const a=d(t=>Ce(r,o.layer,e,t));return m(()=>n.scale,e=>a(e))}function je({data:t,sketchViewModel:r,view:n}){const{templateExecutorInfo:o}=t;if(!o)return null;const l=r.activeComponent;if(!n||!Y(l)&&!_(l))return ee().error(new i("featureworkflow","Failed to set up template feedback.")),null;const c=new S({effect:"saturate(0.6) opacity(0.8)",listMode:"hide",title:"Shared Template Feedback Graphics"});n.map?.add(c);const{executor:u,serviceLayersById:p}=o,d=n.theme?.accentColor??new e([255,165,0,1]);return a([h(()=>l,["cursor-update","vertex-add"],()=>{c.removeAll();const e=Y(l)?l.graphic?.geometry:l.unprocessedGeometry;if(!e||!ke(e))return;const t=u(e,"digitizing");if(!f(t))for(const r of t.edits){const e=p.get(r.id);if(e&&r.addFeatures&&0!==r.addFeatures.length)for(const t of e)if(!t.isTable)for(const e of r.addFeatures){const t=Ae(e,d);t&&c.add(t)}}}),s(()=>{n.map.remove(c),c.destroy()})])}function ke(e){switch(e.type){case"point":case"multipoint":return!0;case"polyline":{if(k(e))return e.curvePaths[0].length>1;const t=e.paths[0];return!!t&&t.length>1}case"polygon":{if(k(e))return e.curveRings[0].length>2;const t=e.rings[0];return!!t&&(n(t.at(0),t.at(-1))?t.length>2:t.length>1)}default:return!1}}function Ae(e,r){let n=null;switch(e.geometry?.type){case"point":case"multipoint":n=new C({angle:0,color:r,outline:new R({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:1}),path:"undefined",size:8,style:"circle",xoffset:0,yoffset:0});break;case"polygon":n=new P({color:r,outline:new R({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:3}),style:"none"});break;case"polyline":n=new R({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:2});break;default:return null}return new t({geometry:e.geometry,symbol:n,attributes:{...e.attributes}})}function Se(e,t){const r=B(t),n=V(e)?e.parent:e;return r.tablesAndLayersLookup.get(n)}function Oe(e,t){const r=Se(e,t);if(!r)return new Map;const n=new Map;for(const o of r.layersAndTables)p(n,o.layerId,()=>[]).push(o);return n}function Ue(e){const t=e.objectIdField,r=e.globalIdField??"";return{id:e.layerId,identifierFields:{objectIdField:t,globalIdField:r},addFeatures:[],deleteAttachments:[],addAttachments:[],deleteFeatures:[],updateFeatures:[]}}function Le(e){const{edits:t,serviceInfo:n,view:o,findOriginalFeature:i}=e,a=Ve(n.layersAndTables),s=n.layersAndTables.toArray(),{allEditData:l,editDataByLayerIdMap:c,editDataByIdMap:u}=xe(t,a,i),p=qe(l,Me(s,c),c);if(o&&Pe(l,p,o),0===p.length)return t;const d=X(p,{continueOnCircularDependency:!0}).map(e=>u.get(e)).filter(r),f=new Map;for(const r of d)f.set(r.uniqueId,r);const y=[];for(const r of l)f.has(r.uniqueId)||y.push(r);const m=[];let h=null;for(const r of d){const{layer:e}=r;switch(null==h?h=Ue(e):h.id!==e.layerId&&(m.push(h),h=Ue(e)),r.operationType){case"add":case"modify":h.addFeatures.push(r.after);break;case"delete":h.deleteFeatures.push(r.before)}}null!==h&&m.push(h);for(const r of y){const e=r.layer.layerId,t=m.find(t=>t.id===e)??Ue(r.layer);switch(m.includes(t)||m.push(t),r.operationType){case"add":t.addFeatures.push(r.after);break;case"modify":t.updateFeatures.push(r.after);break;case"delete":t.deleteFeatures.push(r.before);break;case"deleteAttachment":t.deleteAttachments.push(r.attachmentId);break;case"addAttachment":t.addAttachments.push(r.attachment)}}for(const r of m)void 0!==r.deleteAttachments&&0===r.deleteAttachments.length&&delete r.deleteAttachments,void 0!==r.addAttachments&&0===r.addAttachments.length&&delete r.addAttachments;return m}function Ve(e){const t=new Map;for(const r of e)t.set(r.layerId,r);return t}function Me(e,t){const r=new Map;for(const n of e)for(const e of n.relationships??[])if(r.set(ze(n,e),""),t.has(e.relatedTableId)){const o=t.get(e.relatedTableId);if(o.length>0)for(const t of o[0].layer.relationships??[])if(t.id===e.id){r.set(ze(n,e),t.keyField);break}}return r}function xe(e,t,r){const n=new Map,o=[],a=new Map;let s=1;for(const l of e){const e=[],c=t.get(l.id);if(!c)throw new i("featureworkflow",`Failed to prepare applyEdits payload. Layer with id ${l.id} not found.`);for(const t of l.addFeatures??[])e.push({uniqueId:"T"+s++,operationType:"add",layer:c,after:t});for(const t of l.deleteFeatures??[])e.push({uniqueId:"T"+s++,operationType:"delete",before:t,layer:c});for(const t of l.deleteAttachments??[])e.push({uniqueId:"T"+s++,operationType:"deleteAttachment",attachmentId:t,layer:c});for(const t of l.addAttachments??[])e.push({uniqueId:"T"+s++,operationType:"addAttachment",attachment:t,layer:c});for(const t of l.updateFeatures??[])e.push({uniqueId:"T"+s++,operationType:"modify",before:r(t),after:t,layer:c});n.set(c.layerId,e);for(const t of e)o.push(t),a.set(t.uniqueId,t)}return{allEditData:o,editDataByIdMap:a,editDataByLayerIdMap:n}}function qe(e,t,r){const n=[];for(const o of e){const e=o.layer.relationships??[],{uniqueId:i}=o;for(const a of e){const e=a.keyField;if("origin"===a.role){const s=r.get(a.relatedTableId);if(!s||0===s.length)continue;const l=ze(o.layer,a),c=t.get(l);if(void 0===c||""===c)continue;switch(o.operationType){case"add":for(const t of s)t!==o&&("add"!==t.operationType&&"modify"!==t.operationType||t.after.attributes[c]===o.after.attributes[e]&&n.push([i,t.uniqueId]));break;case"modify":if(o.before.attributes[e]!==o.after.attributes[e])for(const t of s){const r=t.uniqueId;t!==o&&("delete"===t.operationType?t.before.attributes[c]===o.before.attributes[e]?n.push([r,i]):t.before.attributes[c]===o.after.attributes[e]&&n.push([i,r]):"add"===t.operationType?t.after.attributes[c]===o.after.attributes[e]?n.push([i,r]):t.after.attributes[c]===o.before.attributes[e]&&n.push([r,i]):"modify"===t.operationType&&(t.before.attributes[c]!==t.after.attributes[c]?t.after.attributes[c]===o.after.attributes[e]?n.push([i,r]):n.push([r,i]):n.push([i,r])))}break;case"delete":for(const t of s)t!==o&&("delete"!==t.operationType&&"modify"!==t.operationType||t.before.attributes[c]===o.before.attributes[e]&&n.push([t.uniqueId,i]))}}}}return n}function ze(e,t){return`${e.layerId}:${t.id}`}function Ee(e,t){return!!(t?.map&&"utilityNetworks"in t.map&&t.map.utilityNetworks?.length&&t.map.utilityNetworks.some(t=>!(!t.loaded||!e.url?.startsWith(t.featureServiceUrl)||e.layerId!==t.networkSystemLayers.associationsTableId)))}function Pe(e,t,r){const n=[];for(const i of e)Ee(i.layer,r)&&n.push(i);if(0===n.length)return;let o=[];for(const i of n){const r=i.layer;switch(i.operationType){case"delete":o=[...Re(i.before.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Re(i.before.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of o)t.push([i.uniqueId,e.uniqueId]);break;case"add":o=[...Re(i.after.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Re(i.after.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of o)t.push([e.uniqueId,i.uniqueId])}}}function Re(e,t){const r=[],n=t.filter(({layer:e})=>""!==e.globalIdField&&null!=e.globalIdField);for(const o of n){const t=o.layer.globalIdField;("before"in o&&o.before?.attributes[t]===e||"after"in o&&o.after?.attributes[t]===e)&&r.push(o)}return r}async function Ce(e,r,n,o){const i=new t({sourceLayer:r,attributes:n}),{rotation:a,size:s}=fe(i);let l=await G(i,{useSourceLayer:!0,scale:o}),c=!1;for(const t of[s,a]){if(null==t)continue;null==n[t.field]&&(n[t.field]=await t.getDefaultValue(l,e.view),c=!0)}switch(c&&(l=await G(i,{useSourceLayer:!0,scale:o})),l?.type){case"simple-fill":case"polygon-3d":e.polygonSymbol=l;break;case"simple-line":case"line-3d":e.polylineSymbol=l;break;case"simple-marker":case"picture-marker":case"point-3d":case"cim":e.pointSymbol=l;break;case"mesh-3d":e.meshSymbol=l}De(e.tooltipOptions,s,a)}function De(e,t,r){e.visualVariables=null!=t||null!=r?{size:null!=t?{unit:t.displayUnit,axis:t.axis,valueType:t.fieldType}:null,rotation:null!=r?{valueType:r.fieldType,rotationType:r.rotationType??"geographic"}:null}:null}function Ge(e,t){return e.find(e=>e.layer===t)}function Be(e,t){const r=Ge(e,t);if(null==r)throw new i("no-editorItem-found","The EditorViewModel provided did not have an EditorItem associated with the specified layer");return r}function Ne(e,t){return e?.find(e=>e.layer===t)}async function Ze(e,t,r,n){switch(t.type){case"3d":return We(e,t,r,n);case"2d":return $e(e,t,r,n)}}async function We(e,t,r,n){if(0===e.length)return[];const{updatable:i,graphicsByLayer:a}=await r.defer(async()=>{const{results:o}=await y(H(t,r),n),i=new Map,a=e=>{const t=e.layer,r=i.get(t);if(!r){const e=new Array;return i.set(t,e),e}return r};Q(o).forEach(({graphic:e})=>a(e).push(e));const s=e.filter(({capabilities:e,layer:t})=>e.update.enabled&&i.has(t));return 0!==s.length&&r.stopPropagation(),{updatable:s,graphicsByLayer:i}});return y(Promise.allSettled(i.map(async({layer:e})=>{const t=a.get(e),r=Qe(e);if(t.every(e=>O(e,r)))return t;const i=[];for(const n of t){i.push(n.getObjectId());const e=Object.keys(n.attributes);o(r,e)}const s=e.createQuery();return s.returnGeometry=!1,s.objectIds=i,s.outFields=U(e.fieldsIndex,r),e.queryFeatures(s,{signal:n}).then(({features:e})=>e)})),n)}async function $e(e,t,r,n){if(0===e.length)return[];const{mapPoint:o}=r;if(null==o)return[];let i=null;const a=await r.defer(async()=>{const{results:o}=await y(t.hitTest(r),n);if(0===o.length)return[];const a=new Set;i=Q(o),i.forEach(({graphic:e})=>e&&a.add(e.layer));const s=e.filter(e=>a.has(e.layer)&&e.supportsUpdateWorkflow);return s.length>0&&r.stopPropagation(),s});return y(Promise.allSettled(a.map(async({layer:e})=>{const a=e.createQuery();a.returnGeometry=!0,a.outFields=Qe(e);const s="renderer"in e?M({renderer:e.renderer,pointerType:r.pointerType}):0;a.geometry=$(o,s,t),a.outSpatialReference=t.spatialReference;const{features:l}=await e.queryFeatures(a,{signal:n});return i?.forEach(({graphic:t})=>{t.layer!==e||l.some(e=>e.getObjectId()===t.getObjectId())||l.push(t)}),l})),n)}function Qe(e){return U(e.fieldsIndex,[e.objectIdField,L({displayField:"displayField"in e?e.displayField:null,fields:e.fields})])}async function He(e,t,n,o){const i=e.map(e=>e.getObjectId()??e.attributes[t.objectIdField]).filter(r);return await W(i,t,n,o)}async function Je(e){const{graphic:t,sketchViewModel:r,sourceLayer:n,updateOptions:o,visualVariables:i}=e;await Xe(e);const a={multipleSelectionEnabled:!1,...o};return"point"===n.geometryType&&(a.enableRotation=null!=i.rotation,a.enableScaling=null!=i.size),r.update(t,a)}function Ke(e,t){const{activeUpdateOptions:r}=e;r&&(e.activeUpdateOptions={...r,...t,reshapeOptions:{...r.reshapeOptions,...t.reshapeOptions},highlightOptions:{...r.highlightOptions,...t.highlightOptions}})}async function Xe(e){const{graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:o,visualVariables:i}=e;let a=!1;const{rotation:s,size:l}=i;for(const c of[s,l]){if(null==c)continue;const e=t.getAttribute(c.field);if(null!=e)c.setInitialValue(e);else{const e=await c.getDefaultValue(t.symbol,n.view);c.setInitialValue(e),t.setAttribute(c.field,e),a=!0}}if(a){const e="2d"===n.view?.type?n.view.scale:null;await Z(t,e)}De(n.tooltipOptions,l,s),r.elevationInfo=o.elevationInfo}function Ye(e){return null==e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function _e(e){return null==e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}function et(e,t,r,n){if(null==t.geometry||"point"!==t.geometry?.type)return!1;const o=t.attributes;let i=!1;const a=n.rotation,s=Ye(r.toolEventInfo);if(null!=a&&null!=s){const{field:r,getValue:n}=a;if("rotate-stop"===s.type)a.isUpdatingInteractively=!1,a.setInitialValue(t.getAttribute(r));else{a.isUpdatingInteractively=!0;const l=n(s.angle,e);l!==o[r]&&t.setAttribute(r,l),i=!0}}const l=n.size,c=_e(r.toolEventInfo);if(null!=l&&null!=c){const{field:r,getValue:n}=l;if("scale-stop"===c.type)l.isUpdatingInteractively=!1,l.setInitialValue(t.getAttribute(r));else{l.isUpdatingInteractively=!0;const a=n(c.xScale,e);a!==o[r]&&t.setAttribute(r,a),i=!0}}return i}async function tt({feature:e,featureClone:t,sketchLayer:r,sketchViewModel:n,getUpdateOptions:o,view:i,visualVariableAttributes:c,addHandle:u,addUpdatingPromise:p,onUpdate:f}){await Z(t,"2d"===i.type?i.scale:null);let y=null;if("2d"===n?.view?.type){const e=d(e=>Z(t,e));y=m(()=>n?.view?.scale,t=>e(t))}const h=t.sourceLayer,w=st(i,h);await Je({graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:h,updateOptions:o(),visualVariables:c});let I=null;w.then(e=>I=e).catch(()=>{});const v=c.size,T=c.rotation,F=m(()=>e.attributes,async e=>{let r=!1;for(const n in e){const o=e[n];o!==t.getAttribute(n)&&(t.setAttribute(n,o),null==v||v.isUpdatingInteractively||v.field!==n||v.setInitialValue(o),null==T||T.isUpdatingInteractively||T.field!==n||T.setInitialValue(o),(null==I||I.requiredFields.includes(n))&&(r=!0))}r&&await Z(t,"2d"===i.type?i.scale:null)}),j=n.on("update",async e=>{const t=e.graphics[0],a={graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:h,updateOptions:o(),visualVariables:c};if("complete"===e.state){const e=new AbortController,t=l(e);return u(t),p(g(()=>null===i.activeTool,e.signal).then(async()=>{if(!e.signal.aborted)return e.abort(),Je(a)}))}et(i,t,e,c)&&await Z(t,"2d"===i.type?i.scale:null),f(ct(t),e)}),k=b(()=>null!=i.activeTool&&i.activeTool!==n.activeComponent,()=>n.cancel()),A=n.on(["undo","redo"],e=>{f(ct(e.graphics[0]),e)});return a([A,j,k,s(()=>n.cancel()),F,y])}const rt={icon:w(24),text:w(12),line:w(1),viewScaleSizeFactor:100};function nt(e,t,r){let n=!1;return e.filter(e=>!!n||(n=e===t,n)).map(e=>r[e]())}function ot(e,t){e.viewModel.syncFeatureTemplates();const r=e.creationInfo;if("awaiting-feature-creation-info"===t[0].id&&r){const n=r.layer,o=e.viewModel.getTemplatesForLayer(n);1===o.length&&"scene"!==n.type&&(r.template=o[0],t.shift())}return t}function it(e){return"unknown"===e?null:e}const at=e=>e.includes("-stop")||e.includes("vertex-"),st=(e,t)=>{const r="subtype-sublayer"===t.type?t.parent:t;return e.whenLayerView(r)};function lt(e){return"createInteractiveEditSession"in e}function ct(e){const t=e.geometry;if("mesh"===t?.type){const r=e.cloneShallow();return r.attributes=c(e.attributes),r.geometry=t.cloneShallow(),r.geometry.transform=t.transform?.clone()??null,r}return e.clone()}function ut(e){return e.acquireCursor("progress")}function pt(e){for(const t of e){const{destinationGraphic:e,destinationField:r,sourceGraphic:n,sourceField:o}=t;e.setAttribute(r,n.getAttribute(o))}}function dt(e){const t=e.templateExecutorInfo?.completionResults;return t?.length?(t.forEach(e=>pt(e.relationships)),t.flatMap(e=>e.edits)):null}function ft(e){const t=J(e)?e.activeWorkflow:e;if(null==t)return[];if(K(t))return t.data.layers;const r=t.layer;return r?[r]:[]}function yt({attributes:e},t){const r=new Set;r.add(t.objectIdField),"uniqueIdFields"in t&&t.uniqueIdFields&&t.uniqueIdFields.length>0&&I(r,t.uniqueIdFields);const n={};for(const o of r)null!=e[o]&&(n[o]=e[o]);if("scene"===t.type&&null!=t.infoFor3D){const r=t.associatedLayer?.globalIdField;null!=r&&(e[r]=e[r])}return n}function mt(e){if(!ht(e))return e;const t=new Map;for(const r of e){const e=r.getObjectId();if(null!=e){const n=r.sourceLayer??r.layer;p(t,n,()=>[]).push(e)}}return Array.from(t.entries()).map(([e,t])=>({layer:e,objectIds:t}))}function ht(e){return 0===e.length||E(e[0])}function gt({drawTool:e},t){const r=e?.mostDownstreamPlugin?.configuration?.curveTypes;if(!t||!r||0===r.length)return!1;const n=new Set(t.capabilities.supportedCurveTypes);return r.some(e=>!n.has(e))}function bt(e,t){const r=new Set(t.capabilities.supportedCurveTypes);return e.some(({geometry:e})=>e&&k(e)&&A(e,r))}function wt({filter:e,forEachFeature:t,forEachValueChange:r}){return n=>{for(const{feature:o,changes:i}of n.data)if(!e||e(o)){for(const{fieldName:e,value:t}of i)r?.(e,t,o);t?.(o,i)}}}export{gt as activeSketchToolDrawsUnsupportedCurve,Pe as appendAllUtilityNetworkAssociationRelationships,ot as avoidFeatureTemplateSelectionWithOnlyOneItem,lt as canCreateInteractiveEditSession,ct as cloneGraphicExceptMesh,bt as containsUnsupportedCurve,Ve as createLayerIdMap,Me as createRelationshipKeyMap,Ie as createToolFromGeometryType,nt as createWorkflowSteps,Ze as fetchCandidates,He as fetchFullFeatures,qe as findAllDependencies,Re as findChangesByGlobalId,Ge as findEditorItemForLayer,Be as findEditorItemForLayerOrThrow,Ne as findLayerInfo,ze as generateHashForRelationship,ft as getLayersFromWorkflow,ye as getRotationVariableAttribute,dt as getServiceEditsFromWorkflowData,Se as getServiceInfoForLayer,Oe as getServiceLayersById,ge as getSizeVariableAttribute,fe as getVisualVariableAttributes,de as getVisualVariablesForLayer,wt as handleFormValuesChangeEvent,te as isAnyUpdateLeafWorkflow,re as isBatchAttributeFormViewModel,ht as isGraphicsArray,ie as isMergeFeaturesWorkflow,le as isMergeWorkflowOptions,se as isParentWorkflow,ae as isSplitFeatureWorkflow,ce as isSplitWorkflowOptions,at as isTerminalUpdateEventType,ne as isUpdateFeaturesWorkflow,pe as isUpdateFeaturesWorkflowOptions,oe as isUpdateRecordWorkflow,Ee as isUtilityNetworkAssociationsTable,yt as makeMinimalAttributes,Le as orderEditsByRelationshipDependencies,pt as setRelationshipFields,tt as setUpGeometryUpdate,Te as setUpSketchCreateWatchers,Xe as setVisualVariablesAndElevationInfoForUpdate,ut as showProgressCursor,rt as sizeDefaults,it as sizeVariableUnitToLengthUnit,ve as startCreatingNewFeature,Je as startUpdatingFeatureGeometry,Ke as syncUpdateOptions,mt as toFeatureInfos,et as visualVariableInteractiveUpdate,st as whenEditorLayerView,ue as workflowInfluencesOutcomeOfParent};
|
|
2
|
+
import e from"../../Color.js";import t from"../../Graphic.js";import{isSome as r,equals as n,addMany as o}from"../../core/arrayUtils.js";import i from"../../core/Error.js";import{handlesGroup as a,makeHandle as s,abortHandle as l}from"../../core/handleUtils.js";import{clone as c}from"../../core/lang.js";import u from"../../core/Logger.js";import{getOrCreateMapValue as p}from"../../core/MapUtils.js";import{debounce as d,isPromiseLike as f,whenOrAbort as y}from"../../core/promiseUtils.js";import{watch as m,on as h,whenOnce as g,when as b}from"../../core/reactiveUtils.js";import{px2pt as w}from"../../core/screenUtils.js";import{addMany as I}from"../../core/SetUtils.js";import{isSharedTemplateOrMetadata as v,isSharedGroupTemplate as T,getCreationAttributes as F,isSharedPresetTemplate as j}from"../../editing/templateUtils.js";import{isCurvedGeometry as k,hasUnsupportedCurve as A}from"../../geometry/support/curves/curveUtils.js";import S from"../../layers/GraphicsLayer.js";import{featureHasFields as O,fixFields as U,getDisplayFieldName as L}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as V}from"../../layers/support/layerUtils.js";import{calculateTolerance as M}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as x}from"../../renderers/support/lengthUtils.js";import{isRenderer as q}from"../../renderers/support/typeUtils.js";import{getTransformationType as P}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import{isGraphic as z}from"../../support/graphicInstanceUtils.js";import E from"../../symbols/SimpleFillSymbol.js";import R from"../../symbols/SimpleLineSymbol.js";import C from"../../symbols/SimpleMarkerSymbol.js";import{to3D as D}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as G}from"../../symbols/support/symbolUtils.js";import{getServices as B}from"../../undoredo/support/Services.js";import{defaultDrawingMode as N}from"../../views/draw/drawingModes.js";import{updateGraphicSymbolWhenRequired as Z,fetchFullFeaturesByObjectId as W}from"../../views/draw/support/editingSessionUtils.js";import{createQueryGeometry as $}from"../../views/support/drapedUtils.js";import{filterGraphicHits as H,hitTestSelectSimilarDistance as Q}from"../../views/support/hitTestSelectUtils.js";import{isNextOrLegacyUpdateWorkflow as J,isNextOrLegacyUpdateFeaturesWorkflow as K}from"./compatibilityAdapters.js";import{dependencySort as X}from"./support/dependencySort.js";import{isDrawGraphicTool as Y,isDrawTool as _}from"../Sketch/support/sketchUtils.js";const ee=()=>u.getLogger("esri.widgets.Editor.workflowUtils");function te(e){return oe(e)||ne(e)}function re(e){return!!e&&"features"in e}function ne(e){return null!=e&&"update-features"===e.type}function oe(e){return null!=e&&e.type.includes("update-")&&"fullFeature"in e}function ie(e){return null!=e&&"merge-features"===e.type}function ae(e){return null!=e&&"split-feature"===e.type}function se(e){const t=e?.type;return"update-feature"===t||"update-table-record"===t||"update-features"===t||"split-feature"===t}function le(e){return"merge"===e?.type}function ce(e){return"split"===e?.type}function ue(e){return ie(e)||ae(e)}function pe(e){return"update-multiple"===e?.type}function de(e){const t=e&&"renderer"in e?e.renderer:null;if(!we(t))return{rotation:null,size:null};const r=t.getVisualVariablesForType("rotation").filter(e=>(!e.axis||"heading"===e.axis)&&e.field&&!e.valueExpression),n=t.getVisualVariablesForType("size").filter(e=>e.field&&!e.useSymbolValue&&!e.valueExpression&&"real-world-size"===P(e));return{rotation:1===r.length?r[0]:null,size:1===n.length?n[0]:null}}function fe(e){const t=e.sourceLayer;if(!(t&&"renderer"in t&&we(t.renderer)))return{rotation:null,size:null};const{rotation:r,size:n}=de(t);let o=null,i=null;if(r){const e=t.fields?.filter(e=>e.name===r.field),n=1===e?.length?e[0]:null;o=ye(r,n)}if(n){const e=t.fields?.filter(e=>e.name===n.field),r=1===e?.length?e[0]:null;i=ge(n,r)}return{rotation:o,size:i}}function ye(e,t){const r="heading"===(e.axis||"heading")&&"arithmetic"===e.rotationType?-1:1,n=t?.type??"double",o={initial:0,current:0};return{field:e.field,fieldType:n,getDefaultValue:()=>Promise.resolve(0),getValue:e=>(o.current=o.initial-r*e,be((o.current+360)%360,n)),setInitialValue:e=>{o.initial=e,o.current=0},isUpdatingInteractively:!1,rotationType:e.rotationType??"geographic"}}function me(e,t){switch(t){case"width":return e[0];case"depth":return e[1];case"height":return e[2];default:return e[2]||e[1]||e[0]}}async function he(e,t,r){if(null==t)return 0;const{symbol:n}=D(t);if(null==n||"web-style"===n.type||"cim"===n.type)return 0;const o=n.symbolLayers.at(0);if(!o)return 0;switch(o.type){case"icon":{const{computeIconLayerResourceSize:e}=await(import("../../symbols/support/symbolLayerUtils.js"));return Math.min(rt.icon,(await e(o,rt.icon))[0])||rt.icon}case"text":return rt.text;case"line":return rt.line;case"object":{const{computeObjectLayerResourceSize:t}=await(import("../../symbols/support/symbolLayerUtils.js"));return me(await t(o,e.scale/rt.viewScaleSizeFactor),r)}case"path":case"extrude":return e.scale/rt.viewScaleSizeFactor;default:return 0}}function ge(e,t){const r=e.axis,n=t?.type??"double",o={initial:0,current:0},i=x[e.valueUnit]??1;let a;return a="area"===e.valueRepresentation?e=>(e*i/2)**2*Math.PI:"radius"===e.valueRepresentation||"distance"===e.valueRepresentation?e=>e*i/2:e=>e*i,{field:e.field,fieldType:n,getDefaultValue:async(e,t)=>be(a(await he(t,e,r)),n),getValue:(e,t)=>(o.initial||(o.initial=t.pixelSizeAt(t.center)),o.current=o.initial*e,be(o.current,n)),setInitialValue:e=>{o.initial=e,o.current=0},isUpdatingInteractively:!1,displayUnit:it(e.valueUnit),axis:e.axis}}function be(e,t){switch(t){case"small-integer":case"integer":case"long":return Math.round(e);case"double":case"single":return e;default:return 0}}function we(e){if(!q(e))return!1;switch(e?.type){case"class-breaks":case"simple":case"unique-value":case"dot-density":case"dictionary":case"pie-chart":return!0;default:return!1}}function Ie(e,t){if(!e||!t)throw new Error("no geometry type");if("multipatch"===e)return{tool:"mesh",createOptions:{mode:"hybrid"}};const r=new Map;r.set("circle",{mode:"freehand"}),r.set("rectangle",{mode:"freehand"});const n={mode:N,optionsPerTool:r};if(v(t)){const o=t.defaultTool,i=T(t)?t.definition?.inputGeometryType??e:e;switch(o){case"freehand":case"stream-line":return{tool:"polyline"===i?"freehandPolyline":"freehandPolygon",createOptions:n};case"autocomplete-freehand-polygons":case"stream-polygon":return{tool:"freehandPolygon",createOptions:n};case"autocomplete-polygons":case"difference-polygon":case"create-structures":case"polygon":case"trace":return{tool:"polygon"===i?"polygon":"polyline",createOptions:n};case"circle":return r.get("circle").preserveAspectRatio=!0,{tool:"circle",createOptions:n};case"ellipse":return r.get("circle").preserveAspectRatio=!1,{tool:"circle",createOptions:n};case"create-points-along-line":case"multipoint":return{tool:"multipoint",createOptions:n};case"line":case"radial-line":case"right-angle-line":case"split":case"two-point-line":return{tool:"polyline",createOptions:n};case"rectangle":case"regular-polygon":case"right-angle-polygon":return{tool:"rectangle",createOptions:n};case"elevation-point-from-contour":case"elevation-point-from-dem":case"parcel-seed":case"point":case"point-and-rotation":case"point-at-end-of-line":return{tool:"point",createOptions:n}}}else{const o=t.drawingTool;if("circle"===o||"ellipse"===o)return r.get("circle").preserveAspectRatio="circle"===o,{tool:"circle",createOptions:n};if("rectangle"===o)return{tool:"rectangle",createOptions:n};if("freehand"===o)return{tool:"polygon"===e?"freehandPolygon":"freehandPolyline",createOptions:n}}return{tool:e,createOptions:n}}async function ve(e,t,r){const{creationInfo:n,fullTemplate:o}=r;if(!n)throw new i("featureworkflow","No creation info provided.");const a=n.layer,s=F(o,n.attributeOverrides,n.layer),{view:l}=e,c="2d"===l?.type;T(o)||j(o)||await Ce(e,a,s,c?l.scale:null);const{capabilities:u}=a;t.elevationInfo=a.elevationInfo;const p=Ie(a.geometryType,o);e.defaultCreateOptions={graphicProperties:{attributes:s,sourceLayer:a},mode:p.createOptions.mode,optionsPerTool:p.createOptions.optionsPerTool,preserveAspectRatio:p.createOptions.preserveAspectRatio,hasZ:u.data.supportsZ,defaultZ:(c?u.editing.zDefault:null)??e.defaultCreateOptions.defaultZ},null==n.geometryToPlace?await e.create(p.tool):await e.place(n.geometryToPlace,{graphicProperties:{attributes:s,sourceLayer:a}})}async function Te(e){return a([Fe(e),je(e)])}function Fe({creationAttributes:e,data:t,sketchViewModel:r,view:n}){const{creationInfo:o}=t,{fullTemplate:i}=t;if(!o||"2d"!==n?.type||T(i)||j(i))return null;const a=d(t=>Ce(r,o.layer,e,t));return m(()=>n.scale,e=>a(e))}function je({data:t,sketchViewModel:r,view:n}){const{templateExecutorInfo:o}=t;if(!o)return null;const l=r.activeComponent;if(!n||!Y(l)&&!_(l))return ee().error(new i("featureworkflow","Failed to set up template feedback.")),null;const c=new S({effect:"saturate(0.6) opacity(0.8)",listMode:"hide",title:"Shared Template Feedback Graphics"});n.map?.add(c);const{executor:u,serviceLayersById:p}=o,d=n.theme?.accentColor??new e([255,165,0,1]);return a([h(()=>l,["cursor-update","vertex-add"],()=>{c.removeAll();const e=Y(l)?l.graphic?.geometry:l.unprocessedGeometry;if(!e||!ke(e))return;const t=u(e,"digitizing");if(!f(t))for(const r of t.edits){const e=p.get(r.id);if(e&&r.addFeatures&&0!==r.addFeatures.length)for(const t of e)if(!t.isTable)for(const e of r.addFeatures){const t=Ae(e,d);t&&c.add(t)}}}),s(()=>{n.map.remove(c),c.destroy()})])}function ke(e){switch(e.type){case"point":case"multipoint":return!0;case"polyline":{if(k(e))return e.curvePaths[0].length>1;const t=e.paths[0];return!!t&&t.length>1}case"polygon":{if(k(e))return e.curveRings[0].length>2;const t=e.rings[0];return!!t&&(n(t.at(0),t.at(-1))?t.length>2:t.length>1)}default:return!1}}function Ae(e,r){let n=null;switch(e.geometry?.type){case"point":case"multipoint":n=new C({angle:0,color:r,outline:new R({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:1}),path:"undefined",size:8,style:"circle",xoffset:0,yoffset:0});break;case"polygon":n=new E({color:r,outline:new R({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:3}),style:"none"});break;case"polyline":n=new R({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:2});break;default:return null}return new t({geometry:e.geometry,symbol:n,attributes:{...e.attributes}})}function Se(e,t){const r=B(t),n=V(e)?e.parent:e;return r.tablesAndLayersLookup.get(n)}function Oe(e,t){const r=Se(e,t);if(!r)return new Map;const n=new Map;for(const o of r.layersAndTables)p(n,o.layerId,()=>[]).push(o);return n}function Ue(e){const t=e.objectIdField,r=e.globalIdField??"";return{id:e.layerId,identifierFields:{objectIdField:t,globalIdField:r},addFeatures:[],deleteAttachments:[],addAttachments:[],deleteFeatures:[],updateFeatures:[]}}function Le(e){const{edits:t,serviceInfo:n,view:o,findOriginalFeature:i}=e,a=Ve(n.layersAndTables),s=n.layersAndTables.toArray(),{allEditData:l,editDataByLayerIdMap:c,editDataByIdMap:u}=xe(t,a,i),p=qe(l,Me(s,c),c);if(o&&Ee(l,p,o),0===p.length)return t;const d=X(p,{continueOnCircularDependency:!0}).map(e=>u.get(e)).filter(r),f=new Map;for(const r of d)f.set(r.uniqueId,r);const y=[];for(const r of l)f.has(r.uniqueId)||y.push(r);const m=[];let h=null;for(const r of d){const{layer:e}=r;switch(null==h?h=Ue(e):h.id!==e.layerId&&(m.push(h),h=Ue(e)),r.operationType){case"add":case"modify":h.addFeatures.push(r.after);break;case"delete":h.deleteFeatures.push(r.before)}}null!==h&&m.push(h);for(const r of y){const e=r.layer.layerId,t=m.find(t=>t.id===e)??Ue(r.layer);switch(m.includes(t)||m.push(t),r.operationType){case"add":t.addFeatures.push(r.after);break;case"modify":t.updateFeatures.push(r.after);break;case"delete":t.deleteFeatures.push(r.before);break;case"deleteAttachment":t.deleteAttachments.push(r.attachmentId);break;case"addAttachment":t.addAttachments.push(r.attachment)}}for(const r of m)void 0!==r.deleteAttachments&&0===r.deleteAttachments.length&&delete r.deleteAttachments,void 0!==r.addAttachments&&0===r.addAttachments.length&&delete r.addAttachments;return m}function Ve(e){const t=new Map;for(const r of e)t.set(r.layerId,r);return t}function Me(e,t){const r=new Map;for(const n of e)for(const e of n.relationships??[])if(r.set(Pe(n,e),""),t.has(e.relatedTableId)){const o=t.get(e.relatedTableId);if(o.length>0)for(const t of o[0].layer.relationships??[])if(t.id===e.id){r.set(Pe(n,e),t.keyField);break}}return r}function xe(e,t,r){const n=new Map,o=[],a=new Map;let s=1;for(const l of e){const e=[],c=t.get(l.id);if(!c)throw new i("featureworkflow",`Failed to prepare applyEdits payload. Layer with id ${l.id} not found.`);for(const t of l.addFeatures??[])e.push({uniqueId:"T"+s++,operationType:"add",layer:c,after:t});for(const t of l.deleteFeatures??[])e.push({uniqueId:"T"+s++,operationType:"delete",before:t,layer:c});for(const t of l.deleteAttachments??[])e.push({uniqueId:"T"+s++,operationType:"deleteAttachment",attachmentId:t,layer:c});for(const t of l.addAttachments??[])e.push({uniqueId:"T"+s++,operationType:"addAttachment",attachment:t,layer:c});for(const t of l.updateFeatures??[])e.push({uniqueId:"T"+s++,operationType:"modify",before:r(t),after:t,layer:c});n.set(c.layerId,e);for(const t of e)o.push(t),a.set(t.uniqueId,t)}return{allEditData:o,editDataByIdMap:a,editDataByLayerIdMap:n}}function qe(e,t,r){const n=[];for(const o of e){const e=o.layer.relationships??[],{uniqueId:i}=o;for(const a of e){const e=a.keyField;if("origin"===a.role){const s=r.get(a.relatedTableId);if(!s||0===s.length)continue;const l=Pe(o.layer,a),c=t.get(l);if(void 0===c||""===c)continue;switch(o.operationType){case"add":for(const t of s)t!==o&&("add"!==t.operationType&&"modify"!==t.operationType||t.after.attributes[c]===o.after.attributes[e]&&n.push([i,t.uniqueId]));break;case"modify":if(o.before.attributes[e]!==o.after.attributes[e])for(const t of s){const r=t.uniqueId;t!==o&&("delete"===t.operationType?t.before.attributes[c]===o.before.attributes[e]?n.push([r,i]):t.before.attributes[c]===o.after.attributes[e]&&n.push([i,r]):"add"===t.operationType?t.after.attributes[c]===o.after.attributes[e]?n.push([i,r]):t.after.attributes[c]===o.before.attributes[e]&&n.push([r,i]):"modify"===t.operationType&&(t.before.attributes[c]!==t.after.attributes[c]?t.after.attributes[c]===o.after.attributes[e]?n.push([i,r]):n.push([r,i]):n.push([i,r])))}break;case"delete":for(const t of s)t!==o&&("delete"!==t.operationType&&"modify"!==t.operationType||t.before.attributes[c]===o.before.attributes[e]&&n.push([t.uniqueId,i]))}}}}return n}function Pe(e,t){return`${e.layerId}:${t.id}`}function ze(e,t){return!!(t?.map&&"utilityNetworks"in t.map&&t.map.utilityNetworks?.length&&t.map.utilityNetworks.some(t=>!(!t.loaded||!e.url?.startsWith(t.featureServiceUrl)||e.layerId!==t.networkSystemLayers.associationsTableId)))}function Ee(e,t,r){const n=[];for(const i of e)ze(i.layer,r)&&n.push(i);if(0===n.length)return;let o=[];for(const i of n){const r=i.layer;switch(i.operationType){case"delete":o=[...Re(i.before.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Re(i.before.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of o)t.push([i.uniqueId,e.uniqueId]);break;case"add":o=[...Re(i.after.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Re(i.after.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of o)t.push([e.uniqueId,i.uniqueId])}}}function Re(e,t){const r=[],n=t.filter(({layer:e})=>""!==e.globalIdField&&null!=e.globalIdField);for(const o of n){const t=o.layer.globalIdField;("before"in o&&o.before?.attributes[t]===e||"after"in o&&o.after?.attributes[t]===e)&&r.push(o)}return r}async function Ce(e,r,n,o){const i=new t({sourceLayer:r,attributes:n}),{rotation:a,size:s}=fe(i);let l=await G(i,{useSourceLayer:!0,scale:o}),c=!1;for(const t of[s,a]){if(null==t)continue;null==n[t.field]&&(n[t.field]=await t.getDefaultValue(l,e.view),c=!0)}switch(c&&(l=await G(i,{useSourceLayer:!0,scale:o})),l?.type){case"simple-fill":case"polygon-3d":e.polygonSymbol=l;break;case"simple-line":case"line-3d":e.polylineSymbol=l;break;case"simple-marker":case"picture-marker":case"point-3d":case"cim":e.pointSymbol=l;break;case"mesh-3d":e.meshSymbol=l}De(e.tooltipOptions,s,a)}function De(e,t,r){e.visualVariables=null!=t||null!=r?{size:null!=t?{unit:t.displayUnit,axis:t.axis,valueType:t.fieldType}:null,rotation:null!=r?{valueType:r.fieldType,rotationType:r.rotationType??"geographic"}:null}:null}function Ge(e,t){return e.find(e=>e.layer===t)}function Be(e,t){const r=Ge(e,t);if(null==r)throw new i("no-editorItem-found","The EditorViewModel provided did not have an EditorItem associated with the specified layer");return r}function Ne(e,t){return e?.find(e=>e.layer===t)}async function Ze(e,t,r,n){switch(t.type){case"3d":return We(e,t,r,n);case"2d":return $e(e,t,r,n)}}async function We(e,t,r,n){if(0===e.length)return[];const{updatable:i,graphicsByLayer:a}=await r.defer(async()=>{const{results:o}=await y(Q(t,r),n),i=new Map,a=e=>{const t=e.layer,r=i.get(t);if(!r){const e=new Array;return i.set(t,e),e}return r};H(o).forEach(({graphic:e})=>a(e).push(e));const s=e.filter(({capabilities:e,layer:t})=>e.update.enabled&&i.has(t));return 0!==s.length&&r.stopPropagation(),{updatable:s,graphicsByLayer:i}});return y(Promise.allSettled(i.map(async({layer:e})=>{const t=a.get(e),r=He(e);if(t.every(e=>O(e,r)))return t;const i=[];for(const n of t){i.push(n.getObjectId());const e=Object.keys(n.attributes);o(r,e)}const s=e.createQuery();return s.returnGeometry=!1,s.objectIds=i,s.outFields=U(e.fieldsIndex,r),e.queryFeatures(s,{signal:n}).then(({features:e})=>e)})),n)}async function $e(e,t,r,n){if(0===e.length)return[];const{mapPoint:o}=r;if(null==o)return[];let i=null;const a=await r.defer(async()=>{const{results:o}=await y(t.hitTest(r),n);if(0===o.length)return[];const a=new Set;i=H(o),i.forEach(({graphic:e})=>e&&a.add(e.layer));const s=e.filter(e=>a.has(e.layer)&&e.supportsUpdateWorkflow);return s.length>0&&r.stopPropagation(),s});return y(Promise.allSettled(a.map(async({layer:e})=>{const a=e.createQuery();a.returnGeometry=!0,a.outFields=He(e);const s="renderer"in e?M({renderer:e.renderer,pointerType:r.pointerType}):0;a.geometry=$(o,s,t),a.outSpatialReference=t.spatialReference;const{features:l}=await e.queryFeatures(a,{signal:n});return i?.forEach(({graphic:t})=>{t.layer!==e||l.some(e=>e.getObjectId()===t.getObjectId())||l.push(t)}),l})),n)}function He(e){return U(e.fieldsIndex,[e.objectIdField,L({displayField:"displayField"in e?e.displayField:null,fields:e.fields})])}async function Qe(e,t,n,o){const i=e.map(e=>e.getObjectId()??e.attributes[t.objectIdField]).filter(r);return await W(i,t,n,o)}async function Je(e){const{graphic:t,sketchViewModel:r,sourceLayer:n,updateOptions:o,visualVariables:i}=e;await Xe(e);const a={multipleSelectionEnabled:!1,...o};return"point"===n.geometryType&&(a.enableRotation=null!=i.rotation,a.enableScaling=null!=i.size),r.update(t,a)}function Ke(e,t){const{activeUpdateOptions:r}=e;r&&(e.activeUpdateOptions={...r,...t,reshapeOptions:{...r.reshapeOptions,...t.reshapeOptions},highlightOptions:{...r.highlightOptions,...t.highlightOptions}})}async function Xe(e){const{graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:o,visualVariables:i}=e;let a=!1;const{rotation:s,size:l}=i;for(const c of[s,l]){if(null==c)continue;const e=t.getAttribute(c.field);if(null!=e)c.setInitialValue(e);else{const e=await c.getDefaultValue(t.symbol,n.view);c.setInitialValue(e),t.setAttribute(c.field,e),a=!0}}if(a){const e="2d"===n.view?.type?n.view.scale:null;await Z(t,e)}De(n.tooltipOptions,l,s),r.elevationInfo=o.elevationInfo}function Ye(e){return null==e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function _e(e){return null==e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}function et(e,t,r,n){if(null==t.geometry||"point"!==t.geometry?.type)return!1;const o=t.attributes;let i=!1;const a=n.rotation,s=Ye(r.toolEventInfo);if(null!=a&&null!=s){const{field:r,getValue:n}=a;if("rotate-stop"===s.type)a.isUpdatingInteractively=!1,a.setInitialValue(t.getAttribute(r));else{a.isUpdatingInteractively=!0;const l=n(s.angle,e);l!==o[r]&&t.setAttribute(r,l),i=!0}}const l=n.size,c=_e(r.toolEventInfo);if(null!=l&&null!=c){const{field:r,getValue:n}=l;if("scale-stop"===c.type)l.isUpdatingInteractively=!1,l.setInitialValue(t.getAttribute(r));else{l.isUpdatingInteractively=!0;const a=n(c.xScale,e);a!==o[r]&&t.setAttribute(r,a),i=!0}}return i}async function tt({feature:e,featureClone:t,sketchLayer:r,sketchViewModel:n,getUpdateOptions:o,view:i,visualVariableAttributes:c,addHandle:u,updatingHandles:p,onUpdate:f}){await Z(t,"2d"===i.type?i.scale:null);let y=null;if("2d"===n?.view?.type){const e=d(e=>Z(t,e));y=p.add(()=>n?.view?.scale,t=>p.consumePromise(e(t)))}const m=t.sourceLayer,h=st(i,m);await Je({graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:m,updateOptions:o(),visualVariables:c});let w=null;h.then(e=>w=e).catch(()=>{});const I=c.size,v=c.rotation,T=p.add(()=>e.attributes,async e=>{let r=!1;for(const n in e){const o=e[n];o!==t.getAttribute(n)&&(t.setAttribute(n,o),null==I||I.isUpdatingInteractively||I.field!==n||I.setInitialValue(o),null==v||v.isUpdatingInteractively||v.field!==n||v.setInitialValue(o),(null==w||w.requiredFields.includes(n))&&(r=!0))}r&&await p.addPromise(Z(t,"2d"===i.type?i.scale:null))}),F=n.on("update",async e=>{const t=e.graphics[0],a={graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:m,updateOptions:o(),visualVariables:c};if("complete"===e.state){const e=new AbortController,t=l(e);return u(t),void p.consumePromise(g(()=>null===i.activeTool,e.signal).then(async()=>{if(!e.signal.aborted)return e.abort(),Je(a)}))}et(i,t,e,c)&&await p.addPromise(Z(t,"2d"===i.type?i.scale:null)),f(ct(t),e)}),j=b(()=>null!=i.activeTool&&i.activeTool!==n.activeComponent,()=>n.cancel()),k=n.on(["undo","redo"],e=>{f(ct(e.graphics[0]),e)});return a([k,F,j,s(()=>n.cancel()),T,y])}const rt={icon:w(24),text:w(12),line:w(1),viewScaleSizeFactor:100};function nt(e,t,r){let n=!1;return e.filter(e=>!!n||(n=e===t,n)).map(e=>r[e]())}function ot(e,t){e.viewModel.syncFeatureTemplates();const r=e.creationInfo;if("awaiting-feature-creation-info"===t[0].id&&r){const n=r.layer,o=e.viewModel.getTemplatesForLayer(n);1===o.length&&"scene"!==n.type&&(r.template=o[0],t.shift())}return t}function it(e){return"unknown"===e?null:e}const at=e=>e.includes("-stop")||e.includes("vertex-"),st=(e,t)=>{const r="subtype-sublayer"===t.type?t.parent:t;return e.whenLayerView(r)};function lt(e){return"createInteractiveEditSession"in e}function ct(e){const t=e.geometry;if("mesh"===t?.type){const r=e.cloneShallow();return r.attributes=c(e.attributes),r.geometry=t.cloneShallow(),r.geometry.transform=t.transform?.clone()??null,r}return e.clone()}function ut(e){return e.acquireCursor("progress")}function pt(e){for(const t of e){const{destinationGraphic:e,destinationField:r,sourceGraphic:n,sourceField:o}=t;e.setAttribute(r,n.getAttribute(o))}}function dt(e){const t=e.templateExecutorInfo?.completionResults;return t?.length?(t.forEach(e=>pt(e.relationships)),t.flatMap(e=>e.edits)):null}function ft(e){const t=J(e)?e.activeWorkflow:e;if(null==t)return[];if(K(t))return t.data.layers;const r=t.layer;return r?[r]:[]}function yt({attributes:e},t){const r=new Set;r.add(t.objectIdField),"uniqueIdFields"in t&&t.uniqueIdFields&&t.uniqueIdFields.length>0&&I(r,t.uniqueIdFields);const n={};for(const o of r)null!=e[o]&&(n[o]=e[o]);if("scene"===t.type&&null!=t.infoFor3D){const r=t.associatedLayer?.globalIdField;null!=r&&(e[r]=e[r])}return n}function mt(e){if(!ht(e))return e;const t=new Map;for(const r of e){const e=r.getObjectId();if(null!=e){const n=r.sourceLayer??r.layer;p(t,n,()=>[]).push(e)}}return Array.from(t.entries()).map(([e,t])=>({layer:e,objectIds:t}))}function ht(e){return 0===e.length||z(e[0])}function gt({drawTool:e},t){const r=e?.mostDownstreamPlugin?.configuration?.curveTypes;if(!t||!r||0===r.length)return!1;const n=new Set(t.capabilities.supportedCurveTypes);return r.some(e=>!n.has(e))}function bt(e,t){const r=new Set(t.capabilities.supportedCurveTypes);return e.some(({geometry:e})=>e&&k(e)&&A(e,r))}function wt({filter:e,forEachFeature:t,forEachValueChange:r}){return n=>{for(const{feature:o,changes:i}of n.data)if(!e||e(o)){for(const{fieldName:e,value:t}of i)r?.(e,t,o);t?.(o,i)}}}export{gt as activeSketchToolDrawsUnsupportedCurve,Ee as appendAllUtilityNetworkAssociationRelationships,ot as avoidFeatureTemplateSelectionWithOnlyOneItem,lt as canCreateInteractiveEditSession,ct as cloneGraphicExceptMesh,bt as containsUnsupportedCurve,Ve as createLayerIdMap,Me as createRelationshipKeyMap,Ie as createToolFromGeometryType,nt as createWorkflowSteps,Ze as fetchCandidates,Qe as fetchFullFeatures,qe as findAllDependencies,Re as findChangesByGlobalId,Ge as findEditorItemForLayer,Be as findEditorItemForLayerOrThrow,Ne as findLayerInfo,Pe as generateHashForRelationship,ft as getLayersFromWorkflow,ye as getRotationVariableAttribute,dt as getServiceEditsFromWorkflowData,Se as getServiceInfoForLayer,Oe as getServiceLayersById,ge as getSizeVariableAttribute,fe as getVisualVariableAttributes,de as getVisualVariablesForLayer,wt as handleFormValuesChangeEvent,te as isAnyUpdateLeafWorkflow,re as isBatchAttributeFormViewModel,ht as isGraphicsArray,ie as isMergeFeaturesWorkflow,le as isMergeWorkflowOptions,se as isParentWorkflow,ae as isSplitFeatureWorkflow,ce as isSplitWorkflowOptions,at as isTerminalUpdateEventType,ne as isUpdateFeaturesWorkflow,pe as isUpdateFeaturesWorkflowOptions,oe as isUpdateRecordWorkflow,ze as isUtilityNetworkAssociationsTable,yt as makeMinimalAttributes,Le as orderEditsByRelationshipDependencies,pt as setRelationshipFields,tt as setUpGeometryUpdate,Te as setUpSketchCreateWatchers,Xe as setVisualVariablesAndElevationInfoForUpdate,ut as showProgressCursor,rt as sizeDefaults,it as sizeVariableUnitToLengthUnit,ve as startCreatingNewFeature,Je as startUpdatingFeatureGeometry,Ke as syncUpdateOptions,mt as toFeatureInfos,et as visualVariableInteractiveUpdate,st as whenEditorLayerView,ue as workflowInfluencesOutcomeOfParent};
|
package/widgets/Popup/types.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import type Point from "../../geometry/Point.js";
|
|
|
4
4
|
import type ActionButton from "../../support/actions/ActionButton.js";
|
|
5
5
|
import type ActionToggle from "../../support/actions/ActionToggle.js";
|
|
6
6
|
import type { AbortOptions } from "../../core/promiseUtils.js";
|
|
7
|
-
import type { FetchPopupFeaturesDiagnostics } from "../../views/PopupView.js";
|
|
8
7
|
import type { ClickEvent } from "../../views/input/types.js";
|
|
9
8
|
|
|
10
9
|
/** @since 5.0 */
|
|
@@ -136,12 +135,6 @@ export interface PopupOpenOptions {
|
|
|
136
135
|
* @since 5.2
|
|
137
136
|
*/
|
|
138
137
|
featureStream?: AsyncGenerator<Graphic>;
|
|
139
|
-
/**
|
|
140
|
-
* Diagnostics collected while fetching features from a view.
|
|
141
|
-
*
|
|
142
|
-
* @since 5.2
|
|
143
|
-
*/
|
|
144
|
-
diagnostics?: FetchPopupFeaturesDiagnostics;
|
|
145
138
|
/**
|
|
146
139
|
* This property enables multiple features in a popup to display in a list rather than displaying the first selected feature. Setting this to `true`
|
|
147
140
|
* allows the user to scroll through the list of features.
|
package/widgets/Popup.d.ts
CHANGED
|
@@ -178,14 +178,14 @@ export interface PopupEvents extends FeaturesViewModelEvents {}
|
|
|
178
178
|
* view.openPopup(...);
|
|
179
179
|
* view.closePopup(...);
|
|
180
180
|
* ```
|
|
181
|
-
* - Use [
|
|
181
|
+
* - Use [watch()](https://developers.arcgis.com/javascript/latest/references/core/core/reactiveUtils/#watch) with optional chaining to watch properties on the popup and its view model, even before the popup is created.
|
|
182
182
|
* ```js
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
183
|
+
* const handle = reactiveUtils.watch(
|
|
184
|
+
* () => view.popup?.selectedFeature,
|
|
185
|
+
* (selectedFeature) => {
|
|
186
|
+
* console.log("Selected feature:", selectedFeature);
|
|
187
|
+
* }
|
|
188
|
+
* );
|
|
189
189
|
* ```
|
|
190
190
|
* - Use the [when()](https://developers.arcgis.com/javascript/latest/references/core/core/reactiveUtils/#when) method to check when the popup instance is created. Once its created, then it's properties or methods can be accessed and called.
|
|
191
191
|
* ```js
|
|
@@ -129,6 +129,7 @@ export interface TimeSliderViewModelProperties extends Partial<Pick<TimeSliderVi
|
|
|
129
129
|
timeExtent?: TimeExtentProperties | null;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
+
/** @deprecated since version 5.2. Use the [Time Bar component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-time-bar/) instead. */
|
|
132
133
|
export interface TimeSliderViewModelEvents {
|
|
133
134
|
/**
|
|
134
135
|
* Fires when a user clicks on an action in the actions menu.
|
|
@@ -160,6 +161,7 @@ export interface TimeSliderViewModelTriggerActionEvent {
|
|
|
160
161
|
/**
|
|
161
162
|
* Provides the logic for the [TimeSlider](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/) widget and [component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-time-slider/).
|
|
162
163
|
*
|
|
164
|
+
* @deprecated since version 5.2. Use the [Time Bar component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-time-bar/) instead.
|
|
163
165
|
* @since 4.12
|
|
164
166
|
* @see [TimeSlider](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/) widget
|
|
165
167
|
* @see [Time Slider component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-time-slider/)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import e from"../../core/Collection.js";import{
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../core/Collection.js";import{deprecateUnnecessaryViewModel as i}from"../../core/deprecate.js";import{EventedAccessor as n}from"../../core/Evented.js";import s from"../../core/Logger.js";import{after as r,isAbortError as o}from"../../core/promiseUtils.js";import{watch as l,initial as a,syncAndInitial as m,whenOnce as u}from"../../core/reactiveUtils.js";import{offsetDate as p}from"../../core/timeUtils.js";import{property as h,cast as d,subclass as c}from"../../core/accessorSupport/decorators.js";import{ensureType as f}from"../../core/accessorSupport/ensureType.js";import g from"../../time/TimeExtent.js";import w from"../../time/TimeInterval.js";import v from"../../webdoc/Widgets.js";import T from"../../webdoc/widgets/TimeSlider.js";const x=1e4;function E(t){return!!t&&"count"in t}function y(t){return!!t&&"interval"in t}function _(t){return!!t&&"dates"in t}let C=class extends n{constructor(t){super(t),this._animationController=null,this._isViewTimeExtentInitialized=!1,this._timerId=null,this.actions=new e,this.fullTimeExtent=null,this.loop=!1,this.mode="time-window",this.stops={count:10},this.timeExtent=null,this.view=null,t?.suppressDeprecationWarning||i(s.getLogger(this),"Time Bar","arcgis-time-bar",{version:"5.2"})}normalizeCtorArgs(t){const{suppressDeprecationWarning:e,...i}=t??{};return i}initialize(){this.addHandles([l(()=>this.effectiveStops,()=>{this.timeExtent??=this._getDefaultTimeExtent()},a),l(()=>this.view,(t,e)=>{this._unregisterWidget(e),this._registerWidget(t)},m),l(()=>this.timeExtent,t=>{if(!this.view)return;const e=this.view.timeExtent;(t&&!t.isAllTime||e&&!e.isAllTime)&&(t&&e&&t.equals(e)||(this.view.timeExtent=t))},a),l(()=>this.view?.timeExtent,t=>{this._isViewTimeExtentInitialized?(t&&!t.isAllTime||this.timeExtent&&!this.timeExtent.isAllTime)&&(t&&this.timeExtent&&t.equals(this.timeExtent)||(this.timeExtent=t)):this._isViewTimeExtentInitialized=!0})])}destroy(){null!=this._timerId&&(clearInterval(this._timerId),this._timerId=null),this._unregisterWidget(this.view),this.view=null,this._animationController?.abort(),this._animationController=null}get effectiveStops(){const{fullTimeExtent:t,stops:e}=this;if(_(e)){const{dates:i}=e;if(!i?.length)return null;const n=i.sort((t,e)=>t.getTime()-e.getTime());if(!t)return n;const{start:s,end:r}=t;if(!s||!r)return n;return n.filter(t=>!(t.getTime()<s.getTime()||t.getTime()>r.getTime()))}if(E(e)){const i=e.timeExtent??t;return this._divideTimeExtentByCount(i,e.count)}if(y(e)){const i=e.timeExtent??t;return this._divideTimeExtentByInterval(i,e.interval)}return[]}get isPreCommonEra(){return(this.fullTimeExtent?.start?.getFullYear()??0)<0}set playRate(t){t<=0||t>36e5||("playing"===this.state&&this._startAnimation(),this._set("playRate",t))}get state(){return this.fullTimeExtent?this._animationController?"playing":"ready":"disabled"}castStops(t){if(!t)return null;if(y(t)){if("unknown"===t.interval.unit)return s.getLogger(this).warn('A stop interval with an "unknown" time units is not supported. The default stop definition will be used.'),{count:10};t.interval=f(w,t.interval)}return(y(t)||E(t))&&(t.timeExtent=f(g,t.timeExtent)),t}get timeExtentValues(){const{mode:t,timeExtent:e}=this;if(!e||e.isAllTime||e.isEmpty)return null;const{start:i,end:n}=e;switch(t){case"cumulative-from-end":case"instant":return i?[i.getTime()]:null;case"cumulative-from-start":return n?[n.getTime()]:null;case"time-window":return i&&n?[i.getTime(),n.getTime()]:null}}next(){this._step({forward:!0,allowRestart:!1})}play(){this._startAnimation()}previous(){this._step({forward:!1,allowRestart:!1})}stop(){this._stopAnimation()}triggerAction(t){this.emit("trigger-action",{action:t})}updateWebDocument(t){const e=new T({currentTimeExtent:this.timeExtent,fullTimeExtent:this.fullTimeExtent,loop:this.loop,numStops:E(this.stops)?this.stops.count:null,numThumbs:"time-window"===this.mode?2:1,stopDelay:this.playRate,stopInterval:y(this.stops)?this.stops.interval:null,stops:_(this.stops)?this.stops.dates:null});t.widgets??=new v,t.widgets.timeSlider=e}valuesToTimeExtent(t){if(!t)return null;const e=t.sort((t,e)=>t-e).map(t=>new Date(t)),i=e.length>0?e[0]:null,n=e.length>1?e[1]:null;switch(this.mode){case"time-window":return new g({start:i,end:n});case"instant":return new g({start:i,end:i});case"cumulative-from-start":return new g({start:null,end:i});case"cumulative-from-end":return new g({start:i,end:null});default:return g.allTime}}async _animate(){try{const t=this.view,e=this._animationController?.signal;await Promise.all([r(this.playRate,null,e),t&&u(()=>!t.updating,e)])}catch(t){return o(t)||s.getLogger(this).error(t),void(this._animationController=null)}this._step({forward:!0,allowRestart:!1}),this._animationController&&this._animate()}_divideTimeExtentByCount(t,e=10){if(!t||!e)return[];const{start:i,end:n}=t;if(!i||!n)return[];if(e>x)return this._divideTimeExtentByCount(t);const s=[],r=i.getTime(),o=n.getTime()-r;for(let l=0;l<=e;l++)s.push(new Date(r+l/e*o));return s}_divideTimeExtentByInterval(t,e,i=x){if(!t||!e)return[];const{start:n,end:s}=t;if(!n||!s)return[];const r=s.getTime()-n.getTime(),o=e.toMilliseconds();if(o<=0||r/o>i)return this._divideTimeExtentByCount(t);const l=[],{value:a,unit:m}=e;let u=n;for(;u.getTime()<=s.getTime();)l.push(new Date(u)),u=p(u,a,m);return l}_getDefaultTimeExtent(){const{effectiveStops:t,mode:e}=this;if(!t||!e)return null;switch(e){case"time-window":return t.length>1?new g({start:t[0],end:t[1]}):null;case"cumulative-from-start":return t.length>0?new g({start:null,end:t[0]}):null;case"cumulative-from-end":return t.length>0?new g({start:t[0],end:null}):null;case"instant":return t.length>0?new g({start:t[0],end:t[0]}):null;default:return null}}_registerWidget(t){t?.registerComponent(this)}_startAnimation(){this._stopAnimation(),this._animationController=new AbortController,this._step({forward:!0,allowRestart:!0}),this._animate()}_step(t){const{forward:e,allowRestart:i}=t,{effectiveStops:n}=this;if(!this.timeExtentValues||!n)return;const s=n.map(t=>t.getTime()),r=this.timeExtentValues.map(t=>{const e=s.indexOf(t);if(-1!==e)return e;const i=s.reduce((e,i)=>Math.abs(i-t)<Math.abs(e-t)?i:e);return s.indexOf(i)}),o=r.map(t=>t+(e?1:-1)),l=o.some(t=>t<0||t>s.length-1),{loop:a,state:m}=this;if(l)if(a||i){const t=Math.min(...r),i=Math.max(...r),n=(e?r.map(e=>e-t):r.map(t=>t+(s.length-1-i))).map(t=>s[t]);this.timeExtent=this.valuesToTimeExtent(n)}else"playing"===m&&this.stop();else{const t=o.map(t=>s[t]);this.timeExtent=this.valuesToTimeExtent(t)}}_stopAnimation(){null!=this._animationController&&(this._animationController.abort(),this._animationController=null)}_unregisterWidget(t){t?.unregisterComponent(this)}};t([h()],C.prototype,"_animationController",void 0),t([h({type:e})],C.prototype,"actions",void 0),t([h({readOnly:!0})],C.prototype,"effectiveStops",null),t([h({type:g})],C.prototype,"fullTimeExtent",void 0),t([h()],C.prototype,"isPreCommonEra",null),t([h({nonNullable:!0})],C.prototype,"loop",void 0),t([h({nonNullable:!0})],C.prototype,"mode",void 0),t([h({nonNullable:!0,value:1e3})],C.prototype,"playRate",null),t([h({readOnly:!0})],C.prototype,"state",null),t([h()],C.prototype,"stops",void 0),t([d("stops")],C.prototype,"castStops",null),t([h({type:g})],C.prototype,"timeExtent",void 0),t([h({readOnly:!0})],C.prototype,"timeExtentValues",null),t([h()],C.prototype,"view",void 0),t([h()],C.prototype,"next",null),t([h()],C.prototype,"play",null),t([h()],C.prototype,"previous",null),t([h()],C.prototype,"stop",null),t([h()],C.prototype,"updateWebDocument",null),C=t([c("esri.widgets.TimeSlider.TimeSliderViewModel")],C);const b=C;export{b as default};
|
package/widgets/TimeSlider.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{equals as t}from"../core/arrayUtils.js";import i from"../core/Collection.js";import{deprecateWidget as s}from"../core/deprecate.js";import a from"../core/Logger.js";import{watch as n,initial as l}from"../core/reactiveUtils.js";import{truncateDate as o,offsetDate as r}from"../core/timeUtils.js";import{property as u,subclass as m}from"../core/accessorSupport/decorators.js";import{formatDate as c,convertDateFormatToIntlOptions as d}from"../intl/date.js";import{getCalciteModeClass as p}from"../support/modeUtils.js";import{unknown as v,system as h}from"../time/constants.js";import y from"../time/TimeExtent.js";import f from"../time/TimeInterval.js";import g from"./Slider.js";import b from"./Widget.js";import{loadCalciteComponents as x}from"./support/componentsUtils.js";import{globalCss as w}from"./support/globalCss.js";import{messageBundle as E,vmEvent as k,tsx as T}from"./support/widget.js";import{onResize as _}from"./support/widgetUtils.js";import{css as S}from"./TimeSlider/css.js";import M from"./TimeSlider/TimeSliderViewModel.js";const F=3,D=858,j=(e,t,i)=>({minor:e,major:t,format:i}),C={sf:{second:"numeric",fractionalSecondDigits:3},s:{second:"numeric"},ms:{minute:"numeric",second:"numeric"},mi:{minute:"numeric"},hm:{hour:"numeric",minute:"numeric"},dm:{day:"numeric",month:"short"},m:{month:"short"},my:{month:"short",year:"numeric"},y:{year:"numeric"}},L=[j({value:1,unit:"milliseconds"},{value:20,unit:"milliseconds"},C.sf),j({value:2,unit:"milliseconds"},{value:50,unit:"milliseconds"},C.sf),j({value:5,unit:"milliseconds"},{value:100,unit:"milliseconds"},C.sf),j({value:10,unit:"milliseconds"},{value:200,unit:"milliseconds"},C.sf),j({value:20,unit:"milliseconds"},{value:500,unit:"milliseconds"},C.sf),j({value:50,unit:"milliseconds"},{value:1,unit:"seconds"},C.s),j({value:100,unit:"milliseconds"},{value:2,unit:"seconds"},C.s),j({value:200,unit:"milliseconds"},{value:5,unit:"seconds"},C.s),j({value:500,unit:"milliseconds"},{value:10,unit:"seconds"},C.s),j({value:1,unit:"seconds"},{value:20,unit:"seconds"},C.ms),j({value:2,unit:"seconds"},{value:30,unit:"seconds"},C.ms),j({value:5,unit:"seconds"},{value:1,unit:"minutes"},C.mi),j({value:10,unit:"seconds"},{value:2,unit:"minutes"},C.mi),j({value:20,unit:"seconds"},{value:5,unit:"minutes"},C.mi),j({value:40,unit:"seconds"},{value:10,unit:"minutes"},C.mi),j({value:1,unit:"minutes"},{value:30,unit:"minutes"},C.hm),j({value:2,unit:"minutes"},{value:1,unit:"hours"},C.hm),j({value:5,unit:"minutes"},{value:2,unit:"hours"},C.hm),j({value:10,unit:"minutes"},{value:4,unit:"hours"},C.hm),j({value:20,unit:"minutes"},{value:8,unit:"hours"},C.hm),j({value:40,unit:"minutes"},{value:12,unit:"hours"},C.hm),j({value:1,unit:"hours"},{value:1,unit:"days"},C.dm),j({value:2,unit:"hours"},{value:2,unit:"days"},C.dm),j({value:5,unit:"hours"},{value:4,unit:"days"},C.dm),j({value:10,unit:"hours"},{value:10,unit:"days"},C.dm),j({value:20,unit:"hours"},{value:15,unit:"days"},C.dm),j({value:1,unit:"days"},{value:20,unit:"days"},C.dm),j({value:2,unit:"days"},{value:1,unit:"months"},C.m),j({value:5,unit:"days"},{value:3,unit:"months"},C.m),j({value:10,unit:"days"},{value:6,unit:"months"},C.my),j({value:20,unit:"days"},{value:1,unit:"years"},C.y),j({value:1,unit:"months"},{value:2,unit:"years"},C.y),j({value:2,unit:"months"},{value:4,unit:"years"},C.y),j({value:5,unit:"months"},{value:10,unit:"years"},C.y),j({value:1,unit:"years"},{value:20,unit:"years"},C.y),j({value:2,unit:"years"},{value:50,unit:"years"},C.y),j({value:5,unit:"years"},{value:100,unit:"years"},C.y),j({value:10,unit:"years"},{value:200,unit:"years"},C.y),j({value:20,unit:"years"},{value:500,unit:"years"},C.y),j({value:50,unit:"years"},{value:1e3,unit:"years"},C.y),j({value:1,unit:"centuries"},{value:20,unit:"centuries"},C.y),j({value:2,unit:"centuries"},{value:50,unit:"centuries"},C.y),j({value:5,unit:"centuries"},{value:100,unit:"centuries"},C.y),j({value:10,unit:"centuries"},{value:200,unit:"centuries"},C.y),j({value:20,unit:"centuries"},{value:500,unit:"centuries"},C.y),j({value:50,unit:"centuries"},{value:1e3,unit:"centuries"},C.y),j({value:100,unit:"centuries"},{value:2e3,unit:"centuries"},C.y),j({value:200,unit:"centuries"},{value:5e3,unit:"centuries"},C.y),j({value:500,unit:"centuries"},{value:1e4,unit:"centuries"},C.y),j({value:1e3,unit:"centuries"},{value:2e4,unit:"centuries"},C.y)];function Z(e){return T("div",{class:S.warning},T("calcite-icon",{class:S.warningIcon,icon:"exclamation-mark-triangle"}),T("calcite-label",{alignment:"center",class:S.warningLabel,scale:"s"},e))}let U=class extends b{constructor(e,t){super(e,t),this._allLayouts=["auto","compact","wide"],this._ignoreNextSliderUpdate=!1,this._slider=new g({suppressDeprecationWarning:!0,precision:0,visibleElements:{rangeLabels:!1},rangeLabelInputsEnabled:!1,thumbsConstrained:!1}),this._tickFormat=null,this.disabled=!1,this.labelFormatFunction=null,this.messages=null,this.tickConfigs=null,this.timeVisible=!1,this.viewModel=new M,this.announceDeprecation=()=>{s(a.getLogger(this),"Time Slider","arcgis-time-slider",{version:"5.0"})}}initialize(){this.addHandles([n(()=>this._slider.values,e=>{if(this._ignoreNextSliderUpdate)return void(this._ignoreNextSliderUpdate=!1);const t=this.viewModel.valuesToTimeExtent(e);this.timeExtent?t?this.timeExtent.equals(t)||(this.timeExtent=t):this.timeExtent=null:t&&(this.timeExtent=t)}),n(()=>this.effectiveStops,()=>this._updateSliderSteps(),l)])}loadDependencies(){return x({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),"action-menu":()=>import("@esri/calcite-components/dist/components/calcite-action-menu"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),label:()=>import("@esri/calcite-components/dist/components/calcite-label")})}destroy(){this._slider.destroy(),this._tickFormat=null}get _dateFormat(){const{timeZone:e,viewModel:t}=this,i=t.isPreCommonEra?"short":void 0;return this._getIntlOptions("short-date",{era:i,timeZone:e})}get _timeFormat(){const{timeZone:e}=this;return this._getIntlOptions("long-time",{timeZone:e})}get actions(){return this.viewModel.actions}set actions(e){this.viewModel.actions=e}get effectiveStops(){return this.viewModel.effectiveStops}get fullTimeExtent(){return this.viewModel.fullTimeExtent}set fullTimeExtent(e){this.viewModel.fullTimeExtent=e}get icon(){return"clock"}set icon(e){this._overrideIfSome("icon",e)}get interactive(){return!(this.disabled||"disabled"===this.viewModel.state||this.timeZone===v)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}set layout(e){this._set("layout",this._allLayouts.includes(e)?e:"auto")}get loop(){return this.viewModel.loop}set loop(e){this.viewModel.loop=e}get mode(){return this.viewModel.mode}set mode(e){this.viewModel.mode=e}get playRate(){return this.viewModel.playRate}set playRate(e){this.viewModel.playRate=e}get stops(){return this.viewModel.stops}set stops(e){this.viewModel.stops=e}get tickFormats(){const{timeZone:e}=this;return L.map(({minor:t,major:i,format:s})=>({minor:new f(t),major:new f(i),format:{...s,timeZone:e}}))}get timeExtent(){return this.viewModel.timeExtent}set timeExtent(e){this.viewModel.timeExtent=e}get timeZone(){return this.viewModel.view?.timeZone??h}set timeZone(e){this._overrideIfSome("timeZone",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}next(){return this.viewModel.next()}play(){return this.viewModel.play()}previous(){return this.viewModel.previous()}stop(){return this.viewModel.stop()}render(){const{_slider:e,actions:i,domNode:s,effectiveStops:a,fullTimeExtent:n,interactive:l,messages:o,mode:r,tickConfigs:u,timeExtent:m,timeVisible:d,viewModel:{isPreCommonEra:v,state:h,timeExtentValues:y}}=this;if(n){const{start:t,end:i}=n;if(t&&i){const s=t.getTime(),a=i.getTime(),n=e.min!==s||e.max!==a;if(n&&(e.min=s,e.max=a),u)e.tickConfigs!==u&&(e.tickConfigs=u);else{const t=(a-s)/(e.trackElement?.offsetWidth||400),i=this.tickFormats.find(({minor:e})=>e.toMilliseconds()>F*t)??this.tickFormats.at(-1),l=i&&this._tickFormat!==i;if(l&&(this._tickFormat=i),n||l){const t={mode:"position",values:this._getTickPositions(i.minor),labelsVisible:!1,tickCreatedFunction:(e,t)=>{t?.classList.add(S.sliderMinorTick)}},s={...i.format,era:i.format.year&&v?"short":void 0},a={mode:"position",values:this._getTickPositions(i.major),labelsVisible:!0,tickCreatedFunction:(e,t)=>{t?.classList.add(S.sliderMajorTick)},labelFormatFunction:e=>c(e,s)};e.tickConfigs=[t,a]}}}}const f=!this.fullTimeExtent?.start||!this.fullTimeExtent.end||!this.timeExtent||this.timeExtent.isAllTime||this.timeExtent.isEmpty||this.timeExtent.start&&(this.timeExtent.start<this.fullTimeExtent.start||this.timeExtent.start>this.fullTimeExtent.end)||this.timeExtent.end&&(this.timeExtent.end>this.fullTimeExtent.end||this.timeExtent.end<this.fullTimeExtent.start);if(f)switch(this._ignoreNextSliderUpdate=!0,r){case"time-window":e.values=[e.min,e.max];break;case"instant":case"cumulative-from-end":e.values=[e.min];break;case"cumulative-from-start":e.values=[e.max]}else y?t(e.values,y)||(e.values=y):e.values=null;e.disabled=!l;const g=f||!l||!a?.length,b="auto"===this.layout?s.clientWidth<D?"compact":"wide":this.layout,x=T("calcite-button",{appearance:"transparent",bind:this,class:S.play,disabled:g,iconStart:"playing"===h?"pause":"play",kind:"neutral",label:"playing"===h?o.control.stop:o.control.play,scale:"wide"===b?"l":"m",width:"full",onclick:this._playOrStopClick}),E=this.labelFormatFunction?T("div",{afterCreate:this._createLabel,afterUpdate:this._createLabel,bind:this,class:S.timeExtentStartDate,"data-date":m?[m.start,m.end]:null,"data-layout":b,"data-type":"extent",key:S.timeExtentStartDate}):!m||m.isAllTime?Z(o.noTimeExtent):m.isEmpty?Z(o.emptyTimeExtent):[m?.start&&T("div",{class:S.timeExtentStartGroup,key:S.timeExtentStartGroup},T("calcite-label",{alignment:"center",class:S.timeExtentStartDate,key:S.timeExtentStartDate,scale:"s"},this._formatDate(m.start)),d?T("calcite-label",{alignment:"center",class:S.timeExtentStartTime,key:S.timeExtentStartTime,scale:"s"},this._formatTime(m.start)):null),m.start&&m.end&&m.start.getTime()!==m.end.getTime()&&T("div",{class:S.timeExtentSeparator,key:S.timeExtentSeparator}),m?.end&&(!m.start||m.start.getTime()!==m.end.getTime())&&T("div",{class:S.timeExtentEndGroup,key:S.timeExtentEndGroup},T("calcite-label",{alignment:"center",class:S.timeExtentEndDate,key:S.timeExtentEndDate,scale:"s"},this._formatDate(m.end)),d?T("calcite-label",{alignment:"center",class:S.timeExtentEndTime,key:S.timeExtentEndTime,scale:"s"},this._formatTime(m.end)):null)],k=T("div",{class:S.timeExtent},E),M=this.labelFormatFunction?T("div",{afterCreate:this._createLabel,afterUpdate:this._createLabel,bind:this,class:S.minDate,"data-date":n?.start,"data-layout":b,"data-type":"min",key:S.minDate}):n?.start&&[T("calcite-label",{class:S.minDate,key:S.minDate,scale:"s"},this._formatDate(n.start)),d&&T("calcite-label",{class:S.minTime,key:S.minTime,scale:"s"},this._formatTime(n.start))],j=T("div",{class:S.min},M),C=T("div",{class:S.slider},e.render()),L=this.labelFormatFunction?T("div",{afterCreate:this._createLabel,afterUpdate:this._createLabel,bind:this,class:S.maxDate,"data-date":n?.end,"data-layout":b,"data-type":"max",key:S.maxDate}):n?.end&&[T("calcite-label",{class:S.maxDate,key:S.maxDate,scale:"s"},this._formatDate(n.end)),d&&T("calcite-label",{class:S.maxTime,key:S.maxTime,scale:"s"},this._formatTime(n.end))],U=T("div",{class:S.max},L),R=T("calcite-button",{appearance:"transparent",bind:this,class:S.previous,disabled:g||"playing"===h,iconStart:"reverse",kind:"neutral",label:o.pagination.previous,scale:"wide"===b?"l":"m",width:"full",onclick:this._previousClick}),I=T("calcite-button",{appearance:"transparent",bind:this,class:S.next,disabled:g||"playing"===h,iconStart:"forward",kind:"neutral",label:o.pagination.next,scale:"wide"===b?"l":"m",width:"full",onclick:this._nextClick}),O=i?.length>0,A=O&&T("calcite-action-menu",{class:S.actions,label:o.options},i.toArray().map(e=>T("calcite-action",{bind:this,icon:e.icon,id:e.id,text:e.title,textEnabled:!0,onclick:()=>this.viewModel.triggerAction(e)})));return T("div",{afterCreate:e=>{this.addHandles(_(e,()=>this.scheduleRender()))},"aria-label":o.widgetLabel,class:this.classes(S.timeSlider,w.widget,`${S.timeSliderMode}${r}`,`${S.timeSliderLayout}${b}`,!l&&S.timeSliderDisabled,f&&S.timeSliderOutOfBounds,O&&S.hasActions,p(this.container))},"wide"===b&&T("div",{class:S.timeSliderRow},T("div",{class:S.playbackControls},[x,k,j,C,U,R,I]),A),"compact"===b&&[T("div",{class:S.timeSliderRow,key:"time-slider-row-1"},[k,A]),T("div",{class:S.timeSliderRow,key:"time-slider-row-2"},[C]),T("div",{class:S.timeSliderRow,key:"time-slider-row-3"},[j,R,x,I,U])])}updateWebDocument(e){this.viewModel?.updateWebDocument(e)}_createLabel(e){if(!this.labelFormatFunction)return;const t=e.getAttribute("data-type"),i=e.getAttribute("data-layout"),s=e["data-date"];this.labelFormatFunction(s,t,e,i)}_formatDate(e){return c(e,this._dateFormat)}_formatTime(e){return c(e,this._timeFormat)}_getIntlOptions(e,t){return{...d(e),...t}}_getTickPositions(e){const{fullTimeExtent:t}=this;if(!t?.start||!t.end)return[];const{start:i,end:s}=t,a=[],{value:n,unit:l}=e;let u=o(i,e,this.timeZone);for(;u.getTime()<=s.getTime();)u.getTime()>=i.getTime()&&a.push(u.getTime()),u=r(u,n,l,this.timeZone);return a}_updateSliderSteps(){this._slider.steps=this.effectiveStops&&this.effectiveStops.length>0?this.effectiveStops.map(e=>e.getTime()):null}_playOrStopClick(){switch(this.viewModel.state){case"ready":this.viewModel.play();break;case"playing":this.viewModel.stop();break;case"disabled":break;default:this.viewModel.state}}_previousClick(){this.viewModel.previous()}_nextClick(){this.viewModel.next()}};e([u()],U.prototype,"_dateFormat",null),e([u()],U.prototype,"_timeFormat",null),e([u({type:i})],U.prototype,"actions",null),e([u()],U.prototype,"disabled",void 0),e([u()],U.prototype,"effectiveStops",null),e([u({type:y})],U.prototype,"fullTimeExtent",null),e([u()],U.prototype,"icon",null),e([u({readOnly:!0})],U.prototype,"interactive",null),e([u()],U.prototype,"label",null),e([u()],U.prototype,"labelFormatFunction",void 0),e([u({value:"auto"})],U.prototype,"layout",null),e([u()],U.prototype,"loop",null),e([u(),E("esri/widgets/TimeSlider/t9n/TimeSlider")],U.prototype,"messages",void 0),e([u()],U.prototype,"mode",null),e([u()],U.prototype,"playRate",null),e([u()],U.prototype,"stops",null),e([u()],U.prototype,"tickConfigs",void 0),e([u()],U.prototype,"tickFormats",null),e([u({type:y})],U.prototype,"timeExtent",null),e([u({nonNullable:!0})],U.prototype,"timeVisible",void 0),e([u()],U.prototype,"timeZone",null),e([u()],U.prototype,"view",null),e([u({type:M}),k("trigger-action")],U.prototype,"viewModel",void 0),U=e([m("esri.widgets.TimeSlider")],U);const R=U;export{R as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{equals as t}from"../core/arrayUtils.js";import i from"../core/Collection.js";import{deprecateWidget as s}from"../core/deprecate.js";import a from"../core/Logger.js";import{watch as n,initial as l}from"../core/reactiveUtils.js";import{truncateDate as o,offsetDate as r}from"../core/timeUtils.js";import{property as u,subclass as m}from"../core/accessorSupport/decorators.js";import{formatDate as c,convertDateFormatToIntlOptions as d}from"../intl/date.js";import{getCalciteModeClass as p}from"../support/modeUtils.js";import{unknown as v,system as h}from"../time/constants.js";import y from"../time/TimeExtent.js";import f from"../time/TimeInterval.js";import g from"./Slider.js";import b from"./Widget.js";import{loadCalciteComponents as x}from"./support/componentsUtils.js";import{globalCss as w}from"./support/globalCss.js";import{messageBundle as E,vmEvent as k,tsx as T}from"./support/widget.js";import{onResize as _}from"./support/widgetUtils.js";import{css as S}from"./TimeSlider/css.js";import M from"./TimeSlider/TimeSliderViewModel.js";const F=3,D=858,j=(e,t,i)=>({minor:e,major:t,format:i}),C={sf:{second:"numeric",fractionalSecondDigits:3},s:{second:"numeric"},ms:{minute:"numeric",second:"numeric"},mi:{minute:"numeric"},hm:{hour:"numeric",minute:"numeric"},dm:{day:"numeric",month:"short"},m:{month:"short"},my:{month:"short",year:"numeric"},y:{year:"numeric"}},L=[j({value:1,unit:"milliseconds"},{value:20,unit:"milliseconds"},C.sf),j({value:2,unit:"milliseconds"},{value:50,unit:"milliseconds"},C.sf),j({value:5,unit:"milliseconds"},{value:100,unit:"milliseconds"},C.sf),j({value:10,unit:"milliseconds"},{value:200,unit:"milliseconds"},C.sf),j({value:20,unit:"milliseconds"},{value:500,unit:"milliseconds"},C.sf),j({value:50,unit:"milliseconds"},{value:1,unit:"seconds"},C.s),j({value:100,unit:"milliseconds"},{value:2,unit:"seconds"},C.s),j({value:200,unit:"milliseconds"},{value:5,unit:"seconds"},C.s),j({value:500,unit:"milliseconds"},{value:10,unit:"seconds"},C.s),j({value:1,unit:"seconds"},{value:20,unit:"seconds"},C.ms),j({value:2,unit:"seconds"},{value:30,unit:"seconds"},C.ms),j({value:5,unit:"seconds"},{value:1,unit:"minutes"},C.mi),j({value:10,unit:"seconds"},{value:2,unit:"minutes"},C.mi),j({value:20,unit:"seconds"},{value:5,unit:"minutes"},C.mi),j({value:40,unit:"seconds"},{value:10,unit:"minutes"},C.mi),j({value:1,unit:"minutes"},{value:30,unit:"minutes"},C.hm),j({value:2,unit:"minutes"},{value:1,unit:"hours"},C.hm),j({value:5,unit:"minutes"},{value:2,unit:"hours"},C.hm),j({value:10,unit:"minutes"},{value:4,unit:"hours"},C.hm),j({value:20,unit:"minutes"},{value:8,unit:"hours"},C.hm),j({value:40,unit:"minutes"},{value:12,unit:"hours"},C.hm),j({value:1,unit:"hours"},{value:1,unit:"days"},C.dm),j({value:2,unit:"hours"},{value:2,unit:"days"},C.dm),j({value:5,unit:"hours"},{value:4,unit:"days"},C.dm),j({value:10,unit:"hours"},{value:10,unit:"days"},C.dm),j({value:20,unit:"hours"},{value:15,unit:"days"},C.dm),j({value:1,unit:"days"},{value:20,unit:"days"},C.dm),j({value:2,unit:"days"},{value:1,unit:"months"},C.m),j({value:5,unit:"days"},{value:3,unit:"months"},C.m),j({value:10,unit:"days"},{value:6,unit:"months"},C.my),j({value:20,unit:"days"},{value:1,unit:"years"},C.y),j({value:1,unit:"months"},{value:2,unit:"years"},C.y),j({value:2,unit:"months"},{value:4,unit:"years"},C.y),j({value:5,unit:"months"},{value:10,unit:"years"},C.y),j({value:1,unit:"years"},{value:20,unit:"years"},C.y),j({value:2,unit:"years"},{value:50,unit:"years"},C.y),j({value:5,unit:"years"},{value:100,unit:"years"},C.y),j({value:10,unit:"years"},{value:200,unit:"years"},C.y),j({value:20,unit:"years"},{value:500,unit:"years"},C.y),j({value:50,unit:"years"},{value:1e3,unit:"years"},C.y),j({value:1,unit:"centuries"},{value:20,unit:"centuries"},C.y),j({value:2,unit:"centuries"},{value:50,unit:"centuries"},C.y),j({value:5,unit:"centuries"},{value:100,unit:"centuries"},C.y),j({value:10,unit:"centuries"},{value:200,unit:"centuries"},C.y),j({value:20,unit:"centuries"},{value:500,unit:"centuries"},C.y),j({value:50,unit:"centuries"},{value:1e3,unit:"centuries"},C.y),j({value:100,unit:"centuries"},{value:2e3,unit:"centuries"},C.y),j({value:200,unit:"centuries"},{value:5e3,unit:"centuries"},C.y),j({value:500,unit:"centuries"},{value:1e4,unit:"centuries"},C.y),j({value:1e3,unit:"centuries"},{value:2e4,unit:"centuries"},C.y)];function Z(e){return T("div",{class:S.warning},T("calcite-icon",{class:S.warningIcon,icon:"exclamation-mark-triangle"}),T("calcite-label",{alignment:"center",class:S.warningLabel,scale:"s"},e))}let U=class extends b{constructor(e,t){super(e,t),this._allLayouts=["auto","compact","wide"],this._ignoreNextSliderUpdate=!1,this._slider=new g({suppressDeprecationWarning:!0,precision:0,visibleElements:{rangeLabels:!1},rangeLabelInputsEnabled:!1,thumbsConstrained:!1}),this._tickFormat=null,this.disabled=!1,this.labelFormatFunction=null,this.messages=null,this.tickConfigs=null,this.timeVisible=!1,this.viewModel=new M({suppressDeprecationWarning:!0}),this.announceDeprecation=()=>{s(a.getLogger(this),"Time Slider","arcgis-time-slider",{version:"5.0"})}}initialize(){this.addHandles([n(()=>this._slider.values,e=>{if(this._ignoreNextSliderUpdate)return void(this._ignoreNextSliderUpdate=!1);const t=this.viewModel.valuesToTimeExtent(e);this.timeExtent?t?this.timeExtent.equals(t)||(this.timeExtent=t):this.timeExtent=null:t&&(this.timeExtent=t)}),n(()=>this.effectiveStops,()=>this._updateSliderSteps(),l)])}loadDependencies(){return x({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),"action-menu":()=>import("@esri/calcite-components/dist/components/calcite-action-menu"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),label:()=>import("@esri/calcite-components/dist/components/calcite-label")})}destroy(){this._slider.destroy(),this._tickFormat=null}get _dateFormat(){const{timeZone:e,viewModel:t}=this,i=t.isPreCommonEra?"short":void 0;return this._getIntlOptions("short-date",{era:i,timeZone:e})}get _timeFormat(){const{timeZone:e}=this;return this._getIntlOptions("long-time",{timeZone:e})}get actions(){return this.viewModel.actions}set actions(e){this.viewModel.actions=e}get effectiveStops(){return this.viewModel.effectiveStops}get fullTimeExtent(){return this.viewModel.fullTimeExtent}set fullTimeExtent(e){this.viewModel.fullTimeExtent=e}get icon(){return"clock"}set icon(e){this._overrideIfSome("icon",e)}get interactive(){return!(this.disabled||"disabled"===this.viewModel.state||this.timeZone===v)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}set layout(e){this._set("layout",this._allLayouts.includes(e)?e:"auto")}get loop(){return this.viewModel.loop}set loop(e){this.viewModel.loop=e}get mode(){return this.viewModel.mode}set mode(e){this.viewModel.mode=e}get playRate(){return this.viewModel.playRate}set playRate(e){this.viewModel.playRate=e}get stops(){return this.viewModel.stops}set stops(e){this.viewModel.stops=e}get tickFormats(){const{timeZone:e}=this;return L.map(({minor:t,major:i,format:s})=>({minor:new f(t),major:new f(i),format:{...s,timeZone:e}}))}get timeExtent(){return this.viewModel.timeExtent}set timeExtent(e){this.viewModel.timeExtent=e}get timeZone(){return this.viewModel.view?.timeZone??h}set timeZone(e){this._overrideIfSome("timeZone",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}next(){return this.viewModel.next()}play(){return this.viewModel.play()}previous(){return this.viewModel.previous()}stop(){return this.viewModel.stop()}render(){const{_slider:e,actions:i,domNode:s,effectiveStops:a,fullTimeExtent:n,interactive:l,messages:o,mode:r,tickConfigs:u,timeExtent:m,timeVisible:d,viewModel:{isPreCommonEra:v,state:h,timeExtentValues:y}}=this;if(n){const{start:t,end:i}=n;if(t&&i){const s=t.getTime(),a=i.getTime(),n=e.min!==s||e.max!==a;if(n&&(e.min=s,e.max=a),u)e.tickConfigs!==u&&(e.tickConfigs=u);else{const t=(a-s)/(e.trackElement?.offsetWidth||400),i=this.tickFormats.find(({minor:e})=>e.toMilliseconds()>F*t)??this.tickFormats.at(-1),l=i&&this._tickFormat!==i;if(l&&(this._tickFormat=i),n||l){const t={mode:"position",values:this._getTickPositions(i.minor),labelsVisible:!1,tickCreatedFunction:(e,t)=>{t?.classList.add(S.sliderMinorTick)}},s={...i.format,era:i.format.year&&v?"short":void 0},a={mode:"position",values:this._getTickPositions(i.major),labelsVisible:!0,tickCreatedFunction:(e,t)=>{t?.classList.add(S.sliderMajorTick)},labelFormatFunction:e=>c(e,s)};e.tickConfigs=[t,a]}}}}const f=!this.fullTimeExtent?.start||!this.fullTimeExtent.end||!this.timeExtent||this.timeExtent.isAllTime||this.timeExtent.isEmpty||this.timeExtent.start&&(this.timeExtent.start<this.fullTimeExtent.start||this.timeExtent.start>this.fullTimeExtent.end)||this.timeExtent.end&&(this.timeExtent.end>this.fullTimeExtent.end||this.timeExtent.end<this.fullTimeExtent.start);if(f)switch(this._ignoreNextSliderUpdate=!0,r){case"time-window":e.values=[e.min,e.max];break;case"instant":case"cumulative-from-end":e.values=[e.min];break;case"cumulative-from-start":e.values=[e.max]}else y?t(e.values,y)||(e.values=y):e.values=null;e.disabled=!l;const g=f||!l||!a?.length,b="auto"===this.layout?s.clientWidth<D?"compact":"wide":this.layout,x=T("calcite-button",{appearance:"transparent",bind:this,class:S.play,disabled:g,iconStart:"playing"===h?"pause":"play",kind:"neutral",label:"playing"===h?o.control.stop:o.control.play,scale:"wide"===b?"l":"m",width:"full",onclick:this._playOrStopClick}),E=this.labelFormatFunction?T("div",{afterCreate:this._createLabel,afterUpdate:this._createLabel,bind:this,class:S.timeExtentStartDate,"data-date":m?[m.start,m.end]:null,"data-layout":b,"data-type":"extent",key:S.timeExtentStartDate}):!m||m.isAllTime?Z(o.noTimeExtent):m.isEmpty?Z(o.emptyTimeExtent):[m?.start&&T("div",{class:S.timeExtentStartGroup,key:S.timeExtentStartGroup},T("calcite-label",{alignment:"center",class:S.timeExtentStartDate,key:S.timeExtentStartDate,scale:"s"},this._formatDate(m.start)),d?T("calcite-label",{alignment:"center",class:S.timeExtentStartTime,key:S.timeExtentStartTime,scale:"s"},this._formatTime(m.start)):null),m.start&&m.end&&m.start.getTime()!==m.end.getTime()&&T("div",{class:S.timeExtentSeparator,key:S.timeExtentSeparator}),m?.end&&(!m.start||m.start.getTime()!==m.end.getTime())&&T("div",{class:S.timeExtentEndGroup,key:S.timeExtentEndGroup},T("calcite-label",{alignment:"center",class:S.timeExtentEndDate,key:S.timeExtentEndDate,scale:"s"},this._formatDate(m.end)),d?T("calcite-label",{alignment:"center",class:S.timeExtentEndTime,key:S.timeExtentEndTime,scale:"s"},this._formatTime(m.end)):null)],k=T("div",{class:S.timeExtent},E),M=this.labelFormatFunction?T("div",{afterCreate:this._createLabel,afterUpdate:this._createLabel,bind:this,class:S.minDate,"data-date":n?.start,"data-layout":b,"data-type":"min",key:S.minDate}):n?.start&&[T("calcite-label",{class:S.minDate,key:S.minDate,scale:"s"},this._formatDate(n.start)),d&&T("calcite-label",{class:S.minTime,key:S.minTime,scale:"s"},this._formatTime(n.start))],j=T("div",{class:S.min},M),C=T("div",{class:S.slider},e.render()),L=this.labelFormatFunction?T("div",{afterCreate:this._createLabel,afterUpdate:this._createLabel,bind:this,class:S.maxDate,"data-date":n?.end,"data-layout":b,"data-type":"max",key:S.maxDate}):n?.end&&[T("calcite-label",{class:S.maxDate,key:S.maxDate,scale:"s"},this._formatDate(n.end)),d&&T("calcite-label",{class:S.maxTime,key:S.maxTime,scale:"s"},this._formatTime(n.end))],U=T("div",{class:S.max},L),R=T("calcite-button",{appearance:"transparent",bind:this,class:S.previous,disabled:g||"playing"===h,iconStart:"reverse",kind:"neutral",label:o.pagination.previous,scale:"wide"===b?"l":"m",width:"full",onclick:this._previousClick}),I=T("calcite-button",{appearance:"transparent",bind:this,class:S.next,disabled:g||"playing"===h,iconStart:"forward",kind:"neutral",label:o.pagination.next,scale:"wide"===b?"l":"m",width:"full",onclick:this._nextClick}),O=i?.length>0,A=O&&T("calcite-action-menu",{class:S.actions,label:o.options},i.toArray().map(e=>T("calcite-action",{bind:this,icon:e.icon,id:e.id,text:e.title,textEnabled:!0,onclick:()=>this.viewModel.triggerAction(e)})));return T("div",{afterCreate:e=>{this.addHandles(_(e,()=>this.scheduleRender()))},"aria-label":o.widgetLabel,class:this.classes(S.timeSlider,w.widget,`${S.timeSliderMode}${r}`,`${S.timeSliderLayout}${b}`,!l&&S.timeSliderDisabled,f&&S.timeSliderOutOfBounds,O&&S.hasActions,p(this.container))},"wide"===b&&T("div",{class:S.timeSliderRow},T("div",{class:S.playbackControls},[x,k,j,C,U,R,I]),A),"compact"===b&&[T("div",{class:S.timeSliderRow,key:"time-slider-row-1"},[k,A]),T("div",{class:S.timeSliderRow,key:"time-slider-row-2"},[C]),T("div",{class:S.timeSliderRow,key:"time-slider-row-3"},[j,R,x,I,U])])}updateWebDocument(e){this.viewModel?.updateWebDocument(e)}_createLabel(e){if(!this.labelFormatFunction)return;const t=e.getAttribute("data-type"),i=e.getAttribute("data-layout"),s=e["data-date"];this.labelFormatFunction(s,t,e,i)}_formatDate(e){return c(e,this._dateFormat)}_formatTime(e){return c(e,this._timeFormat)}_getIntlOptions(e,t){return{...d(e),...t}}_getTickPositions(e){const{fullTimeExtent:t}=this;if(!t?.start||!t.end)return[];const{start:i,end:s}=t,a=[],{value:n,unit:l}=e;let u=o(i,e,this.timeZone);for(;u.getTime()<=s.getTime();)u.getTime()>=i.getTime()&&a.push(u.getTime()),u=r(u,n,l,this.timeZone);return a}_updateSliderSteps(){this._slider.steps=this.effectiveStops&&this.effectiveStops.length>0?this.effectiveStops.map(e=>e.getTime()):null}_playOrStopClick(){switch(this.viewModel.state){case"ready":this.viewModel.play();break;case"playing":this.viewModel.stop();break;case"disabled":break;default:this.viewModel.state}}_previousClick(){this.viewModel.previous()}_nextClick(){this.viewModel.next()}};e([u()],U.prototype,"_dateFormat",null),e([u()],U.prototype,"_timeFormat",null),e([u({type:i})],U.prototype,"actions",null),e([u()],U.prototype,"disabled",void 0),e([u()],U.prototype,"effectiveStops",null),e([u({type:y})],U.prototype,"fullTimeExtent",null),e([u()],U.prototype,"icon",null),e([u({readOnly:!0})],U.prototype,"interactive",null),e([u()],U.prototype,"label",null),e([u()],U.prototype,"labelFormatFunction",void 0),e([u({value:"auto"})],U.prototype,"layout",null),e([u()],U.prototype,"loop",null),e([u(),E("esri/widgets/TimeSlider/t9n/TimeSlider")],U.prototype,"messages",void 0),e([u()],U.prototype,"mode",null),e([u()],U.prototype,"playRate",null),e([u()],U.prototype,"stops",null),e([u()],U.prototype,"tickConfigs",void 0),e([u()],U.prototype,"tickFormats",null),e([u({type:y})],U.prototype,"timeExtent",null),e([u({nonNullable:!0})],U.prototype,"timeVisible",void 0),e([u()],U.prototype,"timeZone",null),e([u()],U.prototype,"view",null),e([u({type:M}),k("trigger-action")],U.prototype,"viewModel",void 0),U=e([m("esri.widgets.TimeSlider")],U);const R=U;export{R as default};
|