@arcgis/core 6.0.0-next.5 → 6.0.0-next.7
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/analysis/AreaMeasurementAnalysis.d.ts +11 -1
- package/analysis/DirectLineMeasurementAnalysis.d.ts +11 -1
- package/analysis/DistanceMeasurementAnalysis.d.ts +8 -0
- package/arcade/functions/knowledgegraph.js +1 -1
- package/arcade/geometry/unitConversion.js +1 -1
- package/arcgisGlobal.d.ts +5 -5
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{f09c9d9a554c33a753b4.js → 02253bdffbd580af22d8.js} +1 -1
- package/assets/esri/core/workers/chunks/{1ede8666d804c553803e.js → 0b6941781e35ce0f7274.js} +1 -1
- package/assets/esri/core/workers/chunks/0ccab50877b24f862d6e.js +1 -0
- package/assets/esri/core/workers/chunks/{a0d459bdb91ee892d4b6.js → 116293b1ee788a89ce1e.js} +1 -1
- package/assets/esri/core/workers/chunks/{8959a825f5e1ce6f38ac.js → 1c65ab9ed611c322ce27.js} +1 -1
- package/assets/esri/core/workers/chunks/257910cca66dc5df465e.js +1 -0
- package/assets/esri/core/workers/chunks/27da9ece2afaeec39f59.js +1 -0
- package/assets/esri/core/workers/chunks/{83589144eeeb08f45557.js → 2aeb5cc32284dd3e4d22.js} +1 -1
- package/assets/esri/core/workers/chunks/2c90f7a6432cd716db8b.js +1 -0
- package/assets/esri/core/workers/chunks/2e096537a3a5555a4a93.js +1 -0
- package/assets/esri/core/workers/chunks/{b612de42ee86c0d95247.js → 3d9d7d3a40b51eb7ee3d.js} +1 -1
- package/assets/esri/core/workers/chunks/3ffda5bf0b91700dc308.js +1 -0
- package/assets/esri/core/workers/chunks/{1317ecdfd0cfa683a493.js → 42323093827adffe56d3.js} +1 -1
- package/assets/esri/core/workers/chunks/4d3f97a48046021713a6.js +1 -0
- package/assets/esri/core/workers/chunks/505227797bcf2a1d908d.js +1 -0
- package/assets/esri/core/workers/chunks/518e8883b6ed613bf451.js +1 -0
- package/assets/esri/core/workers/chunks/{67ac6b326bf80fc3d33d.js → 53be85d04cd2da4f391d.js} +1 -1
- package/assets/esri/core/workers/chunks/54778dec1598818d93cb.js +1 -0
- package/assets/esri/core/workers/chunks/557671c897ca5563be6c.js +1 -0
- package/assets/esri/core/workers/chunks/56a24061589f4a968818.js +1 -0
- package/assets/esri/core/workers/chunks/{3ac9dcbb0571a2580236.js → 62c8c9ad09e0166207fd.js} +1 -1
- package/assets/esri/core/workers/chunks/6588725275c75fae0d9c.js +1 -0
- package/assets/esri/core/workers/chunks/{9232f57623e1fa3ccabc.js → 67e4b5651fd7ff7d8cf0.js} +1 -1
- package/assets/esri/core/workers/chunks/6ebe73f69ae822053b70.js +1 -0
- package/assets/esri/core/workers/chunks/{e521bb9ee2030245c3ce.js → 6f358116f79021ff9687.js} +1 -1
- package/assets/esri/core/workers/chunks/7038ead1fa1674416ab3.js +1 -0
- package/assets/esri/core/workers/chunks/70cc2d79653d66e85b58.js +1 -0
- package/assets/esri/core/workers/chunks/{8ba32d3a0df4a206ef1c.js → 7165d6f6a5078768bebb.js} +1 -1
- package/assets/esri/core/workers/chunks/76196c414e48834f7b92.js +1 -0
- package/assets/esri/core/workers/chunks/{cbe6c0f32608cb504695.js → 776ae25a34352d3468bc.js} +1 -1
- package/assets/esri/core/workers/chunks/801e9e66edb4961461eb.js +1 -0
- package/assets/esri/core/workers/chunks/{5078b66ba31b770b689f.js → 85908e6e9c50749cee60.js} +1 -1
- package/assets/esri/core/workers/chunks/943a0f140813ee4ab04a.js +1 -0
- package/assets/esri/core/workers/chunks/9ce91a909eccc4dfe388.js +1 -0
- package/assets/esri/core/workers/chunks/aba42885c5d6b2b5fe7f.js +1 -0
- package/assets/esri/core/workers/chunks/ad76f7ab2f3e6d5a5b3c.js +1 -0
- package/assets/esri/core/workers/chunks/ae40eac1eadd1a537bf4.js +1 -0
- package/assets/esri/core/workers/chunks/bbf993dba74850bbf9d7.js +1 -0
- package/assets/esri/core/workers/chunks/bfd85e8d54062a590f0e.js +1 -0
- package/assets/esri/core/workers/chunks/{ff3a53c3f00335552317.js → c29c474c4b1049352d3e.js} +1 -1
- package/assets/esri/core/workers/chunks/d21257d2e2a37266c0f7.js +1 -0
- package/assets/esri/core/workers/chunks/d90a3bfd45b5ed4092e0.js +1 -0
- package/assets/esri/core/workers/chunks/ddf0671976648f621269.js +1 -0
- package/assets/esri/core/workers/chunks/ecaac39dde7ec4213264.js +1 -0
- package/assets/esri/core/workers/chunks/f43a50d4bd9636e68ae5.js +1118 -0
- package/assets/esri/core/workers/chunks/fb444954be74c1962ced.js +1 -0
- package/assets/esri/core/workers/chunks/{fccbb902fe08448f91de.js → fd0a5c243f3426f2a0b5.js} +1 -1
- package/assets/esri/core/workers/chunks/fecaf0bc28aeea4d15db.js +1 -0
- package/assets/esri/themes/base/widgets/_FeatureFormUtilityNetworkAssociationSettings.scss +1 -1
- package/assets/esri/themes/base/widgets/_Features.scss +1 -1
- package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +5 -9
- package/assets/esri/themes/base/widgets/_SelectionToolbar.scss +2 -4
- package/assets/esri/themes/base/widgets/_Tooltip.scss +1 -1
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.en.json +1 -1
- package/{basemaps/BasemapCollection.d.ts → basemapGallery/BasemapGalleryModel.d.ts} +8 -8
- package/{basemaps/BasemapCollection.js → basemapGallery/BasemapGalleryModel.js} +1 -1
- package/{basemaps → basemapGallery}/BasemapsSource.d.ts +1 -1
- package/{basemaps → basemapGallery}/BasemapsSource.js +1 -1
- package/{basemaps → basemapGallery}/LocalBasemapsSource.d.ts +2 -2
- package/{basemaps → basemapGallery}/LocalBasemapsSource.js +1 -1
- package/{basemaps → basemapGallery}/PortalBasemapsSource.d.ts +2 -2
- package/{basemaps → basemapGallery}/PortalBasemapsSource.js +1 -1
- package/{basemaps → basemapGallery}/support/BasemapItem.d.ts +2 -2
- package/{basemaps → basemapGallery}/support/BasemapItem.js +1 -1
- package/{basemaps → basemapGallery}/types.d.ts +2 -2
- package/chunks/GlobalIllumination.glsl.js +4 -2
- package/chunks/GlobalIlluminationBlur.glsl.js +3 -5
- package/chunks/GlobalIlluminationUpscale.glsl.js +1 -1
- package/config.js +1 -1
- package/core/colorUtils.js +1 -1
- package/core/has.js +1 -1
- package/core/units.js +1 -1
- package/core/workers/workerFactory.js +1 -1
- package/geometry/projectionUtils.js +1 -1
- package/geometry/support/wkt.js +2 -0
- package/kernel.js +1 -1
- package/layers/graphics/data/FeatureStore.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/data/geometryUtils.js +1 -1
- package/layers/graphics/data/projectionSupport.js +1 -1
- package/layers/graphics/sources/FeatureLayerSource.js +1 -1
- package/layers/graphics/transferFeatures.js +1 -1
- package/layers/knowledgeGraph/layerUtils.js +1 -1
- package/layers/knowledgeGraph/nodeMovementUtils.js +1 -1
- package/layers/raster/datasets/TIFFRaster.js +1 -1
- package/package.json +2 -2
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/views/2d/analysis/AreaMeasurementAnalysisView2D.d.ts +4 -4
- package/views/2d/analysis/DistanceMeasurementAnalysisView2D.d.ts +4 -4
- package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
- package/views/2d/layers/features/FeatureSourceEventLog.js +1 -1
- package/views/2d/layers/features/sources/strategies/AFeatureTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/FeatureDrillDownTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +3 -0
- package/views/3d/analysis/VolumeMeasurementAnalysisView3D.d.ts +2 -1
- package/views/3d/layers/support/FeatureMemory.js +1 -1
- package/views/3d/layers/support/FeatureTile.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
- package/views/3d/layers/support/featureTileQuery3D.js +1 -1
- package/views/3d/support/PBFDecoder.js +1 -1
- package/views/3d/support/elevationUpdateUtils.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadGlobalIllumination.glsl.js +16 -11
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationColorQuantization.glsl.js +2 -2
- package/views/SceneView.d.ts +4 -10
- package/views/View.d.ts +4 -12
- package/views/draw/Draw.d.ts +1 -1
- package/views/draw/support/InteractiveHandle.js +1 -1
- package/views/interactive/options/SnappingOptions.d.ts +29 -12
- package/views/interactive/options/TooltipOptions.d.ts +9 -1
- package/views/interactive/options/ValueOptions.d.ts +9 -2
- package/views/interactive/options/ViewOptions.d.ts +82 -6
- package/views/interactive/support/Units.d.ts +1 -0
- package/views/interactive/tooltip/components/DrawHeaderActions.js +1 -1
- package/views/interactive/tooltip/components/ElevationModeSelect.js +1 -1
- package/views/support/projectionUtils.js +1 -1
- package/widgets/BasemapGallery/BasemapGalleryViewModel.d.ts +2 -2
- package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
- package/widgets/BasemapGallery/support/BasemapGalleryItem.d.ts +3 -3
- package/widgets/BasemapGallery/support/LocalBasemapsSource.d.ts +2 -2
- package/widgets/BasemapGallery/support/PortalBasemapsSource.d.ts +2 -2
- package/widgets/BasemapGallery/types.d.ts +3 -3
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/DirectionalPad.js +1 -1
- package/widgets/Editor/EditorViewModel.d.ts +13 -8
- package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
- package/widgets/Editor.d.ts +9 -9
- package/widgets/Expand.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable/FieldColumn.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Features/FeaturesDrillIn.js +1 -1
- package/widgets/Features.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/components/SequentialNavigationUI.js +1 -1
- package/widgets/OrientedImageryViewer/components/SketchTools.js +1 -1
- package/widgets/PanoramicVideoViewer.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/ScaleRangeSlider.js +1 -1
- package/widgets/Search/SearchResultRenderer.js +1 -1
- package/widgets/Sketch/SketchViewModel.d.ts +14 -9
- package/widgets/Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js +1 -1
- package/widgets/Sketch.d.ts +10 -10
- package/widgets/Track/TrackViewModel.d.ts +1 -1
- package/widgets/UtilityNetworkAssociations.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeaturesDrillIn.js +1 -1
- package/widgets/UtilityNetworkTrace/types.d.ts +2 -2
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/widgets/UtilityNetworkValidateTopology.js +1 -1
- package/widgets/ValuePicker.js +1 -1
- package/widgets/VideoPlayer/components/PlayerActionsGroup.js +1 -1
- package/widgets/VideoPlayer/components/PlayerControlsGroup.js +1 -1
- package/widgets/support/GridControls.js +1 -1
- package/widgets/support/PluginSettingsControls.js +1 -1
- package/widgets/support/SelectionToolbar.js +1 -1
- package/widgets/support/SnappingControls.js +1 -1
- package/widgets/support/componentsUtils.js +1 -1
- package/arcade/geometry/wkt.js +0 -2
- package/assets/esri/core/workers/chunks/02d4f91652a79d2b637e.js +0 -1
- package/assets/esri/core/workers/chunks/05d865b2736f452ad2aa.js +0 -1
- package/assets/esri/core/workers/chunks/107b025dc5b09465a78f.js +0 -1
- package/assets/esri/core/workers/chunks/1b551ef3d84d9c1e93f9.js +0 -1
- package/assets/esri/core/workers/chunks/1f43e06dcfe56229bb0f.js +0 -1
- package/assets/esri/core/workers/chunks/260dcb79dfd0f981949f.js +0 -1
- package/assets/esri/core/workers/chunks/2a570ce6b99dac6ee996.js +0 -1
- package/assets/esri/core/workers/chunks/303676d1b10676c9cab4.js +0 -1
- package/assets/esri/core/workers/chunks/33956f12505e72e60293.js +0 -1
- package/assets/esri/core/workers/chunks/3880d2c7fb14955d7f93.js +0 -1
- package/assets/esri/core/workers/chunks/512628db534605a2a93e.js +0 -1742
- package/assets/esri/core/workers/chunks/57970d43cdcc5cf57a30.js +0 -1
- package/assets/esri/core/workers/chunks/5e184fd47e76eb976fa9.js +0 -1
- package/assets/esri/core/workers/chunks/5f3ab77a79c408423fde.js +0 -1
- package/assets/esri/core/workers/chunks/5fd099ca1024707387b2.js +0 -1
- package/assets/esri/core/workers/chunks/65654e481cce9ae40e54.js +0 -1
- package/assets/esri/core/workers/chunks/68e24fa3f564c2a5c9fd.js +0 -1
- package/assets/esri/core/workers/chunks/6aebf7cfd294e88bf926.js +0 -1
- package/assets/esri/core/workers/chunks/71103472c45928bd730c.js +0 -1
- package/assets/esri/core/workers/chunks/73a87fb270818aa75fc5.js +0 -1
- package/assets/esri/core/workers/chunks/776565dd9741ba2ba151.js +0 -1
- package/assets/esri/core/workers/chunks/8b54589f173259c1ba55.js +0 -1
- package/assets/esri/core/workers/chunks/8e7a33cc1f83063043f2.js +0 -1
- package/assets/esri/core/workers/chunks/a23272a7a47a95f6ddea.js +0 -1
- package/assets/esri/core/workers/chunks/aa5b42e44d2959fdacd3.js +0 -1
- package/assets/esri/core/workers/chunks/bff767ec5bb4c0d6b324.js +0 -1
- package/assets/esri/core/workers/chunks/c906f984b2b6e7578c06.js +0 -1
- package/assets/esri/core/workers/chunks/cbdebdfa5f2cded29d0d.js +0 -1
- package/assets/esri/core/workers/chunks/d56780290e0218d3e9de.js +0 -1
- package/assets/esri/core/workers/chunks/d89fe41c71c9621c41ae.js +0 -1
- package/assets/esri/core/workers/chunks/de02a6a1f4810f99e9bb.js +0 -1
- package/assets/esri/core/workers/chunks/e22d45aeef293a5ffb78.js +0 -1
- package/assets/esri/core/workers/chunks/e5943f3a4bbc12c06c4d.js +0 -1
- package/assets/esri/core/workers/chunks/edf3be87a997f4f05b96.js +0 -1
- package/assets/esri/core/workers/chunks/f0aaa646b17ffdbdcefa.js +0 -1
- package/assets/esri/core/workers/chunks/f0c0c02730fe0d948fc1.js +0 -1
- /package/{basemaps → basemapGallery}/support/basemapCompatibilityUtils.js +0 -0
package/widgets/Print.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{formatNumber as t}from"../intl.js";import n from"../core/Collection.js";import{deprecateWidget as r}from"../core/deprecate.js";import{JSONMap as i}from"../core/jsonMap.js";import a from"../core/Logger.js";import{watch as o,on as s,whenOnce as c}from"../core/reactiveUtils.js";import{unitName as l}from"../core/unitFormatUtils.js";import{addProxy as u,hasSameOrigin as d}from"../core/urlUtils.js";import{property as f,subclass as p}from"../core/accessorSupport/decorators.js";import{ensureInteger as m}from"../core/accessorSupport/ensureType.js";import h from"../geometry/SpatialReference.js";import{isValid as g}from"../geometry/support/spatialReferenceUtils.js";import _ from"../portal/Portal.js";import{reArcGISOnlineDomain as v}from"../portal/support/urlUtils.js";import{findToken as y}from"../rest/utils.js";import{formatJsonMap as b}from"../rest/support/fileFormat.js";import x from"./Widget.js";import S from"./Print/FileLink.js";import C from"./Print/PrintViewModel.js";import w from"./Print/TemplateOptions.js";import{loadCalciteComponents as T}from"./support/componentsUtils.js";import{globalCss as E}from"./support/globalCss.js";import{Heading as D}from"./support/Heading.js";import{legacyIcon as O}from"./support/legacyIcon.js";import{messageBundle as k,tsx as A,isRTL as j,tsxFragment as M,isActivationKey as N}from"./support/widget.js";const P=`map-only`,F=`esri-print`,I={base:F,headerTitle:`${F}__header-title`,layoutTabList:`${F}__layout-tab-list`,layoutTab:`${F}__layout-tab`,layoutSection:`${F}__layout-section`,mapOnlySection:`${F}__map-only-section`,panelItemsCentered:`${F}__panel-items--centered`,loader:`${F}__loader`,swapButton:`${F}__swap-button`,printButton:`${F}__export-button`,printButtonSection:`${F}__export-button-section`,printButtonSectionDivider:`${F}__export-button-section--divider`,templateSelectContainer:`${F}__template-select-container`,templateSelectIcon:`${F}__template-select-icon`,templateSelectError:`${F}__template-select-error`,templateSelectArrow:`${F}__template-select-arrow`,formSectionContainer:`${F}__form-section-container`,advancedOptionsSection:`${F}__advanced-options-section`,advancedOptionsContainer:`${F}__advanced-options-container`,browseTemplateButtonContainer:`${F}__browse-template-button-container`,browseTemplateButtonContainerFilter:`${F}__browse-template-button-container-filter`,exportedFilesContainer:`${F}__export-panel-container`,exportedFilesTitle:`${F}__export-title`,exportedFile:`${F}__exported-file`,exportedFileLinkTitle:`${F}__exported-file-link-title`,exportedFileLinkDescription:`${F}__exported-file-link-description`,exportedFilesEmpty:`${F}__exported-files-empty`,printWidgetContainer:`${F}__container`,content:`${F}__content`,panelContainer:`${F}__panel-container`,scaleInfoContainer:`${F}__scale-info-container`,scaleInputContainer:`${F}__scale-input-container`,scaleInput:`${F}__scale-input`,sizeContainer:`${F}__size-container`,panelError:`${F}__panel--error`,exportedFileLoader:`${F}__exported-file--loader`,exportSection:`${F}__export-section`,exportSectionCentered:`${F}__export-section--centered`,templateButtonContainer:`${F}__template-button-container`,templateDoneButton:`${F}__template-done-button`,templateSelectFlowItemContainer:`${F}__template-select-flow-item-container`,templateSelectFlowItemContent:`${F}__template-select-flow-item-content`,templateSelectFlowItemListHeading:`${F}__template-select-flow-item-list-heading`,srLabel:`${F}__sr-label`,invalidWkidText:`${F}__invalid-wkid-text`};function L(e){return!isNaN(e)&&e>0&&Number.isFinite(e)}function R(e){return e?.toLowerCase()===P}function z(e){let{state:t,extension:n}=e;switch(t){case`pending`:return`spinner`;case`error`:return`exclamation-mark-circle`;default:return n?.toLowerCase()?.includes(`pdf`)?`file-pdf`:`file`}}const B=new i({inch:`inches`,foot:`feet`,yard:`yards`,mile:`miles`,"nautical-mile":`nautical-miles`,millimeter:`millimeters`,centimeter:`centimeters`,decimeter:`decimeters`,meter:`meters`,kilometer:`kilometers`}),V=new Map([[`a3-landscape`,`a3-landscape`],[`a3-portrait`,`a3-portrait`],[`a4-landscape`,`a4-landscape`],[`a4-portrait`,`a4-portrait`],[`letter-ansi-a-landscape`,`ansi-a-landscape`],[`letter-ansi-a-portrait`,`ansi-a-portrait`],[`tabloid-ansi-b-landscape`,`ansi-b-landscape`],[`tabloid-ansi-b-portrait`,`ansi-b-portrait`]]);let H=class extends x{constructor(e,t){super(e,t),this._activeTabFocusRequested=!1,this._awaitingServerResponse=!1,this._selectedTab=`layoutTab`,this._pendingExportScroll=!1,this._rootNode=null,this._selectedTemplate=null,this._formats=[],this._showTemplates=!1,this._isValidSpatialReference=!0,this.allowedFormatsForSaving=null,this.browseTemplateButtonOnClick=null,this.headerVisible=!0,this.headingLevel=3,this.includeOrganizationTemplates=!0,this.messagesCommon=null,this.messagesUnits=null,this.saveExportHidden=!0,this.saveAsButtonCallback=null,this.viewModel=new C,this._onInput=e=>{this._selectedTab===`layoutTab`?this.templateOptions.title=e.currentTarget.value:this._selectedTab===`mapOnlyTab`&&(this.templateOptions.fileName=e.currentTarget.value)},this._handleLinkClick=e=>{let t=e.currentTarget[`data-item`];if(!t||t.state!==`ready`||!t.url)return;let n=y(this.viewModel.effectivePrintServiceUrl),r=t.url,i=document.createElement(`a`);if(i.target=`_blank`,i.href=r,i.rel=`noreferrer`,i.download=t.formattedName??``,!n){i.click(),e.stopPropagation();return}e.preventDefault();let a=new URL(r);a.searchParams.set(`token`,n),i.href=a.href,i.click(),i.href=r},r(a.getLogger(this),`Print`,`arcgis-print`,{version:`4.33`}),this._focusOnTabChange=this._focusOnTabChange.bind(this)}initialize(){this.addHandles([o(()=>[this.templateOptions.format,this.viewModel.templatesInfo?.format],()=>{let{templatesInfo:e}=this.viewModel;if(!e)return;if(this._formats.length!==e.format.choiceList.length){let t=b.apiValues;this._formats=e.format.choiceList.map(e=>{let n=t.find(t=>RegExp(`\\b${t}\\b`,`i`).test(e))??e;return{value:n,label:e===n?e.toUpperCase():e}}).sort((e,t)=>e.label.localeCompare(t.label))}let t=this._formats.some(({value:e})=>RegExp(`\\b${e}\\b`,`i`).test(this.templateOptions.format));if(e.format.defaultValue&&!t){let t=this._formats.find(({value:t})=>RegExp(`\\b${t}\\b`,`i`).test(e.format.defaultValue))?.value;t&&(this.templateOptions.format=t)}}),o(()=>[this.templateOptions.id,this.viewModel.loaded],()=>{let{layout:e}=this.templateOptions;this._selectedTab=R(e)?`mapOnlyTab`:`layoutTab`,this._selectedTab===`layoutTab`&&this.viewModel.loaded&&(this._selectedTemplate=this.viewModel.getLayoutTemplateById(this.templateOptions.id))}),o(()=>this.templateOptions.dpi,e=>{e<=0&&(this.templateOptions.dpi=1)}),o(()=>this.viewModel.view?.scale,e=>{e&&(!this.templateOptions.scaleEnabled||!this.templateOptions.scale)&&(this.templateOptions.scale=e)}),s(()=>this.viewModel,`submit`,e=>this.emit(`submit`,e)),s(()=>this.viewModel,`complete`,e=>this.emit(`complete`,e))]);let{height:e,width:t}=this.templateOptions;this.templateOptions.width=t||800,this.templateOptions.height=e||1100;let n=setTimeout(()=>{this._awaitingServerResponse=!0,this.scheduleRender()},500);this.viewModel.load().then(()=>{clearTimeout(n),this._awaitingServerResponse=!1},()=>{})}loadDependencies(){return T({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),block:()=>import(`@esri/calcite-components/dist/components/calcite-block`),button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),checkbox:()=>import(`@esri/calcite-components/dist/components/calcite-checkbox`),combobox:()=>import(`@esri/calcite-components/dist/components/calcite-combobox`),"combobox-item":()=>import(`@esri/calcite-components/dist/components/calcite-combobox-item`),flow:()=>import(`@esri/calcite-components/dist/components/calcite-flow`),"flow-item":()=>import(`@esri/calcite-components/dist/components/calcite-flow-item`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),input:()=>import(`@esri/calcite-components/dist/components/calcite-input`),"input-number":()=>import(`@esri/calcite-components/dist/components/calcite-input-number`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),list:()=>import(`@esri/calcite-components/dist/components/calcite-list`),"list-item":()=>import(`@esri/calcite-components/dist/components/calcite-list-item`),loader:()=>import(`@esri/calcite-components/dist/components/calcite-loader`),switch:()=>import(`@esri/calcite-components/dist/components/calcite-switch`),chip:()=>import(`@esri/calcite-components/dist/components/calcite-chip`),popover:()=>import(`@esri/calcite-components/dist/components/calcite-popover`),link:()=>import(`@esri/calcite-components/dist/components/calcite-link`)})}destroy(){this.viewModel.destroy()}get allowedFormats(){return this.viewModel.allowedFormats}set allowedFormats(e){this.viewModel.allowedFormats=e}get allowedLayouts(){return this.viewModel.allowedLayouts}set allowedLayouts(e){this.viewModel.allowedLayouts=e}get error(){return this.viewModel.error}get exportedLinks(){return this.viewModel.exportedLinks}set exportedLinks(e){this.viewModel.exportedLinks=e}get extraParameters(){return this.viewModel.extraParameters}set extraParameters(e){this.viewModel.extraParameters=e}get icon(){return`print`}set icon(e){this._overrideIfSome(`icon`,e)}get includeDefaultTemplates(){return this.viewModel.includeDefaultTemplates}set includeDefaultTemplates(e){this.viewModel.includeDefaultTemplates=e}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get outSpatialReference(){return this.viewModel.outSpatialReference}set outSpatialReference(e){this.viewModel.outSpatialReference=e}get portal(){return this.viewModel.portal}set portal(e){this.viewModel.portal=e}get saveExportEnabled(){return this.viewModel.saveExportEnabled}set saveExportEnabled(e){this.viewModel.saveExportEnabled=e}get showPrintAreaEnabled(){return this.viewModel.showPrintAreaEnabled}set showPrintAreaEnabled(e){this.viewModel.showPrintAreaEnabled=e}get printServiceUrl(){return this.viewModel.printServiceUrl}set printServiceUrl(e){this.viewModel.printServiceUrl=e}get templateCustomTextElements(){return this.viewModel.templateCustomTextElements}set templateCustomTextElements(e){this.viewModel.templateCustomTextElements=e}get templateOptions(){return this.viewModel.templateOptions}set templateOptions(e){this.viewModel.templateOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){let{messages:e,templateOptions:t,viewModel:n,view:r}=this,{attributionEnabled:i,author:a,copyright:o,dpi:s,format:c,height:l,layout:u,layoutItem:d,legendEnabled:f,northArrowEnabled:p,scaleBarEnabled:_,scaleEnabled:v,scale:y,width:b}=t,x=n.state!==`ready`||this._awaitingServerResponse||!(u||d),S=this._renderTitleOrFileNameSection(),C=A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,e.fileFormatTitle,A(`calcite-combobox`,{clearDisabled:!0,label:e.formatDefaultOption,maxItems:6,placeholder:e.formatDefaultOption,selectionMode:`single-persist`,topLayerDisabled:this.topLayerDisabled,onCalciteComboboxChange:({currentTarget:e})=>{this.templateOptions.format=e.selectedItems[0]?.value??`pdf`}},this._formats.map(({value:e,label:t},n)=>A(`calcite-combobox-item`,{heading:t,key:`file-format-${n}`,selected:e===this.templateOptions.format,value:e}))))),w=A(`calcite-label`,{layout:`inline`},A(`calcite-switch`,{checked:this.showPrintAreaEnabled,onCalciteSwitchChange:e=>{this.showPrintAreaEnabled=!!e.currentTarget.checked}}),e.printPreview),T=A(`div`,null,A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,e.template,A(`calcite-block`,{class:I.templateSelectContainer,collapsible:!1,description:this._getPageSizeLabel(this._selectedTemplate),heading:this._getTemplateLabel(this._selectedTemplate,!0),key:`template-select-block`,label:e.template,loading:this._selectedTemplate?.state===`loading`,tabIndex:0,onclick:()=>this._showTemplates=!0,onkeydown:e=>{(e.key===`Enter`||e.key===` `)&&(this._showTemplates=!0)}},A(`calcite-icon`,{class:I.templateSelectIcon,icon:(this._selectedTemplate?.layout?V.get(this._selectedTemplate.layout):null)||`custom-print`,key:`template-select-icon`,scale:`l`,slot:`content-start`}),this._selectedTemplate?.state===`error`?A(`calcite-icon`,{class:I.templateSelectError,icon:`exclamation-mark-circle`,key:`template-select-error`,scale:`s`,slot:`actions-end`}):null,A(`calcite-icon`,{class:I.templateSelectArrow,icon:j()?`chevron-left`:`chevron-right`,key:`template-select-arrow`,scale:`s`,slot:`actions-end`})))),w),k=A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,e.dpi,A(`calcite-input-number`,{bind:this,"data-input-name":`dpi`,min:1,value:`${s}`,onCalciteInputNumberInput:this._updateNumberInputValue}))),M=A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,A(`div`,{class:I.srLabel},e.outSpatialReference,A(`calcite-link`,{href:`https://developers.arcgis.com/rest/services-reference/enterprise/using-spatial-references/`,target:`_blank`},`(WKID)`)),A(`calcite-input-number`,{bind:this,"data-input-name":`outSpatialReference`,integer:!0,numberButtonType:`none`,value:n.outSpatialReference?.wkid?.toString()??``,onCalciteInputNumberInput:({currentTarget:e})=>{let t=m(e.value);n.outSpatialReference=Number.isNaN(t)||t==null?null:new h({wkid:t}),this._isValidSpatialReference=!n.outSpatialReference||g(n.outSpatialReference)}}),this._isValidSpatialReference?null:A(`div`,{class:I.invalidWkidText,key:`out-sr-${n.outSpatialReference?.wkid}`},e.invalidWkid))),N=A(`div`,{class:this.classes(I.scaleInfoContainer,I.formSectionContainer)},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:v,"data-option-name":`scaleEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.scale),A(`div`,{class:I.scaleInputContainer},A(`calcite-input-number`,{"aria-label":e.scaleLabel,"aria-valuenow":`${y}`,bind:this,class:I.scaleInput,"data-input-name":`scale`,disabled:!v,value:`${y}`,onCalciteInputNumberInput:this._updateNumberInputValue}),A(`calcite-button`,{appearance:`outline`,"aria-label":e.reset,bind:this,disabled:!v,iconStart:`refresh`,kind:`neutral`,onclick:this._resetToCurrentScale}))),P=A(`div`,{"aria-labelledby":`${this.id}__advancedOptionsForLayout`,class:I.advancedOptionsContainer,key:`advanced-section-for-layout`},N,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasAuthorText??!0?A(`div`,{class:I.formSectionContainer,key:`author-info`},A(`calcite-label`,null,e.author,A(`calcite-input`,{bind:this,"data-input-name":`author`,value:a??``,onCalciteInputInput:this._updateInputValue}))):null,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasCopyrightText??!0?A(`div`,{class:I.formSectionContainer,key:`copyright-text`},A(`calcite-label`,null,e.copyright,A(`calcite-input`,{bind:this,"data-input-name":`copyright`,value:o??``,onCalciteInputInput:this._updateInputValue}))):null,k,M,this._renderCustomTextElementSection(),this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasLegend??!0?A(`div`,{class:I.formSectionContainer,key:`legend-info`},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:!!f,"data-option-name":`legendEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.legend)):null,this._selectedTemplate?.mapSurroundInfoOptions?.northArrow.length?A(`div`,{class:I.formSectionContainer,key:`north-arrow`},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:!!p,"data-option-name":`northArrowEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.northArrow)):null,this._selectedTemplate?.mapSurroundInfoOptions?.scaleBar.length?A(`div`,{class:I.formSectionContainer,key:`scale-bar`},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:!!_,"data-option-name":`scaleBarEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.scaleBar)):null),F=A(`div`,{"aria-labelledby":`${this.id}__advancedOptionsForMapOnly`,class:I.advancedOptionsContainer},N,k,M,A(`div`,{class:I.formSectionContainer},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:i,"data-option-name":`attributionEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.attribution)),this._renderCustomTextElementSection()),L=this.exportedLinks.toArray(),R=this._renderExportedLinkItems(L),z={[I.exportSectionCentered]:!L.length},B=this._selectedTab===`layoutTab`?A(`section`,{"aria-labelledby":`${this.id}__layoutTab`,class:I.layoutSection,id:`${this.id}__layoutContent`,key:`esri-print__layoutContent`,role:`tabpanel`},A(`div`,{class:I.panelContainer},this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasTitleText??!0?S:null,T,this._selectedTab===`layoutTab`?C:null,A(`calcite-block`,{"aria-label":e.advancedOptions,class:this.classes(I.panelContainer,I.advancedOptionsSection),collapsible:!0,disabled:!(u||d?.id),heading:e.advancedOptions,id:`advancedOptionsForLayout`,key:`advanced-options-for-layout`},P))):this._selectedTab===`mapOnlyTab`?A(`section`,{"aria-labelledby":`${this.id}__mapOnlyTab`,class:I.mapOnlySection,id:`${this.id}__mapOnlyContent`,key:`esri-print__mapOnlyContent`,role:`tabpanel`},A(`div`,{class:I.panelContainer},S,C,A(`div`,null,A(`div`,{class:this.classes(I.sizeContainer,I.formSectionContainer)},A(`calcite-label`,null,e.width,A(`calcite-input-number`,{bind:this,"data-input-name":`width`,value:`${b}`,onCalciteInputNumberInput:this._updateNumberInputValue})),A(`calcite-label`,null,e.height,A(`calcite-input-number`,{bind:this,"data-input-name":`height`,value:`${l}`,onCalciteInputNumberInput:this._updateNumberInputValue})),A(`button`,{"aria-label":e.swap,bind:this,class:this.classes(E.widgetButton,I.swapButton,O.swap),type:`button`,onclick:this._switchInput})),w),A(`calcite-block`,{"aria-label":e.advancedOptions,class:this.classes(I.panelContainer,I.advancedOptionsSection),collapsible:!0,heading:e.advancedOptions,id:`advancedOptionsForMapOnly`,key:`advanced-options-for-map-only`},F))):A(`section`,{"aria-labelledby":`${this.id}__exportTab`,class:this.classes(I.exportSection,z),id:`${this.id}__exportContent`,key:`esri-print__exportContent`,role:`tabpanel`},A(`div`,{class:I.panelContainer},A(`div`,{afterUpdate:this._scrollExportIntoView,bind:this,class:I.exportedFilesContainer},L.length===0?A(`div`,{class:I.exportedFilesEmpty},A(`calcite-icon`,{icon:`file`,scale:`l`}),A(`div`,null,A(D,{class:I.exportedFilesTitle,level:this.headingLevel},e.noExportedFiles),A(`div`,null,e.exportHint))):R))),H=r?.type!==`2d`,U=A(`div`,{class:I.panelError},r?H?e.sceneViewError:e.serviceError:e.noViewError),W=L.some(({state:e})=>e===`pending`),G=A(`div`,{class:I.content,key:`panel`},A(`div`,null,A(`ul`,{bind:this,class:I.layoutTabList,role:`tablist`,onclick:this._toggleLayoutPanel,onkeydown:this._handleLayoutPanelKeyDown},A(`li`,{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===`layoutTab`}`,class:I.layoutTab,"data-tab-id":`layoutTab`,id:`${this.id}__layoutTab`,role:`tab`,tabIndex:0},e.layoutTab),A(`li`,{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===`mapOnlyTab`}`,class:I.layoutTab,"data-tab-id":`mapOnlyTab`,id:`${this.id}__mapOnlyTab`,role:`tab`,tabIndex:0},e.mapOnlyTab),A(`li`,{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===`exportTab`}`,class:I.layoutTab,"data-tab-id":`exportTab`,id:`${this.id}__exportedFilesTab`,role:`tab`,tabIndex:0},W?A(`calcite-loader`,{inline:!0,label:`loading`,scale:`s`}):null,e.exportsTab)),B),this._selectedTab===`exportTab`?null:A(`div`,{class:this.classes(I.printButtonSection,!this.saveExportHidden&&this.portal?I.printButtonSectionDivider:null),key:`export-button-section`},!this.saveExportHidden&&this.portal?A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:this.saveExportEnabled,onCalciteCheckboxChange:e=>{this.saveExportEnabled=!!e.currentTarget.checked}}),e.saveExportToMyContent):null,A(`calcite-button`,{"aria-label":e.exportDescription,bind:this,class:this.classes(I.printButton),disabled:x||!(u||d?.id)&&!c,scale:`l`,width:`full`,onclick:this._handlePrintMap},e.export))),K=A(`calcite-flow`,{key:`root-flow`},A(`calcite-flow-item`,{bind:this,key:`root-flow-item`,selected:!this._showTemplates},A(`div`,{class:I.printWidgetContainer},this.headerVisible?A(`header`,{class:I.headerTitle},e.export):null,this.error||H||!r?U:G)),this._renderChooseTemplateFlowItem()),q=n.state===`initializing`,J=q?this._renderLoader():K,Y={[I.panelItemsCentered]:q};return A(`div`,{bind:this,class:this.classes(I.base,E.widget,E.panel,Y)},J)}_getPageSizeLabel(e){if(!e)return;let n=e.layoutTemplateInfo;if(!n)return;let r=B.fromJSON(n.pageUnits.toLowerCase());return`${t(n.pageSize[0])} \u00D7 ${t(n.pageSize[1])} ${l(this.messagesUnits,r,`abbr`)}`}_getTemplateLabel(e,t=!1){if(!e)return t?this.messages.selectTemplate:this.messages.untitled;let{label:n,layout:r,layoutItem:i}=e;return(r&&!i&&this.messages[r]?this.messages[r]:null)||((n??r??i?.id)?.replaceAll(`_`,` `)??this.messages.untitled)}_getPortalTemplates(){return this.includeDefaultTemplates&&this.includeOrganizationTemplates?this.viewModel.defaultTemplates.toArray().filter(({layout:e,layoutItem:t})=>!R(e)&&!!t?.id):[]}_getDefaultTemplates(){return this.includeDefaultTemplates?this.viewModel.defaultTemplates.toArray().filter(({layout:e,layoutItem:t})=>!R(e)&&!t?.id):[]}_getPrintServiceTemplates(){return!this.includeDefaultTemplates||!this._getDefaultTemplates().length?this.viewModel.printServiceTemplates.toArray().filter(({layout:e})=>!R(e)):[]}_renderLayoutTemplates(e,t=!1,n=!1){return t&&e.sort((e,t)=>(e.label??``)>(t.label??``)?1:-1),e.map(e=>A(`calcite-list-item`,{description:this._getPageSizeLabel(e),key:`template-${e.id}-${e.id===this.templateOptions.id}`,label:this._getTemplateLabel(e),selected:e.id===this.templateOptions.id,title:e.description??``,value:e},A(`calcite-icon`,{icon:(e.layout?V.get(e.layout):null)||`custom-print`,slot:`content-start`}),e.state===`loading`?A(`calcite-loader`,{inline:!0,key:`template-loader-${e.id}`,label:`loading`,scale:`s`,slot:`content-end`}):null,e?.state===`error`?A(`calcite-icon`,{class:I.templateSelectError,icon:`exclamation-mark-circle`,key:`template-error-${e.id}`,scale:`s`,slot:`content-end`}):null,n?A(`calcite-action`,{icon:`trash`,slot:`actions-end`,text:`delete`,onclick:()=>this.viewModel.removePortalTemplate(e)}):null))}_renderChooseTemplateFlowItem(){if(!this._showTemplates)return null;let{messages:e}=this,t=v.test(this.portal?.url),n=this.viewModel.browseTemplates.toArray(),r=this._getPortalTemplates(),i=this._getDefaultTemplates(),a=this._getPrintServiceTemplates(),o=n.length+r.length+i.length+a.length>15,s=this.browseTemplateButtonOnClick?A(`calcite-button`,{appearance:`outline`,class:o?I.browseTemplateButtonContainerFilter:I.browseTemplateButtonContainer,iconStart:`folder`,key:`browse-template-button`,slot:o?`filter-actions-end`:`default`,onclick:this.browseTemplateButtonOnClick},o?null:e.browseTemplates):null;return A(`calcite-flow-item`,{bind:this,closable:!1,heading:e.chooseTemplate,key:`template-flow-item`,selected:this._showTemplates,onCalciteFlowItemBack:e=>{e.preventDefault(),this._showTemplates=!1}},A(`div`,{class:I.templateSelectFlowItemContainer},A(`div`,{class:I.templateSelectFlowItemContent},o?null:s,A(`calcite-list`,{filterEnabled:o,filterProps:[`label`],key:`template-list`,label:e.templateList,selectionMode:`single-persist`,onCalciteListChange:({currentTarget:e})=>this.viewModel.applyTemplate(e.selectedItems[0]?.value)},o?s:null,n.length?A(`div`,{key:`my-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.myTemplates,t?A(`calcite-chip`,{appearance:`outline`,kind:`neutral`,label:e.beta,scale:`s`},e.beta):null),this._renderLayoutTemplates(n,!0,!0)):null,r.length?A(`div`,{key:`org-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.organizationTemplates,t?A(`calcite-chip`,{appearance:`outline`,kind:`neutral`,label:e.beta,scale:`s`},e.beta):null),this._renderLayoutTemplates(r)):null,n.length||r.length?i.length?A(`div`,{key:`default-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(i,!0)):null:this._renderLayoutTemplates(i,!0),n.length||r.length?a.length?A(`div`,{key:`service-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(a)):null:this._renderLayoutTemplates(a))),A(`div`,{class:I.templateButtonContainer},A(`calcite-button`,{class:I.templateDoneButton,onclick:()=>this._showTemplates=!1},this.messagesCommon.done))))}_renderCustomTextElementSection(){let{customTextElements:e}=this.templateOptions;return e?A(`div`,{class:I.formSectionContainer,key:`custom-text-elements`},e.map((e,t)=>{let[n,r]=Object.entries(e)[0];return n===`date`?null:A(`calcite-label`,{key:`custom-text-elements-${n}-${t}`},n,A(`calcite-input`,{bind:this,"data-input-custom":!0,"data-input-name":n,value:r??``,onCalciteInputInput:this._updateInputValue}))})):null}_renderTitleOrFileNameSection(){let{title:e,fileName:t,titlePlaceHolder:n,fileNamePlaceHolder:r}=this.messages,i=this._selectedTab===`layoutTab`?e:t,a=this._selectedTab===`layoutTab`?n:r,o=this._selectedTab===`layoutTab`?this.templateOptions.title:this.templateOptions.fileName;return A(`div`,{class:I.formSectionContainer,key:i},A(`calcite-label`,null,i,A(`calcite-input`,{placeholder:a,value:o??``,onCalciteInputInput:this._onInput})))}_focusOnTabChange(e){if(!this._activeTabFocusRequested)return;let t=e.getAttribute(`data-tab-id`);(t===`layoutTab`&&this._selectedTab===`layoutTab`||t===`mapOnlyTab`&&this._selectedTab===`mapOnlyTab`||t===`exportTab`&&this._selectedTab===`exportTab`)&&(e.focus(),this._activeTabFocusRequested=!1)}_renderLoader(){let e={[I.loader]:this._awaitingServerResponse};return A(`div`,{class:this.classes(e),key:`loader`})}_resetToCurrentScale(){this.templateOptions.scale=this.viewModel.view?.scale}_updateCustomTextElementValue(e,t,n){let r=e.find(e=>{let[n]=Object.entries(e)[0];return n===t});r[t]=n}_updateInputValue(e){let t=e.currentTarget,n=t.getAttribute(`data-input-name`),r=!!t[`data-input-custom`],{templateOptions:i}=this;r?this._updateCustomTextElementValue(i.customTextElements,n,t.value):i[n]=t.value}_updateNumberInputValue(e){let t=e.currentTarget,n=t.getAttribute(`data-input-name`),{templateOptions:r}=this,i=Number(t.value);L(i)?r[n]=i:t.value=`${r[n]}`}_handlePrintMap(){this._pendingExportScroll=!0;let{templateOptions:e}=this,t=this._selectedTab===`layoutTab`?e.title:e.fileName,{promise:n}=this.viewModel.export(t||this.messages.untitled);this._selectedTab=`exportTab`,n.then(()=>this.scheduleRender())}_switchInput(){[this.templateOptions.width,this.templateOptions.height]=[this.templateOptions.height,this.templateOptions.width]}_scrollExportIntoView(){if(!this._pendingExportScroll)return;this._pendingExportScroll=!1;let e=this._rootNode;if(!e)return;let{clientHeight:t,scrollHeight:n}=e,r=n-t;r>0&&(e.scrollTop=r)}_toggleInputValue(e){let t=e.target,n=t.getAttribute(`data-option-name`);this.templateOptions[n]=t.checked,n===`scaleEnabled`&&this._resetToCurrentScale()}_renderExportedLinkItemPopover(e){let t=this.messages,n=e.formattedName??``,{state:r}=e,i=this.saveAsButtonCallback&&r!==`error`&&this._isFormatAllowedForSaving(e.extension);return r!==`pending`&&i?A(`calcite-popover`,{autoClose:!0,key:`${n}-popover`,label:`Popover`,offsetDistance:1,overlayPositioning:`fixed`,pointerDisabled:!0,referenceElement:`${n}-popover-button`,scale:`s`,topLayerDisabled:this.topLayerDisabled},A(`calcite-list`,{label:``},e.portalItem?A(`calcite-list-item`,{label:t.openItem,onCalciteListItemSelect:()=>{let t=e.portalItem;if(!t||!t.itemPageUrl)return;let n=document.createElement(`a`);n.target=`_blank`,n.href=t.itemPageUrl,n.rel=`noreferrer`,n.click()}},A(`calcite-icon`,{icon:`launch2`,key:`${n}-launch-icon`,scale:`s`,slot:`content-start`})):A(`calcite-list-item`,{label:t.saveAs,onCalciteListItemSelect:async()=>{this.saveAsButtonCallback&&(c(()=>e.portalItem).then(e=>{e.itemPageUrl&&this.scheduleRender()}),await this.saveAsButtonCallback(e))}},A(`calcite-icon`,{icon:`save`,key:`${n}-save-icon`,scale:`s`,slot:`content-start`})),A(`calcite-list-item`,{label:this.messagesCommon.delete,onCalciteListItemSelect:()=>this.exportedLinks.remove(e)},A(`calcite-icon`,{icon:`trash`,key:`${n}-delete-icon`,scale:`s`,slot:`content-start`})))):null}_renderExportedLinkItemContent(e){let t=this.messages,{url:n,state:r,error:i}=e,a=e.formattedName??``,o=n||null;o&&=u(o);let s=d(o,location.href),c=r===`error`?i?.name===`print-task:cim-symbol-unsupported`?t.exportWebMapCIMError:t.exportWebMapError:null;return A(`div`,{class:I.exportedFile,"data-item":e,slot:`content`,onclick:this._handleLinkClick},A(`div`,null,A(`div`,{class:I.exportedFileLinkTitle},a),A(`div`,{class:I.exportedFileLinkDescription},r===`pending`?t.generatingExport:c||(s?t.ready:t.linkReady))),r===`ready`?A(`calcite-icon`,{"aria-label":`${a}. ${t.linkReady}`,icon:s?`download-to`:`launch`,key:`${a}-end-icon`,scale:`s`,slot:`content-end`}):null)}_renderExportedLinkItemIcon(e){let t=e.formattedName??``;return e.state===`pending`?A(`calcite-loader`,{class:I.exportedFileLoader,inline:!0,key:`${t}-loader`,label:this.messages.generatingExport,scale:`m`,slot:`content-start`}):A(`calcite-icon`,{icon:z(e),key:`${t}-start-icon`,scale:`s`,slot:`content-start`})}_renderExportedLinkItemAction(e){let{state:t}=e,n=e.formattedName??``,r=this.saveAsButtonCallback&&t!==`error`&&this._isFormatAllowedForSaving(e.extension);return t===`pending`?null:A(`calcite-action`,{icon:r?`ellipsis`:`x`,id:r?`${n}-popover-button`:void 0,key:r?`${n}-saveAs-action`:`${n}-action`,slot:`actions-end`,text:r?this.messagesCommon.options:this.messagesCommon.remove,onclick:r?void 0:()=>{this.exportedLinks.remove(e)}})}_renderExportedLinkItem(e){let t=e.formattedName??``;return A(M,null,A(`calcite-list-item`,{key:t,label:t},this._renderExportedLinkItemContent(e),this._renderExportedLinkItemIcon(e),this._renderExportedLinkItemAction(e)),this._renderExportedLinkItemPopover(e))}_renderExportedLinkItems(e){return A(`calcite-list`,{filterEnabled:e?.length>10,label:this.messages.exportedLinksList,selectionMode:`none`},e.map(this._renderExportedLinkItem.bind(this)))}_isFormatAllowedForSaving(e){return!this.allowedFormatsForSaving||this.allowedFormatsForSaving===`all`||!!(e&&this.allowedFormatsForSaving.includes(e))}_toggleLayoutPanel(e){let t=e.target;this._toggleTab(t.getAttribute(`data-tab-id`))}_toggleTab(e,t=!0){if(this._selectedTab=e,this._selectedTab===`mapOnlyTab`)this.viewModel.applyTemplate(P);else if(this._selectedTab===`layoutTab`){let e=this._selectedTemplate??this.viewModel.defaultTemplate;this.viewModel.applyTemplate(e)}t&&(this._activeTabFocusRequested=!0)}_handleLayoutPanelKeyDown(e){let{key:t}=e,n=e.target.getAttribute(`data-tab-id`);if(N(t))this._toggleTab(n),e.preventDefault(),e.stopPropagation();else if(t===`ArrowLeft`||t===`ArrowRight`){switch(n){case`layoutTab`:this._toggleTab(t===`ArrowLeft`?`exportTab`:`mapOnlyTab`);break;case`mapOnlyTab`:this._toggleTab(t===`ArrowLeft`?`layoutTab`:`exportTab`);break;case`exportTab`:this._toggleTab(t===`ArrowLeft`?`mapOnlyTab`:`layoutTab`)}e.preventDefault(),e.stopPropagation()}}};e([f()],H.prototype,`_showTemplates`,void 0),e([f()],H.prototype,`_isValidSpatialReference`,void 0),e([f()],H.prototype,`allowedFormats`,null),e([f()],H.prototype,`allowedFormatsForSaving`,void 0),e([f()],H.prototype,`allowedLayouts`,null),e([f()],H.prototype,`browseTemplateButtonOnClick`,void 0),e([f()],H.prototype,`error`,null),e([f({type:n.ofType(S)})],H.prototype,`exportedLinks`,null),e([f()],H.prototype,`extraParameters`,null),e([f()],H.prototype,`headerVisible`,void 0),e([f()],H.prototype,`headingLevel`,void 0),e([f()],H.prototype,`icon`,null),e([f()],H.prototype,`includeDefaultTemplates`,null),e([f()],H.prototype,`includeOrganizationTemplates`,void 0),e([f()],H.prototype,`label`,null),e([f(),k(`esri/widgets/Print/t9n/Print`)],H.prototype,`messages`,void 0),e([f(),k(`esri/t9n/common`)],H.prototype,`messagesCommon`,void 0),e([f(),k(`esri/core/t9n/Units`)],H.prototype,`messagesUnits`,void 0),e([f({type:h})],H.prototype,`outSpatialReference`,null),e([f({type:_})],H.prototype,`portal`,null),e([f()],H.prototype,`saveExportEnabled`,null),e([f()],H.prototype,`saveExportHidden`,void 0),e([f()],H.prototype,`showPrintAreaEnabled`,null),e([f()],H.prototype,`printServiceUrl`,null),e([f()],H.prototype,`saveAsButtonCallback`,void 0),e([f()],H.prototype,`templateCustomTextElements`,null),e([f({type:w})],H.prototype,`templateOptions`,null),e([f()],H.prototype,`view`,null),e([f({type:C})],H.prototype,`viewModel`,void 0),H=e([p(`esri.widgets.Print`)],H);const U=H;export{U as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{formatNumber as t}from"../intl.js";import n from"../core/Collection.js";import{deprecateWidget as r}from"../core/deprecate.js";import{JSONMap as i}from"../core/jsonMap.js";import a from"../core/Logger.js";import{watch as o,on as s,whenOnce as c}from"../core/reactiveUtils.js";import{unitName as l}from"../core/unitFormatUtils.js";import{addProxy as u,hasSameOrigin as d}from"../core/urlUtils.js";import{property as f,subclass as p}from"../core/accessorSupport/decorators.js";import{ensureInteger as m}from"../core/accessorSupport/ensureType.js";import h from"../geometry/SpatialReference.js";import{isValid as g}from"../geometry/support/spatialReferenceUtils.js";import _ from"../portal/Portal.js";import{reArcGISOnlineDomain as v}from"../portal/support/urlUtils.js";import{findToken as y}from"../rest/utils.js";import{formatJsonMap as b}from"../rest/support/fileFormat.js";import x from"./Widget.js";import S from"./Print/FileLink.js";import C from"./Print/PrintViewModel.js";import w from"./Print/TemplateOptions.js";import{loadCalciteComponents as T}from"./support/componentsUtils.js";import{globalCss as E}from"./support/globalCss.js";import{Heading as D}from"./support/Heading.js";import{legacyIcon as O}from"./support/legacyIcon.js";import{messageBundle as k,tsx as A,isRTL as j,tsxFragment as M,isActivationKey as N}from"./support/widget.js";const P=`map-only`,F=`esri-print`,I={base:F,headerTitle:`${F}__header-title`,layoutTabList:`${F}__layout-tab-list`,layoutTab:`${F}__layout-tab`,layoutSection:`${F}__layout-section`,mapOnlySection:`${F}__map-only-section`,panelItemsCentered:`${F}__panel-items--centered`,loader:`${F}__loader`,swapButton:`${F}__swap-button`,printButton:`${F}__export-button`,printButtonSection:`${F}__export-button-section`,printButtonSectionDivider:`${F}__export-button-section--divider`,templateSelectContainer:`${F}__template-select-container`,templateSelectIcon:`${F}__template-select-icon`,templateSelectError:`${F}__template-select-error`,templateSelectArrow:`${F}__template-select-arrow`,formSectionContainer:`${F}__form-section-container`,advancedOptionsSection:`${F}__advanced-options-section`,advancedOptionsContainer:`${F}__advanced-options-container`,browseTemplateButtonContainer:`${F}__browse-template-button-container`,browseTemplateButtonContainerFilter:`${F}__browse-template-button-container-filter`,exportedFilesContainer:`${F}__export-panel-container`,exportedFilesTitle:`${F}__export-title`,exportedFile:`${F}__exported-file`,exportedFileLinkTitle:`${F}__exported-file-link-title`,exportedFileLinkDescription:`${F}__exported-file-link-description`,exportedFilesEmpty:`${F}__exported-files-empty`,printWidgetContainer:`${F}__container`,content:`${F}__content`,panelContainer:`${F}__panel-container`,scaleInfoContainer:`${F}__scale-info-container`,scaleInputContainer:`${F}__scale-input-container`,scaleInput:`${F}__scale-input`,sizeContainer:`${F}__size-container`,panelError:`${F}__panel--error`,exportedFileLoader:`${F}__exported-file--loader`,exportSection:`${F}__export-section`,exportSectionCentered:`${F}__export-section--centered`,templateButtonContainer:`${F}__template-button-container`,templateDoneButton:`${F}__template-done-button`,templateSelectFlowItemContainer:`${F}__template-select-flow-item-container`,templateSelectFlowItemContent:`${F}__template-select-flow-item-content`,templateSelectFlowItemListHeading:`${F}__template-select-flow-item-list-heading`,srLabel:`${F}__sr-label`,invalidWkidText:`${F}__invalid-wkid-text`};function L(e){return!isNaN(e)&&e>0&&Number.isFinite(e)}function R(e){return e?.toLowerCase()===P}function z(e){let{state:t,extension:n}=e;switch(t){case`pending`:return`spinner`;case`error`:return`exclamation-mark-circle`;default:return n?.toLowerCase()?.includes(`pdf`)?`file-pdf`:`file`}}const B=new i({inch:`inches`,foot:`feet`,yard:`yards`,mile:`miles`,"nautical-mile":`nautical-miles`,millimeter:`millimeters`,centimeter:`centimeters`,decimeter:`decimeters`,meter:`meters`,kilometer:`kilometers`}),V=new Map([[`a3-landscape`,`a3-landscape`],[`a3-portrait`,`a3-portrait`],[`a4-landscape`,`a4-landscape`],[`a4-portrait`,`a4-portrait`],[`letter-ansi-a-landscape`,`ansi-a-landscape`],[`letter-ansi-a-portrait`,`ansi-a-portrait`],[`tabloid-ansi-b-landscape`,`ansi-b-landscape`],[`tabloid-ansi-b-portrait`,`ansi-b-portrait`]]);let H=class extends x{constructor(e,t){super(e,t),this._activeTabFocusRequested=!1,this._awaitingServerResponse=!1,this._selectedTab=`layoutTab`,this._pendingExportScroll=!1,this._rootNode=null,this._selectedTemplate=null,this._formats=[],this._showTemplates=!1,this._isValidSpatialReference=!0,this.allowedFormatsForSaving=null,this.browseTemplateButtonOnClick=null,this.headerVisible=!0,this.headingLevel=3,this.includeOrganizationTemplates=!0,this.messagesCommon=null,this.messagesUnits=null,this.saveExportHidden=!0,this.saveAsButtonCallback=null,this.viewModel=new C,this._onInput=e=>{this._selectedTab===`layoutTab`?this.templateOptions.title=e.currentTarget.value:this._selectedTab===`mapOnlyTab`&&(this.templateOptions.fileName=e.currentTarget.value)},this._handleLinkClick=e=>{let t=e.currentTarget[`data-item`];if(!t||t.state!==`ready`||!t.url)return;let n=y(this.viewModel.effectivePrintServiceUrl),r=t.url,i=document.createElement(`a`);if(i.target=`_blank`,i.href=r,i.rel=`noreferrer`,i.download=t.formattedName??``,!n){i.click(),e.stopPropagation();return}e.preventDefault();let a=new URL(r);a.searchParams.set(`token`,n),i.href=a.href,i.click(),i.href=r},r(a.getLogger(this),`Print`,`arcgis-print`,{version:`4.33`}),this._focusOnTabChange=this._focusOnTabChange.bind(this)}initialize(){this.addHandles([o(()=>[this.templateOptions.format,this.viewModel.templatesInfo?.format],()=>{let{templatesInfo:e}=this.viewModel;if(!e)return;if(this._formats.length!==e.format.choiceList.length){let t=b.apiValues;this._formats=e.format.choiceList.map(e=>{let n=t.find(t=>RegExp(`\\b${t}\\b`,`i`).test(e))??e;return{value:n,label:e===n?e.toUpperCase():e}}).sort((e,t)=>e.label.localeCompare(t.label))}let t=this._formats.some(({value:e})=>RegExp(`\\b${e}\\b`,`i`).test(this.templateOptions.format));if(e.format.defaultValue&&!t){let t=this._formats.find(({value:t})=>RegExp(`\\b${t}\\b`,`i`).test(e.format.defaultValue))?.value;t&&(this.templateOptions.format=t)}}),o(()=>[this.templateOptions.id,this.viewModel.loaded],()=>{let{layout:e}=this.templateOptions;this._selectedTab=R(e)?`mapOnlyTab`:`layoutTab`,this._selectedTab===`layoutTab`&&this.viewModel.loaded&&(this._selectedTemplate=this.viewModel.getLayoutTemplateById(this.templateOptions.id))}),o(()=>this.templateOptions.dpi,e=>{e<=0&&(this.templateOptions.dpi=1)}),o(()=>this.viewModel.view?.scale,e=>{e&&(!this.templateOptions.scaleEnabled||!this.templateOptions.scale)&&(this.templateOptions.scale=e)}),s(()=>this.viewModel,`submit`,e=>this.emit(`submit`,e)),s(()=>this.viewModel,`complete`,e=>this.emit(`complete`,e))]);let{height:e,width:t}=this.templateOptions;this.templateOptions.width=t||800,this.templateOptions.height=e||1100;let n=setTimeout(()=>{this._awaitingServerResponse=!0,this.scheduleRender()},500);this.viewModel.load().then(()=>{clearTimeout(n),this._awaitingServerResponse=!1},()=>{})}loadDependencies(){return T({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),block:()=>import(`@esri/calcite-components/dist/components/calcite-block`),button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),checkbox:()=>import(`@esri/calcite-components/dist/components/calcite-checkbox`),combobox:()=>import(`@esri/calcite-components/dist/components/calcite-combobox`),"combobox-item":()=>import(`@esri/calcite-components/dist/components/calcite-combobox-item`),flow:()=>import(`@esri/calcite-components/dist/components/calcite-flow`),"flow-item":()=>import(`@esri/calcite-components/dist/components/calcite-flow-item`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),input:()=>import(`@esri/calcite-components/dist/components/calcite-input`),"input-number":()=>import(`@esri/calcite-components/dist/components/calcite-input-number`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),list:()=>import(`@esri/calcite-components/dist/components/calcite-list`),"list-item":()=>import(`@esri/calcite-components/dist/components/calcite-list-item`),loader:()=>import(`@esri/calcite-components/dist/components/calcite-loader`),switch:()=>import(`@esri/calcite-components/dist/components/calcite-switch`),chip:()=>import(`@esri/calcite-components/dist/components/calcite-chip`),popover:()=>import(`@esri/calcite-components/dist/components/calcite-popover`),link:()=>import(`@esri/calcite-components/dist/components/calcite-link`)})}destroy(){this.viewModel.destroy()}get allowedFormats(){return this.viewModel.allowedFormats}set allowedFormats(e){this.viewModel.allowedFormats=e}get allowedLayouts(){return this.viewModel.allowedLayouts}set allowedLayouts(e){this.viewModel.allowedLayouts=e}get error(){return this.viewModel.error}get exportedLinks(){return this.viewModel.exportedLinks}set exportedLinks(e){this.viewModel.exportedLinks=e}get extraParameters(){return this.viewModel.extraParameters}set extraParameters(e){this.viewModel.extraParameters=e}get icon(){return`print`}set icon(e){this._overrideIfSome(`icon`,e)}get includeDefaultTemplates(){return this.viewModel.includeDefaultTemplates}set includeDefaultTemplates(e){this.viewModel.includeDefaultTemplates=e}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get outSpatialReference(){return this.viewModel.outSpatialReference}set outSpatialReference(e){this.viewModel.outSpatialReference=e}get portal(){return this.viewModel.portal}set portal(e){this.viewModel.portal=e}get saveExportEnabled(){return this.viewModel.saveExportEnabled}set saveExportEnabled(e){this.viewModel.saveExportEnabled=e}get showPrintAreaEnabled(){return this.viewModel.showPrintAreaEnabled}set showPrintAreaEnabled(e){this.viewModel.showPrintAreaEnabled=e}get printServiceUrl(){return this.viewModel.printServiceUrl}set printServiceUrl(e){this.viewModel.printServiceUrl=e}get templateCustomTextElements(){return this.viewModel.templateCustomTextElements}set templateCustomTextElements(e){this.viewModel.templateCustomTextElements=e}get templateOptions(){return this.viewModel.templateOptions}set templateOptions(e){this.viewModel.templateOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){let{messages:e,templateOptions:t,viewModel:n,view:r}=this,{attributionEnabled:i,author:a,copyright:o,dpi:s,format:c,height:l,layout:u,layoutItem:d,legendEnabled:f,northArrowEnabled:p,scaleBarEnabled:_,scaleEnabled:v,scale:y,width:b}=t,x=n.state!==`ready`||this._awaitingServerResponse||!(u||d),S=this._renderTitleOrFileNameSection(),C=A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,e.fileFormatTitle,A(`calcite-combobox`,{clearDisabled:!0,label:e.formatDefaultOption,maxItems:6,placeholder:e.formatDefaultOption,selectionMode:`single-persist`,topLayerDisabled:this.topLayerDisabled,onCalciteComboboxChange:({currentTarget:e})=>{this.templateOptions.format=e.selectedItems[0]?.value??`pdf`}},this._formats.map(({value:e,label:t},n)=>A(`calcite-combobox-item`,{heading:t,key:`file-format-${n}`,selected:e===this.templateOptions.format,value:e}))))),w=A(`calcite-label`,{layout:`inline`},A(`calcite-switch`,{checked:this.showPrintAreaEnabled,onCalciteSwitchChange:e=>{this.showPrintAreaEnabled=!!e.currentTarget.checked}}),e.printPreview),T=A(`div`,null,A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,e.template,A(`calcite-block`,{class:I.templateSelectContainer,description:this._getPageSizeLabel(this._selectedTemplate),expandable:!1,heading:this._getTemplateLabel(this._selectedTemplate,!0),key:`template-select-block`,label:e.template,loading:this._selectedTemplate?.state===`loading`,tabIndex:0,onclick:()=>this._showTemplates=!0,onkeydown:e=>{(e.key===`Enter`||e.key===` `)&&(this._showTemplates=!0)}},A(`calcite-icon`,{class:I.templateSelectIcon,icon:(this._selectedTemplate?.layout?V.get(this._selectedTemplate.layout):null)||`custom-print`,key:`template-select-icon`,scale:`l`,slot:`content-start`}),this._selectedTemplate?.state===`error`?A(`calcite-icon`,{class:I.templateSelectError,icon:`exclamation-mark-circle`,key:`template-select-error`,scale:`s`,slot:`actions-end`}):null,A(`calcite-icon`,{class:I.templateSelectArrow,icon:j()?`chevron-left`:`chevron-right`,key:`template-select-arrow`,scale:`s`,slot:`actions-end`})))),w),k=A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,e.dpi,A(`calcite-input-number`,{bind:this,"data-input-name":`dpi`,min:1,value:`${s}`,onCalciteInputNumberInput:this._updateNumberInputValue}))),M=A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,A(`div`,{class:I.srLabel},e.outSpatialReference,A(`calcite-link`,{href:`https://developers.arcgis.com/rest/services-reference/enterprise/using-spatial-references/`,target:`_blank`},`(WKID)`)),A(`calcite-input-number`,{bind:this,"data-input-name":`outSpatialReference`,integer:!0,numberButtonType:`none`,value:n.outSpatialReference?.wkid?.toString()??``,onCalciteInputNumberInput:({currentTarget:e})=>{let t=m(e.value);n.outSpatialReference=Number.isNaN(t)||t==null?null:new h({wkid:t}),this._isValidSpatialReference=!n.outSpatialReference||g(n.outSpatialReference)}}),this._isValidSpatialReference?null:A(`div`,{class:I.invalidWkidText,key:`out-sr-${n.outSpatialReference?.wkid}`},e.invalidWkid))),N=A(`div`,{class:this.classes(I.scaleInfoContainer,I.formSectionContainer)},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:v,"data-option-name":`scaleEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.scale),A(`div`,{class:I.scaleInputContainer},A(`calcite-input-number`,{"aria-label":e.scaleLabel,"aria-valuenow":`${y}`,bind:this,class:I.scaleInput,"data-input-name":`scale`,disabled:!v,value:`${y}`,onCalciteInputNumberInput:this._updateNumberInputValue}),A(`calcite-button`,{appearance:`outline`,"aria-label":e.reset,bind:this,disabled:!v,iconStart:`refresh`,kind:`neutral`,onclick:this._resetToCurrentScale}))),P=A(`div`,{"aria-labelledby":`${this.id}__advancedOptionsForLayout`,class:I.advancedOptionsContainer,key:`advanced-section-for-layout`},N,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasAuthorText??!0?A(`div`,{class:I.formSectionContainer,key:`author-info`},A(`calcite-label`,null,e.author,A(`calcite-input`,{bind:this,"data-input-name":`author`,value:a??``,onCalciteInputInput:this._updateInputValue}))):null,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasCopyrightText??!0?A(`div`,{class:I.formSectionContainer,key:`copyright-text`},A(`calcite-label`,null,e.copyright,A(`calcite-input`,{bind:this,"data-input-name":`copyright`,value:o??``,onCalciteInputInput:this._updateInputValue}))):null,k,M,this._renderCustomTextElementSection(),this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasLegend??!0?A(`div`,{class:I.formSectionContainer,key:`legend-info`},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:!!f,"data-option-name":`legendEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.legend)):null,this._selectedTemplate?.mapSurroundInfoOptions?.northArrow.length?A(`div`,{class:I.formSectionContainer,key:`north-arrow`},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:!!p,"data-option-name":`northArrowEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.northArrow)):null,this._selectedTemplate?.mapSurroundInfoOptions?.scaleBar.length?A(`div`,{class:I.formSectionContainer,key:`scale-bar`},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:!!_,"data-option-name":`scaleBarEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.scaleBar)):null),F=A(`div`,{"aria-labelledby":`${this.id}__advancedOptionsForMapOnly`,class:I.advancedOptionsContainer},N,k,M,A(`div`,{class:I.formSectionContainer},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:i,"data-option-name":`attributionEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.attribution)),this._renderCustomTextElementSection()),L=this.exportedLinks.toArray(),R=this._renderExportedLinkItems(L),z={[I.exportSectionCentered]:!L.length},B=this._selectedTab===`layoutTab`?A(`section`,{"aria-labelledby":`${this.id}__layoutTab`,class:I.layoutSection,id:`${this.id}__layoutContent`,key:`esri-print__layoutContent`,role:`tabpanel`},A(`div`,{class:I.panelContainer},this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasTitleText??!0?S:null,T,this._selectedTab===`layoutTab`?C:null,A(`calcite-block`,{"aria-label":e.advancedOptions,class:this.classes(I.panelContainer,I.advancedOptionsSection),disabled:!(u||d?.id),expandable:!0,heading:e.advancedOptions,id:`advancedOptionsForLayout`,key:`advanced-options-for-layout`},P))):this._selectedTab===`mapOnlyTab`?A(`section`,{"aria-labelledby":`${this.id}__mapOnlyTab`,class:I.mapOnlySection,id:`${this.id}__mapOnlyContent`,key:`esri-print__mapOnlyContent`,role:`tabpanel`},A(`div`,{class:I.panelContainer},S,C,A(`div`,null,A(`div`,{class:this.classes(I.sizeContainer,I.formSectionContainer)},A(`calcite-label`,null,e.width,A(`calcite-input-number`,{bind:this,"data-input-name":`width`,value:`${b}`,onCalciteInputNumberInput:this._updateNumberInputValue})),A(`calcite-label`,null,e.height,A(`calcite-input-number`,{bind:this,"data-input-name":`height`,value:`${l}`,onCalciteInputNumberInput:this._updateNumberInputValue})),A(`button`,{"aria-label":e.swap,bind:this,class:this.classes(E.widgetButton,I.swapButton,O.swap),type:`button`,onclick:this._switchInput})),w),A(`calcite-block`,{"aria-label":e.advancedOptions,class:this.classes(I.panelContainer,I.advancedOptionsSection),expandable:!0,heading:e.advancedOptions,id:`advancedOptionsForMapOnly`,key:`advanced-options-for-map-only`},F))):A(`section`,{"aria-labelledby":`${this.id}__exportTab`,class:this.classes(I.exportSection,z),id:`${this.id}__exportContent`,key:`esri-print__exportContent`,role:`tabpanel`},A(`div`,{class:I.panelContainer},A(`div`,{afterUpdate:this._scrollExportIntoView,bind:this,class:I.exportedFilesContainer},L.length===0?A(`div`,{class:I.exportedFilesEmpty},A(`calcite-icon`,{icon:`file`,scale:`l`}),A(`div`,null,A(D,{class:I.exportedFilesTitle,level:this.headingLevel},e.noExportedFiles),A(`div`,null,e.exportHint))):R))),H=r?.type!==`2d`,U=A(`div`,{class:I.panelError},r?H?e.sceneViewError:e.serviceError:e.noViewError),W=L.some(({state:e})=>e===`pending`),G=A(`div`,{class:I.content,key:`panel`},A(`div`,null,A(`ul`,{bind:this,class:I.layoutTabList,role:`tablist`,onclick:this._toggleLayoutPanel,onkeydown:this._handleLayoutPanelKeyDown},A(`li`,{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===`layoutTab`}`,class:I.layoutTab,"data-tab-id":`layoutTab`,id:`${this.id}__layoutTab`,role:`tab`,tabIndex:0},e.layoutTab),A(`li`,{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===`mapOnlyTab`}`,class:I.layoutTab,"data-tab-id":`mapOnlyTab`,id:`${this.id}__mapOnlyTab`,role:`tab`,tabIndex:0},e.mapOnlyTab),A(`li`,{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===`exportTab`}`,class:I.layoutTab,"data-tab-id":`exportTab`,id:`${this.id}__exportedFilesTab`,role:`tab`,tabIndex:0},W?A(`calcite-loader`,{inline:!0,label:`loading`,scale:`s`}):null,e.exportsTab)),B),this._selectedTab===`exportTab`?null:A(`div`,{class:this.classes(I.printButtonSection,!this.saveExportHidden&&this.portal?I.printButtonSectionDivider:null),key:`export-button-section`},!this.saveExportHidden&&this.portal?A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:this.saveExportEnabled,onCalciteCheckboxChange:e=>{this.saveExportEnabled=!!e.currentTarget.checked}}),e.saveExportToMyContent):null,A(`calcite-button`,{"aria-label":e.exportDescription,bind:this,class:this.classes(I.printButton),disabled:x||!(u||d?.id)&&!c,scale:`l`,width:`full`,onclick:this._handlePrintMap},e.export))),K=A(`calcite-flow`,{key:`root-flow`},A(`calcite-flow-item`,{bind:this,key:`root-flow-item`,selected:!this._showTemplates},A(`div`,{class:I.printWidgetContainer},this.headerVisible?A(`header`,{class:I.headerTitle},e.export):null,this.error||H||!r?U:G)),this._renderChooseTemplateFlowItem()),q=n.state===`initializing`,J=q?this._renderLoader():K,Y={[I.panelItemsCentered]:q};return A(`div`,{bind:this,class:this.classes(I.base,E.widget,E.panel,Y)},J)}_getPageSizeLabel(e){if(!e)return;let n=e.layoutTemplateInfo;if(!n)return;let r=B.fromJSON(n.pageUnits.toLowerCase());return`${t(n.pageSize[0])} \u00D7 ${t(n.pageSize[1])} ${l(this.messagesUnits,r,`abbr`)}`}_getTemplateLabel(e,t=!1){if(!e)return t?this.messages.selectTemplate:this.messages.untitled;let{label:n,layout:r,layoutItem:i}=e;return(r&&!i&&this.messages[r]?this.messages[r]:null)||((n??r??i?.id)?.replaceAll(`_`,` `)??this.messages.untitled)}_getPortalTemplates(){return this.includeDefaultTemplates&&this.includeOrganizationTemplates?this.viewModel.defaultTemplates.toArray().filter(({layout:e,layoutItem:t})=>!R(e)&&!!t?.id):[]}_getDefaultTemplates(){return this.includeDefaultTemplates?this.viewModel.defaultTemplates.toArray().filter(({layout:e,layoutItem:t})=>!R(e)&&!t?.id):[]}_getPrintServiceTemplates(){return!this.includeDefaultTemplates||!this._getDefaultTemplates().length?this.viewModel.printServiceTemplates.toArray().filter(({layout:e})=>!R(e)):[]}_renderLayoutTemplates(e,t=!1,n=!1){return t&&e.sort((e,t)=>(e.label??``)>(t.label??``)?1:-1),e.map(e=>A(`calcite-list-item`,{description:this._getPageSizeLabel(e),key:`template-${e.id}-${e.id===this.templateOptions.id}`,label:this._getTemplateLabel(e),selected:e.id===this.templateOptions.id,title:e.description??``,value:e},A(`calcite-icon`,{icon:(e.layout?V.get(e.layout):null)||`custom-print`,slot:`content-start`}),e.state===`loading`?A(`calcite-loader`,{inline:!0,key:`template-loader-${e.id}`,label:`loading`,scale:`s`,slot:`content-end`}):null,e?.state===`error`?A(`calcite-icon`,{class:I.templateSelectError,icon:`exclamation-mark-circle`,key:`template-error-${e.id}`,scale:`s`,slot:`content-end`}):null,n?A(`calcite-action`,{icon:`trash`,slot:`actions-end`,text:`delete`,onclick:()=>this.viewModel.removePortalTemplate(e)}):null))}_renderChooseTemplateFlowItem(){if(!this._showTemplates)return null;let{messages:e}=this,t=v.test(this.portal?.url),n=this.viewModel.browseTemplates.toArray(),r=this._getPortalTemplates(),i=this._getDefaultTemplates(),a=this._getPrintServiceTemplates(),o=n.length+r.length+i.length+a.length>15,s=this.browseTemplateButtonOnClick?A(`calcite-button`,{appearance:`outline`,class:o?I.browseTemplateButtonContainerFilter:I.browseTemplateButtonContainer,iconStart:`folder`,key:`browse-template-button`,slot:o?`filter-actions-end`:`default`,onclick:this.browseTemplateButtonOnClick},o?null:e.browseTemplates):null;return A(`calcite-flow-item`,{bind:this,closable:!1,heading:e.chooseTemplate,key:`template-flow-item`,selected:this._showTemplates,onCalciteFlowItemBack:e=>{e.preventDefault(),this._showTemplates=!1}},A(`div`,{class:I.templateSelectFlowItemContainer},A(`div`,{class:I.templateSelectFlowItemContent},o?null:s,A(`calcite-list`,{filterEnabled:o,filterProps:[`label`],key:`template-list`,label:e.templateList,selectionMode:`single-persist`,onCalciteListChange:({currentTarget:e})=>this.viewModel.applyTemplate(e.selectedItems[0]?.value)},o?s:null,n.length?A(`div`,{key:`my-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.myTemplates,t?A(`calcite-chip`,{appearance:`outline`,kind:`neutral`,label:e.beta,scale:`s`},e.beta):null),this._renderLayoutTemplates(n,!0,!0)):null,r.length?A(`div`,{key:`org-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.organizationTemplates,t?A(`calcite-chip`,{appearance:`outline`,kind:`neutral`,label:e.beta,scale:`s`},e.beta):null),this._renderLayoutTemplates(r)):null,n.length||r.length?i.length?A(`div`,{key:`default-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(i,!0)):null:this._renderLayoutTemplates(i,!0),n.length||r.length?a.length?A(`div`,{key:`service-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(a)):null:this._renderLayoutTemplates(a))),A(`div`,{class:I.templateButtonContainer},A(`calcite-button`,{class:I.templateDoneButton,onclick:()=>this._showTemplates=!1},this.messagesCommon.done))))}_renderCustomTextElementSection(){let{customTextElements:e}=this.templateOptions;return e?A(`div`,{class:I.formSectionContainer,key:`custom-text-elements`},e.map((e,t)=>{let[n,r]=Object.entries(e)[0];return n===`date`?null:A(`calcite-label`,{key:`custom-text-elements-${n}-${t}`},n,A(`calcite-input`,{bind:this,"data-input-custom":!0,"data-input-name":n,value:r??``,onCalciteInputInput:this._updateInputValue}))})):null}_renderTitleOrFileNameSection(){let{title:e,fileName:t,titlePlaceHolder:n,fileNamePlaceHolder:r}=this.messages,i=this._selectedTab===`layoutTab`?e:t,a=this._selectedTab===`layoutTab`?n:r,o=this._selectedTab===`layoutTab`?this.templateOptions.title:this.templateOptions.fileName;return A(`div`,{class:I.formSectionContainer,key:i},A(`calcite-label`,null,i,A(`calcite-input`,{placeholder:a,value:o??``,onCalciteInputInput:this._onInput})))}_focusOnTabChange(e){if(!this._activeTabFocusRequested)return;let t=e.getAttribute(`data-tab-id`);(t===`layoutTab`&&this._selectedTab===`layoutTab`||t===`mapOnlyTab`&&this._selectedTab===`mapOnlyTab`||t===`exportTab`&&this._selectedTab===`exportTab`)&&(e.focus(),this._activeTabFocusRequested=!1)}_renderLoader(){let e={[I.loader]:this._awaitingServerResponse};return A(`div`,{class:this.classes(e),key:`loader`})}_resetToCurrentScale(){this.templateOptions.scale=this.viewModel.view?.scale}_updateCustomTextElementValue(e,t,n){let r=e.find(e=>{let[n]=Object.entries(e)[0];return n===t});r[t]=n}_updateInputValue(e){let t=e.currentTarget,n=t.getAttribute(`data-input-name`),r=!!t[`data-input-custom`],{templateOptions:i}=this;r?this._updateCustomTextElementValue(i.customTextElements,n,t.value):i[n]=t.value}_updateNumberInputValue(e){let t=e.currentTarget,n=t.getAttribute(`data-input-name`),{templateOptions:r}=this,i=Number(t.value);L(i)?r[n]=i:t.value=`${r[n]}`}_handlePrintMap(){this._pendingExportScroll=!0;let{templateOptions:e}=this,t=this._selectedTab===`layoutTab`?e.title:e.fileName,{promise:n}=this.viewModel.export(t||this.messages.untitled);this._selectedTab=`exportTab`,n.then(()=>this.scheduleRender())}_switchInput(){[this.templateOptions.width,this.templateOptions.height]=[this.templateOptions.height,this.templateOptions.width]}_scrollExportIntoView(){if(!this._pendingExportScroll)return;this._pendingExportScroll=!1;let e=this._rootNode;if(!e)return;let{clientHeight:t,scrollHeight:n}=e,r=n-t;r>0&&(e.scrollTop=r)}_toggleInputValue(e){let t=e.target,n=t.getAttribute(`data-option-name`);this.templateOptions[n]=t.checked,n===`scaleEnabled`&&this._resetToCurrentScale()}_renderExportedLinkItemPopover(e){let t=this.messages,n=e.formattedName??``,{state:r}=e,i=this.saveAsButtonCallback&&r!==`error`&&this._isFormatAllowedForSaving(e.extension);return r!==`pending`&&i?A(`calcite-popover`,{autoClose:!0,key:`${n}-popover`,label:`Popover`,offsetDistance:1,overlayPositioning:`fixed`,pointerDisabled:!0,referenceElement:`${n}-popover-button`,scale:`s`,topLayerDisabled:this.topLayerDisabled},A(`calcite-list`,{label:``},e.portalItem?A(`calcite-list-item`,{label:t.openItem,onCalciteListItemSelect:()=>{let t=e.portalItem;if(!t||!t.itemPageUrl)return;let n=document.createElement(`a`);n.target=`_blank`,n.href=t.itemPageUrl,n.rel=`noreferrer`,n.click()}},A(`calcite-icon`,{icon:`launch2`,key:`${n}-launch-icon`,scale:`s`,slot:`content-start`})):A(`calcite-list-item`,{label:t.saveAs,onCalciteListItemSelect:async()=>{this.saveAsButtonCallback&&(c(()=>e.portalItem).then(e=>{e.itemPageUrl&&this.scheduleRender()}),await this.saveAsButtonCallback(e))}},A(`calcite-icon`,{icon:`save`,key:`${n}-save-icon`,scale:`s`,slot:`content-start`})),A(`calcite-list-item`,{label:this.messagesCommon.delete,onCalciteListItemSelect:()=>this.exportedLinks.remove(e)},A(`calcite-icon`,{icon:`trash`,key:`${n}-delete-icon`,scale:`s`,slot:`content-start`})))):null}_renderExportedLinkItemContent(e){let t=this.messages,{url:n,state:r,error:i}=e,a=e.formattedName??``,o=n||null;o&&=u(o);let s=d(o,location.href),c=r===`error`?i?.name===`print-task:cim-symbol-unsupported`?t.exportWebMapCIMError:t.exportWebMapError:null;return A(`div`,{class:I.exportedFile,"data-item":e,slot:`content`,onclick:this._handleLinkClick},A(`div`,null,A(`div`,{class:I.exportedFileLinkTitle},a),A(`div`,{class:I.exportedFileLinkDescription},r===`pending`?t.generatingExport:c||(s?t.ready:t.linkReady))),r===`ready`?A(`calcite-icon`,{"aria-label":`${a}. ${t.linkReady}`,icon:s?`download-to`:`launch`,key:`${a}-end-icon`,scale:`s`,slot:`content-end`}):null)}_renderExportedLinkItemIcon(e){let t=e.formattedName??``;return e.state===`pending`?A(`calcite-loader`,{class:I.exportedFileLoader,inline:!0,key:`${t}-loader`,label:this.messages.generatingExport,scale:`m`,slot:`content-start`}):A(`calcite-icon`,{icon:z(e),key:`${t}-start-icon`,scale:`s`,slot:`content-start`})}_renderExportedLinkItemAction(e){let{state:t}=e,n=e.formattedName??``,r=this.saveAsButtonCallback&&t!==`error`&&this._isFormatAllowedForSaving(e.extension);return t===`pending`?null:A(`calcite-action`,{icon:r?`ellipsis`:`x`,id:r?`${n}-popover-button`:void 0,key:r?`${n}-saveAs-action`:`${n}-action`,slot:`actions-end`,text:r?this.messagesCommon.options:this.messagesCommon.remove,onclick:r?void 0:()=>{this.exportedLinks.remove(e)}})}_renderExportedLinkItem(e){let t=e.formattedName??``;return A(M,null,A(`calcite-list-item`,{key:t,label:t},this._renderExportedLinkItemContent(e),this._renderExportedLinkItemIcon(e),this._renderExportedLinkItemAction(e)),this._renderExportedLinkItemPopover(e))}_renderExportedLinkItems(e){return A(`calcite-list`,{filterEnabled:e?.length>10,label:this.messages.exportedLinksList,selectionMode:`none`},e.map(this._renderExportedLinkItem.bind(this)))}_isFormatAllowedForSaving(e){return!this.allowedFormatsForSaving||this.allowedFormatsForSaving===`all`||!!(e&&this.allowedFormatsForSaving.includes(e))}_toggleLayoutPanel(e){let t=e.target;this._toggleTab(t.getAttribute(`data-tab-id`))}_toggleTab(e,t=!0){if(this._selectedTab=e,this._selectedTab===`mapOnlyTab`)this.viewModel.applyTemplate(P);else if(this._selectedTab===`layoutTab`){let e=this._selectedTemplate??this.viewModel.defaultTemplate;this.viewModel.applyTemplate(e)}t&&(this._activeTabFocusRequested=!0)}_handleLayoutPanelKeyDown(e){let{key:t}=e,n=e.target.getAttribute(`data-tab-id`);if(N(t))this._toggleTab(n),e.preventDefault(),e.stopPropagation();else if(t===`ArrowLeft`||t===`ArrowRight`){switch(n){case`layoutTab`:this._toggleTab(t===`ArrowLeft`?`exportTab`:`mapOnlyTab`);break;case`mapOnlyTab`:this._toggleTab(t===`ArrowLeft`?`layoutTab`:`exportTab`);break;case`exportTab`:this._toggleTab(t===`ArrowLeft`?`mapOnlyTab`:`layoutTab`)}e.preventDefault(),e.stopPropagation()}}};e([f()],H.prototype,`_showTemplates`,void 0),e([f()],H.prototype,`_isValidSpatialReference`,void 0),e([f()],H.prototype,`allowedFormats`,null),e([f()],H.prototype,`allowedFormatsForSaving`,void 0),e([f()],H.prototype,`allowedLayouts`,null),e([f()],H.prototype,`browseTemplateButtonOnClick`,void 0),e([f()],H.prototype,`error`,null),e([f({type:n.ofType(S)})],H.prototype,`exportedLinks`,null),e([f()],H.prototype,`extraParameters`,null),e([f()],H.prototype,`headerVisible`,void 0),e([f()],H.prototype,`headingLevel`,void 0),e([f()],H.prototype,`icon`,null),e([f()],H.prototype,`includeDefaultTemplates`,null),e([f()],H.prototype,`includeOrganizationTemplates`,void 0),e([f()],H.prototype,`label`,null),e([f(),k(`esri/widgets/Print/t9n/Print`)],H.prototype,`messages`,void 0),e([f(),k(`esri/t9n/common`)],H.prototype,`messagesCommon`,void 0),e([f(),k(`esri/core/t9n/Units`)],H.prototype,`messagesUnits`,void 0),e([f({type:h})],H.prototype,`outSpatialReference`,null),e([f({type:_})],H.prototype,`portal`,null),e([f()],H.prototype,`saveExportEnabled`,null),e([f()],H.prototype,`saveExportHidden`,void 0),e([f()],H.prototype,`showPrintAreaEnabled`,null),e([f()],H.prototype,`printServiceUrl`,null),e([f()],H.prototype,`saveAsButtonCallback`,void 0),e([f()],H.prototype,`templateCustomTextElements`,null),e([f({type:w})],H.prototype,`templateOptions`,null),e([f()],H.prototype,`view`,null),e([f({type:C})],H.prototype,`viewModel`,void 0),H=e([p(`esri.widgets.Print`)],H);const U=H;export{U as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{formatNumber as t,substitute as n}from"../intl.js";import{deprecateWidget as r}from"../core/deprecate.js";import{on as i}from"../core/events.js";import a from"../core/Logger.js";import{destroyMaybe as o}from"../core/maybe.js";import{watch as s,initial as c,when as l}from"../core/reactiveUtils.js";import{property as u,cast as d,subclass as f}from"../core/accessorSupport/decorators.js";import p from"./Slider.js";import m from"./Widget.js";import{css as h}from"./ScaleRangeSlider/css.js";import{getScalePreviewSource as g,getScalePreviewSpriteBackgroundPosition as _}from"./ScaleRangeSlider/scalePreviewUtils.js";import v from"./ScaleRangeSlider/ScaleRanges.js";import y from"./ScaleRangeSlider/ScaleRangeSliderViewModel.js";import{loadCalciteComponents as b}from"./support/componentsUtils.js";import{globalCss as x}from"./support/globalCss.js";import{messageBundle as S,tsx as C}from"./support/widget.js";import{storeNode as w,setFocus as T}from"./support/widgetUtils.js";const E={preview:!0,scaleMenus:{maxScaleMenu:!0,minScaleMenu:!0}},D={maximumFractionDigits:0};let O=class extends m{constructor(e,t){super(e,t),this._activeMenu=null,this._activeThumb=null,this._customInput=null,this._maxThumbNode=null,this._minThumbNode=null,this._lastPreviewReferenceElement=null,this._previewAutoCloseTimeoutId=void 0,this._previewPopover=null,this._slider=new p({suppressDeprecationWarning:!0,thumbCreatedFunction:(e,t,n)=>{e===0?this._minThumbNode=n:e===1&&(this._maxThumbNode=n),this.addHandles([i(n,`mouseenter`,()=>{this._activeThumb=e,this._lastPreviewReferenceElement=n,this.scheduleRender()}),i(n,`mouseleave`,()=>{this._previewAutoCloseTimeoutId||(this._activeThumb=null,this.scheduleRender())})])}}),this.disabled=!1,this.messages=null,this.region=`US`,this.showWorldValue=!1,this.viewModel=new y,this.visibleElements=E,this._repositionPreviewPopover=()=>{let e=this._previewPopover;e&&e.open&&this._activeThumb!=null&&this._getReferenceNode(this._activeThumb)&&requestAnimationFrame(()=>e.reposition())},this._afterInputNumberCreate=e=>{`value`in e&&e.value!=null&&`setNumberValue`in e&&e.setNumberValue({committing:!1,value:e.value,origin:`direct`}),this._customInput=e},this._handleCustomScaleInputChange=(e,t)=>{let{viewModel:{scaleRanges:n}}=this,r=Number.parseFloat(t.value);Number.isNaN(r)?t.value=e:this._setScale(n.clampScale(r))},this.announceDeprecation=()=>{r(a.getLogger(this),`Scale Range Slider`,`arcgis-slider-scale-range`,{version:`5.0`})}}loadDependencies(){return b({button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),dropdown:()=>import(`@esri/calcite-components/dist/components/calcite-dropdown`),"dropdown-group":()=>import(`@esri/calcite-components/dist/components/calcite-dropdown-group`),"dropdown-item":()=>import(`@esri/calcite-components/dist/components/calcite-dropdown-item`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),"input-number":()=>import(`@esri/calcite-components/dist/components/calcite-input-number`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),popover:()=>import(`@esri/calcite-components/dist/components/calcite-popover`)})}initialize(){this.addHandles([s(()=>this.viewModel,e=>this._slider.viewModel=e?.sliderViewModel??null,c),s(()=>this._interactive,e=>{this._slider.disabled=!e,e||this._setActiveMenu(null)},c),this._slider.on(`thumb-drag`,({index:e})=>{this._activeThumb=e,this._lastPreviewReferenceElement=this._getReferenceNode(e),clearTimeout(this._previewAutoCloseTimeoutId),this._previewAutoCloseTimeoutId=setTimeout(()=>{this._previewAutoCloseTimeoutId=void 0,this._activeThumb=null},250)}),l(()=>this.view?.stationary===!0,()=>this.scheduleRender())])}destroy(){this._slider=o(this._slider)}get _maxScaleMenuEnabled(){let{scaleMenus:e}=this.visibleElements;return e===!0||typeof e!=`boolean`&&e?.maxScaleMenu===!0}get _minScaleMenuEnabled(){let{scaleMenus:e}=this.visibleElements;return e===!0||typeof e!=`boolean`&&e?.minScaleMenu===!0}get _interactive(){return this.viewModel?.state!==`disabled`&&!this.disabled}get effectiveMaxScale(){return this.viewModel.effectiveMaxScale}get effectiveMinScale(){return this.viewModel.effectiveMinScale}get effectiveMaxScaleLimit(){return this.viewModel.effectiveMaxScaleLimit}get effectiveMinScaleLimit(){return this.viewModel.effectiveMinScaleLimit}get icon(){return`actual-size`}set icon(e){this._overrideIfSome(`icon`,e)}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get maxScale(){return this.viewModel.maxScale}set maxScale(e){this.viewModel.maxScale=e}get maxScaleLimit(){return this.viewModel.maxScaleLimit}set maxScaleLimit(e){this.viewModel.maxScaleLimit=e}get mode(){return this.viewModel.mode}set mode(e){this.viewModel.mode=e}get minScale(){return this.viewModel.minScale}set minScale(e){this.viewModel.minScale=e}get minScaleLimit(){return this.viewModel.minScaleLimit}set minScaleLimit(e){this.viewModel.minScaleLimit=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...E,...e,scaleMenus:typeof e?.scaleMenus==`boolean`?e.scaleMenus:{...E.scaleMenus,...e?.scaleMenus}}}formatScale(e){return`1:${t(e,D)}`}render(){let{_interactive:e,_slider:t,label:n,view:r,viewModel:{state:i}}=this,a=this._getLabel(`min`),o=this._getLabel(`max`),{segmentElements:s}=t,c=s.at(this.mode===`min-scale-only`?-1:-2);return c&&c.classList.add(h.segmentElementActive),C(`div`,{"aria-label":n,class:this.classes(h.base,x.widget,e?null:x.disabled)},C(`div`,{class:h.scaleIndicatorWrapper,dir:`ltr`},i===`ready`&&r?this._renderCurrentScaleIndicator():null,t.render(),this._renderPreviewPopover()),C(`div`,{class:h.scaleMenuContainer},this._minScaleMenuEnabled&&a?this._renderScaleMenuToggle(`min`,a):null,C(`div`,{class:h.scaleMenuSeparator}),this._maxScaleMenuEnabled&&o?this._renderScaleMenuToggle(`max`,o):null))}_renderPreviewPopover(){let{_activeThumb:e}=this,t=this._getReferenceNode(e)??this._lastPreviewReferenceElement,n=e!=null&&this.visibleElements.preview&&t!=null;return n?C(`calcite-popover`,{afterCreate:w,afterUpdate:this._repositionPreviewPopover,bind:this,"data-node-ref":`_previewPopover`,label:this.messages.preview,offsetDistance:16,open:n,overlayPositioning:`fixed`,placement:`top`,referenceElement:t??void 0,topLayerDisabled:this.topLayerDisabled,triggerDisabled:!0},this._renderScalePreview()):null}_getReferenceNode(e){return e===0?this._minThumbNode:e===1?this._maxThumbNode:null}_renderScalePreview(){let{_activeThumb:e,_slider:t,region:n,viewModel:{scaleRanges:r}}=this,i=e===0||this.mode!==`range`?t.values[0]:t.values[1],a=Object.keys(v.RecommendedScales).indexOf(r.findScaleRangeByIndex(i).id),o={backgroundImage:g(n),backgroundPosition:_(a)};return C(`div`,{class:h.scalePreview},C(`div`,{class:h.scalePreviewThumbnail,styles:o}))}_getLabel(e){let{_slider:t,messages:n,mode:r,viewModel:{scaleRanges:i}}=this,[a,o]=t.values,s=e===`min`||r!==`range`?a:o,c=n.scaleRangeLabels[i.findScaleRangeByIndex(s).id];switch(r){case`range`:return c;case`max-scale-only`:return e===`min`?null:c;case`min-scale-only`:return e===`min`?c:null}}_renderScaleMenuToggle(e,t){let{_activeMenu:n,_interactive:r}=this,i=n===e;return[C(`calcite-dropdown`,{closeOnSelectDisabled:!0,"data-type":e,open:i,overlayPositioning:`fixed`,placement:e===`max`?`bottom-end`:`bottom-start`,scale:`s`,topLayerDisabled:this.topLayerDisabled,onCalciteDropdownClose:({currentTarget:t})=>{this._activeMenu===e&&this._setActiveMenu(null),T(t.querySelector(`calcite-button`))},onCalciteDropdownOpen:()=>this._setActiveMenu(e)},C(`calcite-button`,{appearance:i?`outline`:`transparent`,"aria-pressed":i.toString(),class:h.scaleMenuToggle,disabled:!r,iconEnd:`chevron-down`,scale:`s`,slot:`trigger`},t),i&&e===`max`?this._renderMaxScaleMenu():null,i&&e===`min`?this._renderMinScaleMenu():null)]}_renderMinScaleMenu(){let{effectiveMaxScale:e,effectiveMinScaleLimit:t,view:n,viewModel:{scaleRanges:r}}=this,i=n?n.scale:void 0;return this._renderScaleMenu({type:`min`,min:t,max:r.findScaleRange(e).minScale,viewScale:i})}_renderMaxScaleMenu(){let{effectiveMinScale:e,effectiveMaxScaleLimit:t,view:n,viewModel:{scaleRanges:r}}=this,i=n?n.scale:void 0;return this._renderScaleMenu({type:`max`,min:r.findScaleRange(e).maxScale,max:t,viewScale:i})}_renderScaleMenu({viewScale:e,min:t,max:n,type:r}){let{effectiveMaxScale:i,effectiveMinScale:a,messages:o,showWorldValue:s}=this,c=r===`max`?i:a,l=v.fromScaleRange({minScale:t,maxScale:n}),u=this.messages.featuredScaleLabels,d=v.RecommendedScales,f=Object.keys(d).filter(e=>l.contains(d[e])).map(e=>this._renderScaleMenuItem({scaleLabel:u[e],scaleValue:d[e],isSelected:c===d[e],valueVisible:e!==`world`||s}));return C(`calcite-dropdown-group`,{key:`${this.id}__scale-menu--${r}`},this._renderCustomScaleValue({currentScale:c}),e==null?null:this._renderScaleMenuItem({scaleValue:e,scaleLabel:o.featuredScaleLabels.current,isSelected:c===e,valueVisible:!0}),f)}_renderCustomScaleValue({currentScale:e}){let{messages:t}=this,n=Math.round(e).toString();return C(`calcite-dropdown-item`,{afterCreate:e=>void T(e),key:`custom-scale`,label:t.featuredScaleLabels.custom,onCalciteDropdownItemSelect:()=>void T(this._customInput)},C(`calcite-label`,{scale:`s`},C(`span`,null,t.featuredScaleLabels.custom),C(`calcite-input-number`,{afterCreate:this._afterInputNumberCreate,groupSeparator:!0,inputMode:`numeric`,max:v.RecommendedScales.world,min:0,numberButtonType:`none`,placeholder:t.customScaleInputTooltip,prefixText:`1:`,scale:`s`,step:1,value:n,onCalciteInputNumberChange:({currentTarget:e})=>this._handleCustomScaleInputChange(n,e)})))}_renderScaleMenuItem(e){let{scaleValue:t,scaleLabel:n,valueVisible:r,isSelected:i}=e;return C(`calcite-dropdown-item`,{key:n,label:n,selected:i,onCalciteDropdownItemSelect:this._setScale.bind(this,t)},n,r?C(`div`,{class:h.scaleMenuSubLabel},this.formatScale(t)):void 0)}_renderCurrentScaleIndicator(){let{_slider:e,messages:t,view:r,viewModel:{scaleRanges:i}}=this,a=i.clampScale(r.scale),o=this.viewModel.mapScaleToSlider(a),s=o/e.max,c=t.scaleRangeLabels[i.findScaleRangeByIndex(o).id],l=n(t.currentScaleTooltip,{scaleLabel:c});return C(`div`,{class:h.scaleIndicatorContainer,key:`scale-indicator`},C(`div`,{"aria-label":l,class:h.scaleIndicator,styles:{left:`${s*100}%`},title:l},this.renderCurrentScaleIndicatorIcon()))}renderCurrentScaleIndicatorIcon(){return C(`calcite-icon`,{class:h.scaleIndicatorIcon,icon:`caret-up`,scale:`s`})}_setScale(e){this._activeMenu===`max`?this.maxScale=Math.min(e,this.effectiveMinScale-1):this.minScale=Math.max(e,this.effectiveMaxScale+1),this._setActiveMenu(null)}_setActiveMenu(e){this._activeMenu=e}};e([u()],O.prototype,`_activeMenu`,void 0),e([u()],O.prototype,`_activeThumb`,void 0),e([u()],O.prototype,`_customInput`,void 0),e([u()],O.prototype,`_maxScaleMenuEnabled`,null),e([u()],O.prototype,`_minScaleMenuEnabled`,null),e([u()],O.prototype,`_slider`,void 0),e([u({readOnly:!0})],O.prototype,`_interactive`,null),e([u()],O.prototype,`disabled`,void 0),e([u()],O.prototype,`effectiveMaxScale`,null),e([u()],O.prototype,`effectiveMinScale`,null),e([u()],O.prototype,`effectiveMaxScaleLimit`,null),e([u()],O.prototype,`effectiveMinScaleLimit`,null),e([u()],O.prototype,`icon`,null),e([u()],O.prototype,`label`,null),e([u()],O.prototype,`layer`,null),e([u()],O.prototype,`maxScale`,null),e([u()],O.prototype,`maxScaleLimit`,null),e([u(),S(`esri/widgets/ScaleRangeSlider/t9n/ScaleRangeSlider`)],O.prototype,`messages`,void 0),e([u()],O.prototype,`mode`,null),e([u()],O.prototype,`minScale`,null),e([u()],O.prototype,`minScaleLimit`,null),e([u()],O.prototype,`region`,void 0),e([u()],O.prototype,`showWorldValue`,void 0),e([u()],O.prototype,`view`,null),e([u({type:y})],O.prototype,`viewModel`,void 0),e([u()],O.prototype,`visibleElements`,void 0),e([d(`visibleElements`)],O.prototype,`castVisibleElements`,null),O=e([f(`esri.widgets.ScaleRangeSlider`)],O);const k=O;export{k as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{formatNumber as t,substitute as n}from"../intl.js";import{deprecateWidget as r}from"../core/deprecate.js";import{on as i}from"../core/events.js";import a from"../core/Logger.js";import{destroyMaybe as o}from"../core/maybe.js";import{watch as s,initial as c,when as l}from"../core/reactiveUtils.js";import{property as u,cast as d,subclass as f}from"../core/accessorSupport/decorators.js";import p from"./Slider.js";import m from"./Widget.js";import{css as h}from"./ScaleRangeSlider/css.js";import{getScalePreviewSource as g,getScalePreviewSpriteBackgroundPosition as _}from"./ScaleRangeSlider/scalePreviewUtils.js";import v from"./ScaleRangeSlider/ScaleRanges.js";import y from"./ScaleRangeSlider/ScaleRangeSliderViewModel.js";import{createDropdownReference as b,loadCalciteComponents as x}from"./support/componentsUtils.js";import{globalCss as S}from"./support/globalCss.js";import{messageBundle as C,tsx as w}from"./support/widget.js";import{storeNode as T,setFocus as E}from"./support/widgetUtils.js";const D={preview:!0,scaleMenus:{maxScaleMenu:!0,minScaleMenu:!0}},O={maximumFractionDigits:0};let k=class extends m{constructor(e,t){super(e,t),this._activeMenu=null,this._activeThumb=null,this._customInput=null,this._maxThumbNode=null,this._minThumbNode=null,this._lastPreviewReferenceElement=null,this._previewAutoCloseTimeoutId=void 0,this._previewPopover=null,this._scaleMenuReferences={min:b(),max:b()},this._slider=new p({suppressDeprecationWarning:!0,thumbCreatedFunction:(e,t,n)=>{e===0?this._minThumbNode=n:e===1&&(this._maxThumbNode=n),this.addHandles([i(n,`mouseenter`,()=>{this._activeThumb=e,this._lastPreviewReferenceElement=n,this.scheduleRender()}),i(n,`mouseleave`,()=>{this._previewAutoCloseTimeoutId||(this._activeThumb=null,this.scheduleRender())})])}}),this.disabled=!1,this.messages=null,this.region=`US`,this.showWorldValue=!1,this.viewModel=new y,this.visibleElements=D,this._repositionPreviewPopover=()=>{let e=this._previewPopover;e&&e.open&&this._activeThumb!=null&&this._getReferenceNode(this._activeThumb)&&requestAnimationFrame(()=>e.reposition())},this._afterInputNumberCreate=e=>{`value`in e&&e.value!=null&&`setNumberValue`in e&&e.setNumberValue({committing:!1,value:e.value,origin:`direct`}),this._customInput=e},this._handleCustomScaleInputChange=(e,t)=>{let{viewModel:{scaleRanges:n}}=this,r=Number.parseFloat(t.value);Number.isNaN(r)?t.value=e:this._setScale(n.clampScale(r))},this.announceDeprecation=()=>{r(a.getLogger(this),`Scale Range Slider`,`arcgis-slider-scale-range`,{version:`5.0`})}}loadDependencies(){return x({button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),dropdown:()=>import(`@esri/calcite-components/dist/components/calcite-dropdown`),"dropdown-group":()=>import(`@esri/calcite-components/dist/components/calcite-dropdown-group`),"dropdown-item":()=>import(`@esri/calcite-components/dist/components/calcite-dropdown-item`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),"input-number":()=>import(`@esri/calcite-components/dist/components/calcite-input-number`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),popover:()=>import(`@esri/calcite-components/dist/components/calcite-popover`)})}initialize(){this.addHandles([s(()=>this.viewModel,e=>this._slider.viewModel=e?.sliderViewModel??null,c),s(()=>this._interactive,e=>{this._slider.disabled=!e,e||this._setActiveMenu(null)},c),this._slider.on(`thumb-drag`,({index:e})=>{this._activeThumb=e,this._lastPreviewReferenceElement=this._getReferenceNode(e),clearTimeout(this._previewAutoCloseTimeoutId),this._previewAutoCloseTimeoutId=setTimeout(()=>{this._previewAutoCloseTimeoutId=void 0,this._activeThumb=null},250)}),l(()=>this.view?.stationary===!0,()=>this.scheduleRender())])}destroy(){this._scaleMenuReferences.min.destroy(),this._scaleMenuReferences.max.destroy(),this._slider=o(this._slider)}get _maxScaleMenuEnabled(){let{scaleMenus:e}=this.visibleElements;return e===!0||typeof e!=`boolean`&&e?.maxScaleMenu===!0}get _minScaleMenuEnabled(){let{scaleMenus:e}=this.visibleElements;return e===!0||typeof e!=`boolean`&&e?.minScaleMenu===!0}get _interactive(){return this.viewModel?.state!==`disabled`&&!this.disabled}get effectiveMaxScale(){return this.viewModel.effectiveMaxScale}get effectiveMinScale(){return this.viewModel.effectiveMinScale}get effectiveMaxScaleLimit(){return this.viewModel.effectiveMaxScaleLimit}get effectiveMinScaleLimit(){return this.viewModel.effectiveMinScaleLimit}get icon(){return`actual-size`}set icon(e){this._overrideIfSome(`icon`,e)}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get maxScale(){return this.viewModel.maxScale}set maxScale(e){this.viewModel.maxScale=e}get maxScaleLimit(){return this.viewModel.maxScaleLimit}set maxScaleLimit(e){this.viewModel.maxScaleLimit=e}get mode(){return this.viewModel.mode}set mode(e){this.viewModel.mode=e}get minScale(){return this.viewModel.minScale}set minScale(e){this.viewModel.minScale=e}get minScaleLimit(){return this.viewModel.minScaleLimit}set minScaleLimit(e){this.viewModel.minScaleLimit=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...D,...e,scaleMenus:typeof e?.scaleMenus==`boolean`?e.scaleMenus:{...D.scaleMenus,...e?.scaleMenus}}}formatScale(e){return`1:${t(e,O)}`}render(){let{_interactive:e,_slider:t,label:n,view:r,viewModel:{state:i}}=this,a=this._getLabel(`min`),o=this._getLabel(`max`),{segmentElements:s}=t,c=s.at(this.mode===`min-scale-only`?-1:-2);return c&&c.classList.add(h.segmentElementActive),w(`div`,{"aria-label":n,class:this.classes(h.base,S.widget,e?null:S.disabled)},w(`div`,{class:h.scaleIndicatorWrapper,dir:`ltr`},i===`ready`&&r?this._renderCurrentScaleIndicator():null,t.render(),this._renderPreviewPopover()),w(`div`,{class:h.scaleMenuContainer},this._minScaleMenuEnabled&&a?this._renderScaleMenuToggle(`min`,a):null,w(`div`,{class:h.scaleMenuSeparator}),this._maxScaleMenuEnabled&&o?this._renderScaleMenuToggle(`max`,o):null))}_renderPreviewPopover(){let{_activeThumb:e}=this,t=this._getReferenceNode(e)??this._lastPreviewReferenceElement,n=e!=null&&this.visibleElements.preview&&t!=null;return n?w(`calcite-popover`,{afterCreate:T,afterUpdate:this._repositionPreviewPopover,bind:this,"data-node-ref":`_previewPopover`,label:this.messages.preview,offsetDistance:16,open:n,overlayPositioning:`fixed`,placement:`top`,referenceElement:t??void 0,topLayerDisabled:this.topLayerDisabled,triggerDisabled:!0},this._renderScalePreview()):null}_getReferenceNode(e){return e===0?this._minThumbNode:e===1?this._maxThumbNode:null}_renderScalePreview(){let{_activeThumb:e,_slider:t,region:n,viewModel:{scaleRanges:r}}=this,i=e===0||this.mode!==`range`?t.values[0]:t.values[1],a=Object.keys(v.RecommendedScales).indexOf(r.findScaleRangeByIndex(i).id),o={backgroundImage:g(n),backgroundPosition:_(a)};return w(`div`,{class:h.scalePreview},w(`div`,{class:h.scalePreviewThumbnail,styles:o}))}_getLabel(e){let{_slider:t,messages:n,mode:r,viewModel:{scaleRanges:i}}=this,[a,o]=t.values,s=e===`min`||r!==`range`?a:o,c=n.scaleRangeLabels[i.findScaleRangeByIndex(s).id];switch(r){case`range`:return c;case`max-scale-only`:return e===`min`?null:c;case`min-scale-only`:return e===`min`?c:null}}_renderScaleMenuToggle(e,t){let{_activeMenu:n,_interactive:r}=this,i=n===e,a=this._scaleMenuReferences[e],{storeTrigger:o,destroy:s,referenceTrigger:c}=a;return[w(`calcite-button`,{afterCreate:o,afterRemoved:s,afterUpdate:o,appearance:i?`outline`:`transparent`,"aria-pressed":i.toString(),class:h.scaleMenuToggle,disabled:!r,iconEnd:`chevron-down`,key:`scale-menu-${e}-trigger`,scale:`s`},t),w(`calcite-dropdown`,{afterCreate:c,afterUpdate:c,closeOnSelectDisabled:!0,"data-type":e,key:`scale-menu-${e}-dropdown`,open:i,overlayPositioning:`fixed`,placement:e===`max`?`bottom-end`:`bottom-start`,scale:`s`,topLayerDisabled:this.topLayerDisabled,onCalciteDropdownClose:()=>{this._activeMenu===e&&this._setActiveMenu(null),E(a.trigger)},onCalciteDropdownOpen:()=>this._setActiveMenu(e)},i&&e===`max`?this._renderMaxScaleMenu():null,i&&e===`min`?this._renderMinScaleMenu():null)]}_renderMinScaleMenu(){let{effectiveMaxScale:e,effectiveMinScaleLimit:t,view:n,viewModel:{scaleRanges:r}}=this,i=n?n.scale:void 0;return this._renderScaleMenu({type:`min`,min:t,max:r.findScaleRange(e).minScale,viewScale:i})}_renderMaxScaleMenu(){let{effectiveMinScale:e,effectiveMaxScaleLimit:t,view:n,viewModel:{scaleRanges:r}}=this,i=n?n.scale:void 0;return this._renderScaleMenu({type:`max`,min:r.findScaleRange(e).maxScale,max:t,viewScale:i})}_renderScaleMenu({viewScale:e,min:t,max:n,type:r}){let{effectiveMaxScale:i,effectiveMinScale:a,messages:o,showWorldValue:s}=this,c=r===`max`?i:a,l=v.fromScaleRange({minScale:t,maxScale:n}),u=this.messages.featuredScaleLabels,d=v.RecommendedScales,f=Object.keys(d).filter(e=>l.contains(d[e])).map(e=>this._renderScaleMenuItem({scaleLabel:u[e],scaleValue:d[e],isSelected:c===d[e],valueVisible:e!==`world`||s}));return w(`calcite-dropdown-group`,{key:`${this.id}__scale-menu--${r}`},this._renderCustomScaleValue({currentScale:c}),e==null?null:this._renderScaleMenuItem({scaleValue:e,scaleLabel:o.featuredScaleLabels.current,isSelected:c===e,valueVisible:!0}),f)}_renderCustomScaleValue({currentScale:e}){let{messages:t}=this,n=Math.round(e).toString();return w(`calcite-dropdown-item`,{afterCreate:e=>void E(e),key:`custom-scale`,label:t.featuredScaleLabels.custom,onCalciteDropdownItemSelect:()=>void E(this._customInput)},w(`calcite-label`,{scale:`s`},w(`span`,null,t.featuredScaleLabels.custom),w(`calcite-input-number`,{afterCreate:this._afterInputNumberCreate,groupSeparator:!0,inputMode:`numeric`,max:v.RecommendedScales.world,min:0,numberButtonType:`none`,placeholder:t.customScaleInputTooltip,prefixText:`1:`,scale:`s`,step:1,value:n,onCalciteInputNumberChange:({currentTarget:e})=>this._handleCustomScaleInputChange(n,e)})))}_renderScaleMenuItem(e){let{scaleValue:t,scaleLabel:n,valueVisible:r,isSelected:i}=e;return w(`calcite-dropdown-item`,{key:n,label:n,selected:i,onCalciteDropdownItemSelect:this._setScale.bind(this,t)},n,r?w(`div`,{class:h.scaleMenuSubLabel},this.formatScale(t)):void 0)}_renderCurrentScaleIndicator(){let{_slider:e,messages:t,view:r,viewModel:{scaleRanges:i}}=this,a=i.clampScale(r.scale),o=this.viewModel.mapScaleToSlider(a),s=o/e.max,c=t.scaleRangeLabels[i.findScaleRangeByIndex(o).id],l=n(t.currentScaleTooltip,{scaleLabel:c});return w(`div`,{class:h.scaleIndicatorContainer,key:`scale-indicator`},w(`div`,{"aria-label":l,class:h.scaleIndicator,styles:{left:`${s*100}%`},title:l},this.renderCurrentScaleIndicatorIcon()))}renderCurrentScaleIndicatorIcon(){return w(`calcite-icon`,{class:h.scaleIndicatorIcon,icon:`caret-up`,scale:`s`})}_setScale(e){this._activeMenu===`max`?this.maxScale=Math.min(e,this.effectiveMinScale-1):this.minScale=Math.max(e,this.effectiveMaxScale+1),this._setActiveMenu(null)}_setActiveMenu(e){this._activeMenu=e}};e([u()],k.prototype,`_activeMenu`,void 0),e([u()],k.prototype,`_activeThumb`,void 0),e([u()],k.prototype,`_customInput`,void 0),e([u()],k.prototype,`_maxScaleMenuEnabled`,null),e([u()],k.prototype,`_minScaleMenuEnabled`,null),e([u()],k.prototype,`_slider`,void 0),e([u({readOnly:!0})],k.prototype,`_interactive`,null),e([u()],k.prototype,`disabled`,void 0),e([u()],k.prototype,`effectiveMaxScale`,null),e([u()],k.prototype,`effectiveMinScale`,null),e([u()],k.prototype,`effectiveMaxScaleLimit`,null),e([u()],k.prototype,`effectiveMinScaleLimit`,null),e([u()],k.prototype,`icon`,null),e([u()],k.prototype,`label`,null),e([u()],k.prototype,`layer`,null),e([u()],k.prototype,`maxScale`,null),e([u()],k.prototype,`maxScaleLimit`,null),e([u(),C(`esri/widgets/ScaleRangeSlider/t9n/ScaleRangeSlider`)],k.prototype,`messages`,void 0),e([u()],k.prototype,`mode`,null),e([u()],k.prototype,`minScale`,null),e([u()],k.prototype,`minScaleLimit`,null),e([u()],k.prototype,`region`,void 0),e([u()],k.prototype,`showWorldValue`,void 0),e([u()],k.prototype,`view`,null),e([u({type:y})],k.prototype,`viewModel`,void 0),e([u()],k.prototype,`visibleElements`,void 0),e([d(`visibleElements`)],k.prototype,`castVisibleElements`,null),k=e([f(`esri.widgets.ScaleRangeSlider`)],k);const A=k;export{A as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{substitute as t}from"../../intl.js";import{property as n,subclass as r}from"../../core/accessorSupport/decorators.js";import{popupFromView as i}from"../../views/popupAdapter.js";import a from"../Widget.js";import{css as o}from"./searchResultRendererCSS.js";import s from"./SearchViewModel.js";import{loadCalciteComponents as c}from"../support/componentsUtils.js";import{globalCss as l}from"../support/globalCss.js";import{messageBundle as u,tsx as d}from"../support/widget.js";let f=class extends a{constructor(e,t){super(e,t),this.messages=null,this.showMoreResultsOpen=!1,this.viewModel=null}loadDependencies(){return c({block:()=>import(`@esri/calcite-components/dist/components/calcite-block`),list:()=>import(`@esri/calcite-components/dist/components/calcite-list`),"list-item":()=>import(`@esri/calcite-components/dist/components/calcite-list-item`),"list-item-group":()=>import(`@esri/calcite-components/dist/components/calcite-list-item-group`)})}destroy(){this.viewModel=null}render(){return d(`div`,{class:this.classes(o.base,l.widget)},this.viewModel?.selectedResult?.name??``,this._renderMoreResults())}_renderMoreResults(){if(!this.viewModel)return null;let{resultCount:e,results:n}=this.viewModel;return!e||e<2||!n?null:d(`calcite-block`,{class:o.moreResults,
|
|
2
|
+
import{__decorate as e}from"tslib";import{substitute as t}from"../../intl.js";import{property as n,subclass as r}from"../../core/accessorSupport/decorators.js";import{popupFromView as i}from"../../views/popupAdapter.js";import a from"../Widget.js";import{css as o}from"./searchResultRendererCSS.js";import s from"./SearchViewModel.js";import{loadCalciteComponents as c}from"../support/componentsUtils.js";import{globalCss as l}from"../support/globalCss.js";import{messageBundle as u,tsx as d}from"../support/widget.js";let f=class extends a{constructor(e,t){super(e,t),this.messages=null,this.showMoreResultsOpen=!1,this.viewModel=null}loadDependencies(){return c({block:()=>import(`@esri/calcite-components/dist/components/calcite-block`),list:()=>import(`@esri/calcite-components/dist/components/calcite-list`),"list-item":()=>import(`@esri/calcite-components/dist/components/calcite-list-item`),"list-item-group":()=>import(`@esri/calcite-components/dist/components/calcite-list-item-group`)})}destroy(){this.viewModel=null}render(){return d(`div`,{class:this.classes(o.base,l.widget)},this.viewModel?.selectedResult?.name??``,this._renderMoreResults())}_renderMoreResults(){if(!this.viewModel)return null;let{resultCount:e,results:n}=this.viewModel;return!e||e<2||!n?null:d(`calcite-block`,{class:o.moreResults,expandable:!0,expanded:this.showMoreResultsOpen,heading:t(this.messages.showMoreResults,{count:e-1}),onCalciteBlockClose:()=>this._toggleShowMoreResults(!1),onCalciteBlockOpen:()=>this._toggleShowMoreResults(!0)},n.map(e=>this._renderMoreResultsList(e,n?.length>1)))}_renderListItem(e){return d(`calcite-list-item`,{key:`result-${e.sourceIndex}-${e.key}`,label:e.name,onCalciteListItemSelect:()=>this._selectResult(e)})}_renderMoreResultsList(e,t){let{results:n}=e;if(!(n?.length??0)||!n)return null;let r=this.viewModel?.selectedResult,i=this._getSourceName(e.source,e.sourceIndex),a=n.filter(e=>e!==r).map(e=>this._renderListItem(e));return d(`calcite-list`,{label:i},t?d(`calcite-list-item-group`,{heading:i,key:`group-${e.sourceIndex}`},a):a)}_selectResult(e){this.showMoreResultsOpen=!1,this.viewModel?.select(e)}_toggleShowMoreResults(e){this.showMoreResultsOpen=e;let t=i(this.viewModel?.view);t&&`reposition`in t&&typeof t.reposition==`function`&&t.reposition()}_getSourceName(e,t){return t===s.ALL_INDEX?this.messages.all:e.name}};e([n(),u(`esri/widgets/Search/t9n/Search`)],f.prototype,`messages`,void 0),e([n()],f.prototype,`showMoreResultsOpen`,void 0),e([n({type:s})],f.prototype,`viewModel`,void 0),f=e([r(`esri.widgets.Search.SearchResultRenderer`)],f);const p=f;export{p as default};
|
|
@@ -163,12 +163,14 @@ export interface SketchViewModelProperties extends Partial<Pick<SketchViewModel,
|
|
|
163
163
|
textSymbol?: TextSymbolProperties & { type: "text"; };
|
|
164
164
|
/**
|
|
165
165
|
* Options to configure the tooltip shown next to the cursor when creating or updating graphics.
|
|
166
|
+
* See [useViewOptions](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/SketchViewModel/#useViewOptions) for when these options are used instead of options on the view.
|
|
166
167
|
*
|
|
167
168
|
* @since 4.24
|
|
168
169
|
*/
|
|
169
170
|
tooltipOptions?: SketchTooltipOptionsProperties;
|
|
170
171
|
/**
|
|
171
172
|
* Options to configure how values are displayed and input when creating or updating graphics.
|
|
173
|
+
* See [useViewOptions](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/SketchViewModel/#useViewOptions) for unit inheritance and override behavior.
|
|
172
174
|
*
|
|
173
175
|
* @since 4.29
|
|
174
176
|
*/
|
|
@@ -822,6 +824,7 @@ export default class SketchViewModel extends EventedAccessor {
|
|
|
822
824
|
set textSymbol(value: TextSymbolProperties & { type: "text"; });
|
|
823
825
|
/**
|
|
824
826
|
* Options to configure the tooltip shown next to the cursor when creating or updating graphics.
|
|
827
|
+
* See [useViewOptions](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/SketchViewModel/#useViewOptions) for when these options are used instead of options on the view.
|
|
825
828
|
*
|
|
826
829
|
* @since 4.24
|
|
827
830
|
*/
|
|
@@ -873,17 +876,18 @@ export default class SketchViewModel extends EventedAccessor {
|
|
|
873
876
|
*/
|
|
874
877
|
accessor useLegacyCreateTools: boolean;
|
|
875
878
|
/**
|
|
876
|
-
* Indicates whether to use
|
|
879
|
+
* Indicates whether to use snapping, tooltips, display units, and input units from
|
|
877
880
|
* [ViewOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/).
|
|
878
881
|
*
|
|
879
|
-
* When
|
|
880
|
-
* [snappingOptions](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/SketchViewModel/#snappingOptions) and [tooltipOptions](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/SketchViewModel/#tooltipOptions)
|
|
881
|
-
* are preserved but ignored. When `false`, those options are used instead.
|
|
882
|
+
* When this property is `true`:
|
|
882
883
|
*
|
|
883
|
-
*
|
|
884
|
-
*
|
|
885
|
-
*
|
|
886
|
-
*
|
|
884
|
+
* - Snapping and tooltip options are inherited from the view. The view model's
|
|
885
|
+
* [snappingOptions](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/SketchViewModel/#snappingOptions) and [tooltipOptions](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/SketchViewModel/#tooltipOptions) are preserved but ignored.
|
|
886
|
+
* - Units set through [valueOptions](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/SketchViewModel/#valueOptions) override the corresponding units on the view,
|
|
887
|
+
* such as length or area, without changing the view's options. Setting a unit to `null` or `undefined` restores
|
|
888
|
+
* inheritance for that measurement type.
|
|
889
|
+
*
|
|
890
|
+
* When `false`, the view model uses its own snapping, tooltip, and unit options instead.
|
|
887
891
|
*
|
|
888
892
|
* Label [options](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/SketchViewModel/#labelOptions) and
|
|
889
893
|
* [direction mode](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ValueOptions/#directionMode) are not inherited from the view.
|
|
@@ -905,6 +909,7 @@ export default class SketchViewModel extends EventedAccessor {
|
|
|
905
909
|
accessor useViewOptions: boolean;
|
|
906
910
|
/**
|
|
907
911
|
* Options to configure how values are displayed and input when creating or updating graphics.
|
|
912
|
+
* See [useViewOptions](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/SketchViewModel/#useViewOptions) for unit inheritance and override behavior.
|
|
908
913
|
*
|
|
909
914
|
* @since 4.29
|
|
910
915
|
*/
|
|
@@ -1120,7 +1125,7 @@ export default class SketchViewModel extends EventedAccessor {
|
|
|
1120
1125
|
* // get the graphic as it is being updated
|
|
1121
1126
|
* const graphic = event.graphics[0];
|
|
1122
1127
|
* // check if the graphic is intersecting school buffers
|
|
1123
|
-
* intersects =
|
|
1128
|
+
* intersects = intersectsExecute(buffers, graphic.geometry);
|
|
1124
1129
|
*
|
|
1125
1130
|
* // change the graphic symbol to valid or invalid symbol
|
|
1126
1131
|
* // depending the graphic location
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{isSome as t}from"../../../../core/arrayUtils.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import a from"../../../Widget.js";import o from"./MeasuredContentGroup.js";import s from"./OverflowGroup.js";import c from"./ResponsiveToolbarManager.js";import{SplitButton as l}from"./SplitButton.js";import{loadCalciteComponents as u}from"../../../support/componentsUtils.js";import{tsx as d}from"../../../support/widget.js";const f=`esri-responsive-toolbar`,p={rulerBase:`${f}__ruler`,rulerBarHorizontal:`${f}__ruler--bar`,rulerBarVertical:`${f}__ruler--bar--vertical`,rulerPadVertical:`${f}__ruler--pad--vertical`,rulerPadHorizontal:`${f}__ruler--pad--horizontal`,bar:`${f}__bar`,barHorizontal:`${f}__bar--horizontal`,barVertical:`${f}__bar--vertical`,pad:`${f}__pad`,padVertical:`${f}__pad--vertical`,padHorizontal:`${f}__pad--horizontal`};let m=class extends a{constructor(e){super(e),this.scale=`m`,this.barStyle=`floating`,this._measurementManager=new c,this._managedWidgets=new Map}loadDependencies(){return u({"action-bar":()=>import(`@esri/calcite-components/dist/components/calcite-action-bar`)})}destroy(){this._measurementManager=n(this._measurementManager),this._managedWidgets.forEach(e=>e.destroy()),this._managedWidgets.clear()}set layout(e){let t=this._get(`layout`);this._set(`layout`,e),this._measurementManager&&(this._measurementManager.layout=e),t!==e&&this.scheduleRender()}get _barClasses(){let e=this.barStyle===`docked`,t=this.layout===`vertical`;return{[p.barHorizontal]:e&&!t,[p.barVertical]:e&&t,[p.bar]:e,[p.padHorizontal]:!e&&!t,[p.padVertical]:!e&&t,[p.pad]:!e}}render(){let{layout:e,scale:t,barStyle:n}=this,r={layout:e,scale:t,expandDisabled:!0,key:`measured-toolbar`},i=n===`docked`?e===`vertical`?p.rulerBarVertical:p.rulerBarHorizontal:e===`horizontal`?p.rulerPadHorizontal:p.rulerPadVertical,a=this._renderChildren();return a.length?d(`div`,{key:`toolbar-wrapper`},d(`div`,{afterCreate:e=>{this._measurementManager?.connect(e)},class:this.classes(p.rulerBase,i),key:`ruler-element`}),d(`calcite-action-bar`,{...r,classes:this._barClasses,floating:n!==`docked`,
|
|
2
|
+
import{__decorate as e}from"tslib";import{isSome as t}from"../../../../core/arrayUtils.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import a from"../../../Widget.js";import o from"./MeasuredContentGroup.js";import s from"./OverflowGroup.js";import c from"./ResponsiveToolbarManager.js";import{SplitButton as l}from"./SplitButton.js";import{loadCalciteComponents as u}from"../../../support/componentsUtils.js";import{tsx as d}from"../../../support/widget.js";const f=`esri-responsive-toolbar`,p={rulerBase:`${f}__ruler`,rulerBarHorizontal:`${f}__ruler--bar`,rulerBarVertical:`${f}__ruler--bar--vertical`,rulerPadVertical:`${f}__ruler--pad--vertical`,rulerPadHorizontal:`${f}__ruler--pad--horizontal`,bar:`${f}__bar`,barHorizontal:`${f}__bar--horizontal`,barVertical:`${f}__bar--vertical`,pad:`${f}__pad`,padVertical:`${f}__pad--vertical`,padHorizontal:`${f}__pad--horizontal`};let m=class extends a{constructor(e){super(e),this.scale=`m`,this.barStyle=`floating`,this._measurementManager=new c,this._managedWidgets=new Map}loadDependencies(){return u({"action-bar":()=>import(`@esri/calcite-components/dist/components/calcite-action-bar`)})}destroy(){this._measurementManager=n(this._measurementManager),this._managedWidgets.forEach(e=>e.destroy()),this._managedWidgets.clear()}set layout(e){let t=this._get(`layout`);this._set(`layout`,e),this._measurementManager&&(this._measurementManager.layout=e),t!==e&&this.scheduleRender()}get _barClasses(){let e=this.barStyle===`docked`,t=this.layout===`vertical`;return{[p.barHorizontal]:e&&!t,[p.barVertical]:e&&t,[p.bar]:e,[p.padHorizontal]:!e&&!t,[p.padVertical]:!e&&t,[p.pad]:!e}}render(){let{layout:e,scale:t,barStyle:n}=this,r={layout:e,scale:t,expandDisabled:!0,key:`measured-toolbar`},i=n===`docked`?e===`vertical`?p.rulerBarVertical:p.rulerBarHorizontal:e===`horizontal`?p.rulerPadHorizontal:p.rulerPadVertical,a=this._renderChildren();return a.length?d(`div`,{key:`toolbar-wrapper`},d(`div`,{afterCreate:e=>{this._measurementManager?.connect(e)},class:this.classes(p.rulerBase,i),key:`ruler-element`}),d(`calcite-action-bar`,{...r,classes:this._barClasses,floating:n!==`docked`,overflowMode:`none`},a)):null}_renderChildren(){if(!this.children)return[];let e=new Set,n=[];for(let t of this.children){if(!t.properties?.key||!(`group-kind`in t.properties)||!t.children?.length)continue;let r=t.properties,i=r.key;e.add(i);let a=this.barStyle===`docked`?r.slot??void 0:void 0,c=r.priority??0,u=r[`group-kind`]??`overflow-group`,d=r[`allow-collapse`]??!0,f=u===`measured-content-group`,p=this._managedWidgets.get(i);if(p)p.children=t.children,p.priority=c,`allowCollapse`in p&&(p.allowCollapse=d),p.slot=a,p.layout=this.layout,p.scale=this.scale,p.measurementManager=this._measurementManager,p instanceof o&&(p.useActionGroup=f),n.push(p);else{let e={scale:this.scale,priority:c,measurementManager:this._measurementManager,children:t.children,slot:a,layout:this.layout};switch(u){case`split-button`:{let t=new l({...e,allowCollapse:d});this._managedWidgets.set(i,t),n.push(t);break}case`overflow-group`:{let t=new s({...e,allowCollapse:d});this._managedWidgets.set(i,t),n.push(t);break}case`measured-content`:{let t=new o({...e});this._managedWidgets.set(i,t),n.push(t);break}case`measured-content-group`:{let t=new o({...e,useActionGroup:!0});this._managedWidgets.set(i,t),n.push(t);break}}}}for(let[t]of this._managedWidgets.entries())e.has(t)||(this._managedWidgets.get(t)?.destroy(),this._managedWidgets.delete(t));return this._measurementManager?.allocate(),n.map(e=>e.render()).filter(t)}};e([r()],m.prototype,`scale`,void 0),e([r({value:`horizontal`})],m.prototype,`layout`,null),e([r()],m.prototype,`barStyle`,void 0),e([r()],m.prototype,`_measurementManager`,void 0),e([r()],m.prototype,`_managedWidgets`,void 0),e([r()],m.prototype,`_barClasses`,null),m=e([i(`esri.widgets.Sketch.support.ResponsiveToolbar.ResponsiveToolbar`)],m);export{m as default};
|
package/widgets/Sketch.d.ts
CHANGED
|
@@ -669,19 +669,19 @@ export default class Sketch extends Widget<SketchProperties> {
|
|
|
669
669
|
*/
|
|
670
670
|
accessor useLegacyCreateTools: boolean;
|
|
671
671
|
/**
|
|
672
|
-
* Indicates whether to use
|
|
672
|
+
* Indicates whether to use snapping, tooltips, display units, and input units from
|
|
673
673
|
* [ViewOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ViewOptions/).
|
|
674
674
|
*
|
|
675
|
-
* When
|
|
676
|
-
* [snappingOptions](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/#snappingOptions) and [tooltipOptions](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/#tooltipOptions) are preserved but ignored.
|
|
677
|
-
* When `false`, those options are used instead.
|
|
675
|
+
* When this property is `true`:
|
|
678
676
|
*
|
|
679
|
-
*
|
|
680
|
-
*
|
|
677
|
+
* - Snapping and tooltip options are inherited from the view. The widget's
|
|
678
|
+
* [snappingOptions](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/#snappingOptions) and [tooltipOptions](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/#tooltipOptions) are preserved but ignored.
|
|
679
|
+
* - Snapping controls and the tooltip toggle are hidden from the widget's Settings menu.
|
|
680
|
+
* - Units set through [valueOptions](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/#valueOptions) override the corresponding units on the view,
|
|
681
|
+
* such as length or area, without changing the view's options. Setting a unit to `null` or `undefined` restores
|
|
682
|
+
* inheritance for that measurement type.
|
|
681
683
|
*
|
|
682
|
-
*
|
|
683
|
-
* view for the corresponding measurement type, such as length or area, without changing the units configured
|
|
684
|
-
* in the view. Setting an explicit unit to `null` or `undefined` restores inheritance for that measurement type.
|
|
684
|
+
* When `false`, the widget uses its own snapping, tooltip, and unit options instead.
|
|
685
685
|
*
|
|
686
686
|
* Label [options](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/#labelOptions) and
|
|
687
687
|
* [direction mode](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ValueOptions/#directionMode) are not inherited from the view.
|
|
@@ -836,7 +836,7 @@ export default class Sketch extends Widget<SketchProperties> {
|
|
|
836
836
|
* // get the graphic as it is being updated
|
|
837
837
|
* const graphic = event.graphics[0];
|
|
838
838
|
* // check if the graphic is intersecting school buffers
|
|
839
|
-
* intersects =
|
|
839
|
+
* intersects = intersectsExecute(buffers, graphic.geometry);
|
|
840
840
|
*
|
|
841
841
|
* // change the graphic symbol to valid or invalid symbol
|
|
842
842
|
* // depending the graphic location
|
|
@@ -91,7 +91,7 @@ export default class TrackViewModel extends GeolocationPositioning {
|
|
|
91
91
|
* const geofenceExtent = new Extent({
|
|
92
92
|
* // whatever
|
|
93
93
|
* });
|
|
94
|
-
* return
|
|
94
|
+
* return withinExecute(myLocation, geofenceExtent);
|
|
95
95
|
* };
|
|
96
96
|
*/
|
|
97
97
|
accessor positionFilterFunction: PositionFilterFunction | null | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{deprecateWidget as t}from"../core/deprecate.js";import n from"../core/Logger.js";import{watch as r,initial as i,on as a}from"../core/reactiveUtils.js";import{property as o,subclass as s}from"../core/accessorSupport/decorators.js";import c from"../symbols/SimpleLineSymbol.js";import l from"./Widget.js";import{loadCalciteComponents as u}from"./support/componentsUtils.js";import{messageBundle as d,tsx as f}from"./support/widget.js";import p from"./UtilityNetworkAssociations/UtilityNetworkAssociationsLineSymbolPicker.js";import m from"./UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js";import h from"./UtilityNetworkAssociations/VisibleElements.js";const g=`esri-un-associations`,_={action:`${g}__action`,blockContent:`${g}__block-content`,blockSectionSettings:`${g}__block-section-settings`,combobox:`${g}__combobox`,comboboxItem:`${g}__combobox-item`,divControlsMain:`${g}__div-controls-main`,label:`${g}__label`,labelAndCombobox:`${g}__label-and-combobox`,labelAndSlider:`${g}__label-and-slider`,labelAndToggle:`${g}__label-and-toggle`,panel:`${g}__panel`,slider:`${g}__slider`,statusIconWarning:`${g}__status-icon-warning`,switch:`${g}__switch`,widgetContainer:`${g}__widget-container`};let v=class extends l{constructor(e,r){super(e,r),this._autoRefreshAssociations=!0,this._associationsOptionsEnabled=!1,this._maxAllowableAssociationsSliderMax=1e3,this._maxAllowableAssociationsSliderMin=250,this._maxAllowableAssociationsSliderStep=250,this.messages=null,this.messagesCommon=null,this.viewModel=new m,this.visibleElements=new h,this.announceDeprecation=()=>{t(n.getLogger(this),`Utility Network Associations`,`arcgis-utility-network-associations`,{version:`5.0`})}}initialize(){this.addHandles([r(()=>[this.view?.stationary,this.showAssociationsEnabled,this.includeConnectivityAssociations,this.includeStructuralAttachmentAssociations,this.maxAllowableAssociations],()=>{this.autoRefreshAssociations===!0&&(this.showAssociationsEnabled===!0?this.viewModel.showAssociations():this.viewModel.removeAssociations())}),r(()=>this.view?.map?.utilityNetworks,e=>{e?.items.forEach(async(e,t)=>{e.loaded||await e.load(),t===0&&(this.utilityNetwork=e)})},i),a(()=>this.view?.map?.utilityNetworks,`change`,e=>{let t=e.target;e.added.forEach(async e=>{e.loaded||await e.load()}),e.removed.some(e=>e.layerUrl===this.utilityNetwork?.layerUrl)&&(this.utilityNetwork=null),this.utilityNetwork=t.length?t.getItemAt(0):null})])}get autoRefreshAssociations(){return this._autoRefreshAssociations}set autoRefreshAssociations(e){this._autoRefreshAssociations=e}get connectivityAssociationsLineSymbol(){return this.viewModel.connectivityAssociationsLineSymbol}set connectivityAssociationsLineSymbol(e){this.viewModel.connectivityAssociationsLineSymbol=e}get icon(){return`view-associations`}set icon(e){this._overrideIfSome(`icon`,e)}get includeConnectivityAssociations(){return this.viewModel.includeConnectivityAssociations}set includeConnectivityAssociations(e){this.viewModel.includeConnectivityAssociations=e}get includeStructuralAttachmentAssociations(){return this.viewModel.includeStructuralAttachmentAssociations}set includeStructuralAttachmentAssociations(e){this.viewModel.includeStructuralAttachmentAssociations=e}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get maxAllowableAssociations(){return this.viewModel.maxAllowableAssociations}set maxAllowableAssociations(e){this.viewModel.maxAllowableAssociations=e}get maxAllowableAssociationsSliderMax(){return this._maxAllowableAssociationsSliderMax}set maxAllowableAssociationsSliderMax(e){e<=this.maxAllowableAssociationsSliderMin||(this._maxAllowableAssociationsSliderMax=e)}get maxAllowableAssociationsSliderMin(){return this._maxAllowableAssociationsSliderMin}set maxAllowableAssociationsSliderMin(e){e<0||e>=this.maxAllowableAssociationsSliderMax||(this._maxAllowableAssociationsSliderMin=e)}get maxAllowableAssociationsSliderStep(){return this._maxAllowableAssociationsSliderStep}set maxAllowableAssociationsSliderStep(e){this._maxAllowableAssociationsSliderStep=e}get showArrowsConnectivity(){return this.viewModel.showArrowsConnectivity}set showArrowsConnectivity(e){this.viewModel.showArrowsConnectivity=e}get showArrowsStructuralAttachment(){return this.viewModel.showArrowsStructuralAttachment}set showArrowsStructuralAttachment(e){this.viewModel.showArrowsStructuralAttachment=e}get showAssociationsEnabled(){return this.viewModel.showAssociationsEnabled}set showAssociationsEnabled(e){this.viewModel.showAssociationsEnabled=e}get structuralAttachmentAssociationsLineSymbol(){return this.viewModel.structuralAttachmentAssociationsLineSymbol}set structuralAttachmentAssociationsLineSymbol(e){this.viewModel.structuralAttachmentAssociationsLineSymbol=e}get utilityNetwork(){return this.viewModel.utilityNetwork}set utilityNetwork(e){this.viewModel.utilityNetwork=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){let{label:e}=this;return f(`div`,{class:_.widgetContainer},f(`calcite-block`,{class:_.blockContent,collapsible:!0,heading:e},this._renderStatusIcon(),this.autoRefreshAssociations?this._renderShowAssociationsSwitch():this._renderRefreshAssociationsAction(),this._renderContent()),this._renderWarningIconTooltip(),this._renderStatusIconTooltip(),this._renderShowAssociationsTooltip(),this._renderRefreshAssociationsActionTooltip())}loadDependencies(){return u({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),block:()=>import(`@esri/calcite-components/dist/components/calcite-block`),"block-section":()=>import(`@esri/calcite-components/dist/components/calcite-block-section`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),combobox:()=>import(`@esri/calcite-components/dist/components/calcite-combobox`),"combobox-item":()=>import(`@esri/calcite-components/dist/components/calcite-combobox-item`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),notice:()=>import(`@esri/calcite-components/dist/components/calcite-notice`),panel:()=>import(`@esri/calcite-components/dist/components/calcite-panel`),slider:()=>import(`@esri/calcite-components/dist/components/calcite-slider`),switch:()=>import(`@esri/calcite-components/dist/components/calcite-switch`),tooltip:()=>import(`@esri/calcite-components/dist/components/calcite-tooltip`)})}_connectivityAssociationsSwitchChange(e){this.includeConnectivityAssociations=e.currentTarget.checked}_getLoadErrorMessagesAsNotices(e,t){return f(`calcite-notice`,{closable:!1,key:`error-notice-${t}`,kind:`warning`,open:!0,scale:`s`},f(`div`,{slot:`message`},e))}_maxAllowableAssociationsSliderChange(e){this.maxAllowableAssociations=Number(e.currentTarget.value)}_refreshAssociations(){let{viewModel:e,viewModel:{state:t}}=this;(t===`ready`||t===`warning`)&&e.showAssociations()}_renderConnectivityAssociationsSettings(){let{messages:{input:{enableConnectivity:e}},visibleElements:{connectivityAssociationsSettings:t}}=this;if(t)return f(`calcite-block-section`,{class:_.blockSectionSettings,text:e},f(p,{id:`${this.id}-symbol-picker-connectivity`,lineSymbol:this.connectivityAssociationsLineSymbol,showArrows:this.showArrowsConnectivity,visibleElements:t}))}_renderConnectivityAssociationsToggle(){let{messages:{input:{enableConnectivity:e}}}=this;return f(`div`,{class:_.labelAndToggle,key:`connectivityAssociationsToggleDiv`},f(`calcite-label`,{class:_.label},e),f(`calcite-switch`,{bind:this,checked:this.includeConnectivityAssociations,disabled:!this._associationsOptionsEnabled&&this.autoRefreshAssociations,onCalciteSwitchChange:this._connectivityAssociationsSwitchChange}))}_renderComboboxItem({heading:e,value:t,selected:n}){return f(`calcite-combobox-item`,{class:_.comboboxItem,heading:e,selected:n,value:t})}_renderContent(){let{viewModel:{loadErrors:e,state:t}}=this;return t===`disabled`?f(`div`,{class:_.divControlsMain,key:`loadErrorsDiv`},e.items.map(this._getLoadErrorMessagesAsNotices)):f(`calcite-panel`,{class:_.panel,disabled:t===`loading`},f(`div`,{class:_.divControlsMain},this._renderConnectivityAssociationsToggle(),this._renderStructuralAttachmentAssociationsToggle(),this._renderSettingsPane()))}_renderLoadingIcon(){let{messagesCommon:{executing:e,loading:t},viewModel:{state:n}}=this,r=`${this.id}-status-action`;return f(`calcite-action`,{class:_.statusIconWarning,icon:`spinner`,id:r,loading:!0,scale:`s`,slot:`actions-end`,text:n===`executing`?e:t})}_renderMaxAllowableAssociationsSlider(){let{messages:{input:{maxAllowableAssociations:e}},visibleElements:{maxAllowableAssociationsSlider:t}}=this;if(t)return f(`div`,{class:_.labelAndSlider,key:`maxAllowableAssociationsSliderDiv`},f(`calcite-label`,{class:_.label},e),f(`calcite-slider`,{bind:this,class:_.slider,labelTicks:!0,max:this.maxAllowableAssociationsSliderMax,min:this.maxAllowableAssociationsSliderMin,scale:`s`,snap:!0,step:this.maxAllowableAssociationsSliderStep,ticks:this.maxAllowableAssociationsSliderStep,value:this.maxAllowableAssociations,onCalciteSliderChange:this._maxAllowableAssociationsSliderChange}))}_renderRefreshAssociationsAction(){let{messages:{input:{refreshAssociations:e}},viewModel:{state:t}}=this,n=`${this.id}-refresh-action`;return f(`calcite-action`,{bind:this,class:_.action,disabled:t===`disabled`,icon:`refresh-f`,id:n,loading:t===`loading`,slot:`actions-end`,text:e,onclick:this._refreshAssociations})}_renderRefreshAssociationsActionTooltip(){let{messages:{input:{refreshAssociations:e}}}=this,t=`${this.id}-refresh-action`;return f(`calcite-tooltip`,{overlayPositioning:`fixed`,referenceElement:t,topLayerDisabled:this.topLayerDisabled},e)}_renderSettingsPane(){let{messagesCommon:{settings:e},visibleElements:{maxAllowableAssociationsSlider:t,connectivityAssociationsSettings:n,structuralAttachmentAssociationsSettings:r}}=this;if((this.view?.map).utilityNetworks?.items?.length!==1||t||n||r)return f(`calcite-block`,{class:_.blockContent,collapsible:!0,heading:e},f(`div`,{class:_.divControlsMain},this._renderUtilityNetworkSettings(),this._renderMaxAllowableAssociationsSlider()),this._renderConnectivityAssociationsSettings(),this._renderStructuralAttachmentAssociationsSettings())}_renderShowAssociationsSwitch(){let{viewModel:{state:e}}=this,t=`${this.id}-show-associations-switch`;return f(`calcite-switch`,{bind:this,checked:this.showAssociationsEnabled,class:_.switch,disabled:e===`disabled`,id:t,slot:`actions-end`,onCalciteSwitchChange:this._showAssociationsSwitchChange})}_renderShowAssociationsTooltip(){let{messages:{input:{enableAssociations:e}}}=this,t=`${this.id}-show-associations-switch`;return f(`calcite-tooltip`,{referenceElement:t,topLayerDisabled:this.topLayerDisabled},e)}_renderStatusIcon(){let{viewModel:{state:e}}=this;switch(e){case`disabled`:case`warning`:return this._renderWarningIcon();case`loading`:case`executing`:return this._renderLoadingIcon();default:return}}_renderStatusIconTooltip(){let{messagesCommon:{executing:e,loading:t},viewModel:{state:n}}=this,r=`${this.id}-status-action`;return f(`calcite-tooltip`,{overlayPositioning:`fixed`,referenceElement:r,topLayerDisabled:this.topLayerDisabled},n===`executing`?e:t)}_renderStructuralAttachmentAssociationsSettings(){let{messages:{input:{enableStructuralAttachment:e}},visibleElements:{structuralAttachmentAssociationsSettings:t}}=this;if(t)return f(`calcite-block-section`,{class:_.blockSectionSettings,text:e},f(p,{id:`${this.id}-symbol-picker-structural-attachment`,lineSymbol:this.structuralAttachmentAssociationsLineSymbol,showArrows:this.showArrowsStructuralAttachment,visibleElements:t}))}_renderStructuralAttachmentAssociationsToggle(){let{messages:{input:{enableStructuralAttachment:e}}}=this;return f(`div`,{class:_.labelAndToggle,key:`structuralAttachmentAssociationsToggleDiv`},f(`calcite-label`,{class:_.label},e),f(`calcite-switch`,{bind:this,checked:this.includeStructuralAttachmentAssociations,disabled:!this._associationsOptionsEnabled&&this.autoRefreshAssociations,onCalciteSwitchChange:this._structuralAttAssociationsSwitchChange}))}_renderUtilityNetworkSettings(){let{messages:{input:{utilityNetwork:e}}}=this,t=(this.view?.map).utilityNetworks?.items;if(t?.length===1)return null;let n=t?.map(e=>{let t=e.title,n=e.layerUrl,r=e.layerUrl===this.utilityNetwork?.layerUrl;return this._renderComboboxItem({heading:t,value:n,selected:r})});return f(`div`,{class:_.labelAndCombobox,key:`utilityNetworkComboboxDiv`},f(`calcite-label`,{class:_.label},e),f(`calcite-combobox`,{class:_.combobox,clearDisabled:!0,label:``,maxItems:3,overlayPositioning:`fixed`,selectionMode:`single-persist`,topLayerDisabled:this.topLayerDisabled,onCalciteComboboxChange:e=>{let n=t?.find(t=>t.layerUrl===e.currentTarget.value);this.utilityNetwork=n}},n))}_showAssociationsSwitchChange({currentTarget:e}){let{viewModel:t}=this;this.showAssociationsEnabled=e.checked,this._associationsOptionsEnabled=e.checked,this.showAssociationsEnabled||t.removeAssociations()}_structuralAttAssociationsSwitchChange(e){this.includeStructuralAttachmentAssociations=e.currentTarget.checked}_renderWarningIcon(){let e=`${this.id}-warning-action`;return f(`calcite-icon`,{class:_.statusIconWarning,icon:`exclamation-mark-triangle`,id:e,scale:`s`,slot:`actions-end`})}_renderWarningIconTooltip(){let{viewModel:{executionError:e,state:t}}=this,n=`${this.id}-warning-action`;switch(t){case`warning`:return f(`calcite-tooltip`,{referenceElement:n,topLayerDisabled:this.topLayerDisabled},e);default:return}}};e([o()],v.prototype,`autoRefreshAssociations`,null),e([o({type:c})],v.prototype,`connectivityAssociationsLineSymbol`,null),e([o()],v.prototype,`icon`,null),e([o()],v.prototype,`includeConnectivityAssociations`,null),e([o()],v.prototype,`includeStructuralAttachmentAssociations`,null),e([o()],v.prototype,`label`,null),e([o()],v.prototype,`maxAllowableAssociations`,null),e([o()],v.prototype,`maxAllowableAssociationsSliderMax`,null),e([o()],v.prototype,`maxAllowableAssociationsSliderMin`,null),e([o()],v.prototype,`maxAllowableAssociationsSliderStep`,null),e([o(),d(`esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations`)],v.prototype,`messages`,void 0),e([o(),d(`esri/t9n/common`)],v.prototype,`messagesCommon`,void 0),e([o()],v.prototype,`showArrowsConnectivity`,null),e([o()],v.prototype,`showArrowsStructuralAttachment`,null),e([o()],v.prototype,`showAssociationsEnabled`,null),e([o({type:c})],v.prototype,`structuralAttachmentAssociationsLineSymbol`,null),e([o()],v.prototype,`utilityNetwork`,null),e([o()],v.prototype,`view`,null),e([o({type:m})],v.prototype,`viewModel`,void 0),e([o({type:h,nonNullable:!0})],v.prototype,`visibleElements`,void 0),v=e([s(`esri.widgets.UtilityNetworkAssociations`)],v);const y=v;export{y as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{deprecateWidget as t}from"../core/deprecate.js";import n from"../core/Logger.js";import{watch as r,initial as i,on as a}from"../core/reactiveUtils.js";import{property as o,subclass as s}from"../core/accessorSupport/decorators.js";import c from"../symbols/SimpleLineSymbol.js";import l from"./Widget.js";import{loadCalciteComponents as u}from"./support/componentsUtils.js";import{messageBundle as d,tsx as f}from"./support/widget.js";import p from"./UtilityNetworkAssociations/UtilityNetworkAssociationsLineSymbolPicker.js";import m from"./UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js";import h from"./UtilityNetworkAssociations/VisibleElements.js";const g=`esri-un-associations`,_={action:`${g}__action`,blockContent:`${g}__block-content`,blockSectionSettings:`${g}__block-section-settings`,combobox:`${g}__combobox`,comboboxItem:`${g}__combobox-item`,divControlsMain:`${g}__div-controls-main`,label:`${g}__label`,labelAndCombobox:`${g}__label-and-combobox`,labelAndSlider:`${g}__label-and-slider`,labelAndToggle:`${g}__label-and-toggle`,panel:`${g}__panel`,slider:`${g}__slider`,statusIconWarning:`${g}__status-icon-warning`,switch:`${g}__switch`,widgetContainer:`${g}__widget-container`};let v=class extends l{constructor(e,r){super(e,r),this._autoRefreshAssociations=!0,this._associationsOptionsEnabled=!1,this._maxAllowableAssociationsSliderMax=1e3,this._maxAllowableAssociationsSliderMin=250,this._maxAllowableAssociationsSliderStep=250,this.messages=null,this.messagesCommon=null,this.viewModel=new m,this.visibleElements=new h,this.announceDeprecation=()=>{t(n.getLogger(this),`Utility Network Associations`,`arcgis-utility-network-associations`,{version:`5.0`})}}initialize(){this.addHandles([r(()=>[this.view?.stationary,this.showAssociationsEnabled,this.includeConnectivityAssociations,this.includeStructuralAttachmentAssociations,this.maxAllowableAssociations],()=>{this.autoRefreshAssociations===!0&&(this.showAssociationsEnabled===!0?this.viewModel.showAssociations():this.viewModel.removeAssociations())}),r(()=>this.view?.map?.utilityNetworks,e=>{e?.items.forEach(async(e,t)=>{e.loaded||await e.load(),t===0&&(this.utilityNetwork=e)})},i),a(()=>this.view?.map?.utilityNetworks,`change`,e=>{let t=e.target;e.added.forEach(async e=>{e.loaded||await e.load()}),e.removed.some(e=>e.layerUrl===this.utilityNetwork?.layerUrl)&&(this.utilityNetwork=null),this.utilityNetwork=t.length?t.getItemAt(0):null})])}get autoRefreshAssociations(){return this._autoRefreshAssociations}set autoRefreshAssociations(e){this._autoRefreshAssociations=e}get connectivityAssociationsLineSymbol(){return this.viewModel.connectivityAssociationsLineSymbol}set connectivityAssociationsLineSymbol(e){this.viewModel.connectivityAssociationsLineSymbol=e}get icon(){return`view-associations`}set icon(e){this._overrideIfSome(`icon`,e)}get includeConnectivityAssociations(){return this.viewModel.includeConnectivityAssociations}set includeConnectivityAssociations(e){this.viewModel.includeConnectivityAssociations=e}get includeStructuralAttachmentAssociations(){return this.viewModel.includeStructuralAttachmentAssociations}set includeStructuralAttachmentAssociations(e){this.viewModel.includeStructuralAttachmentAssociations=e}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get maxAllowableAssociations(){return this.viewModel.maxAllowableAssociations}set maxAllowableAssociations(e){this.viewModel.maxAllowableAssociations=e}get maxAllowableAssociationsSliderMax(){return this._maxAllowableAssociationsSliderMax}set maxAllowableAssociationsSliderMax(e){e<=this.maxAllowableAssociationsSliderMin||(this._maxAllowableAssociationsSliderMax=e)}get maxAllowableAssociationsSliderMin(){return this._maxAllowableAssociationsSliderMin}set maxAllowableAssociationsSliderMin(e){e<0||e>=this.maxAllowableAssociationsSliderMax||(this._maxAllowableAssociationsSliderMin=e)}get maxAllowableAssociationsSliderStep(){return this._maxAllowableAssociationsSliderStep}set maxAllowableAssociationsSliderStep(e){this._maxAllowableAssociationsSliderStep=e}get showArrowsConnectivity(){return this.viewModel.showArrowsConnectivity}set showArrowsConnectivity(e){this.viewModel.showArrowsConnectivity=e}get showArrowsStructuralAttachment(){return this.viewModel.showArrowsStructuralAttachment}set showArrowsStructuralAttachment(e){this.viewModel.showArrowsStructuralAttachment=e}get showAssociationsEnabled(){return this.viewModel.showAssociationsEnabled}set showAssociationsEnabled(e){this.viewModel.showAssociationsEnabled=e}get structuralAttachmentAssociationsLineSymbol(){return this.viewModel.structuralAttachmentAssociationsLineSymbol}set structuralAttachmentAssociationsLineSymbol(e){this.viewModel.structuralAttachmentAssociationsLineSymbol=e}get utilityNetwork(){return this.viewModel.utilityNetwork}set utilityNetwork(e){this.viewModel.utilityNetwork=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){let{label:e}=this;return f(`div`,{class:_.widgetContainer},f(`calcite-block`,{class:_.blockContent,expandable:!0,heading:e},this._renderStatusIcon(),this.autoRefreshAssociations?this._renderShowAssociationsSwitch():this._renderRefreshAssociationsAction(),this._renderContent()),this._renderWarningIconTooltip(),this._renderStatusIconTooltip(),this._renderShowAssociationsTooltip(),this._renderRefreshAssociationsActionTooltip())}loadDependencies(){return u({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),block:()=>import(`@esri/calcite-components/dist/components/calcite-block`),"block-section":()=>import(`@esri/calcite-components/dist/components/calcite-block-section`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),combobox:()=>import(`@esri/calcite-components/dist/components/calcite-combobox`),"combobox-item":()=>import(`@esri/calcite-components/dist/components/calcite-combobox-item`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),notice:()=>import(`@esri/calcite-components/dist/components/calcite-notice`),panel:()=>import(`@esri/calcite-components/dist/components/calcite-panel`),slider:()=>import(`@esri/calcite-components/dist/components/calcite-slider`),switch:()=>import(`@esri/calcite-components/dist/components/calcite-switch`),tooltip:()=>import(`@esri/calcite-components/dist/components/calcite-tooltip`)})}_connectivityAssociationsSwitchChange(e){this.includeConnectivityAssociations=e.currentTarget.checked}_getLoadErrorMessagesAsNotices(e,t){return f(`calcite-notice`,{closable:!1,key:`error-notice-${t}`,kind:`warning`,open:!0,scale:`s`},f(`div`,{slot:`message`},e))}_maxAllowableAssociationsSliderChange(e){this.maxAllowableAssociations=Number(e.currentTarget.value)}_refreshAssociations(){let{viewModel:e,viewModel:{state:t}}=this;(t===`ready`||t===`warning`)&&e.showAssociations()}_renderConnectivityAssociationsSettings(){let{messages:{input:{enableConnectivity:e}},visibleElements:{connectivityAssociationsSettings:t}}=this;if(t)return f(`calcite-block-section`,{class:_.blockSectionSettings,text:e},f(p,{id:`${this.id}-symbol-picker-connectivity`,lineSymbol:this.connectivityAssociationsLineSymbol,showArrows:this.showArrowsConnectivity,visibleElements:t}))}_renderConnectivityAssociationsToggle(){let{messages:{input:{enableConnectivity:e}}}=this;return f(`div`,{class:_.labelAndToggle,key:`connectivityAssociationsToggleDiv`},f(`calcite-label`,{class:_.label},e),f(`calcite-switch`,{bind:this,checked:this.includeConnectivityAssociations,disabled:!this._associationsOptionsEnabled&&this.autoRefreshAssociations,onCalciteSwitchChange:this._connectivityAssociationsSwitchChange}))}_renderComboboxItem({heading:e,value:t,selected:n}){return f(`calcite-combobox-item`,{class:_.comboboxItem,heading:e,selected:n,value:t})}_renderContent(){let{viewModel:{loadErrors:e,state:t}}=this;return t===`disabled`?f(`div`,{class:_.divControlsMain,key:`loadErrorsDiv`},e.items.map(this._getLoadErrorMessagesAsNotices)):f(`calcite-panel`,{class:_.panel,disabled:t===`loading`},f(`div`,{class:_.divControlsMain},this._renderConnectivityAssociationsToggle(),this._renderStructuralAttachmentAssociationsToggle(),this._renderSettingsPane()))}_renderLoadingIcon(){let{messagesCommon:{executing:e,loading:t},viewModel:{state:n}}=this,r=`${this.id}-status-action`;return f(`calcite-action`,{class:_.statusIconWarning,icon:`spinner`,id:r,loading:!0,scale:`s`,slot:`actions-end`,text:n===`executing`?e:t})}_renderMaxAllowableAssociationsSlider(){let{messages:{input:{maxAllowableAssociations:e}},visibleElements:{maxAllowableAssociationsSlider:t}}=this;if(t)return f(`div`,{class:_.labelAndSlider,key:`maxAllowableAssociationsSliderDiv`},f(`calcite-label`,{class:_.label},e),f(`calcite-slider`,{bind:this,class:_.slider,labelTicks:!0,max:this.maxAllowableAssociationsSliderMax,min:this.maxAllowableAssociationsSliderMin,scale:`s`,snap:!0,step:this.maxAllowableAssociationsSliderStep,ticks:this.maxAllowableAssociationsSliderStep,value:this.maxAllowableAssociations,onCalciteSliderChange:this._maxAllowableAssociationsSliderChange}))}_renderRefreshAssociationsAction(){let{messages:{input:{refreshAssociations:e}},viewModel:{state:t}}=this,n=`${this.id}-refresh-action`;return f(`calcite-action`,{bind:this,class:_.action,disabled:t===`disabled`,icon:`refresh-f`,id:n,loading:t===`loading`,slot:`actions-end`,text:e,onclick:this._refreshAssociations})}_renderRefreshAssociationsActionTooltip(){let{messages:{input:{refreshAssociations:e}}}=this,t=`${this.id}-refresh-action`;return f(`calcite-tooltip`,{overlayPositioning:`fixed`,referenceElement:t,topLayerDisabled:this.topLayerDisabled},e)}_renderSettingsPane(){let{messagesCommon:{settings:e},visibleElements:{maxAllowableAssociationsSlider:t,connectivityAssociationsSettings:n,structuralAttachmentAssociationsSettings:r}}=this;if((this.view?.map).utilityNetworks?.items?.length!==1||t||n||r)return f(`calcite-block`,{class:_.blockContent,expandable:!0,heading:e},f(`div`,{class:_.divControlsMain},this._renderUtilityNetworkSettings(),this._renderMaxAllowableAssociationsSlider()),this._renderConnectivityAssociationsSettings(),this._renderStructuralAttachmentAssociationsSettings())}_renderShowAssociationsSwitch(){let{viewModel:{state:e}}=this,t=`${this.id}-show-associations-switch`;return f(`calcite-switch`,{bind:this,checked:this.showAssociationsEnabled,class:_.switch,disabled:e===`disabled`,id:t,slot:`actions-end`,onCalciteSwitchChange:this._showAssociationsSwitchChange})}_renderShowAssociationsTooltip(){let{messages:{input:{enableAssociations:e}}}=this,t=`${this.id}-show-associations-switch`;return f(`calcite-tooltip`,{referenceElement:t,topLayerDisabled:this.topLayerDisabled},e)}_renderStatusIcon(){let{viewModel:{state:e}}=this;switch(e){case`disabled`:case`warning`:return this._renderWarningIcon();case`loading`:case`executing`:return this._renderLoadingIcon();default:return}}_renderStatusIconTooltip(){let{messagesCommon:{executing:e,loading:t},viewModel:{state:n}}=this,r=`${this.id}-status-action`;return f(`calcite-tooltip`,{overlayPositioning:`fixed`,referenceElement:r,topLayerDisabled:this.topLayerDisabled},n===`executing`?e:t)}_renderStructuralAttachmentAssociationsSettings(){let{messages:{input:{enableStructuralAttachment:e}},visibleElements:{structuralAttachmentAssociationsSettings:t}}=this;if(t)return f(`calcite-block-section`,{class:_.blockSectionSettings,text:e},f(p,{id:`${this.id}-symbol-picker-structural-attachment`,lineSymbol:this.structuralAttachmentAssociationsLineSymbol,showArrows:this.showArrowsStructuralAttachment,visibleElements:t}))}_renderStructuralAttachmentAssociationsToggle(){let{messages:{input:{enableStructuralAttachment:e}}}=this;return f(`div`,{class:_.labelAndToggle,key:`structuralAttachmentAssociationsToggleDiv`},f(`calcite-label`,{class:_.label},e),f(`calcite-switch`,{bind:this,checked:this.includeStructuralAttachmentAssociations,disabled:!this._associationsOptionsEnabled&&this.autoRefreshAssociations,onCalciteSwitchChange:this._structuralAttAssociationsSwitchChange}))}_renderUtilityNetworkSettings(){let{messages:{input:{utilityNetwork:e}}}=this,t=(this.view?.map).utilityNetworks?.items;if(t?.length===1)return null;let n=t?.map(e=>{let t=e.title,n=e.layerUrl,r=e.layerUrl===this.utilityNetwork?.layerUrl;return this._renderComboboxItem({heading:t,value:n,selected:r})});return f(`div`,{class:_.labelAndCombobox,key:`utilityNetworkComboboxDiv`},f(`calcite-label`,{class:_.label},e),f(`calcite-combobox`,{class:_.combobox,clearDisabled:!0,label:``,maxItems:3,overlayPositioning:`fixed`,selectionMode:`single-persist`,topLayerDisabled:this.topLayerDisabled,onCalciteComboboxChange:e=>{let n=t?.find(t=>t.layerUrl===e.currentTarget.value);this.utilityNetwork=n}},n))}_showAssociationsSwitchChange({currentTarget:e}){let{viewModel:t}=this;this.showAssociationsEnabled=e.checked,this._associationsOptionsEnabled=e.checked,this.showAssociationsEnabled||t.removeAssociations()}_structuralAttAssociationsSwitchChange(e){this.includeStructuralAttachmentAssociations=e.currentTarget.checked}_renderWarningIcon(){let e=`${this.id}-warning-action`;return f(`calcite-icon`,{class:_.statusIconWarning,icon:`exclamation-mark-triangle`,id:e,scale:`s`,slot:`actions-end`})}_renderWarningIconTooltip(){let{viewModel:{executionError:e,state:t}}=this,n=`${this.id}-warning-action`;switch(t){case`warning`:return f(`calcite-tooltip`,{referenceElement:n,topLayerDisabled:this.topLayerDisabled},e);default:return}}};e([o()],v.prototype,`autoRefreshAssociations`,null),e([o({type:c})],v.prototype,`connectivityAssociationsLineSymbol`,null),e([o()],v.prototype,`icon`,null),e([o()],v.prototype,`includeConnectivityAssociations`,null),e([o()],v.prototype,`includeStructuralAttachmentAssociations`,null),e([o()],v.prototype,`label`,null),e([o()],v.prototype,`maxAllowableAssociations`,null),e([o()],v.prototype,`maxAllowableAssociationsSliderMax`,null),e([o()],v.prototype,`maxAllowableAssociationsSliderMin`,null),e([o()],v.prototype,`maxAllowableAssociationsSliderStep`,null),e([o(),d(`esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations`)],v.prototype,`messages`,void 0),e([o(),d(`esri/t9n/common`)],v.prototype,`messagesCommon`,void 0),e([o()],v.prototype,`showArrowsConnectivity`,null),e([o()],v.prototype,`showArrowsStructuralAttachment`,null),e([o()],v.prototype,`showAssociationsEnabled`,null),e([o({type:c})],v.prototype,`structuralAttachmentAssociationsLineSymbol`,null),e([o()],v.prototype,`utilityNetwork`,null),e([o()],v.prototype,`view`,null),e([o({type:m})],v.prototype,`viewModel`,void 0),e([o({type:h,nonNullable:!0})],v.prototype,`visibleElements`,void 0),v=e([s(`esri.widgets.UtilityNetworkAssociations`)],v);const y=v;export{y as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{substitute as t}from"../../intl.js";import n from"../../core/Collection.js";import{watch as r}from"../../core/reactiveUtils.js";import{throttle as i}from"../../core/throttle.js";import{property as a,subclass as o}from"../../core/accessorSupport/decorators.js";import{getGraphicLayer as s}from"../../graphic/graphicOriginUtils.js";import{fetchMessageBundle as c}from"../../intl/messages.js";import{isFeatureLayer as l,isSubtypeSublayer as u}from"../../layers/support/layerUtils.js";import{UtilityNetworkAssociationsContent as d}from"../../popup/content.js";import{substituteActionImage as f,getActionStyles as p}from"../../support/actions/actionUtils.js";import m from"../Feature.js";import h from"../Spinner.js";import g from"../Widget.js";import{css as _}from"../Feature/resources.js";import{FeatureContentMixin as v}from"../Feature/support/FeatureContentMixin.js";import{css as y}from"../Features/css.js";import b from"../Features/FeaturesViewModel.js";import{ActionsCollection as x}from"../Popup/actions.js";import{zoomToLocation as S}from"../Popup/actionUtils.js";import{loadCalciteComponents as C}from"../support/componentsUtils.js";import{globalCss as w}from"../support/globalCss.js";import{Heading as T}from"../support/Heading.js";import{tsx as E,messageBundle as D,vmEvent as O}from"../support/widget.js";import k from"./UtilityNetworkTraceFeaturesDrillIn.js";const A=`features-spinner`,j=`esri-utility-network-trace`,M={blockContainer:`${j}__block-container`,blockContent:`${j}__block-content`,featureContent:`${j}__feature-content`,paddingBottom:`${j}__pad-bottom`,paddingTop:`${j}__pad-top`};let N=class extends v(g){constructor(e,t){super(e,t),this._actionBarMenuNode=null,this._drillInFlowItems=new n,this._drillInWidget=new k({flowItems:this._drillInFlowItems}),this._feature=null,this._featureMenuViewportNode=null,this._spinner=null,this._utilityNetworkTraceMessages=null,this.featureNavigationTop=!1,this.headerActions=new x,this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.responsiveActionsEnabled=!1,this.viewModel=new b({suppressDeprecationWarning:!0}),this._renderAction=(e,t)=>{let n=this._getActionTitle(e),{type:r,active:i,uid:a,disabled:o,indicator:s}=e;return e.visible?E(`calcite-action`,{active:r===`toggle`&&e.value,bind:this,"data-action-uid":a,disabled:e.id===`zoom-to-feature`?!this.feature.geometry:o,icon:this._getActionIcon(e),indicator:s,key:`action-${t}`,loading:i,scale:`s`,text:n,title:this._hideActionText?n:void 0,onclick:this._triggerAction},this._renderFallbackIcon(e)):null},this._renderAddNsoBlock=()=>{let{_utilityNetworkTraceMessages:e,messagesCommon:t}=this;return E(`calcite-block`,{class:M.blockContent,expanded:!this.feature,heading:e?.inputsStrings.addNonspatialOption},E(`calcite-action`,{icon:`x`,slot:`actions-end`,text:t.close,onclick:()=>this.emit(`close-un-trace-feature-block`)}),E(`calcite-notice`,{icon:`information`,kind:`info`,open:!this.feature},E(`div`,{slot:`message`},e?.inputsStrings.addNonspatialHint)))},this._renderNoPopupErrorBlock=()=>{let{_utilityNetworkTraceMessages:e,messagesCommon:t}=this;return E(`calcite-block`,{description:void 0,expanded:!0,heading:this.mode===`show-feature-info`?t.warning:void 0},E(`calcite-notice`,{class:this.classes(M.paddingBottom,M.paddingTop),icon:`exclamation-mark-triangle`,kind:`danger`,open:!0},E(`div`,{slot:`message`},e.alertsStrings.noPopupConfigured)),this.mode===`show-feature-info`?E(`calcite-action`,{icon:`x`,slot:`actions-end`,text:t.close,onclick:()=>this.emit(`close-un-trace-feature-block`)}):void 0)},this._displaySpinnerThrottled=i(()=>this._displaySpinner(),0),this.addHandles([this._displaySpinnerThrottled,r(()=>this.viewModel?.active,e=>this._drillInWidget.closed=!e),r(()=>this.viewModel?.view,(e,t)=>this._viewChange(e,t)),r(()=>this.viewModel?.view?.ready,(e,t)=>this._viewReadyChange(e??!1,t??!1)),r(()=>[this.viewModel?.waitingForResult,this.viewModel?.location],()=>{this._hideSpinner(),this._displaySpinnerThrottled()}),r(()=>this.viewModel?.screenLocation,()=>this._closeOpenActionMenu()),r(()=>this.selectedFeatureWidget,()=>this._destroyDrillInFlowItemWidgets()),r(()=>{let e=this.selectedFeatureWidget?.viewModel;return[e?.title,e?.state]},()=>this._setTitleFromFeatureWidget()),r(()=>{let e=this.selectedFeatureWidget?.viewModel;return[e?.content,e?.state]},()=>this._setContentFromFeatureWidget()),r(()=>this.viewModel?.featureViewModels,()=>this._featureMenuViewportScrollTop()),this._drillInWidget.on(`close`,()=>{this.emit(`close`)}),this._drillInWidget.on(`exit`,()=>this._destroyDrillInFlowItemWidgets()),this._drillInWidget.on(`open-feature`,({feature:e})=>this._openRelatedFeature(e)),this._drillInWidget.on(`zoom-to-feature`,({featureWidget:e})=>S(this.viewModel,e)),this._drillInWidget.on(`add-nso-trace-location`,({featureWidget:e})=>this.emit(`add-nso-trace-location`,{featureWidget:e}))])}initialize(){(async()=>{this._utilityNetworkTraceMessages=await c(`esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace`)})(),this._drillInWidget.mode=this.mode,this._drillInWidget.closable=!1}loadDependencies(){return C({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),"action-bar":()=>import(`@esri/calcite-components/dist/components/calcite-action-bar`),"action-group":()=>import(`@esri/calcite-components/dist/components/calcite-action-group`),block:()=>import(`@esri/calcite-components/dist/components/calcite-block`),flow:()=>import(`@esri/calcite-components/dist/components/calcite-flow`),"flow-item":()=>import(`@esri/calcite-components/dist/components/calcite-flow-item`),notice:()=>import(`@esri/calcite-components/dist/components/calcite-notice`)})}destroy(){this._destroyDrillInFlowItemWidgets(),this._destroySelectedFeatureWidget(),this._destroySpinner(),this._drillInWidget?.destroy()}get _hideActionText(){if(!this.responsiveActionsEnabled)return!1;let e=this.view?.widthBreakpoint;return e===`xsmall`||e===`small`||e===`medium`}get active(){return this.viewModel.active}get content(){return this.viewModel.content}set content(e){this.viewModel.content=e}get feature(){return this.viewModel.features.length?this.viewModel.features[0]:null}set feature(e){e?this.viewModel.features=[e]:this.viewModel.features=[]}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get hasAssociationsPopupElement(){if(!this.feature)return!1;let e=s(this.feature),t=e&&l(e)?e:void 0,n=u(e)?e:void 0,r=(t?.popupTemplate||n?.popupTemplate||null)?.content;return!(Array.isArray(r)&&!r.some(e=>e instanceof d))}get hasPopupInfo(){let e=this.feature?s(this.feature):null,t=e&&l(e)?e:void 0,n=u(e)?e:void 0;return!(!t?.popupTemplate&&!n?.popupTemplate)}get location(){return this.viewModel.location}set location(e){this.viewModel.location=e}get mode(){return this._get(`mode`)||`add-nso`}set mode(e){this._set(`mode`,e)}get promises(){return this.viewModel.promises}set promises(e){this.viewModel.promises=e}get selectedFeature(){return this.viewModel.selectedFeature}get selectedDrillInFeature(){let e=Array.from(this._drillInFlowItems).at(-1);if(!e)return null;let{flowType:t}=e;return t===`feature-association`||t===`feature-relationship`?e.graphic??null:null}get selectedFeatureWidget(){let{_feature:e,headingLevel:t,_drillInFlowItems:n,timeZone:r}=this,{selectedFeatureViewModel:i}=this.viewModel,a={title:!1};return i?(e?(e.viewModel=i,e.visibleElements=a):this._feature=new m({flowItems:n,headingLevel:t+1,timeZone:r,viewModel:i,visibleElements:a}),this._feature):null}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}open(e){this.removeHandles(`selected-index`),this.viewModel.open({features:[e]})}triggerAction(e){return this.viewModel.triggerAction(e)}render(){return E(`div`,{bind:this,class:this.classes(y.base,w.widget,w.panel,M.blockContainer)},this.mode===`add-nso`?this._renderAddNsoBlock():void 0,this.feature?this.hasPopupInfo?this._renderContentContainer():this._renderNoPopupErrorBlock():void 0)}_renderActionBar(){return this.viewModel.allActions?.length?E(`calcite-action-bar`,{expandDisabled:!0,expanded:!this._hideActionText,key:`header-action-bar`,scale:`s`,slot:`action-bar`},E(`calcite-action-group`,{afterCreate:e=>this._actionBarMenuNode=e,overlayPositioning:`fixed`,scale:`s`},this._renderActions())):null}_renderActions(){return this.viewModel.allActions.toArray().map(this._renderAction)}_renderContent(){let e=this.viewModel?.content;return e?typeof e==`string`?E(`div`,{class:_.contentNode,innerHTML:e,key:e}):this.renderNodeContent(e):null}_renderContentContainer(){let e=[this._renderContentFeature(),this._drillInWidget.render()];return E(`calcite-flow`,{key:`content-container`},e)}_renderContentFeature(){let{_drillInFlowItems:e,headingLevel:t,featureNavigationTop:n}=this,{title:r,active:i}=this.viewModel,a=r||``;return E(`calcite-flow-item`,{bind:this,class:this.classes({[y.contentFeature]:!0}),closed:!i,collapseDirection:n?`down`:`up`,headingLevel:t,key:`root-flow-item`,loading:this.viewModel.waitingForContents,selected:e.length===0},this.mode===`show-feature-info`?E(`calcite-action`,{icon:`x`,slot:`header-actions-end`,text:this.messagesCommon.close,onclick:()=>{this.emit(`close`)}}):void 0,a?E(T,{class:this.classes(y.featuresHeading,w.heading),innerHTML:a,key:`header-content`,level:this.headingLevel,slot:`header-content`}):null,this._renderHeaderActions(),this._renderActionBar(),E(`div`,{class:this.mode===`add-nso`?this.classes(y.container,y.contentContainer):this.classes(y.container,y.contentContainer,M.featureContent)},this._renderContent()))}_renderFallbackIcon(e){let{className:t,icon:n}=e;if(n)return null;let r=f({action:e,feature:this.selectedFeature}),i={[y.icon]:!!t,[y.actionImage]:!!r};return t&&(i[t]=!0),r||t?E(`span`,{"aria-hidden":`true`,class:this.classes(y.icon,i),key:`icon`,styles:p(r)}):null}_renderHeaderAction(e,t){let n=e.title||``;return e.visible?E(`calcite-action`,{active:e.type===`toggle`&&e.value,bind:this,"data-action-uid":e.uid,disabled:e.disabled||!this.feature.geometry,icon:e.icon??void 0,indicator:e.indicator,key:`header-action-${t}`,loading:e.active,slot:`header-actions-end`,text:n,title:n,onclick:this._triggerHeaderAction}):null}_renderHeaderActions(){return this.headerActions.map((e,t)=>this._renderHeaderAction(e,t)).toArray()}_closeOpenActionMenu(){let{_actionBarMenuNode:e}=this;e&&(e.menuOpen=!1)}_createSpinner(e){e&&(this._spinner=new h({view:e}),e.ui.add(this._spinner,{key:A,position:`manual`,internal:!0}))}_destroyDrillInFlowItemWidgets(){this._drillInFlowItems.drain(e=>{`showAllEnabled`in e.viewModel&&(e.viewModel.showAllEnabled=!1),e.viewModel=null,e.destroy()})}_destroySelectedFeatureWidget(){let{_feature:e}=this;e&&(e.viewModel=null,!e.destroyed&&e.destroy()),this._feature=null}_destroySpinner(){let{_spinner:e,view:t}=this;e&&(t?.ui?.remove(e,A),e.destroy(),this._spinner=null)}_displaySpinner(){let{_spinner:e}=this;if(!e)return;let{location:t,waitingForResult:n}=this.viewModel;n&&t?e.show({location:t}):e.hide()}_featureMenuViewportScrollTop(){this._featureMenuViewportNode?.scrollContentTo({top:0})}_getActionIcon(e){if(e.icon)return e.icon;if(!e.image&&!e.className)return`question`}_getActionTitle(e){let{messages:n,selectedFeature:r,messagesCommon:i}=this,{id:a}=e,o=r?.attributes,s=e.title??``,c=a===`zoom-to-feature`?t(s,{messages:n}):a===`remove-selected-feature`?t(s,{messages:i}):a===`zoom-to-clustered-features`||a===`browse-clustered-features`?t(s,{messages:n}):e.title;return c&&o?t(c,o):c??``}_hideSpinner(){let{_spinner:e}=this;e&&(e.location=null,e.hide())}async _openRelatedFeature(e){await e.viewModel.updateGeometry();let t=e.graphic,n=t?.geometry;n!=null&&t!=null&&(this._destroyDrillInFlowItemWidgets(),await this.viewModel.zoomTo({target:n}),this.open(t))}_setContentFromFeatureWidget(){let{selectedFeatureWidget:e}=this;e&&(this.viewModel.content=e)}_setTitleFromFeatureWidget(){let{selectedFeatureWidget:e,messagesCommon:t}=this,n=e?.viewModel;e&&(this.viewModel.title=n?.state===`error`?t?.errorMessage:n?.title||``)}_triggerAction(e){let t=e.currentTarget;if(t.disabled)return;let n=t.dataset.actionUid,{allActions:r}=this.viewModel,i=r.findIndex(e=>e.uid===n),a=r.at(i);a?.type===`toggle`&&(a.value=!a.value),this.viewModel.triggerAction(i)}_triggerHeaderAction(e){let t=e.currentTarget;if(t.disabled)return;let n=t.dataset.actionUid,r=this.headerActions.find(({uid:e})=>e===n);r&&!r.disabled&&(r?.type===`toggle`&&(r.value=!r.value),this.emit(`trigger-header-action`,{action:r}))}_viewReadyChange(e,t){e?this._wireUpView(this.viewModel?.view):t&&this.viewModel.clear()}_viewChange(e,t){e&&t&&this.viewModel.clear()}_wireUpView(e){this._destroySpinner(),e&&this._createSpinner(e)}};e([a()],N.prototype,`_drillInFlowItems`,void 0),e([a()],N.prototype,`_hideActionText`,null),e([a({readOnly:!0})],N.prototype,`active`,null),e([a()],N.prototype,`content`,null),e([a()],N.prototype,`feature`,null),e([a()],N.prototype,`featureNavigationTop`,void 0),e([a()],N.prototype,`goToOverride`,null),e([a()],N.prototype,`hasAssociationsPopupElement`,null),e([a()],N.prototype,`hasPopupInfo`,null),e([a({type:x})],N.prototype,`headerActions`,void 0),e([a()],N.prototype,`headingLevel`,void 0),e([a()],N.prototype,`location`,null),e([a(),D(`esri/widgets/Features/t9n/Features`)],N.prototype,`messages`,void 0),e([a(),D(`esri/t9n/common`)],N.prototype,`messagesCommon`,void 0),e([a()],N.prototype,`mode`,null),e([a()],N.prototype,`promises`,null),e([a()],N.prototype,`responsiveActionsEnabled`,void 0),e([a({readOnly:!0})],N.prototype,`selectedFeature`,null),e([a({readOnly:!0})],N.prototype,`selectedDrillInFeature`,null),e([a({readOnly:!0})],N.prototype,`selectedFeatureWidget`,null),e([a()],N.prototype,`timeZone`,null),e([a()],N.prototype,`view`,null),e([a({type:b}),O([`triggerAction`,`trigger-action`])],N.prototype,`viewModel`,void 0),N=e([o(`esri.widgets.UtilityNetworkTrace.UtilityNetworkTraceFeature`)],N);const P=N;export{P as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{substitute as t}from"../../intl.js";import n from"../../core/Collection.js";import{watch as r}from"../../core/reactiveUtils.js";import{throttle as i}from"../../core/throttle.js";import{property as a,subclass as o}from"../../core/accessorSupport/decorators.js";import{getGraphicLayer as s}from"../../graphic/graphicOriginUtils.js";import{fetchMessageBundle as c}from"../../intl/messages.js";import{isFeatureLayer as l,isSubtypeSublayer as u}from"../../layers/support/layerUtils.js";import{UtilityNetworkAssociationsContent as d}from"../../popup/content.js";import{substituteActionImage as f,getActionStyles as p}from"../../support/actions/actionUtils.js";import m from"../Feature.js";import h from"../Spinner.js";import g from"../Widget.js";import{css as _}from"../Feature/resources.js";import{FeatureContentMixin as v}from"../Feature/support/FeatureContentMixin.js";import{css as y}from"../Features/css.js";import b from"../Features/FeaturesViewModel.js";import{ActionsCollection as x}from"../Popup/actions.js";import{zoomToLocation as S}from"../Popup/actionUtils.js";import{loadCalciteComponents as C}from"../support/componentsUtils.js";import{globalCss as w}from"../support/globalCss.js";import{Heading as T}from"../support/Heading.js";import{tsx as E,messageBundle as D,vmEvent as O}from"../support/widget.js";import k from"./UtilityNetworkTraceFeaturesDrillIn.js";const A=`features-spinner`,j=`esri-utility-network-trace`,M={blockContainer:`${j}__block-container`,blockContent:`${j}__block-content`,featureContent:`${j}__feature-content`,paddingBottom:`${j}__pad-bottom`,paddingTop:`${j}__pad-top`};let N=class extends v(g){constructor(e,t){super(e,t),this._actionBarMenuNode=null,this._drillInFlowItems=new n,this._drillInWidget=new k({flowItems:this._drillInFlowItems}),this._feature=null,this._featureMenuViewportNode=null,this._spinner=null,this._utilityNetworkTraceMessages=null,this.featureNavigationTop=!1,this.headerActions=new x,this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.responsiveActionsEnabled=!1,this.viewModel=new b({suppressDeprecationWarning:!0}),this._renderAction=(e,t)=>{let n=this._getActionTitle(e),{type:r,active:i,uid:a,disabled:o,indicator:s}=e;return e.visible?E(`calcite-action`,{active:r===`toggle`&&e.value,bind:this,"data-action-uid":a,disabled:e.id===`zoom-to-feature`?!this.feature.geometry:o,icon:this._getActionIcon(e),indicator:s,key:`action-${t}`,loading:i,scale:`s`,text:n,title:this._hideActionText?n:void 0,onclick:this._triggerAction},this._renderFallbackIcon(e)):null},this._renderAddNsoBlock=()=>{let{_utilityNetworkTraceMessages:e,messagesCommon:t}=this;return E(`calcite-block`,{class:M.blockContent,expanded:!this.feature,heading:e?.inputsStrings.addNonspatialOption},E(`calcite-action`,{icon:`x`,slot:`actions-end`,text:t.close,onclick:()=>this.emit(`close-un-trace-feature-block`)}),E(`calcite-notice`,{icon:`information`,kind:`info`,open:!this.feature},E(`div`,{slot:`message`},e?.inputsStrings.addNonspatialHint)))},this._renderNoPopupErrorBlock=()=>{let{_utilityNetworkTraceMessages:e,messagesCommon:t}=this;return E(`calcite-block`,{description:void 0,expanded:!0,heading:this.mode===`show-feature-info`?t.warning:void 0},E(`calcite-notice`,{class:this.classes(M.paddingBottom,M.paddingTop),icon:`exclamation-mark-triangle`,kind:`danger`,open:!0},E(`div`,{slot:`message`},e.alertsStrings.noPopupConfigured)),this.mode===`show-feature-info`?E(`calcite-action`,{icon:`x`,slot:`actions-end`,text:t.close,onclick:()=>this.emit(`close-un-trace-feature-block`)}):void 0)},this._displaySpinnerThrottled=i(()=>this._displaySpinner(),0),this.addHandles([this._displaySpinnerThrottled,r(()=>this.viewModel?.active,e=>this._drillInWidget.closed=!e),r(()=>this.viewModel?.view,(e,t)=>this._viewChange(e,t)),r(()=>this.viewModel?.view?.ready,(e,t)=>this._viewReadyChange(e??!1,t??!1)),r(()=>[this.viewModel?.waitingForResult,this.viewModel?.location],()=>{this._hideSpinner(),this._displaySpinnerThrottled()}),r(()=>this.viewModel?.screenLocation,()=>this._closeOpenActionMenu()),r(()=>this.selectedFeatureWidget,()=>this._destroyDrillInFlowItemWidgets()),r(()=>{let e=this.selectedFeatureWidget?.viewModel;return[e?.title,e?.state]},()=>this._setTitleFromFeatureWidget()),r(()=>{let e=this.selectedFeatureWidget?.viewModel;return[e?.content,e?.state]},()=>this._setContentFromFeatureWidget()),r(()=>this.viewModel?.featureViewModels,()=>this._featureMenuViewportScrollTop()),this._drillInWidget.on(`close`,()=>{this.emit(`close`)}),this._drillInWidget.on(`exit`,()=>this._destroyDrillInFlowItemWidgets()),this._drillInWidget.on(`open-feature`,({feature:e})=>this._openRelatedFeature(e)),this._drillInWidget.on(`zoom-to-feature`,({featureWidget:e})=>S(this.viewModel,e)),this._drillInWidget.on(`add-nso-trace-location`,({featureWidget:e})=>this.emit(`add-nso-trace-location`,{featureWidget:e}))])}initialize(){(async()=>{this._utilityNetworkTraceMessages=await c(`esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace`)})(),this._drillInWidget.mode=this.mode,this._drillInWidget.closable=!1}loadDependencies(){return C({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),"action-bar":()=>import(`@esri/calcite-components/dist/components/calcite-action-bar`),"action-group":()=>import(`@esri/calcite-components/dist/components/calcite-action-group`),block:()=>import(`@esri/calcite-components/dist/components/calcite-block`),flow:()=>import(`@esri/calcite-components/dist/components/calcite-flow`),"flow-item":()=>import(`@esri/calcite-components/dist/components/calcite-flow-item`),notice:()=>import(`@esri/calcite-components/dist/components/calcite-notice`)})}destroy(){this._destroyDrillInFlowItemWidgets(),this._destroySelectedFeatureWidget(),this._destroySpinner(),this._drillInWidget?.destroy()}get _hideActionText(){if(!this.responsiveActionsEnabled)return!1;let e=this.view?.widthBreakpoint;return e===`xsmall`||e===`small`||e===`medium`}get active(){return this.viewModel.active}get content(){return this.viewModel.content}set content(e){this.viewModel.content=e}get feature(){return this.viewModel.features.length?this.viewModel.features[0]:null}set feature(e){e?this.viewModel.features=[e]:this.viewModel.features=[]}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get hasAssociationsPopupElement(){if(!this.feature)return!1;let e=s(this.feature),t=e&&l(e)?e:void 0,n=u(e)?e:void 0,r=(t?.popupTemplate||n?.popupTemplate||null)?.content;return!(Array.isArray(r)&&!r.some(e=>e instanceof d))}get hasPopupInfo(){let e=this.feature?s(this.feature):null,t=e&&l(e)?e:void 0,n=u(e)?e:void 0;return!(!t?.popupTemplate&&!n?.popupTemplate)}get location(){return this.viewModel.location}set location(e){this.viewModel.location=e}get mode(){return this._get(`mode`)||`add-nso`}set mode(e){this._set(`mode`,e)}get promises(){return this.viewModel.promises}set promises(e){this.viewModel.promises=e}get selectedFeature(){return this.viewModel.selectedFeature}get selectedDrillInFeature(){let e=Array.from(this._drillInFlowItems).at(-1);if(!e)return null;let{flowType:t}=e;return t===`feature-association`||t===`feature-relationship`?e.graphic??null:null}get selectedFeatureWidget(){let{_feature:e,headingLevel:t,_drillInFlowItems:n,timeZone:r}=this,{selectedFeatureViewModel:i}=this.viewModel,a={title:!1};return i?(e?(e.viewModel=i,e.visibleElements=a):this._feature=new m({flowItems:n,headingLevel:t+1,timeZone:r,viewModel:i,visibleElements:a}),this._feature):null}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}open(e){this.removeHandles(`selected-index`),this.viewModel.open({features:[e]})}triggerAction(e){return this.viewModel.triggerAction(e)}render(){return E(`div`,{bind:this,class:this.classes(y.base,w.widget,w.panel,M.blockContainer)},this.mode===`add-nso`?this._renderAddNsoBlock():void 0,this.feature?this.hasPopupInfo?this._renderContentContainer():this._renderNoPopupErrorBlock():void 0)}_renderActionBar(){return this.viewModel.allActions?.length?E(`calcite-action-bar`,{expanded:!this._hideActionText,expandToggleDisabled:!0,key:`header-action-bar`,scale:`s`,slot:`action-bar`},E(`calcite-action-group`,{afterCreate:e=>this._actionBarMenuNode=e,overlayPositioning:`fixed`,scale:`s`},this._renderActions())):null}_renderActions(){return this.viewModel.allActions.toArray().map(this._renderAction)}_renderContent(){let e=this.viewModel?.content;return e?typeof e==`string`?E(`div`,{class:_.contentNode,innerHTML:e,key:e}):this.renderNodeContent(e):null}_renderContentContainer(){let e=[this._renderContentFeature(),this._drillInWidget.render()];return E(`calcite-flow`,{key:`content-container`},e)}_renderContentFeature(){let{_drillInFlowItems:e,headingLevel:t,featureNavigationTop:n}=this,{title:r,active:i}=this.viewModel,a=r||``;return E(`calcite-flow-item`,{bind:this,class:this.classes({[y.contentFeature]:!0}),closed:!i,collapseDirection:n?`down`:`up`,headingLevel:t,key:`root-flow-item`,loading:this.viewModel.waitingForContents,selected:e.length===0},this.mode===`show-feature-info`?E(`calcite-action`,{icon:`x`,slot:`header-actions-end`,text:this.messagesCommon.close,onclick:()=>{this.emit(`close`)}}):void 0,a?E(T,{class:this.classes(y.featuresHeading,w.heading),innerHTML:a,key:`header-content`,level:this.headingLevel,slot:`header-content`}):null,this._renderHeaderActions(),this._renderActionBar(),E(`div`,{class:this.mode===`add-nso`?this.classes(y.container,y.contentContainer):this.classes(y.container,y.contentContainer,M.featureContent)},this._renderContent()))}_renderFallbackIcon(e){let{className:t,icon:n}=e;if(n)return null;let r=f({action:e,feature:this.selectedFeature}),i={[y.icon]:!!t,[y.actionImage]:!!r};return t&&(i[t]=!0),r||t?E(`span`,{"aria-hidden":`true`,class:this.classes(y.icon,i),key:`icon`,styles:p(r)}):null}_renderHeaderAction(e,t){let n=e.title||``;return e.visible?E(`calcite-action`,{active:e.type===`toggle`&&e.value,bind:this,"data-action-uid":e.uid,disabled:e.disabled||!this.feature.geometry,icon:e.icon??void 0,indicator:e.indicator,key:`header-action-${t}`,loading:e.active,slot:`header-actions-end`,text:n,title:n,onclick:this._triggerHeaderAction}):null}_renderHeaderActions(){return this.headerActions.map((e,t)=>this._renderHeaderAction(e,t)).toArray()}_closeOpenActionMenu(){let{_actionBarMenuNode:e}=this;e&&(e.menuOpen=!1)}_createSpinner(e){e&&(this._spinner=new h({view:e}),e.ui.add(this._spinner,{key:A,position:`manual`,internal:!0}))}_destroyDrillInFlowItemWidgets(){this._drillInFlowItems.drain(e=>{`showAllEnabled`in e.viewModel&&(e.viewModel.showAllEnabled=!1),e.viewModel=null,e.destroy()})}_destroySelectedFeatureWidget(){let{_feature:e}=this;e&&(e.viewModel=null,!e.destroyed&&e.destroy()),this._feature=null}_destroySpinner(){let{_spinner:e,view:t}=this;e&&(t?.ui?.remove(e,A),e.destroy(),this._spinner=null)}_displaySpinner(){let{_spinner:e}=this;if(!e)return;let{location:t,waitingForResult:n}=this.viewModel;n&&t?e.show({location:t}):e.hide()}_featureMenuViewportScrollTop(){this._featureMenuViewportNode?.scrollContentTo({top:0})}_getActionIcon(e){if(e.icon)return e.icon;if(!e.image&&!e.className)return`question`}_getActionTitle(e){let{messages:n,selectedFeature:r,messagesCommon:i}=this,{id:a}=e,o=r?.attributes,s=e.title??``,c=a===`zoom-to-feature`?t(s,{messages:n}):a===`remove-selected-feature`?t(s,{messages:i}):a===`zoom-to-clustered-features`||a===`browse-clustered-features`?t(s,{messages:n}):e.title;return c&&o?t(c,o):c??``}_hideSpinner(){let{_spinner:e}=this;e&&(e.location=null,e.hide())}async _openRelatedFeature(e){await e.viewModel.updateGeometry();let t=e.graphic,n=t?.geometry;n!=null&&t!=null&&(this._destroyDrillInFlowItemWidgets(),await this.viewModel.zoomTo({target:n}),this.open(t))}_setContentFromFeatureWidget(){let{selectedFeatureWidget:e}=this;e&&(this.viewModel.content=e)}_setTitleFromFeatureWidget(){let{selectedFeatureWidget:e,messagesCommon:t}=this,n=e?.viewModel;e&&(this.viewModel.title=n?.state===`error`?t?.errorMessage:n?.title||``)}_triggerAction(e){let t=e.currentTarget;if(t.disabled)return;let n=t.dataset.actionUid,{allActions:r}=this.viewModel,i=r.findIndex(e=>e.uid===n),a=r.at(i);a?.type===`toggle`&&(a.value=!a.value),this.viewModel.triggerAction(i)}_triggerHeaderAction(e){let t=e.currentTarget;if(t.disabled)return;let n=t.dataset.actionUid,r=this.headerActions.find(({uid:e})=>e===n);r&&!r.disabled&&(r?.type===`toggle`&&(r.value=!r.value),this.emit(`trigger-header-action`,{action:r}))}_viewReadyChange(e,t){e?this._wireUpView(this.viewModel?.view):t&&this.viewModel.clear()}_viewChange(e,t){e&&t&&this.viewModel.clear()}_wireUpView(e){this._destroySpinner(),e&&this._createSpinner(e)}};e([a()],N.prototype,`_drillInFlowItems`,void 0),e([a()],N.prototype,`_hideActionText`,null),e([a({readOnly:!0})],N.prototype,`active`,null),e([a()],N.prototype,`content`,null),e([a()],N.prototype,`feature`,null),e([a()],N.prototype,`featureNavigationTop`,void 0),e([a()],N.prototype,`goToOverride`,null),e([a()],N.prototype,`hasAssociationsPopupElement`,null),e([a()],N.prototype,`hasPopupInfo`,null),e([a({type:x})],N.prototype,`headerActions`,void 0),e([a()],N.prototype,`headingLevel`,void 0),e([a()],N.prototype,`location`,null),e([a(),D(`esri/widgets/Features/t9n/Features`)],N.prototype,`messages`,void 0),e([a(),D(`esri/t9n/common`)],N.prototype,`messagesCommon`,void 0),e([a()],N.prototype,`mode`,null),e([a()],N.prototype,`promises`,null),e([a()],N.prototype,`responsiveActionsEnabled`,void 0),e([a({readOnly:!0})],N.prototype,`selectedFeature`,null),e([a({readOnly:!0})],N.prototype,`selectedDrillInFeature`,null),e([a({readOnly:!0})],N.prototype,`selectedFeatureWidget`,null),e([a()],N.prototype,`timeZone`,null),e([a()],N.prototype,`view`,null),e([a({type:b}),O([`triggerAction`,`trigger-action`])],N.prototype,`viewModel`,void 0),N=e([o(`esri.widgets.UtilityNetworkTrace.UtilityNetworkTraceFeature`)],N);const P=N;export{P as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{substitute as t}from"../../intl.js";import{property as n,subclass as r}from"../../core/accessorSupport/decorators.js";import{getGraphicLayer as i}from"../../graphic/graphicOriginUtils.js";import{fetchMessageBundle as a}from"../../intl/messages.js";import o from"../Widget.js";import{css as s}from"../Features/css.js";import{zoomToFeature as c}from"../Popup/actions.js";import{loadCalciteComponents as l}from"../support/componentsUtils.js";import{messageBundle as u,tsx as d,tsxFragment as f}from"../support/widget.js";const p=c.clone(),m={featureContent:`esri-utility-network-trace__feature-content`};let h=class extends o{constructor(e,t){super(e,t),this._utilityNetworkTraceMessages=null,this.closed=!1,this.closable=!0,this.messages=null,this.messagesCommon=null,this._handleAddNonspatialTraceLocation=e=>{this.emit(`add-nso-trace-location`,{featureWidget:e})},this._handleOpenFeature=e=>{this.emit(`open-feature`,{feature:e})},this._handleZoomToFeature=e=>{this.emit(`zoom-to-feature`,{featureWidget:e})}}initialize(){(async()=>{this._utilityNetworkTraceMessages=await a(`esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace`)})()}loadDependencies(){return l({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),"action-bar":()=>import(`@esri/calcite-components/dist/components/calcite-action-bar`),"action-group":()=>import(`@esri/calcite-components/dist/components/calcite-action-group`),"flow-item":()=>import(`@esri/calcite-components/dist/components/calcite-flow-item`)})}get mode(){return this._get(`mode`)||`show-feature-info`}set mode(e){this._set(`mode`,e)}render(){let{flowItems:e}=this,t=e?.toArray();return d(f,null,t?.map((t,n)=>this._renderFlowItem(t,n===e.length-1)))}_renderAddNonspatialTraceLocationAction(e){let{_utilityNetworkTraceMessages:t}=this;return d(`calcite-action`,{bind:this,icon:`utility-network-trace`,scale:`s`,text:t.inputsStrings.addNonspatialOption,textEnabled:!0,title:t.inputsStrings.addNonspatialOption,onclick:()=>this._handleAddNonspatialTraceLocation(e)})}_renderFlowItem(e,t){let{messages:n,closable:r,closed:a}=this,o=`graphic`in e&&!e.isTable,c=e.flowType===`feature-association`,l=this._getExitMessage(e),u=n.selectFeature,f=e,p=f&&f.graphic?i(f.graphic):null,h=!(p&&p.geometryType);return d(`calcite-flow-item`,{bind:this,closable:r,closed:a,description:this._getDrillInFlowItemDescription(e),heading:e.title??``,key:`flow-item-${e.viewModel.uid}`,selected:t,onCalciteFlowItemBack:e=>{e.preventDefault(),this._handleDrillInBackClick()}},d(`calcite-action`,{bind:this,class:s.actionExit,icon:`move-up`,key:`exit-action`,slot:`header-actions-start`,text:l,title:l,onclick:this._handleExitClick}),o?d(`calcite-action`,{bind:this,icon:`zoom-to-object`,key:`open-feature-action`,slot:`header-actions-end`,text:u,title:u,onclick:()=>this._handleOpenFeature(e)}):null,this.mode===`show-feature-info`?d(`calcite-action`,{icon:`x`,slot:`header-actions-end`,text:this.messagesCommon.close,onclick:()=>{this.emit(`close`)}}):void 0,c&&this.mode===`add-nso`?h?d(`calcite-action-bar`,{
|
|
2
|
+
import{__decorate as e}from"tslib";import{substitute as t}from"../../intl.js";import{property as n,subclass as r}from"../../core/accessorSupport/decorators.js";import{getGraphicLayer as i}from"../../graphic/graphicOriginUtils.js";import{fetchMessageBundle as a}from"../../intl/messages.js";import o from"../Widget.js";import{css as s}from"../Features/css.js";import{zoomToFeature as c}from"../Popup/actions.js";import{loadCalciteComponents as l}from"../support/componentsUtils.js";import{messageBundle as u,tsx as d,tsxFragment as f}from"../support/widget.js";const p=c.clone(),m={featureContent:`esri-utility-network-trace__feature-content`};let h=class extends o{constructor(e,t){super(e,t),this._utilityNetworkTraceMessages=null,this.closed=!1,this.closable=!0,this.messages=null,this.messagesCommon=null,this._handleAddNonspatialTraceLocation=e=>{this.emit(`add-nso-trace-location`,{featureWidget:e})},this._handleOpenFeature=e=>{this.emit(`open-feature`,{feature:e})},this._handleZoomToFeature=e=>{this.emit(`zoom-to-feature`,{featureWidget:e})}}initialize(){(async()=>{this._utilityNetworkTraceMessages=await a(`esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace`)})()}loadDependencies(){return l({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),"action-bar":()=>import(`@esri/calcite-components/dist/components/calcite-action-bar`),"action-group":()=>import(`@esri/calcite-components/dist/components/calcite-action-group`),"flow-item":()=>import(`@esri/calcite-components/dist/components/calcite-flow-item`)})}get mode(){return this._get(`mode`)||`show-feature-info`}set mode(e){this._set(`mode`,e)}render(){let{flowItems:e}=this,t=e?.toArray();return d(f,null,t?.map((t,n)=>this._renderFlowItem(t,n===e.length-1)))}_renderAddNonspatialTraceLocationAction(e){let{_utilityNetworkTraceMessages:t}=this;return d(`calcite-action`,{bind:this,icon:`utility-network-trace`,scale:`s`,text:t.inputsStrings.addNonspatialOption,textEnabled:!0,title:t.inputsStrings.addNonspatialOption,onclick:()=>this._handleAddNonspatialTraceLocation(e)})}_renderFlowItem(e,t){let{messages:n,closable:r,closed:a}=this,o=`graphic`in e&&!e.isTable,c=e.flowType===`feature-association`,l=this._getExitMessage(e),u=n.selectFeature,f=e,p=f&&f.graphic?i(f.graphic):null,h=!(p&&p.geometryType);return d(`calcite-flow-item`,{bind:this,closable:r,closed:a,description:this._getDrillInFlowItemDescription(e),heading:e.title??``,key:`flow-item-${e.viewModel.uid}`,selected:t,onCalciteFlowItemBack:e=>{e.preventDefault(),this._handleDrillInBackClick()}},d(`calcite-action`,{bind:this,class:s.actionExit,icon:`move-up`,key:`exit-action`,slot:`header-actions-start`,text:l,title:l,onclick:this._handleExitClick}),o?d(`calcite-action`,{bind:this,icon:`zoom-to-object`,key:`open-feature-action`,slot:`header-actions-end`,text:u,title:u,onclick:()=>this._handleOpenFeature(e)}):null,this.mode===`show-feature-info`?d(`calcite-action`,{icon:`x`,slot:`header-actions-end`,text:this.messagesCommon.close,onclick:()=>{this.emit(`close`)}}):void 0,c&&this.mode===`add-nso`?h?d(`calcite-action-bar`,{expanded:!0,expandToggleDisabled:!0,key:`header-action-bar`,scale:`s`,slot:`action-bar`},d(`calcite-action-group`,{overlayPositioning:`fixed`,scale:`s`},this._renderAddNonspatialTraceLocationAction(e))):d(`calcite-action-bar`,{expanded:!0,expandToggleDisabled:!0,key:`header-action-bar`,scale:`s`,slot:`action-bar`},d(`calcite-action-group`,{overlayPositioning:`fixed`,scale:`s`},this._renderZoomToFeatureAction(e))):null,d(`div`,{class:this.classes(s.container,m.featureContent)},e.render()))}_renderZoomToFeatureAction(e){let t=this._getActionTitle(p);return d(`calcite-action`,{active:p.active,bind:this,"data-action-uid":p.uid,disabled:p.disabled,icon:p.icon??`question`,indicator:p.indicator,key:`action-${p.uid}`,loading:p.active,scale:`s`,text:t,textEnabled:!0,title:t,onclick:()=>this._handleZoomToFeature(e)})}_getActionTitle(e){let{messages:n}=this,{id:r}=e,i=e.title??``;return r===`zoom-to-feature`?t(i,{messages:n}):i}_getDrillInFlowItemDescription(e){switch(e.flowType){case`feature`:case`feature-association`:case`feature-utility-network-associations`:return e.viewModel.description??``;case`feature-relationship`:return e.allItemsDescription;case`feature-utility-network-association-type`:return e.description??``}}_getExitMessage(e){switch(e.flowType){case`feature`:case`feature-association`:return``;case`feature-relationship`:return this.messages.exitRelatedRecords;case`feature-utility-network-associations`:case`feature-utility-network-association-type`:return this.messages.exitAssociations}}_handleDrillInBackClick(){let e=this.flowItems?.pop();e&&(`showAllEnabled`in e.viewModel&&(e.viewModel.showAllEnabled=!1),e&&(e.viewModel=null,e.destroy()))}_handleExitClick(){this.emit(`exit`)}};e([n()],h.prototype,`closed`,void 0),e([n()],h.prototype,`closable`,void 0),e([n()],h.prototype,`flowItems`,void 0),e([n(),u(`esri/widgets/Features/t9n/Features`)],h.prototype,`messages`,void 0),e([n(),u(`esri/t9n/common`)],h.prototype,`messagesCommon`,void 0),e([n()],h.prototype,`mode`,null),h=e([r(`esri.widgets.UtilityNetworkTrace.UtilityNetworkTraceFeaturesDrillIn`)],h);const g=h;export{g as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LengthUnit, AreaUnit } from "../../core/units.js";
|
|
2
2
|
import type { GraphicColor } from "./UtilityNetworkTraceViewModel.js";
|
|
3
3
|
|
|
4
4
|
/** @since 5.0 */
|
|
@@ -20,7 +20,7 @@ export interface ResultAreaProperties {
|
|
|
20
20
|
*
|
|
21
21
|
* @since 5.0
|
|
22
22
|
*/
|
|
23
|
-
unit:
|
|
23
|
+
unit: LengthUnit;
|
|
24
24
|
/**
|
|
25
25
|
* Units for area measurements.
|
|
26
26
|
*
|