@geoscene/core 4.23.9 → 4.23.10

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.
Files changed (221) hide show
  1. package/assets/geoscene/core/workers/chunks/6f827a32646bab0a8777.js +1 -1
  2. package/assets/geoscene/core/workers/chunks/9f458f10dc65b185f66e.js +1 -1
  3. package/assets/geoscene/themes/base/_Overlay.scss +2 -2
  4. package/assets/geoscene/themes/base/_OverlayItem.scss +12 -12
  5. package/assets/geoscene/themes/base/_Ui.scss +32 -32
  6. package/assets/geoscene/themes/base/_View.scss +31 -31
  7. package/assets/geoscene/themes/base/_animation.scss +6 -6
  8. package/assets/geoscene/themes/base/_core.scss +2 -2
  9. package/assets/geoscene/themes/base/_mixins.scss +43 -43
  10. package/assets/geoscene/themes/base/icons/style.css +190 -190
  11. package/assets/geoscene/themes/base/icons/style.scss +376 -376
  12. package/assets/geoscene/themes/base/icons/variables.scss +187 -187
  13. package/assets/geoscene/themes/base/widgets/_AreaMeasurement2D.scss +4 -4
  14. package/assets/geoscene/themes/base/widgets/_AreaMeasurement3D.scss +4 -4
  15. package/assets/geoscene/themes/base/widgets/_Attachments.scss +48 -48
  16. package/assets/geoscene/themes/base/widgets/_Attribution.scss +9 -9
  17. package/assets/geoscene/themes/base/widgets/_BasemapGallery.scss +39 -39
  18. package/assets/geoscene/themes/base/widgets/_BasemapLayerList.scss +100 -100
  19. package/assets/geoscene/themes/base/widgets/_BasemapToggle.scss +22 -22
  20. package/assets/geoscene/themes/base/widgets/_BinaryColorSizeSlider.scss +2 -2
  21. package/assets/geoscene/themes/base/widgets/_Bookmarks.scss +48 -48
  22. package/assets/geoscene/themes/base/widgets/_BuildingDisciplinesTree.scss +3 -3
  23. package/assets/geoscene/themes/base/widgets/_BuildingExplorer.scss +4 -4
  24. package/assets/geoscene/themes/base/widgets/_BuildingLevelPicker.scss +4 -4
  25. package/assets/geoscene/themes/base/widgets/_BuildingPhasePicker.scss +4 -4
  26. package/assets/geoscene/themes/base/widgets/_ButtonMenu.scss +21 -21
  27. package/assets/geoscene/themes/base/widgets/_ClassedColorSlider.scss +2 -2
  28. package/assets/geoscene/themes/base/widgets/_ClassedSizeSlider.scss +2 -2
  29. package/assets/geoscene/themes/base/widgets/_ColorPicker.scss +3 -3
  30. package/assets/geoscene/themes/base/widgets/_ColorSizeSlider.scss +2 -2
  31. package/assets/geoscene/themes/base/widgets/_ColorSlider.scss +2 -2
  32. package/assets/geoscene/themes/base/widgets/_Compass.scss +3 -3
  33. package/assets/geoscene/themes/base/widgets/_CoordinateConversion.scss +51 -51
  34. package/assets/geoscene/themes/base/widgets/_DatePicker.scss +34 -34
  35. package/assets/geoscene/themes/base/widgets/_Daylight.scss +63 -63
  36. package/assets/geoscene/themes/base/widgets/_DirectLineMeasurement3D.scss +2 -2
  37. package/assets/geoscene/themes/base/widgets/_Directions.scss +98 -98
  38. package/assets/geoscene/themes/base/widgets/_DistanceMeasurement2D.scss +2 -2
  39. package/assets/geoscene/themes/base/widgets/_Editor.scss +56 -56
  40. package/assets/geoscene/themes/base/widgets/_ElevationProfile.scss +19 -19
  41. package/assets/geoscene/themes/base/widgets/_Expand.scss +58 -58
  42. package/assets/geoscene/themes/base/widgets/_Feature.scss +13 -13
  43. package/assets/geoscene/themes/base/widgets/_FeatureContent.scss +24 -24
  44. package/assets/geoscene/themes/base/widgets/_FeatureForm.scss +36 -36
  45. package/assets/geoscene/themes/base/widgets/_FeatureMedia.scss +17 -17
  46. package/assets/geoscene/themes/base/widgets/_FeatureTable.scss +26 -26
  47. package/assets/geoscene/themes/base/widgets/_FeatureTemplates.scss +9 -9
  48. package/assets/geoscene/themes/base/widgets/_FloorFilter.scss +93 -93
  49. package/assets/geoscene/themes/base/widgets/_Grid.scss +6 -6
  50. package/assets/geoscene/themes/base/widgets/_HeatmapSlider.scss +2 -2
  51. package/assets/geoscene/themes/base/widgets/_Histogram.scss +10 -10
  52. package/assets/geoscene/themes/base/widgets/_HistogramRangeSlider.scss +27 -27
  53. package/assets/geoscene/themes/base/widgets/_IdentityForm.scss +5 -5
  54. package/assets/geoscene/themes/base/widgets/_IdentityModal.scss +13 -13
  55. package/assets/geoscene/themes/base/widgets/_ItemList.scss +18 -18
  56. package/assets/geoscene/themes/base/widgets/_LayerList.scss +89 -89
  57. package/assets/geoscene/themes/base/widgets/_Legend.scss +95 -95
  58. package/assets/geoscene/themes/base/widgets/_LineOfSight.scss +9 -9
  59. package/assets/geoscene/themes/base/widgets/_NavigationToggle.scss +14 -14
  60. package/assets/geoscene/themes/base/widgets/_OpacitySlider.scss +2 -2
  61. package/assets/geoscene/themes/base/widgets/_Popup.scss +167 -167
  62. package/assets/geoscene/themes/base/widgets/_Print.scss +52 -52
  63. package/assets/geoscene/themes/base/widgets/_ScaleBar.scss +28 -28
  64. package/assets/geoscene/themes/base/widgets/_ScaleRangeSlider.scss +29 -29
  65. package/assets/geoscene/themes/base/widgets/_Search.scss +50 -50
  66. package/assets/geoscene/themes/base/widgets/_SearchResultRenderer.scss +7 -7
  67. package/assets/geoscene/themes/base/widgets/_SelectionToolbar.scss +3 -3
  68. package/assets/geoscene/themes/base/widgets/_ShadowCast.scss +17 -17
  69. package/assets/geoscene/themes/base/widgets/_SizeSlider.scss +2 -2
  70. package/assets/geoscene/themes/base/widgets/_Sketch.scss +24 -24
  71. package/assets/geoscene/themes/base/widgets/_Slice.scss +5 -5
  72. package/assets/geoscene/themes/base/widgets/_Slider.scss +70 -70
  73. package/assets/geoscene/themes/base/widgets/_SnappingControls.scss +16 -16
  74. package/assets/geoscene/themes/base/widgets/_Spinner.scss +12 -12
  75. package/assets/geoscene/themes/base/widgets/_Swipe.scss +15 -15
  76. package/assets/geoscene/themes/base/widgets/_TableList.scss +57 -57
  77. package/assets/geoscene/themes/base/widgets/_TimePicker.scss +3 -3
  78. package/assets/geoscene/themes/base/widgets/_TimeSlider.scss +28 -28
  79. package/assets/geoscene/themes/base/widgets/_UtilityNetworkTrace.scss +8 -8
  80. package/assets/geoscene/themes/base/widgets/_Weather.scss +2 -2
  81. package/assets/geoscene/themes/base/widgets/_Widget.scss +95 -95
  82. package/assets/geoscene/themes/base/widgets/_Zoom.scss +8 -8
  83. package/assets/geoscene/themes/dark/main.css +1 -1
  84. package/assets/geoscene/themes/dark/main.scss +3 -3
  85. package/assets/geoscene/themes/dark-blue/main.css +1 -1
  86. package/assets/geoscene/themes/dark-blue/main.scss +3 -3
  87. package/assets/geoscene/themes/dark-green/main.css +1 -1
  88. package/assets/geoscene/themes/dark-green/main.scss +3 -3
  89. package/assets/geoscene/themes/dark-purple/main.css +1 -1
  90. package/assets/geoscene/themes/dark-purple/main.scss +3 -3
  91. package/assets/geoscene/themes/dark-red/main.css +1 -1
  92. package/assets/geoscene/themes/dark-red/main.scss +3 -3
  93. package/assets/geoscene/themes/light/main.css +1 -1
  94. package/assets/geoscene/themes/light/main.scss +2 -2
  95. package/assets/geoscene/themes/light/view.css +1 -1
  96. package/assets/geoscene/themes/light-blue/main.css +1 -1
  97. package/assets/geoscene/themes/light-blue/main.scss +3 -3
  98. package/assets/geoscene/themes/light-green/main.css +1 -1
  99. package/assets/geoscene/themes/light-green/main.scss +3 -3
  100. package/assets/geoscene/themes/light-purple/main.css +1 -1
  101. package/assets/geoscene/themes/light-purple/main.scss +3 -3
  102. package/assets/geoscene/themes/light-red/main.css +1 -1
  103. package/assets/geoscene/themes/light-red/main.scss +3 -3
  104. package/identity/IdentityForm.js +1 -1
  105. package/identity/IdentityModal.js +1 -1
  106. package/package.json +1 -1
  107. package/portal/schemas/definitions.js +1 -1
  108. package/portal/schemas/sceneLayerItem.js +1 -1
  109. package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
  110. package/views/2d/layers/support/clusterUtils.js +1 -1
  111. package/views/2d/navigation/ZoomBox.js +1 -1
  112. package/views/3d/externalRenderers.js +1 -1
  113. package/views/3d/layers/I3SMeshView3D.js +1 -1
  114. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  115. package/views/BreakpointsOwner.js +1 -1
  116. package/views/DOMContainer.js +1 -1
  117. package/views/input/BrowserEventSource.js +1 -1
  118. package/views/overlay/LineOverlayItem.js +1 -1
  119. package/views/overlay/TextOverlayItem.js +1 -1
  120. package/views/overlay/ViewOverlay.js +1 -1
  121. package/views/ui/Component.js +1 -1
  122. package/views/ui/UI.js +1 -1
  123. package/views/webgl/context-util.js +1 -1
  124. package/widgets/AreaMeasurement2D.js +1 -1
  125. package/widgets/AreaMeasurement3D.js +1 -1
  126. package/widgets/Attachments.js +1 -1
  127. package/widgets/Attribution.js +1 -1
  128. package/widgets/BasemapGallery.js +1 -1
  129. package/widgets/BasemapLayerList.js +1 -1
  130. package/widgets/BasemapToggle.js +1 -1
  131. package/widgets/Bookmarks.js +1 -1
  132. package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesNode.js +1 -1
  133. package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesTree.js +1 -1
  134. package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
  135. package/widgets/BuildingExplorer/BuildingLevelPicker/Label.js +1 -1
  136. package/widgets/BuildingExplorer/BuildingLevelPicker/LevelItem.js +1 -1
  137. package/widgets/BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js +1 -1
  138. package/widgets/BuildingExplorer.js +1 -1
  139. package/widgets/Compass.js +1 -1
  140. package/widgets/CoordinateConversion.js +1 -1
  141. package/widgets/Daylight/support/SliderWithDropdown.js +1 -1
  142. package/widgets/Daylight.js +1 -1
  143. package/widgets/DirectLineMeasurement3D.js +1 -1
  144. package/widgets/Directions/support/resources.js +1 -1
  145. package/widgets/Directions.js +1 -1
  146. package/widgets/DistanceMeasurement2D.js +1 -1
  147. package/widgets/Editor/deprecationUtils.js +1 -1
  148. package/widgets/Editor.js +1 -1
  149. package/widgets/ElevationProfile/css.js +1 -1
  150. package/widgets/Expand.js +1 -1
  151. package/widgets/Feature/FeatureAttachments.js +1 -1
  152. package/widgets/Feature/FeatureContent.js +1 -1
  153. package/widgets/Feature/FeatureExpression.js +1 -1
  154. package/widgets/Feature/FeatureFields.js +1 -1
  155. package/widgets/Feature/FeatureMedia.js +1 -1
  156. package/widgets/Feature/support/FeatureElementInfo.js +1 -1
  157. package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
  158. package/widgets/Feature/support/featureUtils.js +1 -1
  159. package/widgets/Feature.js +1 -1
  160. package/widgets/FeatureForm.js +1 -1
  161. package/widgets/FeatureTable/AttachmentsColumn.js +1 -1
  162. package/widgets/FeatureTable/FieldColumn.js +1 -1
  163. package/widgets/FeatureTable/Grid/Column.js +1 -1
  164. package/widgets/FeatureTable/Grid/EditorColumn.js +1 -1
  165. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  166. package/widgets/FeatureTable/Grid/support/ButtonMenu.js +1 -1
  167. package/widgets/FeatureTable.js +1 -1
  168. package/widgets/FeatureTemplates/ItemList.js +1 -1
  169. package/widgets/FeatureTemplates.js +1 -1
  170. package/widgets/FloorFilter.js +1 -1
  171. package/widgets/Fullscreen.js +1 -1
  172. package/widgets/Histogram.js +1 -1
  173. package/widgets/HistogramRangeSlider.js +1 -1
  174. package/widgets/Home.js +1 -1
  175. package/widgets/LayerList/ListItemPanel.js +1 -1
  176. package/widgets/LayerList.js +1 -1
  177. package/widgets/Legend/styles/Card.js +1 -1
  178. package/widgets/Legend/styles/Classic.js +1 -1
  179. package/widgets/Legend/styles/support/relationshipUtils.js +1 -1
  180. package/widgets/Legend/styles/support/univariateUtils.js +1 -1
  181. package/widgets/Legend.js +1 -1
  182. package/widgets/LineOfSight.js +1 -1
  183. package/widgets/Locate.js +1 -1
  184. package/widgets/Measurement.js +1 -1
  185. package/widgets/NavigationToggle.js +1 -1
  186. package/widgets/Popup.js +1 -1
  187. package/widgets/Print.js +1 -1
  188. package/widgets/ScaleBar.js +1 -1
  189. package/widgets/ScaleRangeSlider.js +1 -1
  190. package/widgets/Search/SearchResultRenderer.js +1 -1
  191. package/widgets/Search.js +1 -1
  192. package/widgets/ShadowCast/css.js +1 -1
  193. package/widgets/Sketch.js +1 -1
  194. package/widgets/Slice.js +1 -1
  195. package/widgets/Slider.js +1 -1
  196. package/widgets/Spinner.js +1 -1
  197. package/widgets/Swipe.js +1 -1
  198. package/widgets/TableList.js +1 -1
  199. package/widgets/TimeSlider.js +1 -1
  200. package/widgets/Track.js +1 -1
  201. package/widgets/UtilityNetworkTrace.js +1 -1
  202. package/widgets/Weather/css.js +1 -1
  203. package/widgets/Widget.js +1 -1
  204. package/widgets/Zoom/IconButton.js +1 -1
  205. package/widgets/Zoom.js +1 -1
  206. package/widgets/smartMapping/BinaryColorSizeSlider.js +1 -1
  207. package/widgets/smartMapping/ClassedColorSlider.js +1 -1
  208. package/widgets/smartMapping/ClassedSizeSlider.js +1 -1
  209. package/widgets/smartMapping/ColorSizeSlider.js +1 -1
  210. package/widgets/smartMapping/ColorSlider.js +1 -1
  211. package/widgets/smartMapping/HeatmapSlider.js +1 -1
  212. package/widgets/smartMapping/OpacitySlider.js +1 -1
  213. package/widgets/smartMapping/SizeSlider.js +1 -1
  214. package/widgets/support/ColorPicker.js +1 -1
  215. package/widgets/support/DatePicker.js +1 -1
  216. package/widgets/support/Heading.js +1 -1
  217. package/widgets/support/Popover.js +1 -1
  218. package/widgets/support/SelectionToolbar.js +1 -1
  219. package/widgets/support/SnappingControls.js +1 -1
  220. package/widgets/support/TimePicker.js +1 -1
  221. package/widgets/support/widgetThemeUtils.js +1 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{eventKey as t}from"../core/events.js";import{watch as i}from"../core/watchUtils.js";import{aliasOf as s}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import n from"./Widget.js";import r from"./FloorFilter/FloorFilterViewModel.js";import{Heading as a,incrementHeadingLevel as c}from"./support/Heading.js";import{isRTL as d,storeNode as u}from"./support/widgetUtils.js";import{messageBundle as h}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{tsx as v}from"./support/jsxFactory.js";import{substitute as f}from"../intl/substitute.js";const m={geosceneWidget:"esri-widget",geosceneWidgetButton:"esri-widget--button",geosceneWidgetButtonActive:"esri-widget--button-active",esriButtonDisabled:"esri-button--disabled",esriDisabled:"esri-disabled",esriIcon:"geoscene-icon",esriInteractive:"esri-interactive",geosceneWidgetContentEmpty:"esri-widget__content--empty",floorFilter:"esri-floor-filter",floorFilterLayout:"esri-floor-filter__layout--",floorFilterPosition:"esri-floor-filter__position--",buttonContainer:"esri-floor-filter__button-container",buttonContainerLevels:"esri-floor-filter__button-container--levels",buttonInfo:"esri-floor-filter__button-info",buttonLabel:"esri-floor-filter__button-label",browseButton:"esri-floor-filter__browse-button",closeLevelsButton:"esri-floor-filter__close-levels-button",zoomButton:"esri-floor-filter__zoom-button",zoomButtonLevels:"esri-floor-filter__zoom-button--levels",minimizeToggleButton:"esri-floor-filter__minimize-toggle-button",levelsContainer:"esri-floor-filter__levels-container",levelButton:"esri-floor-filter__level-button",levelButtonActive:"esri-floor-filter__level-button--active",separator:"esri-floor-filter__separator",filterMenu:"esri-floor-filter__filter-menu",filterMenuHeader:"esri-floor-filter__filter-menu-header",filterMenuHeaderTextGroup:"esri-floor-filter__filter-menu-header-text-group",filterMenuHeaderText:"esri-floor-filter__filter-menu-header-text",filterMenuHeaderSubtext:"esri-floor-filter__filter-menu-header-subtext",filterMenuHeaderBack:"esri-floor-filter__filter-menu-header-back",filterMenuSearch:"esri-floor-filter__filter-menu-search",filterMenuSearchInput:"esri-floor-filter__filter-menu-search-input",filterMenuItems:"esri-floor-filter__filter-menu-items",filterMenuItemName:"esri-floor-filter__filter-menu-item-name",filterMenuSelectedItem:"esri-floor-filter__filter-menu-item-name--selected",filterMenuSite:"esri-floor-filter__filter-menu-site",filterMenuFacility:"esri-floor-filter__filter-menu-facility",selectedItemCircle:"esri-floor-filter__selected-item-circle",urbanIcon:"geoscene-icon-urban-model",zoomToIcon:"geoscene-icon-zoom-to-object",collapseIconRight:"geoscene-icon-collapse",collapseIconLeft:"geoscene-icon-expand",expandIconRight:"geoscene-icon-expand",expandIconLeft:"geoscene-icon-collapse",closeIcon:"geoscene-icon-close",searchIcon:"geoscene-icon-search",rightIcon:"geoscene-icon-right",leftIcon:"geoscene-icon-left"},p=["ArrowUp","ArrowDown","End","Home"];let M=class extends n{constructor(e,t){super(e,t),this._activeMenu=null,this._activeMenuIndex={levels:-1,menuItems:-1},this._baseNode=null,this._facilitiesListNode=null,this._levelsListNode=null,this._sitesListNode=null,this._searchInput=null,this.enabled=null,this.longNames=null,this.minimized=null,this.pinnedLevels=null,this.site=null,this.facility=null,this.level=null,this.view=null,this.viewModel=new r,this.messages=null,this.messagesCommon=null,this.goToOverride=null,this.headingLevel=2,this._resizeObserver=new ResizeObserver((()=>this.scheduleRender())),this.own(i(this,"_searchInput",(()=>this._focusSearch())))}destroy(){this._resizeObserver.disconnect()}updateWebDocument(){}render(){var e;const{longNames:t}=this,i=t&&this.viewModel.isNormalMode?"expanded":"collapsed",s=this.renderButtons(),l=this.renderFilterMenu(),o=v("div",{class:this.classes(m.separator)}),n=this._getComponentPosition(),r=this._getPosition(n),a="top-right"===n||"bottom-right"===n,c="top-left"===n||"bottom-left"===n,u=d(this.container),h=u&&c||!u&&a?l:s,f=u&&c||!u&&a?s:l;return v("div",{afterCreate:this._afterBaseNodeCreate,key:"floor-filter-menu",class:this.classes(m.floorFilter,m.geosceneWidget,`${m.floorFilterLayout}${i}`,`${m.floorFilterPosition}${r}`)},h,(null==(e=this.viewModel)?void 0:e.filterMenuOpen)&&o,f)}renderButtons(){const e=this._getComponentPosition(),t=[];return"top"===this._getPosition(e)?(t.push(this.renderBrowseButton()),t.push(this.renderLevelButtons()),t.push(this.renderCloseLevelsButton()),t.push(this.renderZoomButton()),t.push(this.renderCollapseToggleButton())):(t.push(this.renderCollapseToggleButton()),t.push(this.renderZoomButton()),t.push(this.renderCloseLevelsButton()),t.push(this.renderLevelButtons()),t.push(this.renderBrowseButton())),v("div",{key:"button-container",class:this.classes(m.geosceneWidget,m.buttonContainer)},t)}renderBrowseButton(){var e;const{longNames:t,messages:i}=this;return v("button",{key:"browse-button",title:i.buttons.browse,bind:this,class:this.classes(m.geosceneWidget,m.geosceneWidgetButton,m.esriInteractive,("loading"===this.viewModel.state||"disabled"===this.viewModel.state)&&m.esriButtonDisabled,m.browseButton,(null==(e=this.viewModel)?void 0:e.filterMenuOpen)&&m.geosceneWidgetButtonActive),"aria-expanded":this.viewModel.filterMenuOpen.toString(),"aria-label":i.buttons.browse,onclick:this._toggleFilterMenu,type:"button"},v("div",{class:this.classes(m.buttonInfo)},v("span",{class:this.classes(m.esriIcon,m.urbanIcon)}),v("span",{class:this.classes(m.buttonLabel)},t&&this.viewModel.isNormalMode&&i.buttons.browse)))}renderLevelButtons(){var e,t,i,s,l;if(null==(e=this.viewModel)||null==(t=e.filterFeatures)||null==(i=t.levels)||!i.levelsInfo||!this.facility)return null;const{facility:o,messagesCommon:n,messages:r}=this,a=null==(s=this.viewModel)?void 0:s.getFacility(o),c=(null==(l=this.viewModel)?void 0:l.getFacilityLevels(o)).map((e=>this.renderLevelButton(e)));if(!c.length)return null;const d=a&&f(r.selector.levelsLabel,{name:`"${a.name}"`});if(this._isWebScene(this.view.map)&&(null==c?void 0:c.length)>1){const e={id:`all--${o}`,facilityId:o,shortName:n.all,longName:n.all,levelNumber:null,verticalOrder:null},t=this.renderLevelButton(e);c.push(t)}return v("ul",{key:"levels-button-container",class:this.classes(m.levelsContainer),bind:this,"data-id":"levels",afterCreate:u,"data-node-ref":"_levelsListNode","aria-label":d,onkeydown:this._handleListKeydown},c)}renderLevelButton(e){const{longNames:t}=this,{shortName:i,longName:s,id:l}=e,o=`levels--${l}`,n=this.level===l,r=t&&this.viewModel.isNormalMode?s:i;return this.viewModel.isNormalMode||n||this.viewModel.levelsExpanded?v("li",{key:o},v("button",{"data-id":l,"data-list-id":"levels",bind:this,class:this.classes(m.geosceneWidgetButton,n?m.geosceneWidgetButtonActive:null,m.esriInteractive,m.levelButton),onclick:this._levelSelected,onfocus:this._onItemFocus,type:"button"},r)):null}renderCloseLevelsButton(){if(!this.level||this.viewModel.isNormalMode||!this.viewModel.levelsExpanded)return null;const{messagesCommon:e}=this;return v("button",{key:"close-levels-button",title:e.close,bind:this,class:this.classes(m.geosceneWidget,m.geosceneWidgetButton,m.esriInteractive,m.closeLevelsButton),"aria-label":e.close,onclick:this._closeLevels,type:"button"},v("div",{class:this.classes(m.buttonInfo)},v("span",{class:this.classes(m.esriIcon,m.closeIcon)})))}renderZoomButton(){var e,t,i,s,l;const{longNames:o,messages:n,facility:r,site:a}=this,c=null==(e=this.viewModel)?void 0:e.filterMenuType,d=null==(t=this.viewModel)?void 0:t.filterMenuOpen,u=null==(i=this.viewModel)?void 0:i.getSite(a),h=null==(s=this.viewModel)?void 0:s.getFacility(r),f="site"===c&&d?!u:!h;return v("button",{key:"zoom-button",title:n.buttons.zoomTo,bind:this,class:this.classes(m.geosceneWidget,m.geosceneWidgetButton,f&&m.esriButtonDisabled,m.esriInteractive,(null==(l=this.viewModel)?void 0:l.getFacilityLevels(r).length)>0?m.zoomButtonLevels:m.zoomButton),"aria-label":n.buttons.zoomTo,onclick:this._zoomToClicked,type:"button"},v("div",{class:this.classes(m.buttonInfo)},v("span",{class:this.classes(m.esriIcon,m.zoomToIcon)}),v("span",{class:this.classes(m.buttonLabel)},o&&this.viewModel.isNormalMode&&n.buttons.zoomTo)))}renderCollapseToggleButton(){const{longNames:e,messagesCommon:t}=this,i=e?m.collapseIconRight:m.expandIconRight,s=this.classes(m.esriIcon,i),l=e?t.collapse:t.expand;return v("button",{key:"minimize-toggle-button",title:l,bind:this,class:this.classes(m.geosceneWidget,m.geosceneWidgetButton,m.esriInteractive,m.minimizeToggleButton),"aria-label":l,onclick:this._toggleCollapsed,type:"button"},v("div",{class:this.classes(m.buttonInfo)},v("span",{class:s}),v("span",{class:this.classes(m.buttonLabel)},e&&this.viewModel.isNormalMode&&t.collapse)))}renderFilterMenu(){var e,t,i;return null!=(e=this.viewModel)&&e.filterMenuOpen?"site"===(null==(t=this.viewModel)?void 0:t.filterMenuType)?this.renderSiteFilterMenu():"facility"===(null==(i=this.viewModel)?void 0:i.filterMenuType)?this.renderFacilityFilterMenu():null:null}renderSiteFilterMenu(){var e,t;const{messages:i,messagesCommon:s}=this,l=this.site?null==(e=this.viewModel)||null==(t=e.getSite(this.site))?void 0:t.name:i.selector.selectSite,o=v("div",{key:"filter-menu-site-header",class:this.classes(`${m.filterMenuHeader}`)},v("div",{class:this.classes(m.filterMenuHeaderTextGroup)},v(a,{level:this.headingLevel,class:this.classes(m.filterMenuHeaderText)},l)),v("button",{bind:this,title:s.close,class:this.classes(m.esriIcon,m.closeIcon),onclick:this._closeClicked,type:"button"})),n=this.renderSearchInput(),r=this.renderSiteItems();return v("div",{key:"filter-menu-site",class:this.classes(m.filterMenu)},o,n,r)}renderFacilityFilterMenu(){var e,t,i,s;const{messages:l,messagesCommon:o,site:n}=this,r=null==(e=this.viewModel)||null==(t=e.getSite(n))?void 0:t.name,u=this.facility&&(null==(i=this.viewModel)||null==(s=i.getFacility(this.facility))?void 0:s.name)||l.selector.selectFacility,h=this.viewModel.hasMultipleSites?v("button",{bind:this,title:o.back,class:this.classes(m.filterMenuHeaderBack),onclick:this._backClicked,type:"button"},v("span",{class:this.classes(d(this.container)?m.rightIcon:m.leftIcon)})):null,f=this.viewModel.hasMultipleSites?v(a,{level:c(this.headingLevel),class:this.classes(m.filterMenuHeaderSubtext)},r):null,p=v("div",{key:"filter-menu-site-header",class:this.classes(m.filterMenuHeader)},h,v("div",{class:this.classes(m.filterMenuHeaderTextGroup)},v(a,{level:this.headingLevel,class:this.classes(m.filterMenuHeaderText)},u),f),v("button",{bind:this,title:o.close,class:this.classes(m.esriIcon,m.closeIcon),onclick:this._closeClicked,type:"button"})),M=this.renderSearchInput(),g=this.renderFacilityItems();return v("div",{key:"filter-menu-facility",class:this.classes(m.filterMenu)},p,M,g)}renderSearchInput(){const{messagesCommon:e}=this;return v("div",{key:"filter-menu-search",class:this.classes(m.filterMenuSearch)},v("span",{class:this.classes(m.esriIcon,m.searchIcon)}),v("input",{bind:this,key:"filter-menu-search__input",afterCreate:u,"data-node-ref":"_searchInput",class:this.classes(m.filterMenuSearchInput),placeholder:e.search,oninput:this._onSearchChange,onpaste:this._onSearchChange,value:this.viewModel.searchTerm}))}renderBlueCircle(){return v("span",{key:"floor-filter__selected-item-circle",class:this.classes(m.selectedItemCircle)})}renderSiteItems(){var e,t,i,s;if(null==(e=this.viewModel)||null==(t=e.filterFeatures)||null==(i=t.sites)||!i.sitesInfo)return null;const{messages:l}=this,o=this.viewModel.filterFeatures.sites.sitesInfo,n=this.viewModel.filterSites(o).map((e=>this.renderSiteItem(e))),r=0===n.length&&(null==(s=this.viewModel)?void 0:s.searchTerm)&&v("div",{class:this.classes(m.geosceneWidgetContentEmpty)},l.noResults);return v("ul",{key:"filter-menu-items--sites",class:this.classes(m.filterMenuItems),bind:this,afterCreate:u,"data-node-ref":"_sitesListNode","data-id":"sites",onkeydown:this._handleListKeydown,tabIndex:-1,"aria-label":l.selector.sitesLabel},n,r)}renderSiteItem(e){const{name:t,id:i}=e,s=`filter-menu-site--${i}`,l=this.site===i;return v("li",{key:s},v("button",{"data-id":i,"data-list-id":"sites",bind:this,class:this.classes(m.filterMenuSite),onclick:this._siteSelected,onfocus:this._onItemFocus,type:"button"},l&&this.renderBlueCircle(),v("span",{class:this.classes(l?m.filterMenuSelectedItem:m.filterMenuItemName)},t),v("span",{class:this.classes(d(this.container)?m.leftIcon:m.rightIcon)})))}renderFacilityItems(){var e,t,i,s;if(null==(e=this.viewModel)||null==(t=e.filterFeatures)||null==(i=t.facilities)||!i.facilitiesInfo)return null;const{messages:l,site:o}=this,n=this.viewModel.getSite(o),r=this.viewModel.filterFeatures.facilities.facilitiesInfo,a=this.viewModel.filterFacilities(r).map((e=>this.renderFacilityItem(e))),c=0===a.length&&(null==(s=this.viewModel)?void 0:s.searchTerm)&&v("div",{class:this.classes(m.geosceneWidgetContentEmpty)},l.noResults),d=n?f(l.selector.siteFacilitiesLabel,{name:`"${n.name}"`}):l.selector.facilitiesLabel;return v("ul",{key:"filter-menu-items--facilities",class:this.classes(m.filterMenuItems),bind:this,afterCreate:u,"data-node-ref":"_facilitiesListNode","data-id":"facilities",onkeydown:this._handleListKeydown,tabIndex:-1,"aria-label":d},a,c)}renderFacilityItem(e){const{name:t,id:i}=e,s=`filter-menu-facility--${i}`,l=this.facility===i;return v("li",{key:s},v("button",{"data-id":i,"data-list-id":"facilities",bind:this,class:this.classes(m.filterMenuFacility),onclick:this._facilitySelected,onfocus:this._onItemFocus,type:"button"},l&&this.renderBlueCircle(),v("span",{class:this.classes(l?m.filterMenuSelectedItem:m.filterMenuItemName)},t)))}_afterBaseNodeCreate(e){var t,i;this._baseNode&&(null==(i=this._resizeObserver)||i.unobserve(this._baseNode));this._baseNode=e,null==(t=this._resizeObserver)||t.observe(this._baseNode)}_toggleCollapsed(){this.longNames=!this.longNames}_toggleFilterMenu(){var e,t;const i=null!=(e=null==(t=this.viewModel)?void 0:t.filterMenuOpen)&&e;this.viewModel.filterMenuOpen=!i}_setFilterMenuType(e){this.viewModel.filterMenuType=e}_zoomToClicked(){var e,t;if(this.site&&"site"===(null==(e=this.viewModel)?void 0:e.filterMenuType)&&null!=(t=this.viewModel)&&t.filterMenuOpen){var i;const e=null==(i=this.viewModel)?void 0:i.getSite(this.site);this.viewModel.goTo(e)}else if(this.facility){var s;const e=null==(s=this.viewModel)?void 0:s.getFacility(this.facility);this.viewModel.goTo(e)}else if(this.site){var l;const e=null==(l=this.viewModel)?void 0:l.getSite(this.site);this.viewModel.goTo(e)}}_onSearchChange(e){var t;const i=e.target;""===i.value?this.viewModel.searchTerm=null:i.value&&(null==(t=this.viewModel)?void 0:t.searchTerm)!==i.value&&(this.viewModel.searchTerm=i.value.toLowerCase().trim())}_closeClicked(){this.viewModel.searchTerm=null,this.viewModel.filterMenuOpen=!1}_backClicked(){this._setFilterMenuType("site"),this.viewModel.searchTerm=null}_siteSelected(e){const t=e.currentTarget.getAttribute("data-id"),i=this.viewModel.getSite(t);let s=!1;this.site!==t&&(this.facility=void 0,this.level=void 0,s=!0,this.viewModel.levelsExpanded=!1),this.site=t,this.viewModel.searchTerm=null,this._setFilterMenuType("facility"),this.viewModel.goTo(i),s&&this.viewModel.setFloors(null)}_facilitySelected(e){const t=e.currentTarget.getAttribute("data-id"),i=this.viewModel.getFacility(t);let s=!1;if(this.facility!==t){if("base-floors"===this.viewModel.filterMode){var l;const e=null==(l=this.viewModel)?void 0:l.getBaseLevel(i);this.level=e?e.id:void 0}else this.level=void 0;s=!0,this.viewModel.levelsExpanded=!1}if(this.facility=t,this.viewModel.goTo(i),s){const e=this.viewModel.getLevel(this.level);this.viewModel.setFloors(e)}if(!this.viewModel.isNormalMode){const e=this.viewModel.getFacilityLevels(t);(null==e?void 0:e.length)>1&&(this.viewModel.levelsExpanded=!0)}setTimeout((()=>{this._focusActiveLevel()}),50)}_levelSelected(e){const t=e.currentTarget.getAttribute("data-id");this.level=t}_closeLevels(){this.viewModel.levelsExpanded=!1}_isWebScene(e){return"geoscene.WebScene"===e.declaredClass}_getComponentPosition(){var e,t;return null==(e=this.view)||null==(t=e.ui)?void 0:t.getPosition(this.container)}_getPosition(e){switch(e){case"bottom-right":case"bottom-left":return"bottom";default:return"top"}}_handleListKeydown(e){const i=e.currentTarget.getAttribute("data-id");let s=null;"sites"===i||"facilities"===i?(this._activeMenu!==i&&(this._activeMenuIndex.menuItems=-1),this._activeMenu=i,s="menuItems"):"levels"===i&&(s="levels");const l="sites"===i?this._sitesListNode:"facilities"===i?this._facilitiesListNode:"levels"===i?this._levelsListNode:null,o=t(e),n="Tab"===o,r=p.includes(o);r&&e.preventDefault();const a=null==l?void 0:l.getElementsByTagName("li");a&&0!==a.length&&(r||n)&&this._handleItemNavigation(o,e.shiftKey,a,n,s)}_handleItemNavigation(e,t,i,s,l){if(!l)return;this._activeMenuIndex[l]===i.length&&this._activeMenuIndex[l]--,-1===this._activeMenuIndex[l]&&this._activeMenuIndex[l]++;const o=this._activeMenuIndex[l];switch(e){case"Home":this._activeMenuIndex[l]=0;break;case"End":this._activeMenuIndex[l]=i.length-1;break;case"ArrowUp":this._activeMenuIndex[l]=this._activeMenuIndex[l]<=0?i.length-1:this._activeMenuIndex[l]-1;break;case"ArrowDown":this._activeMenuIndex[l]=this._activeMenuIndex[l]===i.length-1?0:this._activeMenuIndex[l]+1}if("Tab"===e&&t&&this._activeMenuIndex[l]>=0&&this._activeMenuIndex[l]--,"Tab"===e&&!t&&this._activeMenuIndex[l]<i.length&&this._activeMenuIndex[l]++,o!==this._activeMenuIndex[l]&&this._activeMenuIndex[l]>-1&&this._activeMenuIndex[l]<i.length&&!s){const e=i[this._activeMenuIndex[l]].getElementsByTagName("button"),t=1===(null==e?void 0:e.length)&&e[0];null==t||t.focus()}}_focusSearch(){var e;null==(e=this._searchInput)||e.focus()}_focusActiveLevel(){var e;const{level:t}=this,i=this._levelsListNode,s=null==i?void 0:i.getElementsByTagName("li");if(!t||!i||!s)return;const l=null==(e=this._facilitiesListNode)?void 0:e.getElementsByTagName("li");this._activeMenuIndex.menuItems=l?l.length-1:-1;const o=[];for(let n=0;n<s.length;n++){const e=s[n].getElementsByTagName("button");1===(null==e?void 0:e.length)&&o.push(e[0])}o.forEach(((e,i)=>{e.getAttribute("data-id")===t&&(e.focus(),this._activeMenuIndex.levels=i)}))}_onItemFocus(e){const t=e.currentTarget,i=t.getAttribute("data-list-id"),s=t.getAttribute("data-id"),l="sites"===i?this._sitesListNode:"facilities"===i?this._facilitiesListNode:"levels"===i?this._levelsListNode:null;if(!l)return;const o=null==l?void 0:l.getElementsByTagName("li");if(!o)return;const n=[];Array.from(o).forEach((e=>{const t=e.getElementsByTagName("button");1===(null==t?void 0:t.length)&&n.push(t[0])}));let r=null;switch(i){case"sites":case"facilities":r="menuItems";break;case"levels":r="levels"}r&&n.forEach(((e,t)=>{e.getAttribute("data-id")===s&&this._activeMenuIndex[r]!==t&&(this._activeMenuIndex[r]=t)}))}};e([l()],M.prototype,"_searchInput",void 0),e([s("viewModel.enabled")],M.prototype,"enabled",void 0),e([s("viewModel.longNames")],M.prototype,"longNames",void 0),e([s("viewModel.minimized")],M.prototype,"minimized",void 0),e([s("viewModel.pinnedLevels")],M.prototype,"pinnedLevels",void 0),e([s("viewModel.site")],M.prototype,"site",void 0),e([s("viewModel.facility")],M.prototype,"facility",void 0),e([s("viewModel.level")],M.prototype,"level",void 0),e([s("viewModel.view")],M.prototype,"view",void 0),e([l({type:r})],M.prototype,"viewModel",void 0),e([l(),h("geoscene/widgets/FloorFilter/t9n/FloorFilter")],M.prototype,"messages",void 0),e([l(),h("geoscene/t9n/common")],M.prototype,"messagesCommon",void 0),e([s("viewModel.goToOverride")],M.prototype,"goToOverride",void 0),e([l()],M.prototype,"headingLevel",void 0),e([s("viewModel.updateWebDocument")],M.prototype,"updateWebDocument",null),M=e([o("geoscene.widgets.FloorFilter")],M);const g=M;export{g as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{eventKey as t}from"../core/events.js";import{watch as i}from"../core/watchUtils.js";import{aliasOf as s}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import n from"./Widget.js";import r from"./FloorFilter/FloorFilterViewModel.js";import{Heading as a,incrementHeadingLevel as c}from"./support/Heading.js";import{isRTL as d,storeNode as u}from"./support/widgetUtils.js";import{messageBundle as h}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{tsx as v}from"./support/jsxFactory.js";import{substitute as f}from"../intl/substitute.js";const m={geosceneWidget:"geoscene-widget",geosceneWidgetButton:"geoscene-widget--button",geosceneWidgetButtonActive:"geoscene-widget--button-active",esriButtonDisabled:"geoscene-button--disabled",esriDisabled:"geoscene-disabled",esriIcon:"geoscene-icon",esriInteractive:"geoscene-interactive",geosceneWidgetContentEmpty:"geoscene-widget__content--empty",floorFilter:"geoscene-floor-filter",floorFilterLayout:"geoscene-floor-filter__layout--",floorFilterPosition:"geoscene-floor-filter__position--",buttonContainer:"geoscene-floor-filter__button-container",buttonContainerLevels:"geoscene-floor-filter__button-container--levels",buttonInfo:"geoscene-floor-filter__button-info",buttonLabel:"geoscene-floor-filter__button-label",browseButton:"geoscene-floor-filter__browse-button",closeLevelsButton:"geoscene-floor-filter__close-levels-button",zoomButton:"geoscene-floor-filter__zoom-button",zoomButtonLevels:"geoscene-floor-filter__zoom-button--levels",minimizeToggleButton:"geoscene-floor-filter__minimize-toggle-button",levelsContainer:"geoscene-floor-filter__levels-container",levelButton:"geoscene-floor-filter__level-button",levelButtonActive:"geoscene-floor-filter__level-button--active",separator:"geoscene-floor-filter__separator",filterMenu:"geoscene-floor-filter__filter-menu",filterMenuHeader:"geoscene-floor-filter__filter-menu-header",filterMenuHeaderTextGroup:"geoscene-floor-filter__filter-menu-header-text-group",filterMenuHeaderText:"geoscene-floor-filter__filter-menu-header-text",filterMenuHeaderSubtext:"geoscene-floor-filter__filter-menu-header-subtext",filterMenuHeaderBack:"geoscene-floor-filter__filter-menu-header-back",filterMenuSearch:"geoscene-floor-filter__filter-menu-search",filterMenuSearchInput:"geoscene-floor-filter__filter-menu-search-input",filterMenuItems:"geoscene-floor-filter__filter-menu-items",filterMenuItemName:"geoscene-floor-filter__filter-menu-item-name",filterMenuSelectedItem:"geoscene-floor-filter__filter-menu-item-name--selected",filterMenuSite:"geoscene-floor-filter__filter-menu-site",filterMenuFacility:"geoscene-floor-filter__filter-menu-facility",selectedItemCircle:"geoscene-floor-filter__selected-item-circle",urbanIcon:"geoscene-icon-urban-model",zoomToIcon:"geoscene-icon-zoom-to-object",collapseIconRight:"geoscene-icon-collapse",collapseIconLeft:"geoscene-icon-expand",expandIconRight:"geoscene-icon-expand",expandIconLeft:"geoscene-icon-collapse",closeIcon:"geoscene-icon-close",searchIcon:"geoscene-icon-search",rightIcon:"geoscene-icon-right",leftIcon:"geoscene-icon-left"},p=["ArrowUp","ArrowDown","End","Home"];let M=class extends n{constructor(e,t){super(e,t),this._activeMenu=null,this._activeMenuIndex={levels:-1,menuItems:-1},this._baseNode=null,this._facilitiesListNode=null,this._levelsListNode=null,this._sitesListNode=null,this._searchInput=null,this.enabled=null,this.longNames=null,this.minimized=null,this.pinnedLevels=null,this.site=null,this.facility=null,this.level=null,this.view=null,this.viewModel=new r,this.messages=null,this.messagesCommon=null,this.goToOverride=null,this.headingLevel=2,this._resizeObserver=new ResizeObserver((()=>this.scheduleRender())),this.own(i(this,"_searchInput",(()=>this._focusSearch())))}destroy(){this._resizeObserver.disconnect()}updateWebDocument(){}render(){var e;const{longNames:t}=this,i=t&&this.viewModel.isNormalMode?"expanded":"collapsed",s=this.renderButtons(),l=this.renderFilterMenu(),o=v("div",{class:this.classes(m.separator)}),n=this._getComponentPosition(),r=this._getPosition(n),a="top-right"===n||"bottom-right"===n,c="top-left"===n||"bottom-left"===n,u=d(this.container),h=u&&c||!u&&a?l:s,f=u&&c||!u&&a?s:l;return v("div",{afterCreate:this._afterBaseNodeCreate,key:"floor-filter-menu",class:this.classes(m.floorFilter,m.geosceneWidget,`${m.floorFilterLayout}${i}`,`${m.floorFilterPosition}${r}`)},h,(null==(e=this.viewModel)?void 0:e.filterMenuOpen)&&o,f)}renderButtons(){const e=this._getComponentPosition(),t=[];return"top"===this._getPosition(e)?(t.push(this.renderBrowseButton()),t.push(this.renderLevelButtons()),t.push(this.renderCloseLevelsButton()),t.push(this.renderZoomButton()),t.push(this.renderCollapseToggleButton())):(t.push(this.renderCollapseToggleButton()),t.push(this.renderZoomButton()),t.push(this.renderCloseLevelsButton()),t.push(this.renderLevelButtons()),t.push(this.renderBrowseButton())),v("div",{key:"button-container",class:this.classes(m.geosceneWidget,m.buttonContainer)},t)}renderBrowseButton(){var e;const{longNames:t,messages:i}=this;return v("button",{key:"browse-button",title:i.buttons.browse,bind:this,class:this.classes(m.geosceneWidget,m.geosceneWidgetButton,m.esriInteractive,("loading"===this.viewModel.state||"disabled"===this.viewModel.state)&&m.esriButtonDisabled,m.browseButton,(null==(e=this.viewModel)?void 0:e.filterMenuOpen)&&m.geosceneWidgetButtonActive),"aria-expanded":this.viewModel.filterMenuOpen.toString(),"aria-label":i.buttons.browse,onclick:this._toggleFilterMenu,type:"button"},v("div",{class:this.classes(m.buttonInfo)},v("span",{class:this.classes(m.esriIcon,m.urbanIcon)}),v("span",{class:this.classes(m.buttonLabel)},t&&this.viewModel.isNormalMode&&i.buttons.browse)))}renderLevelButtons(){var e,t,i,s,l;if(null==(e=this.viewModel)||null==(t=e.filterFeatures)||null==(i=t.levels)||!i.levelsInfo||!this.facility)return null;const{facility:o,messagesCommon:n,messages:r}=this,a=null==(s=this.viewModel)?void 0:s.getFacility(o),c=(null==(l=this.viewModel)?void 0:l.getFacilityLevels(o)).map((e=>this.renderLevelButton(e)));if(!c.length)return null;const d=a&&f(r.selector.levelsLabel,{name:`"${a.name}"`});if(this._isWebScene(this.view.map)&&(null==c?void 0:c.length)>1){const e={id:`all--${o}`,facilityId:o,shortName:n.all,longName:n.all,levelNumber:null,verticalOrder:null},t=this.renderLevelButton(e);c.push(t)}return v("ul",{key:"levels-button-container",class:this.classes(m.levelsContainer),bind:this,"data-id":"levels",afterCreate:u,"data-node-ref":"_levelsListNode","aria-label":d,onkeydown:this._handleListKeydown},c)}renderLevelButton(e){const{longNames:t}=this,{shortName:i,longName:s,id:l}=e,o=`levels--${l}`,n=this.level===l,r=t&&this.viewModel.isNormalMode?s:i;return this.viewModel.isNormalMode||n||this.viewModel.levelsExpanded?v("li",{key:o},v("button",{"data-id":l,"data-list-id":"levels",bind:this,class:this.classes(m.geosceneWidgetButton,n?m.geosceneWidgetButtonActive:null,m.esriInteractive,m.levelButton),onclick:this._levelSelected,onfocus:this._onItemFocus,type:"button"},r)):null}renderCloseLevelsButton(){if(!this.level||this.viewModel.isNormalMode||!this.viewModel.levelsExpanded)return null;const{messagesCommon:e}=this;return v("button",{key:"close-levels-button",title:e.close,bind:this,class:this.classes(m.geosceneWidget,m.geosceneWidgetButton,m.esriInteractive,m.closeLevelsButton),"aria-label":e.close,onclick:this._closeLevels,type:"button"},v("div",{class:this.classes(m.buttonInfo)},v("span",{class:this.classes(m.esriIcon,m.closeIcon)})))}renderZoomButton(){var e,t,i,s,l;const{longNames:o,messages:n,facility:r,site:a}=this,c=null==(e=this.viewModel)?void 0:e.filterMenuType,d=null==(t=this.viewModel)?void 0:t.filterMenuOpen,u=null==(i=this.viewModel)?void 0:i.getSite(a),h=null==(s=this.viewModel)?void 0:s.getFacility(r),f="site"===c&&d?!u:!h;return v("button",{key:"zoom-button",title:n.buttons.zoomTo,bind:this,class:this.classes(m.geosceneWidget,m.geosceneWidgetButton,f&&m.esriButtonDisabled,m.esriInteractive,(null==(l=this.viewModel)?void 0:l.getFacilityLevels(r).length)>0?m.zoomButtonLevels:m.zoomButton),"aria-label":n.buttons.zoomTo,onclick:this._zoomToClicked,type:"button"},v("div",{class:this.classes(m.buttonInfo)},v("span",{class:this.classes(m.esriIcon,m.zoomToIcon)}),v("span",{class:this.classes(m.buttonLabel)},o&&this.viewModel.isNormalMode&&n.buttons.zoomTo)))}renderCollapseToggleButton(){const{longNames:e,messagesCommon:t}=this,i=e?m.collapseIconRight:m.expandIconRight,s=this.classes(m.esriIcon,i),l=e?t.collapse:t.expand;return v("button",{key:"minimize-toggle-button",title:l,bind:this,class:this.classes(m.geosceneWidget,m.geosceneWidgetButton,m.esriInteractive,m.minimizeToggleButton),"aria-label":l,onclick:this._toggleCollapsed,type:"button"},v("div",{class:this.classes(m.buttonInfo)},v("span",{class:s}),v("span",{class:this.classes(m.buttonLabel)},e&&this.viewModel.isNormalMode&&t.collapse)))}renderFilterMenu(){var e,t,i;return null!=(e=this.viewModel)&&e.filterMenuOpen?"site"===(null==(t=this.viewModel)?void 0:t.filterMenuType)?this.renderSiteFilterMenu():"facility"===(null==(i=this.viewModel)?void 0:i.filterMenuType)?this.renderFacilityFilterMenu():null:null}renderSiteFilterMenu(){var e,t;const{messages:i,messagesCommon:s}=this,l=this.site?null==(e=this.viewModel)||null==(t=e.getSite(this.site))?void 0:t.name:i.selector.selectSite,o=v("div",{key:"filter-menu-site-header",class:this.classes(`${m.filterMenuHeader}`)},v("div",{class:this.classes(m.filterMenuHeaderTextGroup)},v(a,{level:this.headingLevel,class:this.classes(m.filterMenuHeaderText)},l)),v("button",{bind:this,title:s.close,class:this.classes(m.esriIcon,m.closeIcon),onclick:this._closeClicked,type:"button"})),n=this.renderSearchInput(),r=this.renderSiteItems();return v("div",{key:"filter-menu-site",class:this.classes(m.filterMenu)},o,n,r)}renderFacilityFilterMenu(){var e,t,i,s;const{messages:l,messagesCommon:o,site:n}=this,r=null==(e=this.viewModel)||null==(t=e.getSite(n))?void 0:t.name,u=this.facility&&(null==(i=this.viewModel)||null==(s=i.getFacility(this.facility))?void 0:s.name)||l.selector.selectFacility,h=this.viewModel.hasMultipleSites?v("button",{bind:this,title:o.back,class:this.classes(m.filterMenuHeaderBack),onclick:this._backClicked,type:"button"},v("span",{class:this.classes(d(this.container)?m.rightIcon:m.leftIcon)})):null,f=this.viewModel.hasMultipleSites?v(a,{level:c(this.headingLevel),class:this.classes(m.filterMenuHeaderSubtext)},r):null,p=v("div",{key:"filter-menu-site-header",class:this.classes(m.filterMenuHeader)},h,v("div",{class:this.classes(m.filterMenuHeaderTextGroup)},v(a,{level:this.headingLevel,class:this.classes(m.filterMenuHeaderText)},u),f),v("button",{bind:this,title:o.close,class:this.classes(m.esriIcon,m.closeIcon),onclick:this._closeClicked,type:"button"})),M=this.renderSearchInput(),g=this.renderFacilityItems();return v("div",{key:"filter-menu-facility",class:this.classes(m.filterMenu)},p,M,g)}renderSearchInput(){const{messagesCommon:e}=this;return v("div",{key:"filter-menu-search",class:this.classes(m.filterMenuSearch)},v("span",{class:this.classes(m.esriIcon,m.searchIcon)}),v("input",{bind:this,key:"filter-menu-search__input",afterCreate:u,"data-node-ref":"_searchInput",class:this.classes(m.filterMenuSearchInput),placeholder:e.search,oninput:this._onSearchChange,onpaste:this._onSearchChange,value:this.viewModel.searchTerm}))}renderBlueCircle(){return v("span",{key:"floor-filter__selected-item-circle",class:this.classes(m.selectedItemCircle)})}renderSiteItems(){var e,t,i,s;if(null==(e=this.viewModel)||null==(t=e.filterFeatures)||null==(i=t.sites)||!i.sitesInfo)return null;const{messages:l}=this,o=this.viewModel.filterFeatures.sites.sitesInfo,n=this.viewModel.filterSites(o).map((e=>this.renderSiteItem(e))),r=0===n.length&&(null==(s=this.viewModel)?void 0:s.searchTerm)&&v("div",{class:this.classes(m.geosceneWidgetContentEmpty)},l.noResults);return v("ul",{key:"filter-menu-items--sites",class:this.classes(m.filterMenuItems),bind:this,afterCreate:u,"data-node-ref":"_sitesListNode","data-id":"sites",onkeydown:this._handleListKeydown,tabIndex:-1,"aria-label":l.selector.sitesLabel},n,r)}renderSiteItem(e){const{name:t,id:i}=e,s=`filter-menu-site--${i}`,l=this.site===i;return v("li",{key:s},v("button",{"data-id":i,"data-list-id":"sites",bind:this,class:this.classes(m.filterMenuSite),onclick:this._siteSelected,onfocus:this._onItemFocus,type:"button"},l&&this.renderBlueCircle(),v("span",{class:this.classes(l?m.filterMenuSelectedItem:m.filterMenuItemName)},t),v("span",{class:this.classes(d(this.container)?m.leftIcon:m.rightIcon)})))}renderFacilityItems(){var e,t,i,s;if(null==(e=this.viewModel)||null==(t=e.filterFeatures)||null==(i=t.facilities)||!i.facilitiesInfo)return null;const{messages:l,site:o}=this,n=this.viewModel.getSite(o),r=this.viewModel.filterFeatures.facilities.facilitiesInfo,a=this.viewModel.filterFacilities(r).map((e=>this.renderFacilityItem(e))),c=0===a.length&&(null==(s=this.viewModel)?void 0:s.searchTerm)&&v("div",{class:this.classes(m.geosceneWidgetContentEmpty)},l.noResults),d=n?f(l.selector.siteFacilitiesLabel,{name:`"${n.name}"`}):l.selector.facilitiesLabel;return v("ul",{key:"filter-menu-items--facilities",class:this.classes(m.filterMenuItems),bind:this,afterCreate:u,"data-node-ref":"_facilitiesListNode","data-id":"facilities",onkeydown:this._handleListKeydown,tabIndex:-1,"aria-label":d},a,c)}renderFacilityItem(e){const{name:t,id:i}=e,s=`filter-menu-facility--${i}`,l=this.facility===i;return v("li",{key:s},v("button",{"data-id":i,"data-list-id":"facilities",bind:this,class:this.classes(m.filterMenuFacility),onclick:this._facilitySelected,onfocus:this._onItemFocus,type:"button"},l&&this.renderBlueCircle(),v("span",{class:this.classes(l?m.filterMenuSelectedItem:m.filterMenuItemName)},t)))}_afterBaseNodeCreate(e){var t,i;this._baseNode&&(null==(i=this._resizeObserver)||i.unobserve(this._baseNode));this._baseNode=e,null==(t=this._resizeObserver)||t.observe(this._baseNode)}_toggleCollapsed(){this.longNames=!this.longNames}_toggleFilterMenu(){var e,t;const i=null!=(e=null==(t=this.viewModel)?void 0:t.filterMenuOpen)&&e;this.viewModel.filterMenuOpen=!i}_setFilterMenuType(e){this.viewModel.filterMenuType=e}_zoomToClicked(){var e,t;if(this.site&&"site"===(null==(e=this.viewModel)?void 0:e.filterMenuType)&&null!=(t=this.viewModel)&&t.filterMenuOpen){var i;const e=null==(i=this.viewModel)?void 0:i.getSite(this.site);this.viewModel.goTo(e)}else if(this.facility){var s;const e=null==(s=this.viewModel)?void 0:s.getFacility(this.facility);this.viewModel.goTo(e)}else if(this.site){var l;const e=null==(l=this.viewModel)?void 0:l.getSite(this.site);this.viewModel.goTo(e)}}_onSearchChange(e){var t;const i=e.target;""===i.value?this.viewModel.searchTerm=null:i.value&&(null==(t=this.viewModel)?void 0:t.searchTerm)!==i.value&&(this.viewModel.searchTerm=i.value.toLowerCase().trim())}_closeClicked(){this.viewModel.searchTerm=null,this.viewModel.filterMenuOpen=!1}_backClicked(){this._setFilterMenuType("site"),this.viewModel.searchTerm=null}_siteSelected(e){const t=e.currentTarget.getAttribute("data-id"),i=this.viewModel.getSite(t);let s=!1;this.site!==t&&(this.facility=void 0,this.level=void 0,s=!0,this.viewModel.levelsExpanded=!1),this.site=t,this.viewModel.searchTerm=null,this._setFilterMenuType("facility"),this.viewModel.goTo(i),s&&this.viewModel.setFloors(null)}_facilitySelected(e){const t=e.currentTarget.getAttribute("data-id"),i=this.viewModel.getFacility(t);let s=!1;if(this.facility!==t){if("base-floors"===this.viewModel.filterMode){var l;const e=null==(l=this.viewModel)?void 0:l.getBaseLevel(i);this.level=e?e.id:void 0}else this.level=void 0;s=!0,this.viewModel.levelsExpanded=!1}if(this.facility=t,this.viewModel.goTo(i),s){const e=this.viewModel.getLevel(this.level);this.viewModel.setFloors(e)}if(!this.viewModel.isNormalMode){const e=this.viewModel.getFacilityLevels(t);(null==e?void 0:e.length)>1&&(this.viewModel.levelsExpanded=!0)}setTimeout((()=>{this._focusActiveLevel()}),50)}_levelSelected(e){const t=e.currentTarget.getAttribute("data-id");this.level=t}_closeLevels(){this.viewModel.levelsExpanded=!1}_isWebScene(e){return"geoscene.WebScene"===e.declaredClass}_getComponentPosition(){var e,t;return null==(e=this.view)||null==(t=e.ui)?void 0:t.getPosition(this.container)}_getPosition(e){switch(e){case"bottom-right":case"bottom-left":return"bottom";default:return"top"}}_handleListKeydown(e){const i=e.currentTarget.getAttribute("data-id");let s=null;"sites"===i||"facilities"===i?(this._activeMenu!==i&&(this._activeMenuIndex.menuItems=-1),this._activeMenu=i,s="menuItems"):"levels"===i&&(s="levels");const l="sites"===i?this._sitesListNode:"facilities"===i?this._facilitiesListNode:"levels"===i?this._levelsListNode:null,o=t(e),n="Tab"===o,r=p.includes(o);r&&e.preventDefault();const a=null==l?void 0:l.getElementsByTagName("li");a&&0!==a.length&&(r||n)&&this._handleItemNavigation(o,e.shiftKey,a,n,s)}_handleItemNavigation(e,t,i,s,l){if(!l)return;this._activeMenuIndex[l]===i.length&&this._activeMenuIndex[l]--,-1===this._activeMenuIndex[l]&&this._activeMenuIndex[l]++;const o=this._activeMenuIndex[l];switch(e){case"Home":this._activeMenuIndex[l]=0;break;case"End":this._activeMenuIndex[l]=i.length-1;break;case"ArrowUp":this._activeMenuIndex[l]=this._activeMenuIndex[l]<=0?i.length-1:this._activeMenuIndex[l]-1;break;case"ArrowDown":this._activeMenuIndex[l]=this._activeMenuIndex[l]===i.length-1?0:this._activeMenuIndex[l]+1}if("Tab"===e&&t&&this._activeMenuIndex[l]>=0&&this._activeMenuIndex[l]--,"Tab"===e&&!t&&this._activeMenuIndex[l]<i.length&&this._activeMenuIndex[l]++,o!==this._activeMenuIndex[l]&&this._activeMenuIndex[l]>-1&&this._activeMenuIndex[l]<i.length&&!s){const e=i[this._activeMenuIndex[l]].getElementsByTagName("button"),t=1===(null==e?void 0:e.length)&&e[0];null==t||t.focus()}}_focusSearch(){var e;null==(e=this._searchInput)||e.focus()}_focusActiveLevel(){var e;const{level:t}=this,i=this._levelsListNode,s=null==i?void 0:i.getElementsByTagName("li");if(!t||!i||!s)return;const l=null==(e=this._facilitiesListNode)?void 0:e.getElementsByTagName("li");this._activeMenuIndex.menuItems=l?l.length-1:-1;const o=[];for(let n=0;n<s.length;n++){const e=s[n].getElementsByTagName("button");1===(null==e?void 0:e.length)&&o.push(e[0])}o.forEach(((e,i)=>{e.getAttribute("data-id")===t&&(e.focus(),this._activeMenuIndex.levels=i)}))}_onItemFocus(e){const t=e.currentTarget,i=t.getAttribute("data-list-id"),s=t.getAttribute("data-id"),l="sites"===i?this._sitesListNode:"facilities"===i?this._facilitiesListNode:"levels"===i?this._levelsListNode:null;if(!l)return;const o=null==l?void 0:l.getElementsByTagName("li");if(!o)return;const n=[];Array.from(o).forEach((e=>{const t=e.getElementsByTagName("button");1===(null==t?void 0:t.length)&&n.push(t[0])}));let r=null;switch(i){case"sites":case"facilities":r="menuItems";break;case"levels":r="levels"}r&&n.forEach(((e,t)=>{e.getAttribute("data-id")===s&&this._activeMenuIndex[r]!==t&&(this._activeMenuIndex[r]=t)}))}};e([l()],M.prototype,"_searchInput",void 0),e([s("viewModel.enabled")],M.prototype,"enabled",void 0),e([s("viewModel.longNames")],M.prototype,"longNames",void 0),e([s("viewModel.minimized")],M.prototype,"minimized",void 0),e([s("viewModel.pinnedLevels")],M.prototype,"pinnedLevels",void 0),e([s("viewModel.site")],M.prototype,"site",void 0),e([s("viewModel.facility")],M.prototype,"facility",void 0),e([s("viewModel.level")],M.prototype,"level",void 0),e([s("viewModel.view")],M.prototype,"view",void 0),e([l({type:r})],M.prototype,"viewModel",void 0),e([l(),h("geoscene/widgets/FloorFilter/t9n/FloorFilter")],M.prototype,"messages",void 0),e([l(),h("geoscene/t9n/common")],M.prototype,"messagesCommon",void 0),e([s("viewModel.goToOverride")],M.prototype,"goToOverride",void 0),e([l()],M.prototype,"headingLevel",void 0),e([s("viewModel.updateWebDocument")],M.prototype,"updateWebDocument",null),M=e([o("geoscene.widgets.FloorFilter")],M);const g=M;export{g as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{aliasOf as s}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as t}from"../core/accessorSupport/decorators/property.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import o from"./Widget.js";import i from"./Fullscreen/FullscreenViewModel.js";import{accessibleHandler as l}from"./support/decorators/accessibleHandler.js";import{messageBundle as a}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{tsx as n}from"./support/jsxFactory.js";import"./support/widgetUtils.js";const d={base:"esri-fullscreen esri-widget--button esri-widget",text:"geoscene-icon-font-fallback-text",icon:"geoscene-icon",enter:"geoscene-icon-zoom-out-fixed",exit:"geoscene-icon-zoom-in-fixed",disabled:"esri-disabled"};let c=class extends o{constructor(e,s){super(e,s),this.element=null,this.label=void 0,this.messages=null,this.view=null,this.viewModel=new i}get fullscreenTitle(){var e;const s=null==(e=this.viewModel)?void 0:e.state;return"active"===s?this.messages.exit:"ready"===s?this.messages.enter:""}render(){var e;const s=null==(e=this.viewModel)?void 0:e.state,{fullscreenTitle:t}=this,r={[d.disabled]:"disabled"===s||"feature-unsupported"===s};return n("div",{bind:this,class:this.classes(d.base,r),role:"button",tabIndex:0,onclick:this._toggle,onkeydown:this._toggle,"aria-label":t,title:t},this.renderIcon(),this.renderTitle())}renderIcon(){var e;const s=null==(e=this.viewModel)?void 0:e.state,t={[d.enter]:"ready"===s||"disabled"===s||"feature-unsupported"===s,[d.exit]:"active"===s};return n("span",{class:this.classes(d.icon,t),"aria-hidden":"true"})}renderTitle(){return n("span",{class:d.text},this.fullscreenTitle)}_toggle(){this.viewModel.toggle()}};e([s("viewModel.element")],c.prototype,"element",void 0),e([t({readOnly:!0})],c.prototype,"fullscreenTitle",null),e([t({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],c.prototype,"label",void 0),e([t(),a("geoscene/widgets/Fullscreen/t9n/Fullscreen")],c.prototype,"messages",void 0),e([s("viewModel.view")],c.prototype,"view",void 0),e([t({type:i})],c.prototype,"viewModel",void 0),e([l()],c.prototype,"_toggle",null),c=e([r("geoscene.widgets.Fullscreen")],c);const p=c;export{p as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{aliasOf as s}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as t}from"../core/accessorSupport/decorators/property.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import o from"./Widget.js";import i from"./Fullscreen/FullscreenViewModel.js";import{accessibleHandler as l}from"./support/decorators/accessibleHandler.js";import{messageBundle as a}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{tsx as n}from"./support/jsxFactory.js";import"./support/widgetUtils.js";const d={base:"geoscene-fullscreen geoscene-widget--button geoscene-widget",text:"geoscene-icon-font-fallback-text",icon:"geoscene-icon",enter:"geoscene-icon-zoom-out-fixed",exit:"geoscene-icon-zoom-in-fixed",disabled:"geoscene-disabled"};let c=class extends o{constructor(e,s){super(e,s),this.element=null,this.label=void 0,this.messages=null,this.view=null,this.viewModel=new i}get fullscreenTitle(){var e;const s=null==(e=this.viewModel)?void 0:e.state;return"active"===s?this.messages.exit:"ready"===s?this.messages.enter:""}render(){var e;const s=null==(e=this.viewModel)?void 0:e.state,{fullscreenTitle:t}=this,r={[d.disabled]:"disabled"===s||"feature-unsupported"===s};return n("div",{bind:this,class:this.classes(d.base,r),role:"button",tabIndex:0,onclick:this._toggle,onkeydown:this._toggle,"aria-label":t,title:t},this.renderIcon(),this.renderTitle())}renderIcon(){var e;const s=null==(e=this.viewModel)?void 0:e.state,t={[d.enter]:"ready"===s||"disabled"===s||"feature-unsupported"===s,[d.exit]:"active"===s};return n("span",{class:this.classes(d.icon,t),"aria-hidden":"true"})}renderTitle(){return n("span",{class:d.text},this.fullscreenTitle)}_toggle(){this.viewModel.toggle()}};e([s("viewModel.element")],c.prototype,"element",void 0),e([t({readOnly:!0})],c.prototype,"fullscreenTitle",null),e([t({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],c.prototype,"label",void 0),e([t(),a("geoscene/widgets/Fullscreen/t9n/Fullscreen")],c.prototype,"messages",void 0),e([s("viewModel.view")],c.prototype,"view",void 0),e([t({type:i})],c.prototype,"viewModel",void 0),e([l()],c.prototype,"_toggle",null),c=e([r("geoscene.widgets.Fullscreen")],c);const p=c;export{p as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{isSome as t}from"../core/maybe.js";import{aliasOf as i}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import r from"./Widget.js";import n from"./Histogram/HistogramViewModel.js";import{onResize as o}from"./support/widgetUtils.js";import{messageBundle as l}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{tsx as d}from"./support/jsxFactory.js";import{substitute as h}from"../intl/substitute.js";var u;const c={base:"esri-histogram",horizontalLayout:"esri-histogram--horizontal",verticalLayout:"esri-histogram--vertical",content:"esri-histogram__content",svg:"esri-histogram__svg",bar:"esri-histogram__bar",bars:"esri-histogram__bars",label:"esri-histogram__label",dataLines:"esri-histogram__data-lines",dataLinesSubgroup:"esri-histogram__data-lines-subgroup",dataLine:"esri-histogram__data-line",averageLabel:"esri-histogram__average-label",averageDataLine:"esri-histogram__average-data-line",averageSymbol:"esri-histogram__average-symbol",geosceneWidget:"esri-widget",widgetIcon:"geoscene-icon-edit",disabled:"esri-disabled"};let p=u=class extends r{constructor(e,t){super(e,t),this._bgFillId=`${this.id}-bg-fill`,this._containerNode=null,this._containerDimensions={width:0,height:0},this._defaultBarColor="#d8d8d8",this.average=null,this.barCreatedFunction=null,this.bins=null,this.dataLines=null,this.dataLineCreatedFunction=null,this.dataLineUpdatedFunction=null,this.label=void 0,this.labelFormatFunction=null,this.max=null,this.messages=null,this.min=null,this.state=null,this.viewModel=new n}set layout(e){"vertical"!==e&&(e="horizontal"),this._set("layout",e)}static fromHistogramResult(e){const{bins:t,maxValue:i,minValue:s}=e;return new u({bins:t,max:i,min:s})}render(){const{label:e,layout:t,state:i}=this,s=this.classes(c.base,c.geosceneWidget,"horizontal"===t?c.horizontalLayout:c.verticalLayout,"disabled"===i?c.disabled:null);return d("div",{"aria-label":e,class:s,bind:this,afterCreate:this._afterContainerNodeCreate},"ready"===i?this.renderContent():null)}renderContent(){if(!this._containerNode)return;const e=this._bgFillId,t=`clip-path: url(#${e})`;return d("div",{class:c.content},d("svg",{class:c.svg,xmlns:"http://www.w3.org/2000/svg"},d("defs",null,this.renderFillDefinition(e)),d("g",{style:t},this.renderBarsGroup()),this.renderLinesGroup()))}renderBarsGroup(){return d("g",{class:this.classes(c.bars)},this.renderBars())}renderBars(){const{layout:e,viewModel:{binRange:t,range:i}}=this;if(!t||!i)return;const s=t/i,{width:a,height:r}=this._containerDimensions;if(0===r&&0===a)return;if(0===r&&0!==a)return void this.scheduleRender();const[n,o]="vertical"===e?[r*s,a]:[r,a*s];return this._getBarDimensions(n,o).map((([e,t],i)=>this.renderBar(i,e,t)))}renderBar(e,t,i){const{bins:s,layout:a,max:r,messages:n,viewModel:{range:o}}=this,{width:l,height:u}=this._containerDimensions,p=s.slice()[e],{count:g,maxValue:m,minValue:b}=p,v=r-m,[_,L]="vertical"===a?[0,v*(u/o)]:[l-i-v*(l/o),u-t],y=h(n.barLabel,{count:g,maxValue:m,minValue:b});return d("rect",{"aria-label":y,afterCreate:this._afterBarCreate,bind:this,class:c.bar,"data-index":e,fill:this._defaultBarColor,height:t,role:"img","shape-rendering":"crispEdges","stroke-width":"0",width:i,x:_,y:L})}renderLinesGroup(){return d("g",{class:this.classes(c.dataLines)},this.renderAverageLine(),this.renderCustomLines())}renderAverageLine(){const{average:e}=this;if(!t(e))return;const i=[d("tspan",{class:this.classes(c.averageSymbol)},"x̄ "),d("tspan",{class:this.classes(c.averageLabel)},this.labelFormatFunction?this.labelFormatFunction(e,"average"):e)];return d("g",{afterCreate:this._afterLinesSubgroupCreate,afterUpdate:this._afterLinesSubgroupUpdate,bind:this,class:this.classes(c.dataLinesSubgroup)},d("title",{key:"title"},e),this.renderLine(e,this.classes(c.averageDataLine)),this.renderLabel(e,i))}renderCustomLines(){if(this.dataLines&&this.dataLines.length)return this.dataLines.map((({value:e,label:t},i)=>this.renderLineSubgroup(i,e,t)))}renderLineSubgroup(e,t,i){return d("g",{afterCreate:this._afterLinesSubgroupCreate,afterUpdate:this._afterLinesSubgroupUpdate,bind:this,class:this.classes(c.dataLinesSubgroup),"data-index":e},d("title",{key:"title"},t),this.renderLine(t),this.renderLabel(t,i))}renderLine(e,t){const[i,s,a,r]=this._getLinePosition(e);return d("line",{class:this.classes(c.dataLine,t),x1:i,x2:s,y1:a,y2:r,"shape-rendering":"crispEdges"})}renderLabel(e,t,i){const[s,a]=this._getLabelPosition(e),r=2;return d("text",{class:this.classes(c.label,i),"text-anchor":"end",transform:"horizontal"===this.layout?"rotate(270)":null,x:s,y:a-r},t)}renderFillDefinition(e){const{width:t,height:i}=this._containerDimensions;return d("clipPath",{id:e},d("rect",{x:"0",y:"0",width:t,height:i}))}_afterContainerNodeCreate(e){this._containerNode=e,this.own(o(e,(e=>{const{width:t,height:i}=e.contentRect;this._containerDimensions={width:t,height:i}})))}_afterBarCreate(e){if(this.barCreatedFunction){const t=e.dataset?parseInt(e.dataset.index,10):e.getAttribute("data-index")?parseInt(e.getAttribute("data-index"),10):null;this.barCreatedFunction(isNaN(t)?null:t,e)}}_afterLinesSubgroupCreate(e){if(this.dataLineCreatedFunction){const t=e.dataset?parseInt(e.dataset.index,10):e.getAttribute("data-index")?parseInt(e.getAttribute("data-index"),10):null,i=e.childNodes[0],s=e.childNodes[1]?e.childNodes[1]:null;this.dataLineCreatedFunction(i,s,isNaN(t)?null:t)}}_afterLinesSubgroupUpdate(e){if(this.dataLineUpdatedFunction){const t=e.dataset?parseInt(e.dataset.index,10):e.getAttribute("data-index")?parseInt(e.getAttribute("data-index"),10):null,i=e.childNodes[0],s=e.childNodes[1]?e.childNodes[1]:null;this.dataLineUpdatedFunction(i,s,isNaN(t)?null:t)}}_getBarDimensions(e,t){const{bins:i,layout:s}=this,a=i?i.map((e=>e.count)):[],r=Math.max.apply(Math,a);return a.map((i=>"vertical"===s?[e/a.length,0!==r?i/r*t:0]:[0!==r?i/r*e:0,t/a.length]))}_getLinePosition(e){const{layout:t,min:i,viewModel:{range:s}}=this,a=Math.round((e-i)/s*100)/100,{width:r,height:n}=this._containerDimensions,[o,l]=[a*r||1,n-a*n||1];return"vertical"===t?[0,"100%",l,l]:[o,o,"100%",0]}_getLabelPosition(e){const{layout:t,min:i,viewModel:{range:s}}=this,a=Math.round((e-i)/s*100)/100,{width:r,height:n}=this._containerDimensions;return"vertical"===t?[r,n-a*n]:[0,a*r]}};e([s()],p.prototype,"_bgFillId",void 0),e([s()],p.prototype,"_containerNode",void 0),e([s()],p.prototype,"_containerDimensions",void 0),e([s()],p.prototype,"_defaultBarColor",void 0),e([i("viewModel.average")],p.prototype,"average",void 0),e([s()],p.prototype,"barCreatedFunction",void 0),e([i("viewModel.bins")],p.prototype,"bins",void 0),e([s()],p.prototype,"dataLines",void 0),e([s()],p.prototype,"dataLineCreatedFunction",void 0),e([s()],p.prototype,"dataLineUpdatedFunction",void 0),e([s({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],p.prototype,"label",void 0),e([i("viewModel.labelFormatFunction")],p.prototype,"labelFormatFunction",void 0),e([s({value:"horizontal"})],p.prototype,"layout",null),e([i("viewModel.max")],p.prototype,"max",void 0),e([s(),l("geoscene/widgets/Histogram/t9n/Histogram")],p.prototype,"messages",void 0),e([i("viewModel.min")],p.prototype,"min",void 0),e([i("viewModel.state")],p.prototype,"state",void 0),e([s()],p.prototype,"viewModel",void 0),p=u=e([a("geoscene.widgets.Histogram")],p);const g=p;export{g as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{isSome as t}from"../core/maybe.js";import{aliasOf as i}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import r from"./Widget.js";import n from"./Histogram/HistogramViewModel.js";import{onResize as o}from"./support/widgetUtils.js";import{messageBundle as l}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{tsx as d}from"./support/jsxFactory.js";import{substitute as h}from"../intl/substitute.js";var u;const c={base:"geoscene-histogram",horizontalLayout:"geoscene-histogram--horizontal",verticalLayout:"geoscene-histogram--vertical",content:"geoscene-histogram__content",svg:"geoscene-histogram__svg",bar:"geoscene-histogram__bar",bars:"geoscene-histogram__bars",label:"geoscene-histogram__label",dataLines:"geoscene-histogram__data-lines",dataLinesSubgroup:"geoscene-histogram__data-lines-subgroup",dataLine:"geoscene-histogram__data-line",averageLabel:"geoscene-histogram__average-label",averageDataLine:"geoscene-histogram__average-data-line",averageSymbol:"geoscene-histogram__average-symbol",geosceneWidget:"geoscene-widget",widgetIcon:"geoscene-icon-edit",disabled:"geoscene-disabled"};let p=u=class extends r{constructor(e,t){super(e,t),this._bgFillId=`${this.id}-bg-fill`,this._containerNode=null,this._containerDimensions={width:0,height:0},this._defaultBarColor="#d8d8d8",this.average=null,this.barCreatedFunction=null,this.bins=null,this.dataLines=null,this.dataLineCreatedFunction=null,this.dataLineUpdatedFunction=null,this.label=void 0,this.labelFormatFunction=null,this.max=null,this.messages=null,this.min=null,this.state=null,this.viewModel=new n}set layout(e){"vertical"!==e&&(e="horizontal"),this._set("layout",e)}static fromHistogramResult(e){const{bins:t,maxValue:i,minValue:s}=e;return new u({bins:t,max:i,min:s})}render(){const{label:e,layout:t,state:i}=this,s=this.classes(c.base,c.geosceneWidget,"horizontal"===t?c.horizontalLayout:c.verticalLayout,"disabled"===i?c.disabled:null);return d("div",{"aria-label":e,class:s,bind:this,afterCreate:this._afterContainerNodeCreate},"ready"===i?this.renderContent():null)}renderContent(){if(!this._containerNode)return;const e=this._bgFillId,t=`clip-path: url(#${e})`;return d("div",{class:c.content},d("svg",{class:c.svg,xmlns:"http://www.w3.org/2000/svg"},d("defs",null,this.renderFillDefinition(e)),d("g",{style:t},this.renderBarsGroup()),this.renderLinesGroup()))}renderBarsGroup(){return d("g",{class:this.classes(c.bars)},this.renderBars())}renderBars(){const{layout:e,viewModel:{binRange:t,range:i}}=this;if(!t||!i)return;const s=t/i,{width:a,height:r}=this._containerDimensions;if(0===r&&0===a)return;if(0===r&&0!==a)return void this.scheduleRender();const[n,o]="vertical"===e?[r*s,a]:[r,a*s];return this._getBarDimensions(n,o).map((([e,t],i)=>this.renderBar(i,e,t)))}renderBar(e,t,i){const{bins:s,layout:a,max:r,messages:n,viewModel:{range:o}}=this,{width:l,height:u}=this._containerDimensions,p=s.slice()[e],{count:g,maxValue:m,minValue:b}=p,v=r-m,[_,L]="vertical"===a?[0,v*(u/o)]:[l-i-v*(l/o),u-t],y=h(n.barLabel,{count:g,maxValue:m,minValue:b});return d("rect",{"aria-label":y,afterCreate:this._afterBarCreate,bind:this,class:c.bar,"data-index":e,fill:this._defaultBarColor,height:t,role:"img","shape-rendering":"crispEdges","stroke-width":"0",width:i,x:_,y:L})}renderLinesGroup(){return d("g",{class:this.classes(c.dataLines)},this.renderAverageLine(),this.renderCustomLines())}renderAverageLine(){const{average:e}=this;if(!t(e))return;const i=[d("tspan",{class:this.classes(c.averageSymbol)},"x̄ "),d("tspan",{class:this.classes(c.averageLabel)},this.labelFormatFunction?this.labelFormatFunction(e,"average"):e)];return d("g",{afterCreate:this._afterLinesSubgroupCreate,afterUpdate:this._afterLinesSubgroupUpdate,bind:this,class:this.classes(c.dataLinesSubgroup)},d("title",{key:"title"},e),this.renderLine(e,this.classes(c.averageDataLine)),this.renderLabel(e,i))}renderCustomLines(){if(this.dataLines&&this.dataLines.length)return this.dataLines.map((({value:e,label:t},i)=>this.renderLineSubgroup(i,e,t)))}renderLineSubgroup(e,t,i){return d("g",{afterCreate:this._afterLinesSubgroupCreate,afterUpdate:this._afterLinesSubgroupUpdate,bind:this,class:this.classes(c.dataLinesSubgroup),"data-index":e},d("title",{key:"title"},t),this.renderLine(t),this.renderLabel(t,i))}renderLine(e,t){const[i,s,a,r]=this._getLinePosition(e);return d("line",{class:this.classes(c.dataLine,t),x1:i,x2:s,y1:a,y2:r,"shape-rendering":"crispEdges"})}renderLabel(e,t,i){const[s,a]=this._getLabelPosition(e),r=2;return d("text",{class:this.classes(c.label,i),"text-anchor":"end",transform:"horizontal"===this.layout?"rotate(270)":null,x:s,y:a-r},t)}renderFillDefinition(e){const{width:t,height:i}=this._containerDimensions;return d("clipPath",{id:e},d("rect",{x:"0",y:"0",width:t,height:i}))}_afterContainerNodeCreate(e){this._containerNode=e,this.own(o(e,(e=>{const{width:t,height:i}=e.contentRect;this._containerDimensions={width:t,height:i}})))}_afterBarCreate(e){if(this.barCreatedFunction){const t=e.dataset?parseInt(e.dataset.index,10):e.getAttribute("data-index")?parseInt(e.getAttribute("data-index"),10):null;this.barCreatedFunction(isNaN(t)?null:t,e)}}_afterLinesSubgroupCreate(e){if(this.dataLineCreatedFunction){const t=e.dataset?parseInt(e.dataset.index,10):e.getAttribute("data-index")?parseInt(e.getAttribute("data-index"),10):null,i=e.childNodes[0],s=e.childNodes[1]?e.childNodes[1]:null;this.dataLineCreatedFunction(i,s,isNaN(t)?null:t)}}_afterLinesSubgroupUpdate(e){if(this.dataLineUpdatedFunction){const t=e.dataset?parseInt(e.dataset.index,10):e.getAttribute("data-index")?parseInt(e.getAttribute("data-index"),10):null,i=e.childNodes[0],s=e.childNodes[1]?e.childNodes[1]:null;this.dataLineUpdatedFunction(i,s,isNaN(t)?null:t)}}_getBarDimensions(e,t){const{bins:i,layout:s}=this,a=i?i.map((e=>e.count)):[],r=Math.max.apply(Math,a);return a.map((i=>"vertical"===s?[e/a.length,0!==r?i/r*t:0]:[0!==r?i/r*e:0,t/a.length]))}_getLinePosition(e){const{layout:t,min:i,viewModel:{range:s}}=this,a=Math.round((e-i)/s*100)/100,{width:r,height:n}=this._containerDimensions,[o,l]=[a*r||1,n-a*n||1];return"vertical"===t?[0,"100%",l,l]:[o,o,"100%",0]}_getLabelPosition(e){const{layout:t,min:i,viewModel:{range:s}}=this,a=Math.round((e-i)/s*100)/100,{width:r,height:n}=this._containerDimensions;return"vertical"===t?[r,n-a*n]:[0,a*r]}};e([s()],p.prototype,"_bgFillId",void 0),e([s()],p.prototype,"_containerNode",void 0),e([s()],p.prototype,"_containerDimensions",void 0),e([s()],p.prototype,"_defaultBarColor",void 0),e([i("viewModel.average")],p.prototype,"average",void 0),e([s()],p.prototype,"barCreatedFunction",void 0),e([i("viewModel.bins")],p.prototype,"bins",void 0),e([s()],p.prototype,"dataLines",void 0),e([s()],p.prototype,"dataLineCreatedFunction",void 0),e([s()],p.prototype,"dataLineUpdatedFunction",void 0),e([s({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],p.prototype,"label",void 0),e([i("viewModel.labelFormatFunction")],p.prototype,"labelFormatFunction",void 0),e([s({value:"horizontal"})],p.prototype,"layout",null),e([i("viewModel.max")],p.prototype,"max",void 0),e([s(),l("geoscene/widgets/Histogram/t9n/Histogram")],p.prototype,"messages",void 0),e([i("viewModel.min")],p.prototype,"min",void 0),e([i("viewModel.state")],p.prototype,"state",void 0),e([s()],p.prototype,"viewModel",void 0),p=u=e([a("geoscene.widgets.Histogram")],p);const g=p;export{g as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Color.js";import{watch as i}from"../core/watchUtils.js";import{aliasOf as r}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import{Integer as s}from"../core/accessorSupport/ensureType.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import n from"./Histogram.js";import l from"./Slider.js";import d from"./Widget.js";import h from"./HistogramRangeSlider/HistogramRangeSliderViewModel.js";import{getDeviationValues as u}from"./smartMapping/support/utils.js";import"./support/widgetUtils.js";import{messageBundle as p}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{tsx as m}from"./support/jsxFactory.js";const c={base:"esri-histogram-range-slider",sliderContainer:"esri-histogram-range-slider__slider-container",histogramContainer:"esri-histogram-range-slider__histogram-container",rangeTypePrefix:"esri-histogram-range-slider__range-type--",geosceneWidget:"esri-widget",widgetIcon:"geoscene-icon-edit",disabled:"esri-disabled"};let g=class extends d{constructor(e,i){super(e,i),this._barElements=[],this._histogram=null,this._slider=null,this.average=null,this.barCreatedFunction=null,this.bins=null,this.dataLines=null,this.dataLineCreatedFunction=null,this.excludedBarColor=new t("#d7e5f0"),this.hasTimeData=null,this.includedBarColor=new t("#599dd4"),this.label=void 0,this.labelFormatFunction=null,this.max=null,this.messages=null,this.min=null,this.precision=4,this.rangeType=null,this.standardDeviation=null,this.standardDeviationCount=1,this.values=null,this.viewModel=new h}initialize(){const{average:e,bins:t,hasTimeData:r,max:s,min:a,viewModel:o}=this;this._updateBarFill=this._updateBarFill.bind(this),this._histogram=new n({average:e,bins:t,barCreatedFunction:(e,t)=>{0===e&&(this._barElements=[]),this._barElements.push(t),this._updateBarFill(e,t),this.barCreatedFunction&&this.barCreatedFunction(e,t)},dataLines:this._getDataLines(),dataLineCreatedFunction:(e,t)=>{this.dataLineCreatedFunction&&this.dataLineCreatedFunction(e,t)},labelFormatFunction:this.labelFormatFunction,layout:"horizontal",max:s,min:a}),this._slider=new l({labelFormatFunction:this.labelFormatFunction,layout:"horizontal",visibleElements:{labels:!0,rangeLabels:!0},rangeLabelInputsEnabled:!r,viewModel:o}),this.own(this._slider.on(["max-change","min-change"],(e=>this.emit(e.type,e))),this._slider.on(["segment-drag","thumb-change","thumb-drag"],(e=>{this._updateBarFills(),this.emit(e.type,e)})),i(this,"bins",(()=>{const{_histogram:e,bins:t}=this;if(t&&e.bins){const i=e.bins.length-t.length;this._barElements.splice(-i,i)}else this._barElements=[];e.set({bins:t}),this._updateBarFills(),this.scheduleRender()})),i(this,["max","min","rangeType","values"],(()=>{const{_histogram:e,max:t,min:i}=this;e.set({max:t,min:i}),this._updateBarFills(),this.scheduleRender()})),i(this,["average","dataLines","standardDeviation","standardDeviationCount"],(()=>{const{_histogram:e,average:t}=this;e.set({average:t,dataLines:this._getDataLines()})})),i(this,"labelFormatFunction",(()=>{const{_histogram:e,labelFormatFunction:t}=this;e.set({labelFormatFunction:t})})),i(this,"hasTimeData",(()=>{this._slider.set({rangeLabelInputsEnabled:!this.hasTimeData})})))}generateWhereClause(e){return this.viewModel.generateWhereClause(e)}render(){const{rangeType:e,viewModel:t,label:i}=this,r=this.classes(c.base,c.geosceneWidget,`${c.rangeTypePrefix}${e}`,"disabled"===t.state?c.disabled:null);return m("div",{"aria-label":i,class:r},"disabled"===t.state?null:this.renderContent())}renderContent(){return[this.renderHistogram(),this.renderSlider()]}renderSlider(){return m("div",{key:`${this.id}-slider-container`,class:c.sliderContainer},this._slider.render())}renderHistogram(){return m("div",{class:c.histogramContainer},this._histogram.render())}_getDataLines(){return[...this._getStandardDeviationDataLines(),...this.dataLines||[]]}_getStandardDeviationDataLines(){const{average:e,standardDeviation:t,standardDeviationCount:i}=this;return u(t,e,i).map((e=>({value:e})))}_updateBarFills(){this._barElements.forEach(((e,t)=>this._updateBarFill(t,e)))}_updateBarFill(e,t){t.setAttribute("fill",this._getFillForBar(e).toHex())}_getFillForBar(e){const{bins:t,rangeType:i,values:r}=this;if(!(t&&t.length&&i&&r.length))return null;const s=t[e];if(!s)return null;const{maxValue:a,minValue:o}=s,n=a-o,l=r[0]>o&&r[0]<a;switch(i){case"equal":case"not-equal":return this.includedBarColor;case"less-than":case"at-most":return l?this._getBlendedColor((r[0]-o)/n):a<=r[0]?this.includedBarColor:this.excludedBarColor;case"greater-than":case"at-least":return l?this._getBlendedColor(1-(r[0]-o)/n):o>=r[0]?this.includedBarColor:this.excludedBarColor;case"between":if(2===r.length)return r[0]>o&&r[0]<a?this._getBlendedColor(1-(r[0]-o)/n):r[1]>o&&r[1]<a?this._getBlendedColor((r[1]-o)/n):o>=r[0]&&a<=r[1]?this.includedBarColor:this.excludedBarColor;case"not-between":if(2===r.length)return r[0]>o&&r[0]<a?this._getBlendedColor((r[0]-o)/n):r[1]>o&&r[1]<a?this._getBlendedColor(1-(r[1]-o)/n):o>r[0]&&a<r[1]?this.excludedBarColor:this.includedBarColor;default:return this.includedBarColor}}_getBlendedColor(e){return t.blendColors(this.excludedBarColor,this.includedBarColor,e)}};e([r("viewModel.average")],g.prototype,"average",void 0),e([a()],g.prototype,"barCreatedFunction",void 0),e([r("viewModel.bins")],g.prototype,"bins",void 0),e([a()],g.prototype,"dataLines",void 0),e([a()],g.prototype,"dataLineCreatedFunction",void 0),e([a({type:t,json:{type:[s],write:!0}})],g.prototype,"excludedBarColor",void 0),e([r("viewModel.hasTimeData")],g.prototype,"hasTimeData",void 0),e([a({type:t,json:{type:[s],write:!0}})],g.prototype,"includedBarColor",void 0),e([a({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],g.prototype,"label",void 0),e([r("viewModel.labelFormatFunction")],g.prototype,"labelFormatFunction",void 0),e([r("viewModel.max")],g.prototype,"max",void 0),e([a(),p("geoscene/widgets/HistogramRangeSlider/t9n/HistogramRangeSlider")],g.prototype,"messages",void 0),e([r("viewModel.min")],g.prototype,"min",void 0),e([r("viewModel.precision")],g.prototype,"precision",void 0),e([r("viewModel.rangeType")],g.prototype,"rangeType",void 0),e([r("viewModel.standardDeviation")],g.prototype,"standardDeviation",void 0),e([a()],g.prototype,"standardDeviationCount",void 0),e([r("viewModel.values")],g.prototype,"values",void 0),e([a()],g.prototype,"viewModel",void 0),g=e([o("geoscene.widgets.HistogramRangeSlider")],g);const v=g;export{v as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Color.js";import{watch as i}from"../core/watchUtils.js";import{aliasOf as r}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import{Integer as s}from"../core/accessorSupport/ensureType.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import n from"./Histogram.js";import l from"./Slider.js";import d from"./Widget.js";import h from"./HistogramRangeSlider/HistogramRangeSliderViewModel.js";import{getDeviationValues as u}from"./smartMapping/support/utils.js";import"./support/widgetUtils.js";import{messageBundle as p}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{tsx as m}from"./support/jsxFactory.js";const c={base:"geoscene-histogram-range-slider",sliderContainer:"geoscene-histogram-range-slider__slider-container",histogramContainer:"geoscene-histogram-range-slider__histogram-container",rangeTypePrefix:"geoscene-histogram-range-slider__range-type--",geosceneWidget:"geoscene-widget",widgetIcon:"geoscene-icon-edit",disabled:"geoscene-disabled"};let g=class extends d{constructor(e,i){super(e,i),this._barElements=[],this._histogram=null,this._slider=null,this.average=null,this.barCreatedFunction=null,this.bins=null,this.dataLines=null,this.dataLineCreatedFunction=null,this.excludedBarColor=new t("#d7e5f0"),this.hasTimeData=null,this.includedBarColor=new t("#599dd4"),this.label=void 0,this.labelFormatFunction=null,this.max=null,this.messages=null,this.min=null,this.precision=4,this.rangeType=null,this.standardDeviation=null,this.standardDeviationCount=1,this.values=null,this.viewModel=new h}initialize(){const{average:e,bins:t,hasTimeData:r,max:s,min:a,viewModel:o}=this;this._updateBarFill=this._updateBarFill.bind(this),this._histogram=new n({average:e,bins:t,barCreatedFunction:(e,t)=>{0===e&&(this._barElements=[]),this._barElements.push(t),this._updateBarFill(e,t),this.barCreatedFunction&&this.barCreatedFunction(e,t)},dataLines:this._getDataLines(),dataLineCreatedFunction:(e,t)=>{this.dataLineCreatedFunction&&this.dataLineCreatedFunction(e,t)},labelFormatFunction:this.labelFormatFunction,layout:"horizontal",max:s,min:a}),this._slider=new l({labelFormatFunction:this.labelFormatFunction,layout:"horizontal",visibleElements:{labels:!0,rangeLabels:!0},rangeLabelInputsEnabled:!r,viewModel:o}),this.own(this._slider.on(["max-change","min-change"],(e=>this.emit(e.type,e))),this._slider.on(["segment-drag","thumb-change","thumb-drag"],(e=>{this._updateBarFills(),this.emit(e.type,e)})),i(this,"bins",(()=>{const{_histogram:e,bins:t}=this;if(t&&e.bins){const i=e.bins.length-t.length;this._barElements.splice(-i,i)}else this._barElements=[];e.set({bins:t}),this._updateBarFills(),this.scheduleRender()})),i(this,["max","min","rangeType","values"],(()=>{const{_histogram:e,max:t,min:i}=this;e.set({max:t,min:i}),this._updateBarFills(),this.scheduleRender()})),i(this,["average","dataLines","standardDeviation","standardDeviationCount"],(()=>{const{_histogram:e,average:t}=this;e.set({average:t,dataLines:this._getDataLines()})})),i(this,"labelFormatFunction",(()=>{const{_histogram:e,labelFormatFunction:t}=this;e.set({labelFormatFunction:t})})),i(this,"hasTimeData",(()=>{this._slider.set({rangeLabelInputsEnabled:!this.hasTimeData})})))}generateWhereClause(e){return this.viewModel.generateWhereClause(e)}render(){const{rangeType:e,viewModel:t,label:i}=this,r=this.classes(c.base,c.geosceneWidget,`${c.rangeTypePrefix}${e}`,"disabled"===t.state?c.disabled:null);return m("div",{"aria-label":i,class:r},"disabled"===t.state?null:this.renderContent())}renderContent(){return[this.renderHistogram(),this.renderSlider()]}renderSlider(){return m("div",{key:`${this.id}-slider-container`,class:c.sliderContainer},this._slider.render())}renderHistogram(){return m("div",{class:c.histogramContainer},this._histogram.render())}_getDataLines(){return[...this._getStandardDeviationDataLines(),...this.dataLines||[]]}_getStandardDeviationDataLines(){const{average:e,standardDeviation:t,standardDeviationCount:i}=this;return u(t,e,i).map((e=>({value:e})))}_updateBarFills(){this._barElements.forEach(((e,t)=>this._updateBarFill(t,e)))}_updateBarFill(e,t){t.setAttribute("fill",this._getFillForBar(e).toHex())}_getFillForBar(e){const{bins:t,rangeType:i,values:r}=this;if(!(t&&t.length&&i&&r.length))return null;const s=t[e];if(!s)return null;const{maxValue:a,minValue:o}=s,n=a-o,l=r[0]>o&&r[0]<a;switch(i){case"equal":case"not-equal":return this.includedBarColor;case"less-than":case"at-most":return l?this._getBlendedColor((r[0]-o)/n):a<=r[0]?this.includedBarColor:this.excludedBarColor;case"greater-than":case"at-least":return l?this._getBlendedColor(1-(r[0]-o)/n):o>=r[0]?this.includedBarColor:this.excludedBarColor;case"between":if(2===r.length)return r[0]>o&&r[0]<a?this._getBlendedColor(1-(r[0]-o)/n):r[1]>o&&r[1]<a?this._getBlendedColor((r[1]-o)/n):o>=r[0]&&a<=r[1]?this.includedBarColor:this.excludedBarColor;case"not-between":if(2===r.length)return r[0]>o&&r[0]<a?this._getBlendedColor((r[0]-o)/n):r[1]>o&&r[1]<a?this._getBlendedColor(1-(r[1]-o)/n):o>r[0]&&a<r[1]?this.excludedBarColor:this.includedBarColor;default:return this.includedBarColor}}_getBlendedColor(e){return t.blendColors(this.excludedBarColor,this.includedBarColor,e)}};e([r("viewModel.average")],g.prototype,"average",void 0),e([a()],g.prototype,"barCreatedFunction",void 0),e([r("viewModel.bins")],g.prototype,"bins",void 0),e([a()],g.prototype,"dataLines",void 0),e([a()],g.prototype,"dataLineCreatedFunction",void 0),e([a({type:t,json:{type:[s],write:!0}})],g.prototype,"excludedBarColor",void 0),e([r("viewModel.hasTimeData")],g.prototype,"hasTimeData",void 0),e([a({type:t,json:{type:[s],write:!0}})],g.prototype,"includedBarColor",void 0),e([a({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],g.prototype,"label",void 0),e([r("viewModel.labelFormatFunction")],g.prototype,"labelFormatFunction",void 0),e([r("viewModel.max")],g.prototype,"max",void 0),e([a(),p("geoscene/widgets/HistogramRangeSlider/t9n/HistogramRangeSlider")],g.prototype,"messages",void 0),e([r("viewModel.min")],g.prototype,"min",void 0),e([r("viewModel.precision")],g.prototype,"precision",void 0),e([r("viewModel.rangeType")],g.prototype,"rangeType",void 0),e([r("viewModel.standardDeviation")],g.prototype,"standardDeviation",void 0),e([a()],g.prototype,"standardDeviationCount",void 0),e([r("viewModel.values")],g.prototype,"values",void 0),e([a()],g.prototype,"viewModel",void 0),g=e([o("geoscene.widgets.HistogramRangeSlider")],g);const v=g;export{v as default};
package/widgets/Home.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../chunks/tslib.es6.js";import{aliasOf as e}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as t}from"../core/accessorSupport/decorators/property.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import r from"./Widget.js";import i from"./Home/HomeViewModel.js";import{accessibleHandler as n}from"./support/decorators/accessibleHandler.js";import{messageBundle as l}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{vmEvent as a}from"./support/decorators/vmEvent.js";import{tsx as c}from"./support/jsxFactory.js";import"./support/widgetUtils.js";const d={base:"esri-home esri-widget--button esri-widget",text:"geoscene-icon-font-fallback-text",homeIcon:"geoscene-icon geoscene-icon-home",loadingIcon:"geoscene-icon-loading-indicator",rotatingIcon:"esri-rotating",widgetIcon:"geoscene-icon-home",disabled:"esri-disabled"};let p=class extends r{constructor(o,e){super(o,e),this.goToOverride=null,this.iconClass=d.widgetIcon,this.label=void 0,this.messages=null,this.messagesCommon=null,this.view=null,this.viewModel=new i,this.viewpoint=null}get homeTitle(){var o;const e=null==(o=this.viewModel)?void 0:o.state,{messagesCommon:t,messages:s}=this;return"going-home"===e?t.cancel:s.title}cancelGo(){return null}go(){return null}render(){var o;const e=null==(o=this.viewModel)?void 0:o.state,{homeTitle:t}=this,s={[d.disabled]:"disabled"===e};return c("div",{bind:this,class:this.classes(d.base,s),role:"button",tabIndex:0,onclick:this._go,onkeydown:this._go,"aria-label":t,title:t},this.renderIcon(),this.renderText())}renderIcon(){var o;const e=null==(o=this.viewModel)?void 0:o.state,t={[d.loadingIcon]:"going-home"===e,[d.rotatingIcon]:"going-home"===e};return c("span",{"aria-hidden":"true",class:this.classes(d.homeIcon,t)})}renderText(){const{messages:o}=this;return c("span",{class:d.text},o.button)}_go(){const{viewModel:o}=this;"going-home"===o.state?o.cancelGo():o.go()}};o([e("viewModel.goToOverride")],p.prototype,"goToOverride",void 0),o([t({readOnly:!0})],p.prototype,"homeTitle",null),o([t()],p.prototype,"iconClass",void 0),o([t({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],p.prototype,"label",void 0),o([t(),l("geoscene/widgets/Home/t9n/Home")],p.prototype,"messages",void 0),o([t(),l("geoscene/t9n/common")],p.prototype,"messagesCommon",void 0),o([e("viewModel.view")],p.prototype,"view",void 0),o([t({type:i}),a("go")],p.prototype,"viewModel",void 0),o([e("viewModel.viewpoint")],p.prototype,"viewpoint",void 0),o([e("viewModel.cancelGo")],p.prototype,"cancelGo",null),o([e("viewModel.go")],p.prototype,"go",null),o([n()],p.prototype,"_go",null),p=o([s("geoscene.widgets.Home")],p);const m=p;export{m as default};
5
+ import{_ as o}from"../chunks/tslib.es6.js";import{aliasOf as e}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as t}from"../core/accessorSupport/decorators/property.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import r from"./Widget.js";import i from"./Home/HomeViewModel.js";import{accessibleHandler as n}from"./support/decorators/accessibleHandler.js";import{messageBundle as l}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{vmEvent as a}from"./support/decorators/vmEvent.js";import{tsx as c}from"./support/jsxFactory.js";import"./support/widgetUtils.js";const d={base:"geoscene-home geoscene-widget--button geoscene-widget",text:"geoscene-icon-font-fallback-text",homeIcon:"geoscene-icon geoscene-icon-home",loadingIcon:"geoscene-icon-loading-indicator",rotatingIcon:"geoscene-rotating",widgetIcon:"geoscene-icon-home",disabled:"geoscene-disabled"};let p=class extends r{constructor(o,e){super(o,e),this.goToOverride=null,this.iconClass=d.widgetIcon,this.label=void 0,this.messages=null,this.messagesCommon=null,this.view=null,this.viewModel=new i,this.viewpoint=null}get homeTitle(){var o;const e=null==(o=this.viewModel)?void 0:o.state,{messagesCommon:t,messages:s}=this;return"going-home"===e?t.cancel:s.title}cancelGo(){return null}go(){return null}render(){var o;const e=null==(o=this.viewModel)?void 0:o.state,{homeTitle:t}=this,s={[d.disabled]:"disabled"===e};return c("div",{bind:this,class:this.classes(d.base,s),role:"button",tabIndex:0,onclick:this._go,onkeydown:this._go,"aria-label":t,title:t},this.renderIcon(),this.renderText())}renderIcon(){var o;const e=null==(o=this.viewModel)?void 0:o.state,t={[d.loadingIcon]:"going-home"===e,[d.rotatingIcon]:"going-home"===e};return c("span",{"aria-hidden":"true",class:this.classes(d.homeIcon,t)})}renderText(){const{messages:o}=this;return c("span",{class:d.text},o.button)}_go(){const{viewModel:o}=this;"going-home"===o.state?o.cancelGo():o.go()}};o([e("viewModel.goToOverride")],p.prototype,"goToOverride",void 0),o([t({readOnly:!0})],p.prototype,"homeTitle",null),o([t()],p.prototype,"iconClass",void 0),o([t({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],p.prototype,"label",void 0),o([t(),l("geoscene/widgets/Home/t9n/Home")],p.prototype,"messages",void 0),o([t(),l("geoscene/t9n/common")],p.prototype,"messagesCommon",void 0),o([e("viewModel.view")],p.prototype,"view",void 0),o([t({type:i}),a("go")],p.prototype,"viewModel",void 0),o([e("viewModel.viewpoint")],p.prototype,"viewpoint",void 0),o([e("viewModel.cancelGo")],p.prototype,"cancelGo",null),o([e("viewModel.go")],p.prototype,"go",null),o([n()],p.prototype,"_go",null),p=o([s("geoscene.widgets.Home")],p);const m=p;export{m as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Handles.js";import{IdentifiableMixin as s}from"../../core/Identifiable.js";import{init as n}from"../../core/watchUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import o from"../Widget.js";import{getLegendLayerInfo as l}from"./support/layerListUtils.js";import{isWidget as a}from"../support/widget.js";import{tsx as c}from"../support/jsxFactory.js";const d={base:"esri-layer-list-panel",content:"esri-layer-list-panel__content",contentLegend:"esri-layer-list-panel__content--legend",contentString:"esri-layer-list-panel__content--string",contentElement:"esri-layer-list-panel__content--html-element",contentWidget:"esri-layer-list-panel__content--widget"},h="legends";let p=class extends(s(o)){constructor(e,s){super(e,s),this._legend=null,this._handles=new t,this.content=null,this.image=null,this.listItem=null,this.open=!1,this.visible=!0}initialize(){this.own([n(this,"content",(e=>this._createLegend(e)))])}destroy(){const{_legend:e}=this;e&&e.destroy(),this._legend=null}get className(){const{image:e}=this,t=this._getFirstWidget();return this._get("className")||!e&&t?t.iconClass:""}set className(e){void 0!==e?this._override("className",e):this._clearOverride("className")}get title(){const e=this._getFirstWidget();return this._get("title")||e?e.label:""}set title(e){void 0!==e?this._override("title",e):this._clearOverride("title")}render(){return c("div",{class:d.base},this._renderContents())}_renderContent(e){const{_legend:t,listItem:s}=this;if(!e)return null;if("legend"===e){return s&&s.view&&s.layer&&t?c("div",{class:this.classes(d.content,d.contentLegend),key:t},t.render()):null}return"string"==typeof e?c("div",{class:this.classes(d.content,d.contentString),key:e,innerHTML:e}):a(e)?c("div",{class:this.classes(d.content,d.contentWidget),key:e},e.render()):e instanceof HTMLElement?c("div",{class:this.classes(d.content,d.contentElement),key:e,bind:e,afterCreate:this._attachToNode}):null}_renderContents(){const{content:e}=this;return Array.isArray(e)?e.map((e=>this._renderContent(e))):this._renderContent(e)}_getLegendOptions(){const{listItem:e}=this;if(!e)return{};const{layer:t,view:s}=e;return t&&s?{view:s,layerInfos:[l(t)]}:{}}_createLegend(e){this._hasLegend(e)&&!this._legend&&import("../Legend.js").then((({default:e})=>{const{_handles:t}=this,s=new e(this._getLegendOptions());this._legend=s,this.notifyChange("className"),this.notifyChange("title");const i=n(this,["listItem.view","listItem.layer","listItem.layer.source","listItem.layer.parent"],(()=>this._updateLegend(s)));t.add(i,h),this.scheduleRender()}))}_hasLegend(e){const t="legend";return e===t||!!Array.isArray(e)&&e.some((e=>e===t))}_attachToNode(e){e.appendChild(this)}_updateLegend(e){e.set(this._getLegendOptions()),this.scheduleRender()}_getWidget(e){return"legend"===e?this._legend:a(e)?e:null}_getFirstWidget(){const{content:e}=this;if(Array.isArray(e)){let t=null;return e.some((e=>{const s=this._getWidget(e);return s&&(t=s),!!s})),t}return this._getWidget(e)}};e([i()],p.prototype,"className",null),e([i()],p.prototype,"content",void 0),e([i()],p.prototype,"image",void 0),e([i()],p.prototype,"listItem",void 0),e([i()],p.prototype,"title",null),e([i()],p.prototype,"open",void 0),e([i()],p.prototype,"visible",void 0),p=e([r("geoscene.widgets.LayerList.ListItemPanel")],p);const g=p;export{g as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Handles.js";import{IdentifiableMixin as s}from"../../core/Identifiable.js";import{init as n}from"../../core/watchUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import o from"../Widget.js";import{getLegendLayerInfo as l}from"./support/layerListUtils.js";import{isWidget as a}from"../support/widget.js";import{tsx as c}from"../support/jsxFactory.js";const d={base:"geoscene-layer-list-panel",content:"geoscene-layer-list-panel__content",contentLegend:"geoscene-layer-list-panel__content--legend",contentString:"geoscene-layer-list-panel__content--string",contentElement:"geoscene-layer-list-panel__content--html-element",contentWidget:"geoscene-layer-list-panel__content--widget"},h="legends";let p=class extends(s(o)){constructor(e,s){super(e,s),this._legend=null,this._handles=new t,this.content=null,this.image=null,this.listItem=null,this.open=!1,this.visible=!0}initialize(){this.own([n(this,"content",(e=>this._createLegend(e)))])}destroy(){const{_legend:e}=this;e&&e.destroy(),this._legend=null}get className(){const{image:e}=this,t=this._getFirstWidget();return this._get("className")||!e&&t?t.iconClass:""}set className(e){void 0!==e?this._override("className",e):this._clearOverride("className")}get title(){const e=this._getFirstWidget();return this._get("title")||e?e.label:""}set title(e){void 0!==e?this._override("title",e):this._clearOverride("title")}render(){return c("div",{class:d.base},this._renderContents())}_renderContent(e){const{_legend:t,listItem:s}=this;if(!e)return null;if("legend"===e){return s&&s.view&&s.layer&&t?c("div",{class:this.classes(d.content,d.contentLegend),key:t},t.render()):null}return"string"==typeof e?c("div",{class:this.classes(d.content,d.contentString),key:e,innerHTML:e}):a(e)?c("div",{class:this.classes(d.content,d.contentWidget),key:e},e.render()):e instanceof HTMLElement?c("div",{class:this.classes(d.content,d.contentElement),key:e,bind:e,afterCreate:this._attachToNode}):null}_renderContents(){const{content:e}=this;return Array.isArray(e)?e.map((e=>this._renderContent(e))):this._renderContent(e)}_getLegendOptions(){const{listItem:e}=this;if(!e)return{};const{layer:t,view:s}=e;return t&&s?{view:s,layerInfos:[l(t)]}:{}}_createLegend(e){this._hasLegend(e)&&!this._legend&&import("../Legend.js").then((({default:e})=>{const{_handles:t}=this,s=new e(this._getLegendOptions());this._legend=s,this.notifyChange("className"),this.notifyChange("title");const i=n(this,["listItem.view","listItem.layer","listItem.layer.source","listItem.layer.parent"],(()=>this._updateLegend(s)));t.add(i,h),this.scheduleRender()}))}_hasLegend(e){const t="legend";return e===t||!!Array.isArray(e)&&e.some((e=>e===t))}_attachToNode(e){e.appendChild(this)}_updateLegend(e){e.set(this._getLegendOptions()),this.scheduleRender()}_getWidget(e){return"legend"===e?this._legend:a(e)?e:null}_getFirstWidget(){const{content:e}=this;if(Array.isArray(e)){let t=null;return e.some((e=>{const s=this._getWidget(e);return s&&(t=s),!!s})),t}return this._getWidget(e)}};e([i()],p.prototype,"className",null),e([i()],p.prototype,"content",void 0),e([i()],p.prototype,"image",void 0),e([i()],p.prototype,"listItem",void 0),e([i()],p.prototype,"title",null),e([i()],p.prototype,"open",void 0),e([i()],p.prototype,"visible",void 0),p=e([r("geoscene.widgets.LayerList.ListItemPanel")],p);const g=p;export{g as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{eventKey as i}from"../core/events.js";import s from"../core/Handles.js";import o from"../core/has.js";import{on as n,init as l}from"../core/watchUtils.js";import{aliasOf as r}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import{cast as a}from"../core/accessorSupport/decorators/cast.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import h from"./Widget.js";import m from"./LayerList/LayerListViewModel.js";import g from"./LayerList/ListItem.js";import{findSelectedItem as u,sortLayersToIds as p,sortChildLayersToIds as _,canSortSublayers as b}from"./LayerList/support/layerListUtils.js";import{accessibleHandler as y}from"./support/decorators/accessibleHandler.js";import{messageBundle as v}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{vmEvent as I}from"./support/decorators/vmEvent.js";import{tsx as f}from"./support/jsxFactory.js";import"./support/widgetUtils.js";import A from"sortablejs";function w(e,t,i){e.splice(i,0,e.splice(t,1)[0])}const C="esri-layerlist-new-ui",S=t.ofType(g),L="data-sort-filter",k="data-layer-uid",M="layerUid",T={base:"esri-layer-list esri-widget esri-widget--panel",newUI:"esri-layer-list--new-ui",noItems:"esri-layer-list__no-items",list:"esri-layer-list__list",listRoot:"esri-layer-list__list--root",listExclusive:"esri-layer-list__list--exclusive",listInherited:"esri-layer-list__list--inherited",listIndependent:"esri-layer-list__list--independent",item:"esri-layer-list__item",itemContent:"esri-layer-list__item-content",itemMessage:"esri-layer-list__item--has-message",itemInvisible:"esri-layer-list__item--invisible",itemInvisibleAtScale:"esri-layer-list__item--invisible-at-scale",itemUpdating:"esri-layer-list__item--updating",itemChildren:"esri-layer-list__item--has-children",itemSelectable:"esri-layer-list__item--selectable",itemContainer:"esri-layer-list__item-container",actionsMenu:"esri-layer-list__item-actions-menu",actionsMenuItem:"esri-layer-list__item-actions-menu-item",actionsMenuItemActive:"esri-layer-list__item-actions-menu-item--active",actions:"esri-layer-list__item-actions",actionsList:"esri-layer-list__item-actions-list",action:"esri-layer-list__item-action",actionIcon:"esri-layer-list__item-action-icon",actionImage:"esri-layer-list__item-action-image",actionTitle:"esri-layer-list__item-action-title",actionToggle:"esri-layer-list__action-toggle",actionToggleOn:"esri-layer-list__action-toggle--on",label:"esri-layer-list__item-label",message:"esri-layer-list__item-message",title:"esri-layer-list__item-title",toggleVisible:"esri-layer-list__item-toggle",toggleVisibleIcon:"esri-layer-list__item-toggle-icon",toggleIcon:"esri-layer-list__item-toggle-icon",radioIcon:"esri-layer-list__item-radio-icon",childToggle:"esri-layer-list__child-toggle",childToggleOpen:"esri-layer-list__child-toggle--open",childOpened:"esri-layer-list__child-toggle-icon--opened",childClosed:"esri-layer-list__child-toggle-icon--closed",childClosed_RTL:"esri-layer-list__child-toggle-icon--closed-rtl",sortableChosen:"esri-layer-list--chosen",disabled:"esri-disabled",disabledElement:"esri-disabled-element",hidden:"esri-hidden",rotating:"esri-rotating",iconEllipses:"geoscene-icon-handle-horizontal",iconVisible:"geoscene-icon-visible",iconInvisible:"geoscene-icon-non-visible",iconRadioSelected:"geoscene-icon-radio-checked",iconRadioUnselected:"geoscene-icon-radio-unchecked",iconNoticeTriangle:"geoscene-icon-notice-triangle",iconChildrenOpen:"geoscene-icon-down-arrow",iconDownArrow:"geoscene-icon-down-arrow",iconRightArrow:"geoscene-icon-right-triangle-arrow",iconLeftArrow:"geoscene-icon-left-triangle-arrow",iconLoading:"geoscene-icon-loading-indicator",iconDefaultAction:"geoscene-icon-default-action",widgetIcon:"geoscene-icon-layers"},E={actions:"actions",actionSection:"action-section",items:"items"},R={exclusive:"exclusive",inherited:"inherited",independent:"independent"};function x(e){const{actionsOpen:t,children:i}=e;t&&(e.actionsOpen=!1),i.forEach((e=>x(e)))}const U="root",O={statusIndicators:!0};let N=class extends h{constructor(e,t){super(e,t),this._handles=new s,this._sortableNodes=new Map,this._sortableMap=new Map,this._focusSortUid=null,this._newUI=o(C),this._tooltipReferenceMap=new Map,this.visibleItems=null,this.iconClass=T.widgetIcon,this.label=void 0,this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.listItemCreatedFunction=null,this.messages=null,this.messagesCommon=null,this.multipleSelectionEnabled=!1,this.operationalItems=null,this.selectionEnabled=!1,this.selectedItems=new S,this.view=null,this.viewModel=new m,this.visibleElements={...O},this._onSortableSort=({to:e,from:t,item:i,newIndex:s})=>{t&&e&&(t===e?this._sortLayers(this._sortableMap.get(t.dataset.group)):this._moveLayerFromChildList({to:e,from:t,item:i,newIndex:s}))},this._sortableCanSort=(e,t)=>!(!e.el.dataset.group||!t.el.dataset.group),this._sortableCanPull=(e,t,i)=>{const{listItemCanGiveFunction:s}=this,o={selected:i["data-item"],from:t.el["data-item"],to:e.el["data-item"]};return!this._sortableCanSort(e,t)||"function"!=typeof s||s.call(null,o)},this._sortableCanPut=(e,t,i)=>{const{listItemCanReceiveFunction:s}=this,o={selected:i["data-item"],from:t.el["data-item"],to:e.el["data-item"]};return!this._sortableCanSort(e,t)||"function"!=typeof s||s.call(null,o)},this._onSortableEnd=({oldIndex:e,from:t,to:i,item:s})=>{t!==i&&t.insertBefore(s,t.children[e])}}initialize(){const e=this.operationalItems;this._setVisibleItems(e),this.own(n(this,"operationalItems","change",(()=>this._itemsChanged(e))),l(this,"selectionEnabled",(()=>this._toggleAllSorting())))}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-tooltip-manager.js"),import("@esri/calcite-components/dist/components/calcite-tooltip.js")])}destroy(){this._destroySortables(),this._tooltipReferenceMap.clear(),this._handles.destroy(),this._handles=null}castVisibleElements(e){return{...O,...e}}triggerAction(e,t){this.viewModel.triggerAction(e,t)}render(){var e;const{visibleItems:t,_newUI:i}=this,s=null==(e=this.viewModel)?void 0:e.state,o={[T.newUI]:i,[T.hidden]:"loading"===s,[T.disabled]:"disabled"===s},n=this.renderItemTooltips(),l=this.renderItems();return f("div",{class:this.classes(T.base,o)},null!=t&&t.length?[n,n.length?f("calcite-tooltip-manager",null,l):l]:this.renderNoItems())}renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:i}=this;return e?f("calcite-tooltip",{label:i.layerIncompatible,referenceElement:t.get(e.uid)},i.layerIncompatibleTooltip):null}renderItemTooltipNodes(e){const{incompatible:t,children:i}=e;return[t?this.renderItemTooltip(e):null,...t?[]:null==i?void 0:i.toArray().map((e=>this.renderItemTooltipNodes(e)))]}renderItemTooltips(){return this.visibleItems.toArray().map((e=>this.renderItemTooltipNodes(e)))}renderNoItems(){return f("div",{class:T.noItems},this.messages.noItemsToDisplay)}renderItems(){const{visibleItems:e,selectionEnabled:t,messages:i}=this;return f("ul",{"aria-label":i.widgetLabel,role:t?"listbox":void 0,afterCreate:this._sortNodeCreated,afterUpdate:this._sortNodeCreated,afterRemoved:this._sortNodeRemoved,"data-group":U,bind:this,class:this.classes(T.list,T.listRoot,T.listIndependent)},null==e?void 0:e.map((e=>this.renderItem(e,null))).toArray())}renderActionsMenuIcon(e,t){const{messagesCommon:i}=this,s={[T.actionsMenuItemActive]:e.actionsOpen};return f("div",{key:"actions-menu-toggle","data-item":e,bind:this,onclick:this._toggleActionsOpen,onkeydown:this._toggleActionsOpen,class:this.classes(T.actionsMenuItem,s),tabindex:"0",role:"button","aria-controls":t,"aria-label":i.options,title:i.options},f("span",{"aria-hidden":"true",class:T.iconEllipses}))}renderActionsMenu(e,t,i,s){const{panel:o}=e,n=o&&o.visible?this.renderPanelButton(o):null,l=1===i&&this._getSingleActionButton(t),r=l?this.renderAction({item:e,action:l,singleAction:!0}):null,a=!l&&i?this.renderActionsMenuIcon(e,s):null;return a||n||l?f("div",{key:"actions-menu",class:T.actionsMenu},n,r,a):null}renderChildList(e,t){var i;const{selectionEnabled:s}=this,{visibilityMode:o,children:n}=e,l=this._hasChildren(e),r=!l&&s&&"group"===(null==(i=e.layer)?void 0:i.type),{exclusive:a,inherited:c}=R,d={[T.listExclusive]:o===a,[T.listInherited]:o===c,[T.listIndependent]:o!==c&&o!==a};return l||r?f("ul",{bind:this,key:"list-items",id:t,"data-group":e.uid,"data-item":e,afterCreate:this._sortNodeCreated,afterUpdate:this._sortNodeCreated,afterRemoved:this._sortNodeRemoved,class:this.classes(T.list,d),"aria-expanded":e.open?"true":"false",role:s?"listbox":o===a?"radiogroup":"group",hidden:!e.open&&!r||null},null==n?void 0:n.map((t=>this.renderItem(t,e))).toArray()):null}renderChildrenToggle(e,t){const{messagesCommon:i}=this,s=this._hasChildren(e),o={[T.childToggleOpen]:e.open},n=e.open?i.collapse:i.expand;return s?f("span",{onclick:this._toggleChildrenClick,onkeydown:this._toggleChildrenClick,"data-item":e,key:"toggle-children",class:this.classes(T.childToggle,o),tabindex:"0",role:"button","aria-controls":t,"aria-label":n,title:n},f("span",{"aria-hidden":"true",class:this.classes(T.childClosed,T.iconRightArrow)}),f("span",{"aria-hidden":"true",class:this.classes(T.childOpened,T.iconDownArrow)}),f("span",{"aria-hidden":"true",class:this.classes(T.childClosed_RTL,T.iconLeftArrow)})):null}renderItemMessage(e){return e.error?f("div",{key:"esri-layer-list__error",class:T.message,role:"alert"},f("span",{"aria-hidden":"true",class:T.iconNoticeTriangle}),this.messages.layerError):e.incompatible?f("div",{key:"esri-layer-list__incompatible",class:T.message,role:"alert"},f("span",{bind:this,tabIndex:0,"aria-hidden":"true",class:T.iconNoticeTriangle,afterCreate:t=>this._setTooltipReference(t,e)}),this.messages.layerIncompatible):null}renderItemContent(e,t,i){const{id:s}=this,o=`${s}_${e.uid}`,n=`${o}_actions`,l=`${o}__list`,{panel:r}=e,a=this._filterActions(e.actionsSections),c=this._countActions(a);return[f("div",{key:"list-item-container",class:T.itemContainer},this.renderChildrenToggle(e,l),this.renderLabel(e,t,i),this.renderActionsMenu(e,a,c,n)),this.renderItemMessage(e),c?this.renderActionsSections(e,a,n):null,r&&r.open?r.render():null,this.renderChildList(e,l)]}renderItem(e,t){const{_newUI:i,id:s,selectionEnabled:o,selectedItems:n,visibleElements:l}=this,r=`${`${s}_${e.uid}`}__title`,a=this._hasMessage(e),c=this._hasChildren(e),d={[T.itemChildren]:c,[T.itemMessage]:!!a,[T.itemUpdating]:e.updating&&!t&&l.statusIndicators,[T.itemInvisible]:i&&!e.visible,[T.itemInvisibleAtScale]:!e.visibleAtCurrentScale,[T.itemSelectable]:o};if(o){var h;const i={[k]:null==(h=e.layer)?void 0:h.uid,[L]:(!e.sortable).toString()};return f("li",{key:`item-with-selection-${e.uid}`,bind:this,afterCreate:this._focusListItem,afterUpdate:this._focusListItem,class:this.classes(T.item,d),"aria-labelledby":r,onclick:this._toggleSelection,onkeydown:this._selectionKeydown,"data-item":e,"data-group":t?t.uid:U,tabIndex:0,"aria-selected":u(e,n)?"true":"false",role:"option",...i},this.renderItemContent(e,t,r))}return f("li",{key:`item-no-selection-${e.uid}`,bind:this,afterCreate:this._focusListItem,afterUpdate:this._focusListItem,class:this.classes(T.item,d),"aria-labelledby":r},this.renderItemContent(e,t,r))}renderItemTitle(e,t){const{messages:i}=this,s=e.title||i.untitledLayer,o=e.visibleAtCurrentScale?s:`${s} (${i.layerInvisibleAtScale})`;return f("span",{key:"layer-title-container",id:t,title:o,"aria-label":o,class:T.title},s)}renderItemToggleIcon(e,t){const{_newUI:i}=this,{exclusive:s}=R,o=t&&t.visibilityMode,n={[T.toggleVisibleIcon]:i,[T.toggleIcon]:i&&o!==s,[T.radioIcon]:i&&o===s,[T.iconRadioSelected]:o===s&&e.visible,[T.iconRadioUnselected]:o===s&&!e.visible,[T.iconVisible]:o!==s&&e.visible,[T.iconInvisible]:o!==s&&!e.visible};return f("span",{key:"item-toggle-icon",class:this.classes(n),"aria-hidden":"true"})}renderItemToggle(e,t,i){const{selectionEnabled:s,messages:o}=this,{exclusive:n}=R,l=t&&t.visibilityMode,r=l===n?"radio":"switch";return f("span",s?{key:"item-toggle-selection-enabled",class:T.toggleVisible,bind:this,onclick:this._toggleVisibility,onkeydown:this._toggleVisibility,"data-item":e,"data-parent-visibility":l,tabIndex:0,title:e.visible?o.hideLayer:o.showLayer,"aria-checked":e.visible?"true":"false",role:r,"aria-labelledby":i}:{key:"item-toggle",class:T.toggleVisible},this.renderItemToggleIcon(e,t))}renderLabel(e,t,i){const{selectionEnabled:s,_newUI:o,messages:n}=this,{inherited:l,exclusive:r}=R,a=null==t?void 0:t.visibilityMode,c=a===r?"radio":"switch",d=[this.renderItemToggle(e,t,i),this.renderItemTitle(e,i)];o&&d.reverse();const h=f("div",s?{key:`item-label-no-selection-${e.uid}`,class:T.label}:{key:`item-label-with-selection-${e.uid}`,class:T.label,bind:this,onclick:this._toggleVisibility,onkeydown:this._toggleVisibility,"data-item":e,"data-parent-visibility":a,tabIndex:0,"aria-checked":e.visible?"true":"false",title:e.visible?n.hideLayer:n.showLayer,role:c,"aria-labelledby":i},d);return a===l||e.error?f("div",{key:`item-label-container-${e.uid}`,class:T.label},this.renderItemTitle(e,i)):h}renderPanelButton(e){const{className:t,open:i,title:s,image:o}=e,n=o||t?t:T.iconDefaultAction,l=this._getIconImageStyles(e),r={[T.actionsMenuItemActive]:i},a={[T.actionImage]:!!l["background-image"]};return n&&(a[n]=!!n),f("div",{key:`panel-${e.uid}`,bind:this,"data-panel":e,onclick:this._triggerPanel,onkeydown:this._triggerPanel,class:this.classes(T.actionsMenuItem,r),role:"button",tabindex:"0",title:s,"aria-label":s},f("span",{class:this.classes(a),styles:l}))}renderActionsSections(e,t,i){const s=t.toArray().map(((t,i)=>f("ul",{key:`${e}-action-section-${i}`,class:T.actionsList},this.renderActionSection(e,t))));return f("div",{role:"group","aria-expanded":e.actionsOpen?"true":"false",key:"actions-section",id:i,class:T.actions,hidden:!e.actionsOpen||null},s)}renderActionSection(e,t){return(t&&t.toArray()).map((t=>this.renderAction({item:e,action:t})))}renderActionIcon(e){const{active:t,className:i}=e,s=this._getIconImageStyles(e),o="button"!==e.type||e.image||i?i:T.iconDefaultAction,n={[T.actionImage]:!t&&!!s["background-image"],[T.iconLoading]:t,[T.rotating]:t};return o&&!t&&(n[o]=!0),f("span",{key:"action-icon","aria-hidden":"true",class:this.classes(T.actionIcon,n),styles:s})}renderActionTitle(e,t){return t?null:f("span",{key:"action-title",class:T.actionTitle},e)}renderAction(e){const{item:t,action:i,singleAction:s}=e,{active:o,disabled:n,title:l}=i,r={[T.actionsMenuItem]:s&&"button"===i.type,[T.action]:o||!s&&"toggle"!==i.type,[T.actionToggle]:!o&&"toggle"===i.type,[T.actionToggleOn]:!o&&"toggle"===i.type&&i.value,[T.disabledElement]:n},a=[this.renderActionIcon(i),this.renderActionTitle(l,s)];return s?f("div",{bind:this,"data-item":t,"data-action":i,role:"button",key:`single-action-${i.uid}`,onclick:this._triggerAction,onkeydown:this._triggerAction,classes:r,tabindex:"0",title:l,"aria-label":l},a):f("li",{bind:this,"data-item":t,"data-action":i,key:`action-${i.uid}`,onclick:this._triggerAction,onkeydown:this._triggerAction,classes:r,tabindex:"0",role:"button",title:l,"aria-label":l},a)}_setTooltipReference(e,t){this._tooltipReferenceMap.set(t.uid,e),this.scheduleRender()}_hasMessage(e){return!!e.error||e.incompatible}_hasChildren(e){return!!e.children.length&&!this._hasMessage(e)}_sortNodeRemoved(e){const{_sortableMap:t}=this,i=e.dataset.group,s=t.get(i);s&&s.destroy(),t.delete(i)}_destroySortables(){const{_sortableMap:e,_sortableNodes:t}=this;e.forEach((e=>e&&e.destroy())),e.clear(),t.clear()}_moveLayerFromChildList({to:e,from:t,item:i,newIndex:s}){const o=i["data-item"],n=e["data-item"],l=t["data-item"];this.viewModel.moveListItem(o,l,n,s)}_sortLayers(e){if(!e)return;const t=e.el["data-item"],i=e.toArray();var s,o;t?_(t,i):p(null==(s=this.view)||null==(o=s.map)?void 0:o.layers,i)}_toggleSorting(e,t){const{_sortableMap:i,selectionEnabled:s}=this,o=i.get(t),n=e["data-item"],l=(t===U||n.childrenSortable&&b(n))&&s;if(o)o.option("disabled",!l);else if(l){const s=A.create(e,{dataIdAttr:k,group:{name:t,pull:this._sortableCanPull,put:this._sortableCanPut},filter:`[${L}="true"]`,fallbackTolerance:4,onSort:this._onSortableSort,onEnd:this._onSortableEnd,disabled:!l,chosenClass:T.sortableChosen});i.set(t,s)}}_toggleAllSorting(){this._sortableNodes.forEach(((e,t)=>this._toggleSorting(e,t)))}_sortNodeCreated(e){const t=e.dataset.group;t&&(this._sortableNodes.set(t,e),this._toggleSorting(e,t))}_setVisibleItems(e){this._tooltipReferenceMap.clear(),this.visibleItems=null==e?void 0:e.filter((e=>this.errorsVisible||!e.error))}_getSingleActionButton(e){return e.reduce((e=>e)).filter((e=>e&&"button"===e.type)).getItemAt(0)}_focusListItem(e){var t;const{_focusSortUid:i}=this;if(!e||!i)return;(null==(t=e["data-item"].layer)?void 0:t.uid)===i&&(e.focus(),this._focusSortUid=null)}_watchActionSectionChanges(e,t){const i=E.actionSection+t;this._handles.add(e.on("change",this.scheduleRender.bind(this)),i),e.forEach((e=>this._renderOnActionChanges(e,t)))}_renderOnActionChanges(e,t){const i=E.actions+t;"toggle"!==e.type?"slider"!==e.type?this._handles.add([l(e,["className","image","id","title","visible"],(()=>this.scheduleRender()))],i):this._handles.add([l(e,["className","id","title","visible","value","displayValueEnabled","max","min","step"],(()=>this.scheduleRender()))],i):this._handles.add([l(e,["className","image","id","title","visible","value"],(()=>this.scheduleRender()))],i)}_renderOnItemChanges(e){const t=e.uid,i=E.items+t;this._handles.add([l(e,["actionsOpen","visible","open","updating","title","visibleAtCurrentScale","error","visibilityMode","panel","panel.title","panel.content","panel.className","sortable","childrenSortable"],(()=>this.scheduleRender())),e.actionsSections.on("change",(()=>this.scheduleRender())),e.children.on("change",(()=>this.scheduleRender()))],i),e.children.forEach((e=>this._renderOnItemChanges(e))),e.actionsSections.forEach((e=>this._watchActionSectionChanges(e,t)))}_itemsChanged(e){this._handles.removeAll(),e.forEach((e=>this._renderOnItemChanges(e))),this._setVisibleItems(e),this.scheduleRender()}_filterActions(e){return e.map((e=>e.filter((e=>e.visible))))}_countActions(e){return e.reduce(((e,t)=>e+t.length),0)}_getIconImageStyles(e){const t="geoscene.widgets.LayerList.ListItemPanel"===e.declaredClass||"geoscene.support.Action.ActionButton"===e.declaredClass||"geoscene.support.Action.ActionToggle"===e.declaredClass?e.image:null;return{"background-image":t?`url("${t}")`:null}}_selectionKeydown(e){const t=["ArrowDown","ArrowUp"],s=i(e);if(-1===t.indexOf(s))return void this._toggleSelection(e);e.stopPropagation();const o=e.currentTarget,n=o["data-item"],{_sortableMap:l,selectedItems:r}=this,a=o.dataset.group,c=l.get(a);if(!c)return;const d=u(n,r),h=c.toArray(),m=e.target,g=h.indexOf(m.dataset[M]);if(-1!==g){if("ArrowDown"===s){const e=g+1;if(e>=h.length)return;var p,_;if(d)w(h,g,e),c.sort(h),this._sortLayers(c),this._focusSortUid=null==(p=n.layer)?void 0:p.uid;else this._focusSortUid=null==(_=n.layer)?void 0:_.uid,this.scheduleRender()}if("ArrowUp"===s){const e=g-1;if(e<=-1)return;var b,y;if(d)w(h,g,e),c.sort(h),this._sortLayers(c),this._focusSortUid=null==(b=n.layer)?void 0:b.uid;else this._focusSortUid=null==(y=n.layer)?void 0:y.uid,this.scheduleRender()}}}_toggleActionsOpen(e){const t=e.currentTarget["data-item"],{actionsOpen:i}=t,s=!i;s&&this.operationalItems.forEach((e=>x(e))),t.actionsOpen=s,e.stopPropagation()}_triggerPanel(e){const t=e.currentTarget["data-panel"];t&&(t.open=!t.open),e.stopPropagation()}_triggerAction(e){const t=e.currentTarget,i=t["data-action"],s=t["data-item"];"toggle"===i.type&&(i.value=!i.value),this.triggerAction(i,s),e.stopPropagation()}_toggleVisibility(e){const t=e.currentTarget,i=t.getAttribute("data-parent-visibility"),s=t["data-item"];i===R.exclusive&&s.visible||(s.visible=!s.visible),e.stopPropagation()}_toggleChildrenClick(e){const t=e.currentTarget["data-item"];t.open=!t.open,e.stopPropagation()}_toggleSelection(e){e.stopPropagation();const{multipleSelectionEnabled:t,selectedItems:i}=this,s=e.currentTarget["data-item"],o=u(s,i),{length:n}=i;if(!t)return n&&!(o&&1===n)?(i.removeAll(),void i.add(s)):void(o?null==i.remove||i.remove(o):i.add(s));o?null==i.remove||i.remove(o):i.add(s)}};e([c()],N.prototype,"visibleItems",void 0),e([c()],N.prototype,"iconClass",void 0),e([c()],N.prototype,"errorsVisible",void 0),e([c({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],N.prototype,"label",void 0),e([c()],N.prototype,"listItemCanGiveFunction",void 0),e([c()],N.prototype,"listItemCanReceiveFunction",void 0),e([r("viewModel.listItemCreatedFunction")],N.prototype,"listItemCreatedFunction",void 0),e([c(),v("geoscene/widgets/LayerList/t9n/LayerList")],N.prototype,"messages",void 0),e([c(),v("geoscene/t9n/common")],N.prototype,"messagesCommon",void 0),e([c()],N.prototype,"multipleSelectionEnabled",void 0),e([r("viewModel.operationalItems")],N.prototype,"operationalItems",void 0),e([c()],N.prototype,"selectionEnabled",void 0),e([c()],N.prototype,"selectedItems",void 0),e([r("viewModel.view")],N.prototype,"view",void 0),e([I("trigger-action"),c({type:m})],N.prototype,"viewModel",void 0),e([c()],N.prototype,"visibleElements",void 0),e([a("visibleElements")],N.prototype,"castVisibleElements",null),e([r("viewModel.triggerAction")],N.prototype,"triggerAction",null),e([y()],N.prototype,"_toggleActionsOpen",null),e([y()],N.prototype,"_triggerPanel",null),e([y()],N.prototype,"_triggerAction",null),e([y()],N.prototype,"_toggleVisibility",null),e([y()],N.prototype,"_toggleChildrenClick",null),e([y()],N.prototype,"_toggleSelection",null),N=e([d("geoscene.widgets.LayerList")],N);const j=N;export{j as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{eventKey as i}from"../core/events.js";import s from"../core/Handles.js";import o from"../core/has.js";import{on as n,init as l}from"../core/watchUtils.js";import{aliasOf as r}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import{cast as a}from"../core/accessorSupport/decorators/cast.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import h from"./Widget.js";import m from"./LayerList/LayerListViewModel.js";import g from"./LayerList/ListItem.js";import{findSelectedItem as u,sortLayersToIds as p,sortChildLayersToIds as _,canSortSublayers as b}from"./LayerList/support/layerListUtils.js";import{accessibleHandler as y}from"./support/decorators/accessibleHandler.js";import{messageBundle as v}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{vmEvent as I}from"./support/decorators/vmEvent.js";import{tsx as f}from"./support/jsxFactory.js";import"./support/widgetUtils.js";import A from"sortablejs";function w(e,t,i){e.splice(i,0,e.splice(t,1)[0])}const C="geoscene-layerlist-new-ui",S=t.ofType(g),L="data-sort-filter",k="data-layer-uid",M="layerUid",T={base:"geoscene-layer-list geoscene-widget geoscene-widget--panel",newUI:"geoscene-layer-list--new-ui",noItems:"geoscene-layer-list__no-items",list:"geoscene-layer-list__list",listRoot:"geoscene-layer-list__list--root",listExclusive:"geoscene-layer-list__list--exclusive",listInherited:"geoscene-layer-list__list--inherited",listIndependent:"geoscene-layer-list__list--independent",item:"geoscene-layer-list__item",itemContent:"geoscene-layer-list__item-content",itemMessage:"geoscene-layer-list__item--has-message",itemInvisible:"geoscene-layer-list__item--invisible",itemInvisibleAtScale:"geoscene-layer-list__item--invisible-at-scale",itemUpdating:"geoscene-layer-list__item--updating",itemChildren:"geoscene-layer-list__item--has-children",itemSelectable:"geoscene-layer-list__item--selectable",itemContainer:"geoscene-layer-list__item-container",actionsMenu:"geoscene-layer-list__item-actions-menu",actionsMenuItem:"geoscene-layer-list__item-actions-menu-item",actionsMenuItemActive:"geoscene-layer-list__item-actions-menu-item--active",actions:"geoscene-layer-list__item-actions",actionsList:"geoscene-layer-list__item-actions-list",action:"geoscene-layer-list__item-action",actionIcon:"geoscene-layer-list__item-action-icon",actionImage:"geoscene-layer-list__item-action-image",actionTitle:"geoscene-layer-list__item-action-title",actionToggle:"geoscene-layer-list__action-toggle",actionToggleOn:"geoscene-layer-list__action-toggle--on",label:"geoscene-layer-list__item-label",message:"geoscene-layer-list__item-message",title:"geoscene-layer-list__item-title",toggleVisible:"geoscene-layer-list__item-toggle",toggleVisibleIcon:"geoscene-layer-list__item-toggle-icon",toggleIcon:"geoscene-layer-list__item-toggle-icon",radioIcon:"geoscene-layer-list__item-radio-icon",childToggle:"geoscene-layer-list__child-toggle",childToggleOpen:"geoscene-layer-list__child-toggle--open",childOpened:"geoscene-layer-list__child-toggle-icon--opened",childClosed:"geoscene-layer-list__child-toggle-icon--closed",childClosed_RTL:"geoscene-layer-list__child-toggle-icon--closed-rtl",sortableChosen:"geoscene-layer-list--chosen",disabled:"geoscene-disabled",disabledElement:"geoscene-disabled-element",hidden:"geoscene-hidden",rotating:"geoscene-rotating",iconEllipses:"geoscene-icon-handle-horizontal",iconVisible:"geoscene-icon-visible",iconInvisible:"geoscene-icon-non-visible",iconRadioSelected:"geoscene-icon-radio-checked",iconRadioUnselected:"geoscene-icon-radio-unchecked",iconNoticeTriangle:"geoscene-icon-notice-triangle",iconChildrenOpen:"geoscene-icon-down-arrow",iconDownArrow:"geoscene-icon-down-arrow",iconRightArrow:"geoscene-icon-right-triangle-arrow",iconLeftArrow:"geoscene-icon-left-triangle-arrow",iconLoading:"geoscene-icon-loading-indicator",iconDefaultAction:"geoscene-icon-default-action",widgetIcon:"geoscene-icon-layers"},E={actions:"actions",actionSection:"action-section",items:"items"},R={exclusive:"exclusive",inherited:"inherited",independent:"independent"};function x(e){const{actionsOpen:t,children:i}=e;t&&(e.actionsOpen=!1),i.forEach((e=>x(e)))}const U="root",O={statusIndicators:!0};let N=class extends h{constructor(e,t){super(e,t),this._handles=new s,this._sortableNodes=new Map,this._sortableMap=new Map,this._focusSortUid=null,this._newUI=o(C),this._tooltipReferenceMap=new Map,this.visibleItems=null,this.iconClass=T.widgetIcon,this.label=void 0,this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.listItemCreatedFunction=null,this.messages=null,this.messagesCommon=null,this.multipleSelectionEnabled=!1,this.operationalItems=null,this.selectionEnabled=!1,this.selectedItems=new S,this.view=null,this.viewModel=new m,this.visibleElements={...O},this._onSortableSort=({to:e,from:t,item:i,newIndex:s})=>{t&&e&&(t===e?this._sortLayers(this._sortableMap.get(t.dataset.group)):this._moveLayerFromChildList({to:e,from:t,item:i,newIndex:s}))},this._sortableCanSort=(e,t)=>!(!e.el.dataset.group||!t.el.dataset.group),this._sortableCanPull=(e,t,i)=>{const{listItemCanGiveFunction:s}=this,o={selected:i["data-item"],from:t.el["data-item"],to:e.el["data-item"]};return!this._sortableCanSort(e,t)||"function"!=typeof s||s.call(null,o)},this._sortableCanPut=(e,t,i)=>{const{listItemCanReceiveFunction:s}=this,o={selected:i["data-item"],from:t.el["data-item"],to:e.el["data-item"]};return!this._sortableCanSort(e,t)||"function"!=typeof s||s.call(null,o)},this._onSortableEnd=({oldIndex:e,from:t,to:i,item:s})=>{t!==i&&t.insertBefore(s,t.children[e])}}initialize(){const e=this.operationalItems;this._setVisibleItems(e),this.own(n(this,"operationalItems","change",(()=>this._itemsChanged(e))),l(this,"selectionEnabled",(()=>this._toggleAllSorting())))}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-tooltip-manager.js"),import("@esri/calcite-components/dist/components/calcite-tooltip.js")])}destroy(){this._destroySortables(),this._tooltipReferenceMap.clear(),this._handles.destroy(),this._handles=null}castVisibleElements(e){return{...O,...e}}triggerAction(e,t){this.viewModel.triggerAction(e,t)}render(){var e;const{visibleItems:t,_newUI:i}=this,s=null==(e=this.viewModel)?void 0:e.state,o={[T.newUI]:i,[T.hidden]:"loading"===s,[T.disabled]:"disabled"===s},n=this.renderItemTooltips(),l=this.renderItems();return f("div",{class:this.classes(T.base,o)},null!=t&&t.length?[n,n.length?f("calcite-tooltip-manager",null,l):l]:this.renderNoItems())}renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:i}=this;return e?f("calcite-tooltip",{label:i.layerIncompatible,referenceElement:t.get(e.uid)},i.layerIncompatibleTooltip):null}renderItemTooltipNodes(e){const{incompatible:t,children:i}=e;return[t?this.renderItemTooltip(e):null,...t?[]:null==i?void 0:i.toArray().map((e=>this.renderItemTooltipNodes(e)))]}renderItemTooltips(){return this.visibleItems.toArray().map((e=>this.renderItemTooltipNodes(e)))}renderNoItems(){return f("div",{class:T.noItems},this.messages.noItemsToDisplay)}renderItems(){const{visibleItems:e,selectionEnabled:t,messages:i}=this;return f("ul",{"aria-label":i.widgetLabel,role:t?"listbox":void 0,afterCreate:this._sortNodeCreated,afterUpdate:this._sortNodeCreated,afterRemoved:this._sortNodeRemoved,"data-group":U,bind:this,class:this.classes(T.list,T.listRoot,T.listIndependent)},null==e?void 0:e.map((e=>this.renderItem(e,null))).toArray())}renderActionsMenuIcon(e,t){const{messagesCommon:i}=this,s={[T.actionsMenuItemActive]:e.actionsOpen};return f("div",{key:"actions-menu-toggle","data-item":e,bind:this,onclick:this._toggleActionsOpen,onkeydown:this._toggleActionsOpen,class:this.classes(T.actionsMenuItem,s),tabindex:"0",role:"button","aria-controls":t,"aria-label":i.options,title:i.options},f("span",{"aria-hidden":"true",class:T.iconEllipses}))}renderActionsMenu(e,t,i,s){const{panel:o}=e,n=o&&o.visible?this.renderPanelButton(o):null,l=1===i&&this._getSingleActionButton(t),r=l?this.renderAction({item:e,action:l,singleAction:!0}):null,a=!l&&i?this.renderActionsMenuIcon(e,s):null;return a||n||l?f("div",{key:"actions-menu",class:T.actionsMenu},n,r,a):null}renderChildList(e,t){var i;const{selectionEnabled:s}=this,{visibilityMode:o,children:n}=e,l=this._hasChildren(e),r=!l&&s&&"group"===(null==(i=e.layer)?void 0:i.type),{exclusive:a,inherited:c}=R,d={[T.listExclusive]:o===a,[T.listInherited]:o===c,[T.listIndependent]:o!==c&&o!==a};return l||r?f("ul",{bind:this,key:"list-items",id:t,"data-group":e.uid,"data-item":e,afterCreate:this._sortNodeCreated,afterUpdate:this._sortNodeCreated,afterRemoved:this._sortNodeRemoved,class:this.classes(T.list,d),"aria-expanded":e.open?"true":"false",role:s?"listbox":o===a?"radiogroup":"group",hidden:!e.open&&!r||null},null==n?void 0:n.map((t=>this.renderItem(t,e))).toArray()):null}renderChildrenToggle(e,t){const{messagesCommon:i}=this,s=this._hasChildren(e),o={[T.childToggleOpen]:e.open},n=e.open?i.collapse:i.expand;return s?f("span",{onclick:this._toggleChildrenClick,onkeydown:this._toggleChildrenClick,"data-item":e,key:"toggle-children",class:this.classes(T.childToggle,o),tabindex:"0",role:"button","aria-controls":t,"aria-label":n,title:n},f("span",{"aria-hidden":"true",class:this.classes(T.childClosed,T.iconRightArrow)}),f("span",{"aria-hidden":"true",class:this.classes(T.childOpened,T.iconDownArrow)}),f("span",{"aria-hidden":"true",class:this.classes(T.childClosed_RTL,T.iconLeftArrow)})):null}renderItemMessage(e){return e.error?f("div",{key:"geoscene-layer-list__error",class:T.message,role:"alert"},f("span",{"aria-hidden":"true",class:T.iconNoticeTriangle}),this.messages.layerError):e.incompatible?f("div",{key:"geoscene-layer-list__incompatible",class:T.message,role:"alert"},f("span",{bind:this,tabIndex:0,"aria-hidden":"true",class:T.iconNoticeTriangle,afterCreate:t=>this._setTooltipReference(t,e)}),this.messages.layerIncompatible):null}renderItemContent(e,t,i){const{id:s}=this,o=`${s}_${e.uid}`,n=`${o}_actions`,l=`${o}__list`,{panel:r}=e,a=this._filterActions(e.actionsSections),c=this._countActions(a);return[f("div",{key:"list-item-container",class:T.itemContainer},this.renderChildrenToggle(e,l),this.renderLabel(e,t,i),this.renderActionsMenu(e,a,c,n)),this.renderItemMessage(e),c?this.renderActionsSections(e,a,n):null,r&&r.open?r.render():null,this.renderChildList(e,l)]}renderItem(e,t){const{_newUI:i,id:s,selectionEnabled:o,selectedItems:n,visibleElements:l}=this,r=`${`${s}_${e.uid}`}__title`,a=this._hasMessage(e),c=this._hasChildren(e),d={[T.itemChildren]:c,[T.itemMessage]:!!a,[T.itemUpdating]:e.updating&&!t&&l.statusIndicators,[T.itemInvisible]:i&&!e.visible,[T.itemInvisibleAtScale]:!e.visibleAtCurrentScale,[T.itemSelectable]:o};if(o){var h;const i={[k]:null==(h=e.layer)?void 0:h.uid,[L]:(!e.sortable).toString()};return f("li",{key:`item-with-selection-${e.uid}`,bind:this,afterCreate:this._focusListItem,afterUpdate:this._focusListItem,class:this.classes(T.item,d),"aria-labelledby":r,onclick:this._toggleSelection,onkeydown:this._selectionKeydown,"data-item":e,"data-group":t?t.uid:U,tabIndex:0,"aria-selected":u(e,n)?"true":"false",role:"option",...i},this.renderItemContent(e,t,r))}return f("li",{key:`item-no-selection-${e.uid}`,bind:this,afterCreate:this._focusListItem,afterUpdate:this._focusListItem,class:this.classes(T.item,d),"aria-labelledby":r},this.renderItemContent(e,t,r))}renderItemTitle(e,t){const{messages:i}=this,s=e.title||i.untitledLayer,o=e.visibleAtCurrentScale?s:`${s} (${i.layerInvisibleAtScale})`;return f("span",{key:"layer-title-container",id:t,title:o,"aria-label":o,class:T.title},s)}renderItemToggleIcon(e,t){const{_newUI:i}=this,{exclusive:s}=R,o=t&&t.visibilityMode,n={[T.toggleVisibleIcon]:i,[T.toggleIcon]:i&&o!==s,[T.radioIcon]:i&&o===s,[T.iconRadioSelected]:o===s&&e.visible,[T.iconRadioUnselected]:o===s&&!e.visible,[T.iconVisible]:o!==s&&e.visible,[T.iconInvisible]:o!==s&&!e.visible};return f("span",{key:"item-toggle-icon",class:this.classes(n),"aria-hidden":"true"})}renderItemToggle(e,t,i){const{selectionEnabled:s,messages:o}=this,{exclusive:n}=R,l=t&&t.visibilityMode,r=l===n?"radio":"switch";return f("span",s?{key:"item-toggle-selection-enabled",class:T.toggleVisible,bind:this,onclick:this._toggleVisibility,onkeydown:this._toggleVisibility,"data-item":e,"data-parent-visibility":l,tabIndex:0,title:e.visible?o.hideLayer:o.showLayer,"aria-checked":e.visible?"true":"false",role:r,"aria-labelledby":i}:{key:"item-toggle",class:T.toggleVisible},this.renderItemToggleIcon(e,t))}renderLabel(e,t,i){const{selectionEnabled:s,_newUI:o,messages:n}=this,{inherited:l,exclusive:r}=R,a=null==t?void 0:t.visibilityMode,c=a===r?"radio":"switch",d=[this.renderItemToggle(e,t,i),this.renderItemTitle(e,i)];o&&d.reverse();const h=f("div",s?{key:`item-label-no-selection-${e.uid}`,class:T.label}:{key:`item-label-with-selection-${e.uid}`,class:T.label,bind:this,onclick:this._toggleVisibility,onkeydown:this._toggleVisibility,"data-item":e,"data-parent-visibility":a,tabIndex:0,"aria-checked":e.visible?"true":"false",title:e.visible?n.hideLayer:n.showLayer,role:c,"aria-labelledby":i},d);return a===l||e.error?f("div",{key:`item-label-container-${e.uid}`,class:T.label},this.renderItemTitle(e,i)):h}renderPanelButton(e){const{className:t,open:i,title:s,image:o}=e,n=o||t?t:T.iconDefaultAction,l=this._getIconImageStyles(e),r={[T.actionsMenuItemActive]:i},a={[T.actionImage]:!!l["background-image"]};return n&&(a[n]=!!n),f("div",{key:`panel-${e.uid}`,bind:this,"data-panel":e,onclick:this._triggerPanel,onkeydown:this._triggerPanel,class:this.classes(T.actionsMenuItem,r),role:"button",tabindex:"0",title:s,"aria-label":s},f("span",{class:this.classes(a),styles:l}))}renderActionsSections(e,t,i){const s=t.toArray().map(((t,i)=>f("ul",{key:`${e}-action-section-${i}`,class:T.actionsList},this.renderActionSection(e,t))));return f("div",{role:"group","aria-expanded":e.actionsOpen?"true":"false",key:"actions-section",id:i,class:T.actions,hidden:!e.actionsOpen||null},s)}renderActionSection(e,t){return(t&&t.toArray()).map((t=>this.renderAction({item:e,action:t})))}renderActionIcon(e){const{active:t,className:i}=e,s=this._getIconImageStyles(e),o="button"!==e.type||e.image||i?i:T.iconDefaultAction,n={[T.actionImage]:!t&&!!s["background-image"],[T.iconLoading]:t,[T.rotating]:t};return o&&!t&&(n[o]=!0),f("span",{key:"action-icon","aria-hidden":"true",class:this.classes(T.actionIcon,n),styles:s})}renderActionTitle(e,t){return t?null:f("span",{key:"action-title",class:T.actionTitle},e)}renderAction(e){const{item:t,action:i,singleAction:s}=e,{active:o,disabled:n,title:l}=i,r={[T.actionsMenuItem]:s&&"button"===i.type,[T.action]:o||!s&&"toggle"!==i.type,[T.actionToggle]:!o&&"toggle"===i.type,[T.actionToggleOn]:!o&&"toggle"===i.type&&i.value,[T.disabledElement]:n},a=[this.renderActionIcon(i),this.renderActionTitle(l,s)];return s?f("div",{bind:this,"data-item":t,"data-action":i,role:"button",key:`single-action-${i.uid}`,onclick:this._triggerAction,onkeydown:this._triggerAction,classes:r,tabindex:"0",title:l,"aria-label":l},a):f("li",{bind:this,"data-item":t,"data-action":i,key:`action-${i.uid}`,onclick:this._triggerAction,onkeydown:this._triggerAction,classes:r,tabindex:"0",role:"button",title:l,"aria-label":l},a)}_setTooltipReference(e,t){this._tooltipReferenceMap.set(t.uid,e),this.scheduleRender()}_hasMessage(e){return!!e.error||e.incompatible}_hasChildren(e){return!!e.children.length&&!this._hasMessage(e)}_sortNodeRemoved(e){const{_sortableMap:t}=this,i=e.dataset.group,s=t.get(i);s&&s.destroy(),t.delete(i)}_destroySortables(){const{_sortableMap:e,_sortableNodes:t}=this;e.forEach((e=>e&&e.destroy())),e.clear(),t.clear()}_moveLayerFromChildList({to:e,from:t,item:i,newIndex:s}){const o=i["data-item"],n=e["data-item"],l=t["data-item"];this.viewModel.moveListItem(o,l,n,s)}_sortLayers(e){if(!e)return;const t=e.el["data-item"],i=e.toArray();var s,o;t?_(t,i):p(null==(s=this.view)||null==(o=s.map)?void 0:o.layers,i)}_toggleSorting(e,t){const{_sortableMap:i,selectionEnabled:s}=this,o=i.get(t),n=e["data-item"],l=(t===U||n.childrenSortable&&b(n))&&s;if(o)o.option("disabled",!l);else if(l){const s=A.create(e,{dataIdAttr:k,group:{name:t,pull:this._sortableCanPull,put:this._sortableCanPut},filter:`[${L}="true"]`,fallbackTolerance:4,onSort:this._onSortableSort,onEnd:this._onSortableEnd,disabled:!l,chosenClass:T.sortableChosen});i.set(t,s)}}_toggleAllSorting(){this._sortableNodes.forEach(((e,t)=>this._toggleSorting(e,t)))}_sortNodeCreated(e){const t=e.dataset.group;t&&(this._sortableNodes.set(t,e),this._toggleSorting(e,t))}_setVisibleItems(e){this._tooltipReferenceMap.clear(),this.visibleItems=null==e?void 0:e.filter((e=>this.errorsVisible||!e.error))}_getSingleActionButton(e){return e.reduce((e=>e)).filter((e=>e&&"button"===e.type)).getItemAt(0)}_focusListItem(e){var t;const{_focusSortUid:i}=this;if(!e||!i)return;(null==(t=e["data-item"].layer)?void 0:t.uid)===i&&(e.focus(),this._focusSortUid=null)}_watchActionSectionChanges(e,t){const i=E.actionSection+t;this._handles.add(e.on("change",this.scheduleRender.bind(this)),i),e.forEach((e=>this._renderOnActionChanges(e,t)))}_renderOnActionChanges(e,t){const i=E.actions+t;"toggle"!==e.type?"slider"!==e.type?this._handles.add([l(e,["className","image","id","title","visible"],(()=>this.scheduleRender()))],i):this._handles.add([l(e,["className","id","title","visible","value","displayValueEnabled","max","min","step"],(()=>this.scheduleRender()))],i):this._handles.add([l(e,["className","image","id","title","visible","value"],(()=>this.scheduleRender()))],i)}_renderOnItemChanges(e){const t=e.uid,i=E.items+t;this._handles.add([l(e,["actionsOpen","visible","open","updating","title","visibleAtCurrentScale","error","visibilityMode","panel","panel.title","panel.content","panel.className","sortable","childrenSortable"],(()=>this.scheduleRender())),e.actionsSections.on("change",(()=>this.scheduleRender())),e.children.on("change",(()=>this.scheduleRender()))],i),e.children.forEach((e=>this._renderOnItemChanges(e))),e.actionsSections.forEach((e=>this._watchActionSectionChanges(e,t)))}_itemsChanged(e){this._handles.removeAll(),e.forEach((e=>this._renderOnItemChanges(e))),this._setVisibleItems(e),this.scheduleRender()}_filterActions(e){return e.map((e=>e.filter((e=>e.visible))))}_countActions(e){return e.reduce(((e,t)=>e+t.length),0)}_getIconImageStyles(e){const t="geoscene.widgets.LayerList.ListItemPanel"===e.declaredClass||"geoscene.support.Action.ActionButton"===e.declaredClass||"geoscene.support.Action.ActionToggle"===e.declaredClass?e.image:null;return{"background-image":t?`url("${t}")`:null}}_selectionKeydown(e){const t=["ArrowDown","ArrowUp"],s=i(e);if(-1===t.indexOf(s))return void this._toggleSelection(e);e.stopPropagation();const o=e.currentTarget,n=o["data-item"],{_sortableMap:l,selectedItems:r}=this,a=o.dataset.group,c=l.get(a);if(!c)return;const d=u(n,r),h=c.toArray(),m=e.target,g=h.indexOf(m.dataset[M]);if(-1!==g){if("ArrowDown"===s){const e=g+1;if(e>=h.length)return;var p,_;if(d)w(h,g,e),c.sort(h),this._sortLayers(c),this._focusSortUid=null==(p=n.layer)?void 0:p.uid;else this._focusSortUid=null==(_=n.layer)?void 0:_.uid,this.scheduleRender()}if("ArrowUp"===s){const e=g-1;if(e<=-1)return;var b,y;if(d)w(h,g,e),c.sort(h),this._sortLayers(c),this._focusSortUid=null==(b=n.layer)?void 0:b.uid;else this._focusSortUid=null==(y=n.layer)?void 0:y.uid,this.scheduleRender()}}}_toggleActionsOpen(e){const t=e.currentTarget["data-item"],{actionsOpen:i}=t,s=!i;s&&this.operationalItems.forEach((e=>x(e))),t.actionsOpen=s,e.stopPropagation()}_triggerPanel(e){const t=e.currentTarget["data-panel"];t&&(t.open=!t.open),e.stopPropagation()}_triggerAction(e){const t=e.currentTarget,i=t["data-action"],s=t["data-item"];"toggle"===i.type&&(i.value=!i.value),this.triggerAction(i,s),e.stopPropagation()}_toggleVisibility(e){const t=e.currentTarget,i=t.getAttribute("data-parent-visibility"),s=t["data-item"];i===R.exclusive&&s.visible||(s.visible=!s.visible),e.stopPropagation()}_toggleChildrenClick(e){const t=e.currentTarget["data-item"];t.open=!t.open,e.stopPropagation()}_toggleSelection(e){e.stopPropagation();const{multipleSelectionEnabled:t,selectedItems:i}=this,s=e.currentTarget["data-item"],o=u(s,i),{length:n}=i;if(!t)return n&&!(o&&1===n)?(i.removeAll(),void i.add(s)):void(o?null==i.remove||i.remove(o):i.add(s));o?null==i.remove||i.remove(o):i.add(s)}};e([c()],N.prototype,"visibleItems",void 0),e([c()],N.prototype,"iconClass",void 0),e([c()],N.prototype,"errorsVisible",void 0),e([c({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],N.prototype,"label",void 0),e([c()],N.prototype,"listItemCanGiveFunction",void 0),e([c()],N.prototype,"listItemCanReceiveFunction",void 0),e([r("viewModel.listItemCreatedFunction")],N.prototype,"listItemCreatedFunction",void 0),e([c(),v("geoscene/widgets/LayerList/t9n/LayerList")],N.prototype,"messages",void 0),e([c(),v("geoscene/t9n/common")],N.prototype,"messagesCommon",void 0),e([c()],N.prototype,"multipleSelectionEnabled",void 0),e([r("viewModel.operationalItems")],N.prototype,"operationalItems",void 0),e([c()],N.prototype,"selectionEnabled",void 0),e([c()],N.prototype,"selectedItems",void 0),e([r("viewModel.view")],N.prototype,"view",void 0),e([I("trigger-action"),c({type:m})],N.prototype,"viewModel",void 0),e([c()],N.prototype,"visibleElements",void 0),e([a("visibleElements")],N.prototype,"castVisibleElements",null),e([r("viewModel.triggerAction")],N.prototype,"triggerAction",null),e([y()],N.prototype,"_toggleActionsOpen",null),e([y()],N.prototype,"_triggerPanel",null),e([y()],N.prototype,"_triggerAction",null),e([y()],N.prototype,"_toggleVisibility",null),e([y()],N.prototype,"_toggleChildrenClick",null),e([y()],N.prototype,"_toggleSelection",null),N=e([d("geoscene.widgets.LayerList")],N);const j=N;export{j as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import t from"../../../core/Handles.js";import{pt2px as s}from"../../../core/screenUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{renderSVG as a}from"../../../symbols/support/svgUtils.js";import{getCSSFilterFromEffectList as o}from"../../../symbols/support/utils.js";import l from"../../Widget.js";import{renderRelationshipRamp as n}from"./support/relationshipUtils.js";import{getUnivariateAboveAndBelowRampElements as c,getUnivariateSizeRampSize as d,getUnivariateColorRampSize as p,getUnivariateColorRampPreview as m,getUnivariateColorRampMargin as h,getUnivariateColorSizeRampElements as y}from"./support/univariateUtils.js";import{getTitle as g,attachToNode as _,isImageryStretchedLegend as v}from"../support/styleUtils.js";import{Heading as u,incrementHeadingLevel as f}from"../../support/Heading.js";import{accessibleHandler as b}from"../../support/decorators/accessibleHandler.js";import{messageBundle as w}from"../../support/decorators/messageBundle.js";import"../../../core/Logger.js";import{tsx as L}from"../../support/jsxFactory.js";import{isRTL as C}from"../../support/widgetUtils.js";import{substitute as x}from"../../../intl/substitute.js";const S={activated:"esri-legend--card__carousel-indicator--activated",base:"esri-legend--card",stacked:"esri-legend--stacked",carouselTitle:"esri-legend--card__carousel-title",indicator:"esri-legend--card__carousel-indicator",intervalSeparator:"esri-legend--card__interval-separator",imageryLayerStretchedImage:"esri-legend--card__imagery-layer-image--stretched",imageLabel:"esri-legend--card__image-label",layerCaption:"esri-legend--card__layer-caption",labelElement:"esri-legend--card__label-element",layerRow:"esri-legend--card__layer-row",labelCell:"esri-legend--card__label-cell",message:"esri-legend--card__message",rampLabel:"esri-legend--card__ramp-label",section:"esri-legend--card__section",relationshipSection:"esri-legend--card__relationship-section",serviceCaptionText:"esri-legend--card__service-caption-text",serviceContent:"esri-legend--card__service-content",service:"esri-legend--card__service",groupLayer:"esri-legend--card__group-layer",groupLayerChild:"esri-legend--card__group-layer-child",symbol:"esri-legend--card__symbol",sizeRampRow:"esri-legend--card__size-ramp-row",symbolRow:"esri-legend--card__symbol-row",symbolCell:"esri-legend--card__symbol-cell",indicatorContainer:"esri-legend--card__carousel-indicator-container",intervalSeparatorsContainer:"esri-legend--card__interval-separators-container",relationshipLabelContainer:"esri-legend--card__relationship-label-container",labelContainer:"esri-legend--card__label-container",serviceCaptionContainer:"esri-legend--card__service-caption-container",symbolContainer:"esri-legend--card__symbol-container",sizeRampContainer:"esri-legend--card__size-ramp-container",sizeRampPreview:"esri-legend--card__size-ramp-preview",rampContainer:"esri-legend__ramps",sizeRampHorizontal:"esri-legend__size-ramp--horizontal",rampLabelsContainer:"esri-legend__ramp-labels",layerInfo:"esri-legend__layer-cell esri-legend__layer-cell--info",univariateAboveAndBelowColorRamp:"esri-univariate-above-and-below-ramp__color--card",hidden:"esri-hidden"},R=25,z=25,$=768,I=100;var k;!function(e){e.Auto="auto",e.Stack="stack",e.SideBySide="side-by-side"}(k||(k={}));const A="#ddd",N=window.devicePixelRatio;function j(e){if(e){if(e.type.indexOf("3d")>-1){const t=e.symbolLayers&&e.symbolLayers.length;if(!t)return;const s=e.symbolLayers.getItemAt(t-1),i=s.resource&&s.resource.primitive;return"circle"===i||"cross"===i||"kite"===i||"sphere"===i||"cube"===i||"diamond"===i}{const t=e.style;return"circle"===t||"diamond"===t||"cross"===t}}}function E(e){if(e){if(e.type.indexOf("3d")>-1){const t=e.symbolLayers&&e.symbolLayers.length;if(!t)return;const s=e.symbolLayers.getItemAt(t-1).get("resource.primitive");return"triangle"===s||"cone"===s||"tetrahedron"===s}return"triangle"===e.style}}let F=class extends l{constructor(e,s){super(e,s),this._handles=new t,this._hasIndicators=!1,this._selectedSectionName=null,this._sectionNames=[],this._sectionMap=new Map,this.activeLayerInfos=null,this.headingLevel=3,this.layout=k.Stack,this.messages=null,this.messagesCommon=null,this.type="card",this.view=null}initialize(){this.own([this.watch("activeLayerInfos",(e=>{this._handles.removeAll(),this._watchForSectionChanges(e)}))])}destroy(){this._handles.destroy(),this._handles=null}render(){this._hasIndicators=this.layout===k.Auto&&this.view.container.clientWidth<=$||this.layout===k.Stack;const e=this.activeLayerInfos,t=e&&e.toArray().map((e=>this._renderLegendForLayer(e))).filter((e=>!!e));this._hasIndicators?this._selectedSectionName&&-1!==this._sectionNames.indexOf(this._selectedSectionName)||(this._selectedSectionName=this._sectionNames&&this._sectionNames[0]):this._selectedSectionName=null;const s=this._sectionNames.length,i=this._sectionNames.map(((e,t)=>{const i=x(this.messagesCommon.pagination.pageText,{index:t+1,total:s});return L("div",{key:e,role:"tab",id:e,"aria-label":i,"aria-controls":`${e}-panel`,"aria-selected":(this._selectedSectionName===e).toString(),tabIndex:this._selectedSectionName===e?0:-1,title:i,onclick:this._selectSection,onkeydown:this._focusSection,bind:this,class:this.classes(S.indicator,{[S.activated]:this._selectedSectionName===e}),"data-section-name":e})})),r=this._hasIndicators&&s>1?L("div",{class:S.indicatorContainer,key:"carousel-navigation",role:"tablist"},i):null,a=this._hasIndicators?this._sectionMap.get(this._selectedSectionName):t&&t.length?t:null,o={[S.stacked]:this._hasIndicators};return L("div",{class:this.classes(S.base,o)},a||L("div",{class:S.message},this.messages.noLegend),r)}_selectSection(e){const t=e.target.getAttribute("data-section-name");t&&(this._selectedSectionName=t)}_focusSection(e){switch(e.key){case"ArrowLeft":case"ArrowRight":this._switchSectionOnArrowPress(e);break;case"Enter":case" ":this._selectSection(e)}}_switchSectionOnArrowPress(e){const t=e.key,s="ArrowLeft"===t?-1:1,i=e.target.getAttribute("data-section-name"),r=this._sectionNames.indexOf(i),a=this._sectionNames;let o=null;-1!==r&&(a[r+s]?o=document.getElementById(a[r+s]):"ArrowLeft"===t?o=document.getElementById(a[a.length-1]):"ArrowRight"===t&&(o=document.getElementById(a[0])),o&&o.focus())}_watchForSectionChanges(e){if(this._generateSectionNames(),e){e.forEach((e=>{const t=`activeLayerInfo-${e.layer.uid}-version-change`;this._handles.remove(t),this._watchForSectionChanges(e.children),this._handles.add(e.watch("version",(()=>this._generateSectionNames())),t)}));const t="activeLayerInfos-collection-change";this._handles.remove(t),this._handles.add(e.on("change",(()=>this._watchForSectionChanges(e))),t)}}_generateSectionNames(){this._sectionNames.length=0,this._selectedSectionName=null,this.activeLayerInfos&&this.activeLayerInfos.forEach(this._generateSectionNamesForActiveLayerInfo,this)}_getSectionName(e,t,s){return`${this.id}${e.uid}-type-${t.type}-${s}`}_generateSectionNamesForActiveLayerInfo(e){e.children.forEach(this._generateSectionNamesForActiveLayerInfo,this),e.legendElements&&e.legendElements.forEach(((t,s)=>{this._sectionNames.push(this._getSectionName(e.layer,t,s))}))}_renderLegendForLayer(e){if(!e.ready)return null;if(e.children.length){const t=e.children.map((e=>this._renderLegendForLayer(e))).toArray();return L("div",{key:e.layer.uid,class:this.classes(S.service,S.groupLayer)},L("div",{class:S.serviceCaptionContainer},e.title),t)}{const t=e.legendElements;if(t&&!t.length)return null;const s=t.some((e=>"relationship-ramp"===e.type)),i=t.map(((t,i)=>this._renderLegendForElement(t,e,i,s))).filter((e=>!!e));if(!i.length)return null;const r={[S.groupLayerChild]:!!e.parent};return L("div",{key:e.layer.uid,class:this.classes(S.service,r)},L("div",{class:S.serviceCaptionContainer},L("div",{class:S.serviceCaptionText},e.title)),L("div",{class:S.serviceContent},i))}}_renderLegendForElement(e,t,s,i=!1){const r="color-ramp"===e.type,a="opacity-ramp"===e.type,o="size-ramp"===e.type,l=t.layer;let c=null;if("string"==typeof e.title)c=e.title;else if(e.title){const t=e.title,s=g(this.messages,t,r||a);c=t.title?`${t.title} (${s})`:s}const d=this._getSectionName(l,e,s),p=this._hasIndicators?L("div",null,L(u,{level:this.headingLevel,class:S.carouselTitle},t.title),L(u,{level:f(this.headingLevel),class:S.layerCaption},c)):c?L(u,{level:this.headingLevel,class:S.layerCaption},c):null,m=t.effectList;let h=null;if("symbol-table"===e.type){const s=e.infos.map(((s,i)=>this._renderLegendForElementInfo(s,t,e.legendType,i))).filter((e=>!!e));if(s.length){const e=s[0].properties.classes&&s[0].properties.classes[S.symbolRow],t={[S.labelContainer]:!e&&!i,[S.relationshipLabelContainer]:i};h=L("div",{class:this.classes(t)},s)}}else"color-ramp"===e.type||"opacity-ramp"===e.type||"heatmap-ramp"===e.type?h=this._renderLegendForRamp(e,l.opacity,m):o?h=this._renderSizeRamp(e,l.opacity):"relationship-ramp"===e.type?h=n(e,this.id,l.opacity,m):"univariate-above-and-below-ramp"===e.type?h=this._renderUnivariateAboveAndBelowRamp(e,l.opacity,m):"univariate-color-size-ramp"===e.type&&(h=this._renderUnivariateColorSizeRamp(e,l.opacity,m));if(!h)return null;const y=L("div",{key:d,class:S.section,id:`${d}-panel`,role:"tabpanel","aria-labelledby":d,tabIndex:0},[p,h]);return this._sectionMap.set(d,y),y}_renderUnivariateAboveAndBelowRamp(e,t,s){const{sizeRampElement:i,colorRampElement:r}=c(e,t,"horizontal");if(!i)return null;const a=d(i,"full",!0,"horizontal"),o=p(i,"above",!0,"horizontal"),l=p(i,"below",!0,"horizontal"),n=12,y=m(r,{width:o,height:n,rampAlignment:"horizontal",opacity:t,type:"above",effectList:s}),g=m(r,{width:l,height:n,rampAlignment:"horizontal",opacity:t,type:"below",effectList:s}),v=h(i,"card"),u=i.infos.map((e=>e.label)),f=u.length-1,b=u.map(((e,t)=>0===t||t===f?L("div",{key:t},e):null)),w={display:"flex",flexDirection:"column"},x={display:"flex",flexDirection:"row"},R={marginTop:"3px",display:"flex"};C(this.container)?R.marginRight=`${v}px`:R.marginLeft=`${v}px`;const z={width:`${a}px`,display:"flex",flexDirection:"row",justifyContent:"space-between"};return L("div",{class:S.layerRow,key:"size-ramp-preview",styles:w},L("div",{class:this.classes(S.symbolContainer,S.sizeRampHorizontal),styles:x},i.infos.map(((e,t)=>L("div",{key:t,class:S.symbol,bind:e.preview,afterCreate:_})))),y?L("div",{class:S.univariateAboveAndBelowColorRamp,styles:R,key:"color-ramp-preview"},L("div",{bind:y,afterCreate:_}),L("div",{bind:g,afterCreate:_})):null,L("div",{class:S.layerInfo},L("div",{class:S.rampLabelsContainer,styles:z},b)))}_renderUnivariateColorSizeRamp(e,t,s){const{sizeRampElement:i,colorRampElement:r}=y(e,"horizontal");if(!i)return null;const a=d(i,"full",!1,"horizontal"),o=p(i,"full",!1,"horizontal"),l=m(r,{width:o,height:12,rampAlignment:"horizontal",opacity:t,type:"full",effectList:s}),n=h(i,"card"),c=i.infos.length-1,g=i.infos.map(((e,t)=>0===t||t===c?L("div",{key:t},e.label):null)),v={display:"flex",flexDirection:"column"},u={display:"flex",flexDirection:"row"},f={marginTop:"3px",display:"flex"};C(this.container)?f.marginRight=`${n}px`:f.marginLeft=`${n}px`;const b={width:`${a}px`,display:"flex",flexDirection:"row",justifyContent:"space-between"};return L("div",{class:S.layerRow,key:"size-ramp-preview",styles:v},L("div",{class:this.classes(S.symbolContainer,S.sizeRampHorizontal),styles:u},i.infos.map(((e,t)=>L("div",{key:t,class:S.symbol,bind:e.preview,afterCreate:_})))),L("div",{class:S.univariateAboveAndBelowColorRamp,styles:f,key:"color-ramp-preview"},L("div",{bind:l,afterCreate:_})),L("div",{class:S.layerInfo},L("div",{class:S.rampLabelsContainer,styles:b},g)))}_renderLegendForElementInfo(e,t,s,i){const r=t.layer;if(e.type)return this._renderLegendForElement(e,t,i);const a=v(r,s);if(e.preview){var l,n;if(!e.symbol||-1===e.symbol.type.indexOf("simple-fill")){if(!e.label)return L("div",{key:i,bind:e.preview,afterCreate:_});const t={[S.symbolCell]:this._hasIndicators};return L("div",{key:i,class:this.classes(S.layerRow,{[S.symbolRow]:this._hasIndicators})},L("div",{class:this.classes(t),bind:e.preview,afterCreate:_}),L("div",{class:this.classes(S.imageLabel,{[S.labelCell]:this._hasIndicators})},g(this.messages,e.label,!1)||""))}let s=255,a=255,c=255,d=0,p=255,m=255,h=255,y=0;const v=e.symbol.color&&e.symbol.color.a,u=e.symbol.outline&&e.symbol.outline.color&&e.symbol.outline.color.a;v&&(s=e.symbol.color.r,a=e.symbol.color.g,c=e.symbol.color.b,d=e.symbol.color.a*r.opacity),u&&(p=e.symbol.outline.color.r,m=e.symbol.outline.color.g,h=e.symbol.outline.color.b,y=e.symbol.outline.color.a*r.opacity);const f=null==(l=null==(n=e.symbol.color)?void 0:n.isBright)||l,b=f?"rgba(255, 255, 255, .6)":"rgba(0, 0, 0, .6)",w={background:v?`rgba(${s}, ${a}, ${c}, ${d})`:"none",color:f?"black":"white",textShadow:`-1px -1px 0 ${b},\n 1px -1px 0 ${b},\n -1px 1px 0 ${b},\n 1px 1px 0 ${b}`,border:u?`1px solid rgba(${p}, ${m}, ${h}, ${y})`:"none",filter:o(t.effectList)};return L("div",{key:i,class:S.layerRow},L("div",{class:S.labelElement,styles:w}," ",e.label," "))}if(e.src){const t=this._renderImage(e,r,a);return L("div",{key:i,class:S.layerRow},t,L("div",{class:S.imageLabel},e.label||""))}}_renderImage(e,t,s){const{label:i,src:r,opacity:a}=e,o={[S.imageryLayerStretchedImage]:s,[S.symbol]:!s},l={opacity:`${null!=a?a:t.opacity}`};return L("img",{alt:g(this.messages,i,!1),src:r,border:0,width:e.width,height:e.height,class:this.classes(o),styles:l})}_renderSizeRampLines(e){const t=e.infos,i=t[0],r=t[t.length-1],a=i.symbol,o=this._hasIndicators,l=s(i.size+i.outlineSize)*N,n=s(r.size+r.outlineSize)*N,c=o?l:l+50*N,d=o?l/2+50*N:l,p=E(a),m=j(a),h=document.createElement("canvas");h.width=c,h.height=d,h.style.width=h.width/N+"px",h.style.height=h.height/N+"px";const y=h.getContext("2d");if(o){y.beginPath();const e=0,t=0,s=c/2-n/2,i=d;y.moveTo(e,t),y.lineTo(s,i);const r=c,a=0,o=c/2+n/2,l=d;y.moveTo(r,a),y.lineTo(o,l)}else{y.beginPath();const e=0,t=d/2-n/2,s=c,i=0;y.moveTo(e,t),y.lineTo(s,i);const r=0,a=d/2+n/2,o=c,l=d;y.moveTo(r,a),y.lineTo(o,l)}return y.strokeStyle=A,y.stroke(),L("div",{bind:h,afterCreate:_,styles:o?{display:"flex",marginTop:`-${p?0:m?l/2:0}px`,marginBottom:`-${p?n:m?n/2:0}px`}:{display:"flex",marginRight:`-${p?0:m?l/2:0}px`,marginLeft:`-${p?0:m?n/2:0}px`}})}_renderSizeRamp(e,t){const s=e.infos,i=s[0].label,r=s[s.length-1].label;let a=s[0].preview,o=s[s.length-1].preview;const l=this._hasIndicators,n={"flex-direction":l?"column":"row-reverse"};a&&(a=a.cloneNode(!0),a.style.display="flex"),o&&(o=o.cloneNode(!0),o.style.display="flex");const c={opacity:null!=t?`${t}`:""};return L("div",{class:this.classes(S.layerRow,{[S.sizeRampRow]:l})},L("div",{class:S.rampLabel},l?i:r),L("div",{class:S.sizeRampContainer,styles:n},L("div",{bind:a,afterCreate:_,class:S.sizeRampPreview,styles:c}),this._renderSizeRampLines(e),L("div",{bind:o,afterCreate:_,class:S.sizeRampContainer,styles:c})),L("div",{class:S.rampLabel},l?r:i))}_renderLegendForRamp(e,t,s){const i=e.infos,r="heatmap-ramp"===e.type,l=i.length-1,n=z,c=l>2&&!r?R*l:I,d=c+20,p=10,m=i.slice(0).reverse();m.forEach(((e,t)=>{e.offset=r?e.ratio:t/l}));const h=m.length-1,y=m.length%2!=0&&m[m.length/2|0],g=y&&L("div",{class:S.intervalSeparatorsContainer},L("div",{class:S.intervalSeparator},"|"),L("div",{class:S.rampLabel},y.label)),_=i[i.length-1].label,v=i[0].label,u=[[{shape:{type:"path",path:`M0 ${n/2} L${p} 0 L${p} ${n} Z`},fill:m[0].color,stroke:{width:0}},{shape:{type:"rect",x:p,y:0,width:c,height:n},fill:{type:"linear",x1:p,y1:0,x2:c+p,y2:0,colors:m},stroke:{width:0}},{shape:{type:"path",path:`M${c+p} 0 L${d} ${n/2} L${c+p} ${n} Z`},fill:m[h].color,stroke:{width:0}}]],f=a(u,d,n),{messages:b}=this,w={filter:o(s),opacity:null==t?null:`${t}`},C={justifyContent:"center"};return L("div",{class:S.layerRow,styles:C},L("div",{class:S.rampLabel},r?b[_]:_),L("div",{class:S.symbolContainer},L("div",{styles:w},f),g),L("div",{class:S.rampLabel},r?b[v]:v))}};e([i()],F.prototype,"activeLayerInfos",void 0),e([i()],F.prototype,"headingLevel",void 0),e([i()],F.prototype,"layout",void 0),e([i(),w("geoscene/widgets/Legend/t9n/Legend")],F.prototype,"messages",void 0),e([i(),w("geoscene/t9n/common")],F.prototype,"messagesCommon",void 0),e([i({readOnly:!0})],F.prototype,"type",void 0),e([i()],F.prototype,"view",void 0),e([b()],F.prototype,"_selectSection",null),F=e([r("geoscene.widgets.Legend.styles.Card")],F);const T=F;export{T as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import t from"../../../core/Handles.js";import{pt2px as s}from"../../../core/screenUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{renderSVG as a}from"../../../symbols/support/svgUtils.js";import{getCSSFilterFromEffectList as o}from"../../../symbols/support/utils.js";import l from"../../Widget.js";import{renderRelationshipRamp as n}from"./support/relationshipUtils.js";import{getUnivariateAboveAndBelowRampElements as c,getUnivariateSizeRampSize as d,getUnivariateColorRampSize as p,getUnivariateColorRampPreview as m,getUnivariateColorRampMargin as h,getUnivariateColorSizeRampElements as y}from"./support/univariateUtils.js";import{getTitle as g,attachToNode as _,isImageryStretchedLegend as v}from"../support/styleUtils.js";import{Heading as u,incrementHeadingLevel as f}from"../../support/Heading.js";import{accessibleHandler as b}from"../../support/decorators/accessibleHandler.js";import{messageBundle as w}from"../../support/decorators/messageBundle.js";import"../../../core/Logger.js";import{tsx as L}from"../../support/jsxFactory.js";import{isRTL as C}from"../../support/widgetUtils.js";import{substitute as x}from"../../../intl/substitute.js";const S={activated:"geoscene-legend--card__carousel-indicator--activated",base:"geoscene-legend--card",stacked:"geoscene-legend--stacked",carouselTitle:"geoscene-legend--card__carousel-title",indicator:"geoscene-legend--card__carousel-indicator",intervalSeparator:"geoscene-legend--card__interval-separator",imageryLayerStretchedImage:"geoscene-legend--card__imagery-layer-image--stretched",imageLabel:"geoscene-legend--card__image-label",layerCaption:"geoscene-legend--card__layer-caption",labelElement:"geoscene-legend--card__label-element",layerRow:"geoscene-legend--card__layer-row",labelCell:"geoscene-legend--card__label-cell",message:"geoscene-legend--card__message",rampLabel:"geoscene-legend--card__ramp-label",section:"geoscene-legend--card__section",relationshipSection:"geoscene-legend--card__relationship-section",serviceCaptionText:"geoscene-legend--card__service-caption-text",serviceContent:"geoscene-legend--card__service-content",service:"geoscene-legend--card__service",groupLayer:"geoscene-legend--card__group-layer",groupLayerChild:"geoscene-legend--card__group-layer-child",symbol:"geoscene-legend--card__symbol",sizeRampRow:"geoscene-legend--card__size-ramp-row",symbolRow:"geoscene-legend--card__symbol-row",symbolCell:"geoscene-legend--card__symbol-cell",indicatorContainer:"geoscene-legend--card__carousel-indicator-container",intervalSeparatorsContainer:"geoscene-legend--card__interval-separators-container",relationshipLabelContainer:"geoscene-legend--card__relationship-label-container",labelContainer:"geoscene-legend--card__label-container",serviceCaptionContainer:"geoscene-legend--card__service-caption-container",symbolContainer:"geoscene-legend--card__symbol-container",sizeRampContainer:"geoscene-legend--card__size-ramp-container",sizeRampPreview:"geoscene-legend--card__size-ramp-preview",rampContainer:"geoscene-legend__ramps",sizeRampHorizontal:"geoscene-legend__size-ramp--horizontal",rampLabelsContainer:"geoscene-legend__ramp-labels",layerInfo:"geoscene-legend__layer-cell geoscene-legend__layer-cell--info",univariateAboveAndBelowColorRamp:"geoscene-univariate-above-and-below-ramp__color--card",hidden:"geoscene-hidden"},R=25,z=25,$=768,I=100;var k;!function(e){e.Auto="auto",e.Stack="stack",e.SideBySide="side-by-side"}(k||(k={}));const A="#ddd",N=window.devicePixelRatio;function j(e){if(e){if(e.type.indexOf("3d")>-1){const t=e.symbolLayers&&e.symbolLayers.length;if(!t)return;const s=e.symbolLayers.getItemAt(t-1),i=s.resource&&s.resource.primitive;return"circle"===i||"cross"===i||"kite"===i||"sphere"===i||"cube"===i||"diamond"===i}{const t=e.style;return"circle"===t||"diamond"===t||"cross"===t}}}function E(e){if(e){if(e.type.indexOf("3d")>-1){const t=e.symbolLayers&&e.symbolLayers.length;if(!t)return;const s=e.symbolLayers.getItemAt(t-1).get("resource.primitive");return"triangle"===s||"cone"===s||"tetrahedron"===s}return"triangle"===e.style}}let F=class extends l{constructor(e,s){super(e,s),this._handles=new t,this._hasIndicators=!1,this._selectedSectionName=null,this._sectionNames=[],this._sectionMap=new Map,this.activeLayerInfos=null,this.headingLevel=3,this.layout=k.Stack,this.messages=null,this.messagesCommon=null,this.type="card",this.view=null}initialize(){this.own([this.watch("activeLayerInfos",(e=>{this._handles.removeAll(),this._watchForSectionChanges(e)}))])}destroy(){this._handles.destroy(),this._handles=null}render(){this._hasIndicators=this.layout===k.Auto&&this.view.container.clientWidth<=$||this.layout===k.Stack;const e=this.activeLayerInfos,t=e&&e.toArray().map((e=>this._renderLegendForLayer(e))).filter((e=>!!e));this._hasIndicators?this._selectedSectionName&&-1!==this._sectionNames.indexOf(this._selectedSectionName)||(this._selectedSectionName=this._sectionNames&&this._sectionNames[0]):this._selectedSectionName=null;const s=this._sectionNames.length,i=this._sectionNames.map(((e,t)=>{const i=x(this.messagesCommon.pagination.pageText,{index:t+1,total:s});return L("div",{key:e,role:"tab",id:e,"aria-label":i,"aria-controls":`${e}-panel`,"aria-selected":(this._selectedSectionName===e).toString(),tabIndex:this._selectedSectionName===e?0:-1,title:i,onclick:this._selectSection,onkeydown:this._focusSection,bind:this,class:this.classes(S.indicator,{[S.activated]:this._selectedSectionName===e}),"data-section-name":e})})),r=this._hasIndicators&&s>1?L("div",{class:S.indicatorContainer,key:"carousel-navigation",role:"tablist"},i):null,a=this._hasIndicators?this._sectionMap.get(this._selectedSectionName):t&&t.length?t:null,o={[S.stacked]:this._hasIndicators};return L("div",{class:this.classes(S.base,o)},a||L("div",{class:S.message},this.messages.noLegend),r)}_selectSection(e){const t=e.target.getAttribute("data-section-name");t&&(this._selectedSectionName=t)}_focusSection(e){switch(e.key){case"ArrowLeft":case"ArrowRight":this._switchSectionOnArrowPress(e);break;case"Enter":case" ":this._selectSection(e)}}_switchSectionOnArrowPress(e){const t=e.key,s="ArrowLeft"===t?-1:1,i=e.target.getAttribute("data-section-name"),r=this._sectionNames.indexOf(i),a=this._sectionNames;let o=null;-1!==r&&(a[r+s]?o=document.getElementById(a[r+s]):"ArrowLeft"===t?o=document.getElementById(a[a.length-1]):"ArrowRight"===t&&(o=document.getElementById(a[0])),o&&o.focus())}_watchForSectionChanges(e){if(this._generateSectionNames(),e){e.forEach((e=>{const t=`activeLayerInfo-${e.layer.uid}-version-change`;this._handles.remove(t),this._watchForSectionChanges(e.children),this._handles.add(e.watch("version",(()=>this._generateSectionNames())),t)}));const t="activeLayerInfos-collection-change";this._handles.remove(t),this._handles.add(e.on("change",(()=>this._watchForSectionChanges(e))),t)}}_generateSectionNames(){this._sectionNames.length=0,this._selectedSectionName=null,this.activeLayerInfos&&this.activeLayerInfos.forEach(this._generateSectionNamesForActiveLayerInfo,this)}_getSectionName(e,t,s){return`${this.id}${e.uid}-type-${t.type}-${s}`}_generateSectionNamesForActiveLayerInfo(e){e.children.forEach(this._generateSectionNamesForActiveLayerInfo,this),e.legendElements&&e.legendElements.forEach(((t,s)=>{this._sectionNames.push(this._getSectionName(e.layer,t,s))}))}_renderLegendForLayer(e){if(!e.ready)return null;if(e.children.length){const t=e.children.map((e=>this._renderLegendForLayer(e))).toArray();return L("div",{key:e.layer.uid,class:this.classes(S.service,S.groupLayer)},L("div",{class:S.serviceCaptionContainer},e.title),t)}{const t=e.legendElements;if(t&&!t.length)return null;const s=t.some((e=>"relationship-ramp"===e.type)),i=t.map(((t,i)=>this._renderLegendForElement(t,e,i,s))).filter((e=>!!e));if(!i.length)return null;const r={[S.groupLayerChild]:!!e.parent};return L("div",{key:e.layer.uid,class:this.classes(S.service,r)},L("div",{class:S.serviceCaptionContainer},L("div",{class:S.serviceCaptionText},e.title)),L("div",{class:S.serviceContent},i))}}_renderLegendForElement(e,t,s,i=!1){const r="color-ramp"===e.type,a="opacity-ramp"===e.type,o="size-ramp"===e.type,l=t.layer;let c=null;if("string"==typeof e.title)c=e.title;else if(e.title){const t=e.title,s=g(this.messages,t,r||a);c=t.title?`${t.title} (${s})`:s}const d=this._getSectionName(l,e,s),p=this._hasIndicators?L("div",null,L(u,{level:this.headingLevel,class:S.carouselTitle},t.title),L(u,{level:f(this.headingLevel),class:S.layerCaption},c)):c?L(u,{level:this.headingLevel,class:S.layerCaption},c):null,m=t.effectList;let h=null;if("symbol-table"===e.type){const s=e.infos.map(((s,i)=>this._renderLegendForElementInfo(s,t,e.legendType,i))).filter((e=>!!e));if(s.length){const e=s[0].properties.classes&&s[0].properties.classes[S.symbolRow],t={[S.labelContainer]:!e&&!i,[S.relationshipLabelContainer]:i};h=L("div",{class:this.classes(t)},s)}}else"color-ramp"===e.type||"opacity-ramp"===e.type||"heatmap-ramp"===e.type?h=this._renderLegendForRamp(e,l.opacity,m):o?h=this._renderSizeRamp(e,l.opacity):"relationship-ramp"===e.type?h=n(e,this.id,l.opacity,m):"univariate-above-and-below-ramp"===e.type?h=this._renderUnivariateAboveAndBelowRamp(e,l.opacity,m):"univariate-color-size-ramp"===e.type&&(h=this._renderUnivariateColorSizeRamp(e,l.opacity,m));if(!h)return null;const y=L("div",{key:d,class:S.section,id:`${d}-panel`,role:"tabpanel","aria-labelledby":d,tabIndex:0},[p,h]);return this._sectionMap.set(d,y),y}_renderUnivariateAboveAndBelowRamp(e,t,s){const{sizeRampElement:i,colorRampElement:r}=c(e,t,"horizontal");if(!i)return null;const a=d(i,"full",!0,"horizontal"),o=p(i,"above",!0,"horizontal"),l=p(i,"below",!0,"horizontal"),n=12,y=m(r,{width:o,height:n,rampAlignment:"horizontal",opacity:t,type:"above",effectList:s}),g=m(r,{width:l,height:n,rampAlignment:"horizontal",opacity:t,type:"below",effectList:s}),v=h(i,"card"),u=i.infos.map((e=>e.label)),f=u.length-1,b=u.map(((e,t)=>0===t||t===f?L("div",{key:t},e):null)),w={display:"flex",flexDirection:"column"},x={display:"flex",flexDirection:"row"},R={marginTop:"3px",display:"flex"};C(this.container)?R.marginRight=`${v}px`:R.marginLeft=`${v}px`;const z={width:`${a}px`,display:"flex",flexDirection:"row",justifyContent:"space-between"};return L("div",{class:S.layerRow,key:"size-ramp-preview",styles:w},L("div",{class:this.classes(S.symbolContainer,S.sizeRampHorizontal),styles:x},i.infos.map(((e,t)=>L("div",{key:t,class:S.symbol,bind:e.preview,afterCreate:_})))),y?L("div",{class:S.univariateAboveAndBelowColorRamp,styles:R,key:"color-ramp-preview"},L("div",{bind:y,afterCreate:_}),L("div",{bind:g,afterCreate:_})):null,L("div",{class:S.layerInfo},L("div",{class:S.rampLabelsContainer,styles:z},b)))}_renderUnivariateColorSizeRamp(e,t,s){const{sizeRampElement:i,colorRampElement:r}=y(e,"horizontal");if(!i)return null;const a=d(i,"full",!1,"horizontal"),o=p(i,"full",!1,"horizontal"),l=m(r,{width:o,height:12,rampAlignment:"horizontal",opacity:t,type:"full",effectList:s}),n=h(i,"card"),c=i.infos.length-1,g=i.infos.map(((e,t)=>0===t||t===c?L("div",{key:t},e.label):null)),v={display:"flex",flexDirection:"column"},u={display:"flex",flexDirection:"row"},f={marginTop:"3px",display:"flex"};C(this.container)?f.marginRight=`${n}px`:f.marginLeft=`${n}px`;const b={width:`${a}px`,display:"flex",flexDirection:"row",justifyContent:"space-between"};return L("div",{class:S.layerRow,key:"size-ramp-preview",styles:v},L("div",{class:this.classes(S.symbolContainer,S.sizeRampHorizontal),styles:u},i.infos.map(((e,t)=>L("div",{key:t,class:S.symbol,bind:e.preview,afterCreate:_})))),L("div",{class:S.univariateAboveAndBelowColorRamp,styles:f,key:"color-ramp-preview"},L("div",{bind:l,afterCreate:_})),L("div",{class:S.layerInfo},L("div",{class:S.rampLabelsContainer,styles:b},g)))}_renderLegendForElementInfo(e,t,s,i){const r=t.layer;if(e.type)return this._renderLegendForElement(e,t,i);const a=v(r,s);if(e.preview){var l,n;if(!e.symbol||-1===e.symbol.type.indexOf("simple-fill")){if(!e.label)return L("div",{key:i,bind:e.preview,afterCreate:_});const t={[S.symbolCell]:this._hasIndicators};return L("div",{key:i,class:this.classes(S.layerRow,{[S.symbolRow]:this._hasIndicators})},L("div",{class:this.classes(t),bind:e.preview,afterCreate:_}),L("div",{class:this.classes(S.imageLabel,{[S.labelCell]:this._hasIndicators})},g(this.messages,e.label,!1)||""))}let s=255,a=255,c=255,d=0,p=255,m=255,h=255,y=0;const v=e.symbol.color&&e.symbol.color.a,u=e.symbol.outline&&e.symbol.outline.color&&e.symbol.outline.color.a;v&&(s=e.symbol.color.r,a=e.symbol.color.g,c=e.symbol.color.b,d=e.symbol.color.a*r.opacity),u&&(p=e.symbol.outline.color.r,m=e.symbol.outline.color.g,h=e.symbol.outline.color.b,y=e.symbol.outline.color.a*r.opacity);const f=null==(l=null==(n=e.symbol.color)?void 0:n.isBright)||l,b=f?"rgba(255, 255, 255, .6)":"rgba(0, 0, 0, .6)",w={background:v?`rgba(${s}, ${a}, ${c}, ${d})`:"none",color:f?"black":"white",textShadow:`-1px -1px 0 ${b},\n 1px -1px 0 ${b},\n -1px 1px 0 ${b},\n 1px 1px 0 ${b}`,border:u?`1px solid rgba(${p}, ${m}, ${h}, ${y})`:"none",filter:o(t.effectList)};return L("div",{key:i,class:S.layerRow},L("div",{class:S.labelElement,styles:w}," ",e.label," "))}if(e.src){const t=this._renderImage(e,r,a);return L("div",{key:i,class:S.layerRow},t,L("div",{class:S.imageLabel},e.label||""))}}_renderImage(e,t,s){const{label:i,src:r,opacity:a}=e,o={[S.imageryLayerStretchedImage]:s,[S.symbol]:!s},l={opacity:`${null!=a?a:t.opacity}`};return L("img",{alt:g(this.messages,i,!1),src:r,border:0,width:e.width,height:e.height,class:this.classes(o),styles:l})}_renderSizeRampLines(e){const t=e.infos,i=t[0],r=t[t.length-1],a=i.symbol,o=this._hasIndicators,l=s(i.size+i.outlineSize)*N,n=s(r.size+r.outlineSize)*N,c=o?l:l+50*N,d=o?l/2+50*N:l,p=E(a),m=j(a),h=document.createElement("canvas");h.width=c,h.height=d,h.style.width=h.width/N+"px",h.style.height=h.height/N+"px";const y=h.getContext("2d");if(o){y.beginPath();const e=0,t=0,s=c/2-n/2,i=d;y.moveTo(e,t),y.lineTo(s,i);const r=c,a=0,o=c/2+n/2,l=d;y.moveTo(r,a),y.lineTo(o,l)}else{y.beginPath();const e=0,t=d/2-n/2,s=c,i=0;y.moveTo(e,t),y.lineTo(s,i);const r=0,a=d/2+n/2,o=c,l=d;y.moveTo(r,a),y.lineTo(o,l)}return y.strokeStyle=A,y.stroke(),L("div",{bind:h,afterCreate:_,styles:o?{display:"flex",marginTop:`-${p?0:m?l/2:0}px`,marginBottom:`-${p?n:m?n/2:0}px`}:{display:"flex",marginRight:`-${p?0:m?l/2:0}px`,marginLeft:`-${p?0:m?n/2:0}px`}})}_renderSizeRamp(e,t){const s=e.infos,i=s[0].label,r=s[s.length-1].label;let a=s[0].preview,o=s[s.length-1].preview;const l=this._hasIndicators,n={"flex-direction":l?"column":"row-reverse"};a&&(a=a.cloneNode(!0),a.style.display="flex"),o&&(o=o.cloneNode(!0),o.style.display="flex");const c={opacity:null!=t?`${t}`:""};return L("div",{class:this.classes(S.layerRow,{[S.sizeRampRow]:l})},L("div",{class:S.rampLabel},l?i:r),L("div",{class:S.sizeRampContainer,styles:n},L("div",{bind:a,afterCreate:_,class:S.sizeRampPreview,styles:c}),this._renderSizeRampLines(e),L("div",{bind:o,afterCreate:_,class:S.sizeRampContainer,styles:c})),L("div",{class:S.rampLabel},l?r:i))}_renderLegendForRamp(e,t,s){const i=e.infos,r="heatmap-ramp"===e.type,l=i.length-1,n=z,c=l>2&&!r?R*l:I,d=c+20,p=10,m=i.slice(0).reverse();m.forEach(((e,t)=>{e.offset=r?e.ratio:t/l}));const h=m.length-1,y=m.length%2!=0&&m[m.length/2|0],g=y&&L("div",{class:S.intervalSeparatorsContainer},L("div",{class:S.intervalSeparator},"|"),L("div",{class:S.rampLabel},y.label)),_=i[i.length-1].label,v=i[0].label,u=[[{shape:{type:"path",path:`M0 ${n/2} L${p} 0 L${p} ${n} Z`},fill:m[0].color,stroke:{width:0}},{shape:{type:"rect",x:p,y:0,width:c,height:n},fill:{type:"linear",x1:p,y1:0,x2:c+p,y2:0,colors:m},stroke:{width:0}},{shape:{type:"path",path:`M${c+p} 0 L${d} ${n/2} L${c+p} ${n} Z`},fill:m[h].color,stroke:{width:0}}]],f=a(u,d,n),{messages:b}=this,w={filter:o(s),opacity:null==t?null:`${t}`},C={justifyContent:"center"};return L("div",{class:S.layerRow,styles:C},L("div",{class:S.rampLabel},r?b[_]:_),L("div",{class:S.symbolContainer},L("div",{styles:w},f),g),L("div",{class:S.rampLabel},r?b[v]:v))}};e([i()],F.prototype,"activeLayerInfos",void 0),e([i()],F.prototype,"headingLevel",void 0),e([i()],F.prototype,"layout",void 0),e([i(),w("geoscene/widgets/Legend/t9n/Legend")],F.prototype,"messages",void 0),e([i(),w("geoscene/t9n/common")],F.prototype,"messagesCommon",void 0),e([i({readOnly:!0})],F.prototype,"type",void 0),e([i()],F.prototype,"view",void 0),e([b()],F.prototype,"_selectSection",null),F=e([r("geoscene.widgets.Legend.styles.Card")],F);const T=F;export{T as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../Widget.js";import{renderRelationshipRamp as s}from"./support/relationshipUtils.js";import{getUnivariateAboveAndBelowRampElements as t,getUnivariateColorRampSize as i,getUnivariateColorRampPreview as n,getUnivariateColorRampMargin as o,getUnivariateColorSizeRampElements as p}from"./support/univariateUtils.js";import{getTitle as d,isRendererTitle as y,attachToNode as c,isImageryStretchedLegend as m}from"../support/styleUtils.js";import{Heading as g}from"../../support/Heading.js";import"../../support/widgetUtils.js";import{messageBundle as v}from"../../support/decorators/messageBundle.js";import"../../../core/Logger.js";import{tsx as h}from"../../support/jsxFactory.js";import{formatNumber as b}from"../../../intl/number.js";const u={service:"esri-legend__service",label:"esri-legend__service-label",layer:"esri-legend__layer",groupLayer:"esri-legend__group-layer",groupLayerChild:"esri-legend__group-layer-child",layerTable:"esri-legend__layer-table",layerTableSizeRamp:"esri-legend__layer-table--size-ramp",layerChildTable:"esri-legend__layer-child-table",layerCaption:"esri-legend__layer-caption",layerBody:"esri-legend__layer-body",layerRow:"esri-legend__layer-row",layerCell:"esri-legend__layer-cell",layerInfo:"esri-legend__layer-cell esri-legend__layer-cell--info",imageryLayerStretchedImage:"esri-legend__imagery-layer-image--stretched",imageryLayerCellStretched:"esri-legend__imagery-layer-cell--stretched",imageryLayerInfoStretched:"esri-legend__imagery-layer-info--stretched",symbolContainer:"esri-legend__layer-cell esri-legend__layer-cell--symbols",symbol:"esri-legend__symbol",rampContainer:"esri-legend__ramps",sizeRamp:"esri-legend__size-ramp",colorRamp:"esri-legend__color-ramp",opacityRamp:"esri-legend__opacity-ramp",borderlessRamp:"esri-legend__borderless-ramp",rampTick:"esri-legend__ramp-tick",rampFirstTick:"esri-legend__ramp-tick-first",rampLastTick:"esri-legend__ramp-tick-last",rampLabelsContainer:"esri-legend__ramp-labels",rampLabel:"esri-legend__ramp-label",univariateAboveAndBelowSymbol:"esri-univariate-above-and-below-ramp__symbol",univariateAboveAndBelowLabel:"esri-univariate-above-and-below-ramp__label",message:"esri-legend__message",header:"esri-widget__heading",hidden:"esri-hidden"},_="esri-legend__",f=24,L={display:"flex",alignItems:"flex-start"},w={marginLeft:"3px"},C={display:"table-cell",verticalAlign:"middle"};let R=class extends a{constructor(e,r){super(e,r),this.activeLayerInfos=null,this.headingLevel=3,this.messages=null,this.type="classic"}render(){const e=this.activeLayerInfos,r=e&&e.toArray().map((e=>this._renderLegendForLayer(e))).filter((e=>!!e));return h("div",null,r&&r.length?r:h("div",{class:u.message},this.messages.noLegend))}_renderLegendForLayer(e){if(!e.ready)return null;const r=!!e.children.length,l=`${_}${e.layer.uid}-version-${e.version}`,a=e.title?g({level:this.headingLevel,class:this.classes(u.header,u.label)},e.title):null;if(r){const r=e.children.map((e=>this._renderLegendForLayer(e))).toArray();return h("div",{key:l,class:this.classes(u.service,u.groupLayer)},a,r)}{const r=e.legendElements;if(r&&!r.length)return null;const s=r.map((r=>this._renderLegendForElement(r,e.layer,e.effectList))).filter((e=>!!e));if(!s.length)return null;const t={[u.groupLayerChild]:!!e.parent};return h("div",{key:l,class:this.classes(u.service,t),tabIndex:0},a,h("div",{class:u.layer},s))}}_renderLegendForElement(e,r,l,a){const t="color-ramp"===e.type,i="opacity-ramp"===e.type,n="size-ramp"===e.type;let o=null;if("symbol-table"===e.type||n){const a=e.infos.map((a=>this._renderLegendForElementInfo(a,r,l,n,e.legendType))).filter((e=>!!e));a.length&&(o=h("div",{class:u.layerBody},a))}else"color-ramp"===e.type||"opacity-ramp"===e.type||"heatmap-ramp"===e.type||"stretch-ramp"===e.type?o=this._renderLegendForRamp(e,r.opacity):"relationship-ramp"===e.type?o=s(e,this.id,r.opacity,l):"univariate-above-and-below-ramp"===e.type?o=this._renderUnivariateAboveAndBelowRamp(e,r.opacity,l):"univariate-color-size-ramp"===e.type&&(o=this._renderUnivariateColorSizeRamp(e,r.opacity,l));if(!o)return null;const p=e.title;let c=null;if("string"==typeof p)c=p;else if(p){const e=d(this.messages,p,t||i);c=y(p,t||i)&&p.title?`${p.title} (${e})`:e}const m=a?u.layerChildTable:u.layerTable,g=c?h("div",{class:u.layerCaption},c):null,v={[u.layerTableSizeRamp]:n||!a};return h("div",{class:this.classes(m,v)},g,o)}_renderUnivariateAboveAndBelowRamp(e,r,l){const{sizeRampElement:a,colorRampElement:s}=t(e,r);if(!a)return null;const p=i(a,"above",!0),d=i(a,"below",!0),y=12,m=n(s,{width:y,height:p,rampAlignment:"vertical",opacity:r,type:"above",effectList:l}),g=n(s,{width:y,height:d,rampAlignment:"vertical",opacity:r,type:"below",effectList:l}),v=o(a),b=a.infos.map((e=>e.label)),_=b.map(((e,r)=>{const l=2===r;return 0===r?h("div",{key:r,class:e?m?u.univariateAboveAndBelowLabel:u.rampLabel:null},e):l?h("div",null):null})),f=b.length-1,R=Math.floor(b.length/2),A=b.map(((e,r)=>r===R||r===f?h("div",{key:r,class:e?m?u.univariateAboveAndBelowLabel:u.rampLabel:null},e):null)),S={display:"table-cell",verticalAlign:"middle"},j={marginTop:`${v}px`},I={height:`${p}px`},k={height:`${d}px`};return h("div",{key:"univariate-above-and-below-ramp-preview",styles:L},h("div",{class:u.layerBody},a.infos.map(((e,r)=>h("div",{class:this.classes(u.layerRow,u.sizeRamp)},h("div",{class:u.symbol,styles:S,bind:e.preview,afterCreate:c}),m||r%2!=0?null:h("div",{class:u.layerInfo},b[r]))))),m?h("div",{styles:j,key:"color-ramp-preview"},h("div",{styles:w},h("div",{styles:C},h("div",{class:u.rampContainer,bind:m,afterCreate:c})),h("div",{styles:C},h("div",{class:u.rampLabelsContainer,styles:I},_))),h("div",{styles:w},h("div",{styles:C},h("div",{class:u.rampContainer,bind:g,afterCreate:c})),h("div",{styles:C},h("div",{class:u.rampLabelsContainer,styles:k},A)))):null)}_renderUnivariateColorSizeRamp(e,r,l){const{sizeRampElement:a,colorRampElement:s}=p(e);if(!a)return null;const t=o(a),d=12,y=i(a,"full",!1),m=n(s,{width:d,height:y,rampAlignment:"vertical",opacity:r,type:"full",effectList:l}),g=a.infos.length-1,v=a.infos.map(((e,r)=>0===r||r===g?h("div",{key:r,class:e.label?s?u.univariateAboveAndBelowLabel:u.rampLabel:null},e.label):null)),b={display:"table-cell",verticalAlign:"middle"},_={marginTop:`${t}px`},f={height:`${y}px`};return h("div",{key:"univariate-above-and-below-ramp-preview",styles:L},h("div",{class:u.layerBody},a.infos.map((e=>h("div",{class:this.classes(u.layerRow,u.sizeRamp)},h("div",{class:u.symbol,styles:b,bind:e.preview,afterCreate:c}))))),h("div",{styles:_,key:"color-ramp-preview"},h("div",{styles:w},h("div",{styles:C},h("div",{class:u.rampContainer,bind:m,afterCreate:c})),h("div",{styles:C},h("div",{class:u.rampLabelsContainer,styles:f},v)))))}_renderLegendForRamp(e,r){const l=e.infos,a="opacity-ramp"===e.type,s="heatmap-ramp"===e.type,t="stretch-ramp"===e.type,i=e.preview,n=a?u.opacityRamp:"";i.className=`${u.colorRamp} ${n}`,null!=r&&(i.style.opacity=r.toString());const o=l.map((e=>h("div",{class:e.label?u.rampLabel:null},s?this.messages[e.label]:t?this._getStretchStopLabel(e):e.label))),p={width:`${f}px`},d={height:i.style.height};return h("div",{class:u.layerRow},h("div",{class:u.symbolContainer,styles:p},h("div",{class:u.rampContainer,bind:i,afterCreate:c})),h("div",{class:u.layerInfo},h("div",{class:u.rampLabelsContainer,styles:d},o)))}_getStretchStopLabel(e){return e.label?this.messages[e.label]+": "+("string"==typeof e.value?e.value:b(e.value,{style:"decimal",notation:e.value.toString().indexOf("e")>-1?"scientific":"standard"})):""}_renderLegendForElementInfo(e,r,l,a,s){if(e.type)return this._renderLegendForElement(e,r,l,!0);let t=null;const i=m(r,s);if(e.preview?t=h("div",{class:u.symbol,bind:e.preview,afterCreate:c}):e.src&&(t=this._renderImage(e,r,i)),!t)return null;const n={[u.imageryLayerInfoStretched]:i},o={[u.imageryLayerInfoStretched]:i,[u.sizeRamp]:!i&&a};return h("div",{class:u.layerRow},h("div",{class:this.classes(u.symbolContainer,o)},t),h("div",{class:this.classes(u.layerInfo,n)},d(this.messages,e.label,!1)||""))}_renderImage(e,r,l){const{label:a,src:s,opacity:t}=e,i={[u.imageryLayerStretchedImage]:l,[u.symbol]:!l},n={opacity:`${null!=t?t:r.opacity}`};return h("img",{alt:d(this.messages,a,!1),src:s,border:0,width:e.width,height:e.height,class:this.classes(i),styles:n})}};e([r()],R.prototype,"activeLayerInfos",void 0),e([r()],R.prototype,"headingLevel",void 0),e([r(),v("geoscene/widgets/Legend/t9n/Legend")],R.prototype,"messages",void 0),e([r({readOnly:!0})],R.prototype,"type",void 0),R=e([l("geoscene.widgets.Legend.styles.Classic")],R);const A=R;export{A as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../Widget.js";import{renderRelationshipRamp as s}from"./support/relationshipUtils.js";import{getUnivariateAboveAndBelowRampElements as t,getUnivariateColorRampSize as i,getUnivariateColorRampPreview as n,getUnivariateColorRampMargin as o,getUnivariateColorSizeRampElements as p}from"./support/univariateUtils.js";import{getTitle as d,isRendererTitle as y,attachToNode as c,isImageryStretchedLegend as m}from"../support/styleUtils.js";import{Heading as g}from"../../support/Heading.js";import"../../support/widgetUtils.js";import{messageBundle as v}from"../../support/decorators/messageBundle.js";import"../../../core/Logger.js";import{tsx as h}from"../../support/jsxFactory.js";import{formatNumber as b}from"../../../intl/number.js";const u={service:"geoscene-legend__service",label:"geoscene-legend__service-label",layer:"geoscene-legend__layer",groupLayer:"geoscene-legend__group-layer",groupLayerChild:"geoscene-legend__group-layer-child",layerTable:"geoscene-legend__layer-table",layerTableSizeRamp:"geoscene-legend__layer-table--size-ramp",layerChildTable:"geoscene-legend__layer-child-table",layerCaption:"geoscene-legend__layer-caption",layerBody:"geoscene-legend__layer-body",layerRow:"geoscene-legend__layer-row",layerCell:"geoscene-legend__layer-cell",layerInfo:"geoscene-legend__layer-cell geoscene-legend__layer-cell--info",imageryLayerStretchedImage:"geoscene-legend__imagery-layer-image--stretched",imageryLayerCellStretched:"geoscene-legend__imagery-layer-cell--stretched",imageryLayerInfoStretched:"geoscene-legend__imagery-layer-info--stretched",symbolContainer:"geoscene-legend__layer-cell geoscene-legend__layer-cell--symbols",symbol:"geoscene-legend__symbol",rampContainer:"geoscene-legend__ramps",sizeRamp:"geoscene-legend__size-ramp",colorRamp:"geoscene-legend__color-ramp",opacityRamp:"geoscene-legend__opacity-ramp",borderlessRamp:"geoscene-legend__borderless-ramp",rampTick:"geoscene-legend__ramp-tick",rampFirstTick:"geoscene-legend__ramp-tick-first",rampLastTick:"geoscene-legend__ramp-tick-last",rampLabelsContainer:"geoscene-legend__ramp-labels",rampLabel:"geoscene-legend__ramp-label",univariateAboveAndBelowSymbol:"geoscene-univariate-above-and-below-ramp__symbol",univariateAboveAndBelowLabel:"geoscene-univariate-above-and-below-ramp__label",message:"geoscene-legend__message",header:"geoscene-widget__heading",hidden:"geoscene-hidden"},_="geoscene-legend__",f=24,L={display:"flex",alignItems:"flex-start"},w={marginLeft:"3px"},C={display:"table-cell",verticalAlign:"middle"};let R=class extends a{constructor(e,r){super(e,r),this.activeLayerInfos=null,this.headingLevel=3,this.messages=null,this.type="classic"}render(){const e=this.activeLayerInfos,r=e&&e.toArray().map((e=>this._renderLegendForLayer(e))).filter((e=>!!e));return h("div",null,r&&r.length?r:h("div",{class:u.message},this.messages.noLegend))}_renderLegendForLayer(e){if(!e.ready)return null;const r=!!e.children.length,l=`${_}${e.layer.uid}-version-${e.version}`,a=e.title?g({level:this.headingLevel,class:this.classes(u.header,u.label)},e.title):null;if(r){const r=e.children.map((e=>this._renderLegendForLayer(e))).toArray();return h("div",{key:l,class:this.classes(u.service,u.groupLayer)},a,r)}{const r=e.legendElements;if(r&&!r.length)return null;const s=r.map((r=>this._renderLegendForElement(r,e.layer,e.effectList))).filter((e=>!!e));if(!s.length)return null;const t={[u.groupLayerChild]:!!e.parent};return h("div",{key:l,class:this.classes(u.service,t),tabIndex:0},a,h("div",{class:u.layer},s))}}_renderLegendForElement(e,r,l,a){const t="color-ramp"===e.type,i="opacity-ramp"===e.type,n="size-ramp"===e.type;let o=null;if("symbol-table"===e.type||n){const a=e.infos.map((a=>this._renderLegendForElementInfo(a,r,l,n,e.legendType))).filter((e=>!!e));a.length&&(o=h("div",{class:u.layerBody},a))}else"color-ramp"===e.type||"opacity-ramp"===e.type||"heatmap-ramp"===e.type||"stretch-ramp"===e.type?o=this._renderLegendForRamp(e,r.opacity):"relationship-ramp"===e.type?o=s(e,this.id,r.opacity,l):"univariate-above-and-below-ramp"===e.type?o=this._renderUnivariateAboveAndBelowRamp(e,r.opacity,l):"univariate-color-size-ramp"===e.type&&(o=this._renderUnivariateColorSizeRamp(e,r.opacity,l));if(!o)return null;const p=e.title;let c=null;if("string"==typeof p)c=p;else if(p){const e=d(this.messages,p,t||i);c=y(p,t||i)&&p.title?`${p.title} (${e})`:e}const m=a?u.layerChildTable:u.layerTable,g=c?h("div",{class:u.layerCaption},c):null,v={[u.layerTableSizeRamp]:n||!a};return h("div",{class:this.classes(m,v)},g,o)}_renderUnivariateAboveAndBelowRamp(e,r,l){const{sizeRampElement:a,colorRampElement:s}=t(e,r);if(!a)return null;const p=i(a,"above",!0),d=i(a,"below",!0),y=12,m=n(s,{width:y,height:p,rampAlignment:"vertical",opacity:r,type:"above",effectList:l}),g=n(s,{width:y,height:d,rampAlignment:"vertical",opacity:r,type:"below",effectList:l}),v=o(a),b=a.infos.map((e=>e.label)),_=b.map(((e,r)=>{const l=2===r;return 0===r?h("div",{key:r,class:e?m?u.univariateAboveAndBelowLabel:u.rampLabel:null},e):l?h("div",null):null})),f=b.length-1,R=Math.floor(b.length/2),A=b.map(((e,r)=>r===R||r===f?h("div",{key:r,class:e?m?u.univariateAboveAndBelowLabel:u.rampLabel:null},e):null)),S={display:"table-cell",verticalAlign:"middle"},j={marginTop:`${v}px`},I={height:`${p}px`},k={height:`${d}px`};return h("div",{key:"univariate-above-and-below-ramp-preview",styles:L},h("div",{class:u.layerBody},a.infos.map(((e,r)=>h("div",{class:this.classes(u.layerRow,u.sizeRamp)},h("div",{class:u.symbol,styles:S,bind:e.preview,afterCreate:c}),m||r%2!=0?null:h("div",{class:u.layerInfo},b[r]))))),m?h("div",{styles:j,key:"color-ramp-preview"},h("div",{styles:w},h("div",{styles:C},h("div",{class:u.rampContainer,bind:m,afterCreate:c})),h("div",{styles:C},h("div",{class:u.rampLabelsContainer,styles:I},_))),h("div",{styles:w},h("div",{styles:C},h("div",{class:u.rampContainer,bind:g,afterCreate:c})),h("div",{styles:C},h("div",{class:u.rampLabelsContainer,styles:k},A)))):null)}_renderUnivariateColorSizeRamp(e,r,l){const{sizeRampElement:a,colorRampElement:s}=p(e);if(!a)return null;const t=o(a),d=12,y=i(a,"full",!1),m=n(s,{width:d,height:y,rampAlignment:"vertical",opacity:r,type:"full",effectList:l}),g=a.infos.length-1,v=a.infos.map(((e,r)=>0===r||r===g?h("div",{key:r,class:e.label?s?u.univariateAboveAndBelowLabel:u.rampLabel:null},e.label):null)),b={display:"table-cell",verticalAlign:"middle"},_={marginTop:`${t}px`},f={height:`${y}px`};return h("div",{key:"univariate-above-and-below-ramp-preview",styles:L},h("div",{class:u.layerBody},a.infos.map((e=>h("div",{class:this.classes(u.layerRow,u.sizeRamp)},h("div",{class:u.symbol,styles:b,bind:e.preview,afterCreate:c}))))),h("div",{styles:_,key:"color-ramp-preview"},h("div",{styles:w},h("div",{styles:C},h("div",{class:u.rampContainer,bind:m,afterCreate:c})),h("div",{styles:C},h("div",{class:u.rampLabelsContainer,styles:f},v)))))}_renderLegendForRamp(e,r){const l=e.infos,a="opacity-ramp"===e.type,s="heatmap-ramp"===e.type,t="stretch-ramp"===e.type,i=e.preview,n=a?u.opacityRamp:"";i.className=`${u.colorRamp} ${n}`,null!=r&&(i.style.opacity=r.toString());const o=l.map((e=>h("div",{class:e.label?u.rampLabel:null},s?this.messages[e.label]:t?this._getStretchStopLabel(e):e.label))),p={width:`${f}px`},d={height:i.style.height};return h("div",{class:u.layerRow},h("div",{class:u.symbolContainer,styles:p},h("div",{class:u.rampContainer,bind:i,afterCreate:c})),h("div",{class:u.layerInfo},h("div",{class:u.rampLabelsContainer,styles:d},o)))}_getStretchStopLabel(e){return e.label?this.messages[e.label]+": "+("string"==typeof e.value?e.value:b(e.value,{style:"decimal",notation:e.value.toString().indexOf("e")>-1?"scientific":"standard"})):""}_renderLegendForElementInfo(e,r,l,a,s){if(e.type)return this._renderLegendForElement(e,r,l,!0);let t=null;const i=m(r,s);if(e.preview?t=h("div",{class:u.symbol,bind:e.preview,afterCreate:c}):e.src&&(t=this._renderImage(e,r,i)),!t)return null;const n={[u.imageryLayerInfoStretched]:i},o={[u.imageryLayerInfoStretched]:i,[u.sizeRamp]:!i&&a};return h("div",{class:u.layerRow},h("div",{class:this.classes(u.symbolContainer,o)},t),h("div",{class:this.classes(u.layerInfo,n)},d(this.messages,e.label,!1)||""))}_renderImage(e,r,l){const{label:a,src:s,opacity:t}=e,i={[u.imageryLayerStretchedImage]:l,[u.symbol]:!l},n={opacity:`${null!=t?t:r.opacity}`};return h("img",{alt:d(this.messages,a,!1),src:s,border:0,width:e.width,height:e.height,class:this.classes(i),styles:n})}};e([r()],R.prototype,"activeLayerInfos",void 0),e([r()],R.prototype,"headingLevel",void 0),e([r(),v("geoscene/widgets/Legend/t9n/Legend")],R.prototype,"messages",void 0),e([r({readOnly:!0})],R.prototype,"type",void 0),R=e([l("geoscene.widgets.Legend.styles.Classic")],R);const A=R;export{A as default};