@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.
- package/assets/geoscene/core/workers/chunks/6f827a32646bab0a8777.js +1 -1
- package/assets/geoscene/core/workers/chunks/9f458f10dc65b185f66e.js +1 -1
- package/assets/geoscene/themes/base/_Overlay.scss +2 -2
- package/assets/geoscene/themes/base/_OverlayItem.scss +12 -12
- package/assets/geoscene/themes/base/_Ui.scss +32 -32
- package/assets/geoscene/themes/base/_View.scss +31 -31
- package/assets/geoscene/themes/base/_animation.scss +6 -6
- package/assets/geoscene/themes/base/_core.scss +2 -2
- package/assets/geoscene/themes/base/_mixins.scss +43 -43
- package/assets/geoscene/themes/base/icons/style.css +190 -190
- package/assets/geoscene/themes/base/icons/style.scss +376 -376
- package/assets/geoscene/themes/base/icons/variables.scss +187 -187
- package/assets/geoscene/themes/base/widgets/_AreaMeasurement2D.scss +4 -4
- package/assets/geoscene/themes/base/widgets/_AreaMeasurement3D.scss +4 -4
- package/assets/geoscene/themes/base/widgets/_Attachments.scss +48 -48
- package/assets/geoscene/themes/base/widgets/_Attribution.scss +9 -9
- package/assets/geoscene/themes/base/widgets/_BasemapGallery.scss +39 -39
- package/assets/geoscene/themes/base/widgets/_BasemapLayerList.scss +100 -100
- package/assets/geoscene/themes/base/widgets/_BasemapToggle.scss +22 -22
- package/assets/geoscene/themes/base/widgets/_BinaryColorSizeSlider.scss +2 -2
- package/assets/geoscene/themes/base/widgets/_Bookmarks.scss +48 -48
- package/assets/geoscene/themes/base/widgets/_BuildingDisciplinesTree.scss +3 -3
- package/assets/geoscene/themes/base/widgets/_BuildingExplorer.scss +4 -4
- package/assets/geoscene/themes/base/widgets/_BuildingLevelPicker.scss +4 -4
- package/assets/geoscene/themes/base/widgets/_BuildingPhasePicker.scss +4 -4
- package/assets/geoscene/themes/base/widgets/_ButtonMenu.scss +21 -21
- package/assets/geoscene/themes/base/widgets/_ClassedColorSlider.scss +2 -2
- package/assets/geoscene/themes/base/widgets/_ClassedSizeSlider.scss +2 -2
- package/assets/geoscene/themes/base/widgets/_ColorPicker.scss +3 -3
- package/assets/geoscene/themes/base/widgets/_ColorSizeSlider.scss +2 -2
- package/assets/geoscene/themes/base/widgets/_ColorSlider.scss +2 -2
- package/assets/geoscene/themes/base/widgets/_Compass.scss +3 -3
- package/assets/geoscene/themes/base/widgets/_CoordinateConversion.scss +51 -51
- package/assets/geoscene/themes/base/widgets/_DatePicker.scss +34 -34
- package/assets/geoscene/themes/base/widgets/_Daylight.scss +63 -63
- package/assets/geoscene/themes/base/widgets/_DirectLineMeasurement3D.scss +2 -2
- package/assets/geoscene/themes/base/widgets/_Directions.scss +98 -98
- package/assets/geoscene/themes/base/widgets/_DistanceMeasurement2D.scss +2 -2
- package/assets/geoscene/themes/base/widgets/_Editor.scss +56 -56
- package/assets/geoscene/themes/base/widgets/_ElevationProfile.scss +19 -19
- package/assets/geoscene/themes/base/widgets/_Expand.scss +58 -58
- package/assets/geoscene/themes/base/widgets/_Feature.scss +13 -13
- package/assets/geoscene/themes/base/widgets/_FeatureContent.scss +24 -24
- package/assets/geoscene/themes/base/widgets/_FeatureForm.scss +36 -36
- package/assets/geoscene/themes/base/widgets/_FeatureMedia.scss +17 -17
- package/assets/geoscene/themes/base/widgets/_FeatureTable.scss +26 -26
- package/assets/geoscene/themes/base/widgets/_FeatureTemplates.scss +9 -9
- package/assets/geoscene/themes/base/widgets/_FloorFilter.scss +93 -93
- package/assets/geoscene/themes/base/widgets/_Grid.scss +6 -6
- package/assets/geoscene/themes/base/widgets/_HeatmapSlider.scss +2 -2
- package/assets/geoscene/themes/base/widgets/_Histogram.scss +10 -10
- package/assets/geoscene/themes/base/widgets/_HistogramRangeSlider.scss +27 -27
- package/assets/geoscene/themes/base/widgets/_IdentityForm.scss +5 -5
- package/assets/geoscene/themes/base/widgets/_IdentityModal.scss +13 -13
- package/assets/geoscene/themes/base/widgets/_ItemList.scss +18 -18
- package/assets/geoscene/themes/base/widgets/_LayerList.scss +89 -89
- package/assets/geoscene/themes/base/widgets/_Legend.scss +95 -95
- package/assets/geoscene/themes/base/widgets/_LineOfSight.scss +9 -9
- package/assets/geoscene/themes/base/widgets/_NavigationToggle.scss +14 -14
- package/assets/geoscene/themes/base/widgets/_OpacitySlider.scss +2 -2
- package/assets/geoscene/themes/base/widgets/_Popup.scss +167 -167
- package/assets/geoscene/themes/base/widgets/_Print.scss +52 -52
- package/assets/geoscene/themes/base/widgets/_ScaleBar.scss +28 -28
- package/assets/geoscene/themes/base/widgets/_ScaleRangeSlider.scss +29 -29
- package/assets/geoscene/themes/base/widgets/_Search.scss +50 -50
- package/assets/geoscene/themes/base/widgets/_SearchResultRenderer.scss +7 -7
- package/assets/geoscene/themes/base/widgets/_SelectionToolbar.scss +3 -3
- package/assets/geoscene/themes/base/widgets/_ShadowCast.scss +17 -17
- package/assets/geoscene/themes/base/widgets/_SizeSlider.scss +2 -2
- package/assets/geoscene/themes/base/widgets/_Sketch.scss +24 -24
- package/assets/geoscene/themes/base/widgets/_Slice.scss +5 -5
- package/assets/geoscene/themes/base/widgets/_Slider.scss +70 -70
- package/assets/geoscene/themes/base/widgets/_SnappingControls.scss +16 -16
- package/assets/geoscene/themes/base/widgets/_Spinner.scss +12 -12
- package/assets/geoscene/themes/base/widgets/_Swipe.scss +15 -15
- package/assets/geoscene/themes/base/widgets/_TableList.scss +57 -57
- package/assets/geoscene/themes/base/widgets/_TimePicker.scss +3 -3
- package/assets/geoscene/themes/base/widgets/_TimeSlider.scss +28 -28
- package/assets/geoscene/themes/base/widgets/_UtilityNetworkTrace.scss +8 -8
- package/assets/geoscene/themes/base/widgets/_Weather.scss +2 -2
- package/assets/geoscene/themes/base/widgets/_Widget.scss +95 -95
- package/assets/geoscene/themes/base/widgets/_Zoom.scss +8 -8
- package/assets/geoscene/themes/dark/main.css +1 -1
- package/assets/geoscene/themes/dark/main.scss +3 -3
- package/assets/geoscene/themes/dark-blue/main.css +1 -1
- package/assets/geoscene/themes/dark-blue/main.scss +3 -3
- package/assets/geoscene/themes/dark-green/main.css +1 -1
- package/assets/geoscene/themes/dark-green/main.scss +3 -3
- package/assets/geoscene/themes/dark-purple/main.css +1 -1
- package/assets/geoscene/themes/dark-purple/main.scss +3 -3
- package/assets/geoscene/themes/dark-red/main.css +1 -1
- package/assets/geoscene/themes/dark-red/main.scss +3 -3
- package/assets/geoscene/themes/light/main.css +1 -1
- package/assets/geoscene/themes/light/main.scss +2 -2
- package/assets/geoscene/themes/light/view.css +1 -1
- package/assets/geoscene/themes/light-blue/main.css +1 -1
- package/assets/geoscene/themes/light-blue/main.scss +3 -3
- package/assets/geoscene/themes/light-green/main.css +1 -1
- package/assets/geoscene/themes/light-green/main.scss +3 -3
- package/assets/geoscene/themes/light-purple/main.css +1 -1
- package/assets/geoscene/themes/light-purple/main.scss +3 -3
- package/assets/geoscene/themes/light-red/main.css +1 -1
- package/assets/geoscene/themes/light-red/main.scss +3 -3
- package/identity/IdentityForm.js +1 -1
- package/identity/IdentityModal.js +1 -1
- package/package.json +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/portal/schemas/sceneLayerItem.js +1 -1
- package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
- package/views/2d/layers/support/clusterUtils.js +1 -1
- package/views/2d/navigation/ZoomBox.js +1 -1
- package/views/3d/externalRenderers.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/BreakpointsOwner.js +1 -1
- package/views/DOMContainer.js +1 -1
- package/views/input/BrowserEventSource.js +1 -1
- package/views/overlay/LineOverlayItem.js +1 -1
- package/views/overlay/TextOverlayItem.js +1 -1
- package/views/overlay/ViewOverlay.js +1 -1
- package/views/ui/Component.js +1 -1
- package/views/ui/UI.js +1 -1
- package/views/webgl/context-util.js +1 -1
- package/widgets/AreaMeasurement2D.js +1 -1
- package/widgets/AreaMeasurement3D.js +1 -1
- package/widgets/Attachments.js +1 -1
- package/widgets/Attribution.js +1 -1
- package/widgets/BasemapGallery.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/BasemapToggle.js +1 -1
- package/widgets/Bookmarks.js +1 -1
- package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesNode.js +1 -1
- package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesTree.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/Label.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/LevelItem.js +1 -1
- package/widgets/BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js +1 -1
- package/widgets/BuildingExplorer.js +1 -1
- package/widgets/Compass.js +1 -1
- package/widgets/CoordinateConversion.js +1 -1
- package/widgets/Daylight/support/SliderWithDropdown.js +1 -1
- package/widgets/Daylight.js +1 -1
- package/widgets/DirectLineMeasurement3D.js +1 -1
- package/widgets/Directions/support/resources.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/DistanceMeasurement2D.js +1 -1
- package/widgets/Editor/deprecationUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/ElevationProfile/css.js +1 -1
- package/widgets/Expand.js +1 -1
- package/widgets/Feature/FeatureAttachments.js +1 -1
- package/widgets/Feature/FeatureContent.js +1 -1
- package/widgets/Feature/FeatureExpression.js +1 -1
- package/widgets/Feature/FeatureFields.js +1 -1
- package/widgets/Feature/FeatureMedia.js +1 -1
- package/widgets/Feature/support/FeatureElementInfo.js +1 -1
- package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
- package/widgets/Feature/support/featureUtils.js +1 -1
- package/widgets/Feature.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable/AttachmentsColumn.js +1 -1
- package/widgets/FeatureTable/FieldColumn.js +1 -1
- package/widgets/FeatureTable/Grid/Column.js +1 -1
- package/widgets/FeatureTable/Grid/EditorColumn.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable/Grid/support/ButtonMenu.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/FeatureTemplates/ItemList.js +1 -1
- package/widgets/FeatureTemplates.js +1 -1
- package/widgets/FloorFilter.js +1 -1
- package/widgets/Fullscreen.js +1 -1
- package/widgets/Histogram.js +1 -1
- package/widgets/HistogramRangeSlider.js +1 -1
- package/widgets/Home.js +1 -1
- package/widgets/LayerList/ListItemPanel.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/Legend/styles/Card.js +1 -1
- package/widgets/Legend/styles/Classic.js +1 -1
- package/widgets/Legend/styles/support/relationshipUtils.js +1 -1
- package/widgets/Legend/styles/support/univariateUtils.js +1 -1
- package/widgets/Legend.js +1 -1
- package/widgets/LineOfSight.js +1 -1
- package/widgets/Locate.js +1 -1
- package/widgets/Measurement.js +1 -1
- package/widgets/NavigationToggle.js +1 -1
- package/widgets/Popup.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/ScaleBar.js +1 -1
- package/widgets/ScaleRangeSlider.js +1 -1
- package/widgets/Search/SearchResultRenderer.js +1 -1
- package/widgets/Search.js +1 -1
- package/widgets/ShadowCast/css.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/Slice.js +1 -1
- package/widgets/Slider.js +1 -1
- package/widgets/Spinner.js +1 -1
- package/widgets/Swipe.js +1 -1
- package/widgets/TableList.js +1 -1
- package/widgets/TimeSlider.js +1 -1
- package/widgets/Track.js +1 -1
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/widgets/Weather/css.js +1 -1
- package/widgets/Widget.js +1 -1
- package/widgets/Zoom/IconButton.js +1 -1
- package/widgets/Zoom.js +1 -1
- package/widgets/smartMapping/BinaryColorSizeSlider.js +1 -1
- package/widgets/smartMapping/ClassedColorSlider.js +1 -1
- package/widgets/smartMapping/ClassedSizeSlider.js +1 -1
- package/widgets/smartMapping/ColorSizeSlider.js +1 -1
- package/widgets/smartMapping/ColorSlider.js +1 -1
- package/widgets/smartMapping/HeatmapSlider.js +1 -1
- package/widgets/smartMapping/OpacitySlider.js +1 -1
- package/widgets/smartMapping/SizeSlider.js +1 -1
- package/widgets/support/ColorPicker.js +1 -1
- package/widgets/support/DatePicker.js +1 -1
- package/widgets/support/Heading.js +1 -1
- package/widgets/support/Popover.js +1 -1
- package/widgets/support/SelectionToolbar.js +1 -1
- package/widgets/support/SnappingControls.js +1 -1
- package/widgets/support/TimePicker.js +1 -1
- package/widgets/support/widgetThemeUtils.js +1 -1
package/widgets/Swipe.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 e}from"../chunks/tslib.es6.js";import{eventKey as i}from"../core/events.js";import{aliasOf as t}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import n from"./Widget.js";import"./support/widgetUtils.js";import{messageBundle as s}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{tsx as a}from"./support/jsxFactory.js";import l from"./Swipe/SwipeViewModel.js";const d={base:"
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import{eventKey as i}from"../core/events.js";import{aliasOf as t}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import n from"./Widget.js";import"./support/widgetUtils.js";import{messageBundle as s}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{tsx as a}from"./support/jsxFactory.js";import l from"./Swipe/SwipeViewModel.js";const d={base:"geoscene-swipe",baseDisabled:"geoscene-swipe--disabled",vertical:"geoscene-swipe--vertical",horizontal:"geoscene-swipe--horizontal",container:"geoscene-swipe__container",divider:"geoscene-swipe__divider",handle:"geoscene-swipe__handle",handleHidden:"geoscene-swipe__handle--hidden",widgetIcon:"geoscene-icon-up-down-arrows",handleIcon:"geoscene-swipe__handle-icon",dragIconHorizontal:"geoscene-icon-drag-horizontal",dragIconVertical:"geoscene-icon-drag-vertical",widget:"geoscene-widget",disabled:"geoscene-disabled"},c={handle:!0,divider:!0};let p=class extends n{constructor(e,i){super(e,i),this.direction=null,this.disabled=!1,this.dragLabel=void 0,this.iconClass=d.widgetIcon,this.label=void 0,this.leadingLayers=null,this.messages=null,this.position=null,this.trailingLayers=null,this.view=null,this.viewModel=new l,this._pointerOffset=null,this._container=null,this._onContainerPointerDown=this._onContainerPointerDown.bind(this),this._onContainerPointerMove=this._onContainerPointerMove.bind(this),this._onContainerPointerUp=this._onContainerPointerUp.bind(this)}set visibleElements(e){this._set("visibleElements",{...c,...e})}get visibleElements(){return this._get("visibleElements")||c}render(){const{state:e,direction:i}=this.viewModel,t="disabled"===e||this.disabled,r={[d.disabled]:t,[d.baseDisabled]:t,[d.vertical]:"vertical"===i,[d.horizontal]:"horizontal"===i};return a("div",{class:this.classes(d.base,d.widget,r)},"disabled"===e?null:this.renderContainer())}renderHandle(){const{direction:e}=this.viewModel,{visibleElements:i}=this,t={[d.dragIconHorizontal]:"vertical"===e,[d.dragIconVertical]:"horizontal"===e},r=this.classes(d.handle,!i.handle&&d.handleHidden);return a("div",{key:"handle",role:"presentation",class:r},a("span",{"aria-hidden":"true",class:this.classes(d.handleIcon,t)}))}renderDivider(){const{visibleElements:e}=this;return e&&e.divider?a("div",{key:"divider",role:"presentation",class:d.divider}):null}renderContent(){return[this.renderDivider(),this.renderHandle()]}renderContainer(){const{disabled:e,dragLabel:i,viewModel:t}=this,{max:r,min:o,direction:n,position:s}=t,l=`${s}%`,c={top:"vertical"===n?l:null,left:"vertical"===n?null:l},p=this.renderContent();return a("div",e?{key:"container",role:"presentation",styles:c,class:d.container}:{tabIndex:0,key:"container",bind:this,afterCreate:this._afterContainerCreate,onkeydown:this._onContainerKeyDown,"touch-action":"none",role:"slider",title:i,"aria-label":i,"aria-orientation":n,"aria-valuemax":`${r}`,"aria-valuemin":`${o}`,"aria-valuenow":`${s}`,"aria-valuetext":l,styles:c,class:d.container},p)}_afterContainerCreate(e){this._container=e,e.addEventListener("pointerdown",this._onContainerPointerDown)}_calculatePointerOffset(e){const{direction:i}=this,t=e.target,r=("vertical"===i?t.clientHeight:t.clientWidth)/2,o=t.getBoundingClientRect(),n=e.clientX-o.left,s=e.clientY-o.top;this._pointerOffset="vertical"===i?s-r:n-r}_onContainerPointerDown(e){e.preventDefault(),this._container&&document.activeElement!==this.container&&this._container.focus(),this._calculatePointerOffset(e),document.addEventListener("pointerup",this._onContainerPointerUp),document.addEventListener("pointermove",this._onContainerPointerMove)}_onContainerPointerUp(e){e.preventDefault(),document.removeEventListener("pointerup",this._onContainerPointerUp),document.removeEventListener("pointermove",this._onContainerPointerMove)}_onContainerPointerMove(e){e.preventDefault();const{_pointerOffset:i,container:t,direction:r}=this,{clientX:o,clientY:n}=e,{top:s,left:a,width:l,height:d}=t.getBoundingClientRect(),c=("vertical"===r?n-s-i:o-a-i)/("vertical"===r?d:l)*100;this.position=c}_getKeyPosition(e){const t=i(e),{position:r}=this,{max:o,min:n,step:s,stepMultiplier:a,direction:l}=this.viewModel,d=s*a;["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"].indexOf(t)>-1&&(e.preventDefault(),e.stopPropagation());if("vertical"===l?"ArrowDown"===t||"ArrowRight"===t:"ArrowUp"===t||"ArrowRight"===t){return r+(e.shiftKey?d:s)}if("vertical"===l?"ArrowUp"===t||"ArrowLeft"===t:"ArrowDown"===t||"ArrowLeft"===t){return r-(e.shiftKey?d:s)}if("Home"===t)return n;if("End"===t)return o;if("vertical"===l?"PageDown"===t:"PageUp"===t)return r+d;return("vertical"===l?"PageUp"===t:"PageDown"===t)?r-d:null}_onContainerKeyDown(e){const i=this._getKeyPosition(e);"number"==typeof i&&(this.position=i)}};e([t("viewModel.direction")],p.prototype,"direction",void 0),e([r()],p.prototype,"disabled",void 0),e([r({aliasOf:{source:"messages.dragLabel",overridable:!0}})],p.prototype,"dragLabel",void 0),e([r()],p.prototype,"iconClass",void 0),e([r({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],p.prototype,"label",void 0),e([t("viewModel.leadingLayers")],p.prototype,"leadingLayers",void 0),e([r(),s("geoscene/widgets/Swipe/t9n/Swipe")],p.prototype,"messages",void 0),e([t("viewModel.position")],p.prototype,"position",void 0),e([t("viewModel.trailingLayers")],p.prototype,"trailingLayers",void 0),e([t("viewModel.view")],p.prototype,"view",void 0),e([r({type:l})],p.prototype,"viewModel",void 0),e([r()],p.prototype,"visibleElements",null),p=e([o("geoscene.widgets.Swipe")],p);const h=p;export{h as default};
|
package/widgets/TableList.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 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{on as o,init as r}from"../core/watchUtils.js";import{aliasOf as n}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 a}from"../core/accessorSupport/decorators/subclass.js";import c from"./Widget.js";import{accessibleHandler as d}from"./support/decorators/accessibleHandler.js";import{messageBundle as m}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{vmEvent as u}from"./support/decorators/vmEvent.js";import{tsx as h}from"./support/jsxFactory.js";import"./support/widgetUtils.js";import g from"./TableList/ListItem.js";import p from"./TableList/TableListViewModel.js";import{findSelectedItem as b}from"./TableList/support/tableListUtils.js";import _ from"sortablejs";function y(e,t,i){e.splice(i,0,e.splice(t,1)[0])}const v=t.ofType(g),f="root-tables",I="data-layer-uid",A="layerUid",S={base:"esri-table-list",geosceneWidget:"esri-widget",geosceneWidgetPanel:"esri-widget--panel",noItems:"esri-table-list__no-items",list:"esri-table-list__list",listRoot:"esri-table-list__list--root",item:"esri-table-list__item",itemChosen:"esri-table-list__item--chosen",itemError:"esri-table-list__item--error",itemSelectable:"esri-table-list__item--selectable",itemContainer:"esri-table-list__item-container",actionsMenu:"esri-table-list__item-actions-menu",actionsMenuItem:"esri-table-list__item-actions-menu-item",actionsMenuItemActive:"esri-table-list__item-actions-menu-item--active",actions:"esri-table-list__item-actions",actionsList:"esri-table-list__item-actions-list",action:"esri-table-list__item-action",actionIcon:"esri-table-list__item-action-icon",actionImage:"esri-table-list__item-action-image",actionTitle:"esri-table-list__item-action-title",actionToggle:"esri-table-list__action-toggle",actionToggleOn:"esri-table-list__action-toggle--on",errorMessage:"esri-table-list__item-error-message",title:"esri-table-list__item-title",disabled:"esri-disabled",disabledElement:"esri-disabled-element",hidden:"esri-hidden",rotating:"esri-rotating",iconEllipses:"geoscene-icon-handle-horizontal",iconNoticeTriangle:"geoscene-icon-notice-triangle",iconLoading:"geoscene-icon-loading-indicator",iconDefaultAction:"geoscene-icon-default-action",widgetIcon:"geoscene-icon-table"},w={actions:"actions",actionSection:"action-section",items:"items"};function T(e){const{actionsOpen:t}=e;t&&(e.actionsOpen=!1)}let C=class extends c{constructor(e,t){super(e,t),this._handles=new s,this._sortable=null,this._sortableNode=null,this._focusSortUid=null,this.visibleItems=null,this.iconClass=S.widgetIcon,this.label=void 0,this.listItemCreatedFunction=null,this.map=null,this.messages=null,this.messagesCommon=null,this.multipleSelectionEnabled=!1,this.selectionEnabled=!1,this.selectedItems=new v,this.tableItems=null,this.viewModel=new p}initialize(){this._setVisibleItems(this.tableItems),this.own(o(this.viewModel,"tableItems","change",(()=>this._itemsChanged())),r(this,"selectionEnabled",(()=>this._toggleSorting())))}destroy(){this._destroySortable(),this._handles.destroy(),this._handles=null}triggerAction(e,t){this.viewModel.triggerAction(e,t)}render(){var e;const{visibleItems:t}=this,i=null==(e=this.viewModel)?void 0:e.state,s={[S.hidden]:"loading"===i,[S.disabled]:"disabled"===i};return h("div",{class:this.classes(S.base,S.geosceneWidget,S.geosceneWidgetPanel,s)},null!=t&&t.length?this.renderList():this.renderNoItems())}renderNoItems(){return h("div",{class:S.noItems},this.messages.noItemsToDisplay)}renderList(){const{visibleItems:e,messages:t,selectionEnabled:i}=this;return h("ul",{"aria-label":t.widgetLabel,role:i?"listbox":void 0,afterCreate:this._sortNodeCreated,afterRemoved:this._destroySortable,"data-node-ref":"_sortableNode",bind:this,class:this.classes(S.list,S.listRoot)},e.map((e=>this.renderItem(e))).toArray())}renderItem(e){const{id:t,selectionEnabled:i,selectedItems:s}=this,o=`${`${t}_${e.uid}`}__title`,r=!!e.error,n={[S.itemError]:!!r,[S.itemSelectable]:i};if(i){var l;const t={[I]:null==(l=e.layer)?void 0:l.uid};return h("li",{key:`item-with-selection-${e.uid}`,bind:this,afterCreate:this._focusListItem,afterUpdate:this._focusListItem,class:this.classes(S.item,n),"aria-labelledby":o,onclick:this._toggleSelection,onkeydown:this._selectionKeydown,"data-item":e,tabIndex:0,"aria-selected":b(e,s)?"true":"false",role:"option",...t},this.renderItemContent(e,o))}return h("li",{key:`item-no-selection-${e.uid}`,bind:this,afterCreate:this._focusListItem,afterUpdate:this._focusListItem,class:this.classes(S.item,n),"aria-labelledby":o},this.renderItemContent(e,o))}renderActionsMenuIcon(e,t){const{messagesCommon:i}=this,s={[S.actionsMenuItemActive]:e.actionsOpen};return h("div",{key:"actions-menu-toggle","data-item":e,bind:this,onclick:this._toggleActionsOpen,onkeydown:this._toggleActionsOpen,class:this.classes(S.actionsMenuItem,s),tabindex:"0",role:"button","aria-controls":t,"aria-label":i.options,title:i.options},h("span",{"aria-hidden":"true",class:S.iconEllipses}))}renderActionsMenu(e,t,i,s){const o=1===i&&this._getSingleActionButton(t),r=o?this.renderAction({item:e,action:o,singleAction:!0}):null,n=!o&&i?this.renderActionsMenuIcon(e,s):null;return n||o?h("div",{key:"actions-menu",class:S.actionsMenu},r,n):null}renderError(e){return e.error?h("div",{key:"error",class:S.errorMessage,role:"alert"},h("span",null,this.messages.tableError)):null}renderItemContent(e,t){const{id:i}=this,s=`${`${i}_${e.uid}`}_actions`,o=this._filterActions(e.actionsSections),r=this._countActions(o);return[h("div",{key:"list-item-container",class:S.itemContainer},this.renderLabel(e,t),this.renderActionsMenu(e,o,r,s)),this.renderError(e),r?this.renderActionsSections(e,o,s):null]}renderTitle(e,t){const{messages:i}=this,s=e.title||i.untitledTable;return h("span",{key:"layer-title-container",id:t,class:S.title},s)}renderItemError(e){return e.error?h("span",{key:"notice-triangle","aria-hidden":"true",class:S.iconNoticeTriangle}):null}renderLabel(e,t){return e.error?[this.renderItemError(e),this.renderTitle(e,t)]:this.renderTitle(e,t)}renderActionsSections(e,t,i){const s=t.toArray().map(((t,i)=>h("ul",{key:`${e}-action-section-${i}`,class:S.actionsList},this.renderActionSection(e,t))));return h("div",{role:"group","aria-expanded":e.actionsOpen?"true":"false",key:"actions-section",id:i,class:S.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:S.iconDefaultAction,r={[S.actionImage]:!t&&!!s["background-image"],[S.iconLoading]:t,[S.rotating]:t};return o&&!t&&(r[o]=!0),h("span",{key:"action-icon","aria-hidden":"true",class:this.classes(S.actionIcon,r),styles:s})}renderActionTitle(e,t){return t?null:h("span",{key:"action-title",class:S.actionTitle},e)}renderAction(e){const{item:t,action:i,singleAction:s}=e,{active:o,disabled:r,title:n}=i,l={[S.actionsMenuItem]:s&&"button"===i.type,[S.action]:o||!s&&"toggle"!==i.type,[S.actionToggle]:!o&&"toggle"===i.type,[S.actionToggleOn]:!o&&"toggle"===i.type&&i.value,[S.disabledElement]:r},a=[this.renderActionIcon(i),this.renderActionTitle(n,s)];return s?h("div",{bind:this,"data-item":t,"data-action":i,role:"button",key:`single-action-${i.uid}`,onclick:this._triggerAction,onkeydown:this._triggerAction,classes:l,tabindex:"0",title:n,"aria-label":n},a):h("li",{bind:this,"data-item":t,"data-action":i,key:`action-${i.uid}`,onclick:this._triggerAction,onkeydown:this._triggerAction,classes:l,tabindex:"0",role:"button",title:n,"aria-label":n},a)}_filterActions(e){return e.map((e=>e.filter((e=>e.visible))))}_setVisibleItems(e){this.visibleItems=null==e?void 0:e.filter((e=>this.errorsVisible||!e.error))}_destroySortable(){const{_sortable:e}=this;e&&e.destroy(),this._sortable=null}_toggleSorting(){const{_sortable:e,_sortableNode:t,selectionEnabled:i}=this;if(t)if(e)e.option("disabled",!i);else{const e=_.create(t,{dataIdAttr:I,group:f,fallbackTolerance:4,disabled:!i,onSort:()=>this._sortTablesToItems(e.toArray()),chosenClass:S.itemChosen});this._sortable=e}}_sortNodeCreated(e){this._sortableNode=e,this._toggleSorting()}_sortTablesToItems(e){var t;const i=null==(t=this.map)?void 0:t.tables;i&&i.sort(((t,i)=>{const s=e.indexOf(t.uid),o=e.indexOf(i.uid);return s>o?-1:s<o?1:0}))}_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=w.actionSection+t,s=()=>this.scheduleRender();this._handles.add(e.on("change",s),i),e.forEach((e=>this._renderOnActionChanges(e,t)))}_renderOnActionChanges(e,t){const i=w.actions+t,s=()=>this.scheduleRender();"toggle"!==e.type?"slider"!==e.type?this._handles.add([r(e,["className","image","id","title","visible"],s)],i):this._handles.add([r(e,["className","id","title","visible","value","displayValueEnabled","max","min","step"],s)],i):this._handles.add([r(e,["className","image","id","title","visible","value"],s)],i)}_renderOnItemChanges(e){const t=e.uid,i=w.items+t,s=()=>this.scheduleRender();this._handles.add([r(e,["actionsOpen","open","title","error"],s),e.actionsSections.on("change",s)],i),e.actionsSections.forEach((e=>this._watchActionSectionChanges(e,t)))}_itemsChanged(){const{tableItems:e}=this.viewModel;this._setVisibleItems(e),this._handles.removeAll(),e.forEach((e=>this._renderOnItemChanges(e))),this.scheduleRender()}_countActions(e){return e.reduce(((e,t)=>e+t.length),0)}_getIconImageStyles(e){const t="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["data-item"],{_sortable:r,selectedItems:n}=this,l=b(o,n),a=r.toArray(),c=e.target,d=a.indexOf(c.dataset[A]);if(-1!==d){if("ArrowDown"===s){const e=d+1;if(e>=a.length)return;var m,u;if(l)y(a,d,e),r.sort(a),this._sortTablesToItems(r.toArray()),this._focusSortUid=null==(m=o.layer)?void 0:m.uid;else this._focusSortUid=null==(u=o.layer)?void 0:u.uid,this.scheduleRender()}if("ArrowUp"===s){const e=d-1;if(e<=-1)return;var h,g;if(l)y(a,d,e),r.sort(a),this._sortTablesToItems(r.toArray()),this._focusSortUid=null==(h=o.layer)?void 0:h.uid;else this._focusSortUid=null==(g=o.layer)?void 0:g.uid,this.scheduleRender()}}}_toggleActionsOpen(e){const t=e.currentTarget["data-item"],{actionsOpen:i}=t,s=!i;s&&this.tableItems.forEach((e=>T(e))),t.actionsOpen=s,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()}_toggleSelection(e){e.stopPropagation();const{multipleSelectionEnabled:t,selectedItems:i}=this,s=t&&(e.metaKey||e.ctrlKey),o=e.currentTarget["data-item"],r=b(o,i),{length:n}=i;if(!s)return n&&!(r&&1===n)?(i.removeAll(),void i.add(o)):void(r?i.remove(r):i.add(o));r?i.remove(r):i.add(o)}};e([l()],C.prototype,"visibleItems",void 0),e([l()],C.prototype,"iconClass",void 0),e([l()],C.prototype,"errorsVisible",void 0),e([l({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],C.prototype,"label",void 0),e([n("viewModel.listItemCreatedFunction")],C.prototype,"listItemCreatedFunction",void 0),e([n("viewModel.map")],C.prototype,"map",void 0),e([l(),m("geoscene/widgets/TableList/t9n/TableList")],C.prototype,"messages",void 0),e([l(),m("geoscene/t9n/common")],C.prototype,"messagesCommon",void 0),e([l()],C.prototype,"multipleSelectionEnabled",void 0),e([l()],C.prototype,"selectionEnabled",void 0),e([l()],C.prototype,"selectedItems",void 0),e([n("viewModel.tableItems")],C.prototype,"tableItems",void 0),e([u("trigger-action"),l({type:p})],C.prototype,"viewModel",void 0),e([n("viewModel.triggerAction")],C.prototype,"triggerAction",null),e([d()],C.prototype,"_toggleActionsOpen",null),e([d()],C.prototype,"_triggerAction",null),e([d()],C.prototype,"_toggleSelection",null),C=e([a("geoscene.widgets.TableList")],C);const k=C;export{k 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{on as o,init as r}from"../core/watchUtils.js";import{aliasOf as n}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 a}from"../core/accessorSupport/decorators/subclass.js";import c from"./Widget.js";import{accessibleHandler as d}from"./support/decorators/accessibleHandler.js";import{messageBundle as m}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{vmEvent as u}from"./support/decorators/vmEvent.js";import{tsx as h}from"./support/jsxFactory.js";import"./support/widgetUtils.js";import g from"./TableList/ListItem.js";import p from"./TableList/TableListViewModel.js";import{findSelectedItem as b}from"./TableList/support/tableListUtils.js";import _ from"sortablejs";function y(e,t,i){e.splice(i,0,e.splice(t,1)[0])}const v=t.ofType(g),f="root-tables",I="data-layer-uid",A="layerUid",S={base:"geoscene-table-list",geosceneWidget:"geoscene-widget",geosceneWidgetPanel:"geoscene-widget--panel",noItems:"geoscene-table-list__no-items",list:"geoscene-table-list__list",listRoot:"geoscene-table-list__list--root",item:"geoscene-table-list__item",itemChosen:"geoscene-table-list__item--chosen",itemError:"geoscene-table-list__item--error",itemSelectable:"geoscene-table-list__item--selectable",itemContainer:"geoscene-table-list__item-container",actionsMenu:"geoscene-table-list__item-actions-menu",actionsMenuItem:"geoscene-table-list__item-actions-menu-item",actionsMenuItemActive:"geoscene-table-list__item-actions-menu-item--active",actions:"geoscene-table-list__item-actions",actionsList:"geoscene-table-list__item-actions-list",action:"geoscene-table-list__item-action",actionIcon:"geoscene-table-list__item-action-icon",actionImage:"geoscene-table-list__item-action-image",actionTitle:"geoscene-table-list__item-action-title",actionToggle:"geoscene-table-list__action-toggle",actionToggleOn:"geoscene-table-list__action-toggle--on",errorMessage:"geoscene-table-list__item-error-message",title:"geoscene-table-list__item-title",disabled:"geoscene-disabled",disabledElement:"geoscene-disabled-element",hidden:"geoscene-hidden",rotating:"geoscene-rotating",iconEllipses:"geoscene-icon-handle-horizontal",iconNoticeTriangle:"geoscene-icon-notice-triangle",iconLoading:"geoscene-icon-loading-indicator",iconDefaultAction:"geoscene-icon-default-action",widgetIcon:"geoscene-icon-table"},w={actions:"actions",actionSection:"action-section",items:"items"};function T(e){const{actionsOpen:t}=e;t&&(e.actionsOpen=!1)}let C=class extends c{constructor(e,t){super(e,t),this._handles=new s,this._sortable=null,this._sortableNode=null,this._focusSortUid=null,this.visibleItems=null,this.iconClass=S.widgetIcon,this.label=void 0,this.listItemCreatedFunction=null,this.map=null,this.messages=null,this.messagesCommon=null,this.multipleSelectionEnabled=!1,this.selectionEnabled=!1,this.selectedItems=new v,this.tableItems=null,this.viewModel=new p}initialize(){this._setVisibleItems(this.tableItems),this.own(o(this.viewModel,"tableItems","change",(()=>this._itemsChanged())),r(this,"selectionEnabled",(()=>this._toggleSorting())))}destroy(){this._destroySortable(),this._handles.destroy(),this._handles=null}triggerAction(e,t){this.viewModel.triggerAction(e,t)}render(){var e;const{visibleItems:t}=this,i=null==(e=this.viewModel)?void 0:e.state,s={[S.hidden]:"loading"===i,[S.disabled]:"disabled"===i};return h("div",{class:this.classes(S.base,S.geosceneWidget,S.geosceneWidgetPanel,s)},null!=t&&t.length?this.renderList():this.renderNoItems())}renderNoItems(){return h("div",{class:S.noItems},this.messages.noItemsToDisplay)}renderList(){const{visibleItems:e,messages:t,selectionEnabled:i}=this;return h("ul",{"aria-label":t.widgetLabel,role:i?"listbox":void 0,afterCreate:this._sortNodeCreated,afterRemoved:this._destroySortable,"data-node-ref":"_sortableNode",bind:this,class:this.classes(S.list,S.listRoot)},e.map((e=>this.renderItem(e))).toArray())}renderItem(e){const{id:t,selectionEnabled:i,selectedItems:s}=this,o=`${`${t}_${e.uid}`}__title`,r=!!e.error,n={[S.itemError]:!!r,[S.itemSelectable]:i};if(i){var l;const t={[I]:null==(l=e.layer)?void 0:l.uid};return h("li",{key:`item-with-selection-${e.uid}`,bind:this,afterCreate:this._focusListItem,afterUpdate:this._focusListItem,class:this.classes(S.item,n),"aria-labelledby":o,onclick:this._toggleSelection,onkeydown:this._selectionKeydown,"data-item":e,tabIndex:0,"aria-selected":b(e,s)?"true":"false",role:"option",...t},this.renderItemContent(e,o))}return h("li",{key:`item-no-selection-${e.uid}`,bind:this,afterCreate:this._focusListItem,afterUpdate:this._focusListItem,class:this.classes(S.item,n),"aria-labelledby":o},this.renderItemContent(e,o))}renderActionsMenuIcon(e,t){const{messagesCommon:i}=this,s={[S.actionsMenuItemActive]:e.actionsOpen};return h("div",{key:"actions-menu-toggle","data-item":e,bind:this,onclick:this._toggleActionsOpen,onkeydown:this._toggleActionsOpen,class:this.classes(S.actionsMenuItem,s),tabindex:"0",role:"button","aria-controls":t,"aria-label":i.options,title:i.options},h("span",{"aria-hidden":"true",class:S.iconEllipses}))}renderActionsMenu(e,t,i,s){const o=1===i&&this._getSingleActionButton(t),r=o?this.renderAction({item:e,action:o,singleAction:!0}):null,n=!o&&i?this.renderActionsMenuIcon(e,s):null;return n||o?h("div",{key:"actions-menu",class:S.actionsMenu},r,n):null}renderError(e){return e.error?h("div",{key:"error",class:S.errorMessage,role:"alert"},h("span",null,this.messages.tableError)):null}renderItemContent(e,t){const{id:i}=this,s=`${`${i}_${e.uid}`}_actions`,o=this._filterActions(e.actionsSections),r=this._countActions(o);return[h("div",{key:"list-item-container",class:S.itemContainer},this.renderLabel(e,t),this.renderActionsMenu(e,o,r,s)),this.renderError(e),r?this.renderActionsSections(e,o,s):null]}renderTitle(e,t){const{messages:i}=this,s=e.title||i.untitledTable;return h("span",{key:"layer-title-container",id:t,class:S.title},s)}renderItemError(e){return e.error?h("span",{key:"notice-triangle","aria-hidden":"true",class:S.iconNoticeTriangle}):null}renderLabel(e,t){return e.error?[this.renderItemError(e),this.renderTitle(e,t)]:this.renderTitle(e,t)}renderActionsSections(e,t,i){const s=t.toArray().map(((t,i)=>h("ul",{key:`${e}-action-section-${i}`,class:S.actionsList},this.renderActionSection(e,t))));return h("div",{role:"group","aria-expanded":e.actionsOpen?"true":"false",key:"actions-section",id:i,class:S.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:S.iconDefaultAction,r={[S.actionImage]:!t&&!!s["background-image"],[S.iconLoading]:t,[S.rotating]:t};return o&&!t&&(r[o]=!0),h("span",{key:"action-icon","aria-hidden":"true",class:this.classes(S.actionIcon,r),styles:s})}renderActionTitle(e,t){return t?null:h("span",{key:"action-title",class:S.actionTitle},e)}renderAction(e){const{item:t,action:i,singleAction:s}=e,{active:o,disabled:r,title:n}=i,l={[S.actionsMenuItem]:s&&"button"===i.type,[S.action]:o||!s&&"toggle"!==i.type,[S.actionToggle]:!o&&"toggle"===i.type,[S.actionToggleOn]:!o&&"toggle"===i.type&&i.value,[S.disabledElement]:r},a=[this.renderActionIcon(i),this.renderActionTitle(n,s)];return s?h("div",{bind:this,"data-item":t,"data-action":i,role:"button",key:`single-action-${i.uid}`,onclick:this._triggerAction,onkeydown:this._triggerAction,classes:l,tabindex:"0",title:n,"aria-label":n},a):h("li",{bind:this,"data-item":t,"data-action":i,key:`action-${i.uid}`,onclick:this._triggerAction,onkeydown:this._triggerAction,classes:l,tabindex:"0",role:"button",title:n,"aria-label":n},a)}_filterActions(e){return e.map((e=>e.filter((e=>e.visible))))}_setVisibleItems(e){this.visibleItems=null==e?void 0:e.filter((e=>this.errorsVisible||!e.error))}_destroySortable(){const{_sortable:e}=this;e&&e.destroy(),this._sortable=null}_toggleSorting(){const{_sortable:e,_sortableNode:t,selectionEnabled:i}=this;if(t)if(e)e.option("disabled",!i);else{const e=_.create(t,{dataIdAttr:I,group:f,fallbackTolerance:4,disabled:!i,onSort:()=>this._sortTablesToItems(e.toArray()),chosenClass:S.itemChosen});this._sortable=e}}_sortNodeCreated(e){this._sortableNode=e,this._toggleSorting()}_sortTablesToItems(e){var t;const i=null==(t=this.map)?void 0:t.tables;i&&i.sort(((t,i)=>{const s=e.indexOf(t.uid),o=e.indexOf(i.uid);return s>o?-1:s<o?1:0}))}_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=w.actionSection+t,s=()=>this.scheduleRender();this._handles.add(e.on("change",s),i),e.forEach((e=>this._renderOnActionChanges(e,t)))}_renderOnActionChanges(e,t){const i=w.actions+t,s=()=>this.scheduleRender();"toggle"!==e.type?"slider"!==e.type?this._handles.add([r(e,["className","image","id","title","visible"],s)],i):this._handles.add([r(e,["className","id","title","visible","value","displayValueEnabled","max","min","step"],s)],i):this._handles.add([r(e,["className","image","id","title","visible","value"],s)],i)}_renderOnItemChanges(e){const t=e.uid,i=w.items+t,s=()=>this.scheduleRender();this._handles.add([r(e,["actionsOpen","open","title","error"],s),e.actionsSections.on("change",s)],i),e.actionsSections.forEach((e=>this._watchActionSectionChanges(e,t)))}_itemsChanged(){const{tableItems:e}=this.viewModel;this._setVisibleItems(e),this._handles.removeAll(),e.forEach((e=>this._renderOnItemChanges(e))),this.scheduleRender()}_countActions(e){return e.reduce(((e,t)=>e+t.length),0)}_getIconImageStyles(e){const t="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["data-item"],{_sortable:r,selectedItems:n}=this,l=b(o,n),a=r.toArray(),c=e.target,d=a.indexOf(c.dataset[A]);if(-1!==d){if("ArrowDown"===s){const e=d+1;if(e>=a.length)return;var m,u;if(l)y(a,d,e),r.sort(a),this._sortTablesToItems(r.toArray()),this._focusSortUid=null==(m=o.layer)?void 0:m.uid;else this._focusSortUid=null==(u=o.layer)?void 0:u.uid,this.scheduleRender()}if("ArrowUp"===s){const e=d-1;if(e<=-1)return;var h,g;if(l)y(a,d,e),r.sort(a),this._sortTablesToItems(r.toArray()),this._focusSortUid=null==(h=o.layer)?void 0:h.uid;else this._focusSortUid=null==(g=o.layer)?void 0:g.uid,this.scheduleRender()}}}_toggleActionsOpen(e){const t=e.currentTarget["data-item"],{actionsOpen:i}=t,s=!i;s&&this.tableItems.forEach((e=>T(e))),t.actionsOpen=s,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()}_toggleSelection(e){e.stopPropagation();const{multipleSelectionEnabled:t,selectedItems:i}=this,s=t&&(e.metaKey||e.ctrlKey),o=e.currentTarget["data-item"],r=b(o,i),{length:n}=i;if(!s)return n&&!(r&&1===n)?(i.removeAll(),void i.add(o)):void(r?i.remove(r):i.add(o));r?i.remove(r):i.add(o)}};e([l()],C.prototype,"visibleItems",void 0),e([l()],C.prototype,"iconClass",void 0),e([l()],C.prototype,"errorsVisible",void 0),e([l({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],C.prototype,"label",void 0),e([n("viewModel.listItemCreatedFunction")],C.prototype,"listItemCreatedFunction",void 0),e([n("viewModel.map")],C.prototype,"map",void 0),e([l(),m("geoscene/widgets/TableList/t9n/TableList")],C.prototype,"messages",void 0),e([l(),m("geoscene/t9n/common")],C.prototype,"messagesCommon",void 0),e([l()],C.prototype,"multipleSelectionEnabled",void 0),e([l()],C.prototype,"selectionEnabled",void 0),e([l()],C.prototype,"selectedItems",void 0),e([n("viewModel.tableItems")],C.prototype,"tableItems",void 0),e([u("trigger-action"),l({type:p})],C.prototype,"viewModel",void 0),e([n("viewModel.triggerAction")],C.prototype,"triggerAction",null),e([d()],C.prototype,"_toggleActionsOpen",null),e([d()],C.prototype,"_triggerAction",null),e([d()],C.prototype,"_toggleSelection",null),C=e([a("geoscene.widgets.TableList")],C);const k=C;export{k as default};
|
package/widgets/TimeSlider.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 e}from"../chunks/tslib.es6.js";import t from"../TimeInterval.js";import{equals as i}from"../core/arrayUtils.js";import s from"../core/Collection.js";import{neverReached as n}from"../core/compilerUtils.js";import{isSome as o,isNone as a,applySome as r}from"../core/maybe.js";import{watch as l,initial as m}from"../core/reactiveUtils.js";import{truncateDate as u,offsetDate as d}from"../core/timeUtils.js";import{aliasOf as c}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import{subclass as v}from"../core/accessorSupport/decorators/subclass.js";import{formatDate as h,convertDateFormatToIntlOptions as w}from"../intl/date.js";import y from"./Slider.js";import f from"./Widget.js";import{accessibleHandler as x}from"./support/decorators/accessibleHandler.js";import{messageBundle as b}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{vmEvent as _}from"./support/decorators/vmEvent.js";import{tsx as g}from"./support/jsxFactory.js";import{onResize as k}from"./support/widgetUtils.js";import{getCalciteThemeClass as j}from"./support/widgetThemeUtils.js";import T from"./TimeSlider/TimeSliderViewModel.js";const E="esri-time-slider",S={widgetIcon:"geoscene-icon-time-clock",geosceneWidget:"esri-widget",geosceneWidgetButton:"esri-widget--button",esriButtonDisabled:"esri-button--disabled",esriDisabled:"esri-disabled",timeSlider:`${E}`,timeSliderOutOfBounds:`${E}--out-of-bounds`,timeSliderMode:`${E}__mode--`,timeSliderLayout:`${E}__layout--`,timeSliderRow:`${E}__row`,animation:`${E}__animation`,animationButton:`${E}__animation-button`,animationPlay:"geoscene-icon-play",animationPause:"geoscene-icon-pause",timeExtent:`${E}__time-extent`,timeExtentGroup:`${E}__time-extent-group`,timeExtentDate:`${E}__time-extent-date`,timeExtentTime:`${E}__time-extent-time`,timeExtentSeparator:`${E}__time-extent-separator`,playbackControls:`${E}__playback-controls`,min:`${E}__min`,minDate:`${E}__min-date`,minTime:`${E}__min-time`,slider:`${E}__slider`,sliderMajorTick:"majorTick",sliderMinorTick:"minorTick",max:`${E}__max`,maxDate:`${E}__max-date`,maxTime:`${E}__max-time`,previous:`${E}__previous`,previousButton:`${E}__previous-button`,previousIcon:"geoscene-icon-reverse",next:`${E}__next`,nextButton:`${E}__next-button`,nextIcon:"geoscene-icon-forward",warning:`${E}__warning`,warningIcon:"geoscene-icon-notice-triangle",warningText:`${E}__warning-text`,hasActions:`${E}--has-actions`,actions:`${E}__actions`,actionsButton:`${E}__actions-button`},M=3,$=858,C=new s([{minor:new t({value:100,unit:"milliseconds"}),major:new t({value:1,unit:"seconds"}),format:{second:"numeric"}},{minor:new t({value:500,unit:"milliseconds"}),major:new t({value:5,unit:"seconds"}),format:{second:"numeric"}},{minor:new t({value:1,unit:"seconds"}),major:new t({value:20,unit:"seconds"}),format:{minute:"numeric",second:"numeric"}},{minor:new t({value:2,unit:"seconds"}),major:new t({value:30,unit:"seconds"}),format:{minute:"numeric",second:"numeric"}},{minor:new t({value:10,unit:"seconds"}),major:new t({value:1,unit:"minutes"}),format:{minute:"numeric"}},{minor:new t({value:15,unit:"seconds"}),major:new t({value:5,unit:"minutes"}),format:{hour:"numeric",minute:"numeric"}},{minor:new t({value:1,unit:"minutes"}),major:new t({value:20,unit:"minutes"}),format:{hour:"numeric",minute:"numeric"}},{minor:new t({value:5,unit:"minutes"}),major:new t({value:2,unit:"hours"}),format:{hour:"numeric",minute:"numeric"}},{minor:new t({value:15,unit:"minutes"}),major:new t({value:6,unit:"hours"}),format:{hour:"numeric",minute:"numeric"}},{minor:new t({value:1,unit:"hours"}),major:new t({value:1,unit:"days"}),format:{day:"numeric",month:"short"}},{minor:new t({value:6,unit:"hours"}),major:new t({value:1,unit:"weeks"}),format:{day:"numeric",month:"short"}},{minor:new t({value:1,unit:"days"}),major:new t({value:1,unit:"months"}),format:{month:"long"}},{minor:new t({value:2,unit:"days"}),major:new t({value:1,unit:"months"}),format:{month:"short"}},{minor:new t({value:3,unit:"days"}),major:new t({value:1,unit:"months"}),format:{month:"short"}},{minor:new t({value:4,unit:"days"}),major:new t({value:3,unit:"months"}),format:{month:"short",year:"numeric"}},{minor:new t({value:1,unit:"weeks"}),major:new t({value:1,unit:"years"}),format:{year:"numeric"}},{minor:new t({value:1,unit:"months"}),major:new t({value:1,unit:"years"}),format:{year:"numeric"}},{minor:new t({value:2,unit:"months"}),major:new t({value:2,unit:"years"}),format:{year:"numeric"}},{minor:new t({value:1,unit:"years"}),major:new t({value:1,unit:"decades"}),format:{year:"numeric"}},{minor:new t({value:2,unit:"years"}),major:new t({value:5,unit:"decades"}),format:{year:"numeric"}},{minor:new t({value:5,unit:"decades"}),major:new t({value:10,unit:"centuries"}),format:{era:"short",year:"numeric"}},{minor:new t({value:1,unit:"centuries"}),major:new t({value:10,unit:"centuries"}),format:{era:"short",year:"numeric"}},{minor:new t({value:2,unit:"centuries"}),major:new t({value:20,unit:"centuries"}),format:{era:"short",year:"numeric"}},{minor:new t({value:5,unit:"centuries"}),major:new t({value:50,unit:"centuries"}),format:{era:"short",year:"numeric"}},{minor:new t({value:10,unit:"centuries"}),major:new t({value:100,unit:"centuries"}),format:{era:"short",year:"numeric"}},{minor:new t({value:20,unit:"centuries"}),major:new t({value:200,unit:"centuries"}),format:{era:"short",year:"numeric"}},{minor:new t({value:50,unit:"centuries"}),major:new t({value:500,unit:"centuries"}),format:{era:"short",year:"numeric"}},{minor:new t({value:100,unit:"centuries"}),major:new t({value:1e3,unit:"centuries"}),format:{era:"short",year:"numeric"}},{minor:new t({value:200,unit:"centuries"}),major:new t({value:1e3,unit:"centuries"}),format:{era:"short",year:"numeric"}},{minor:new t({value:500,unit:"centuries"}),major:new t({value:5e3,unit:"centuries"}),format:{era:"short",year:"numeric"}},{minor:new t({value:1e3,unit:"centuries"}),major:new t({value:1e4,unit:"centuries"}),format:{era:"short",year:"numeric"}}]);let D=class extends f{constructor(e,t){super(e,t),this._ignoreNextSliderUpdate=!1,this._slider=new y({precision:0,visibleElements:{rangeLabels:!1},rangeLabelInputsEnabled:!1,thumbsConstrained:!1}),this._tickFormat=null,this.actions=null,this.disabled=!1,this.effectiveStops=null,this.fullTimeExtent=null,this.iconClass=S.widgetIcon,this.label=void 0,this.labelFormatFunction=null,this.loop=!1,this.messages=null,this.messagesCommon=null,this.mode="time-window",this.playRate=1e3,this.stops={count:10},this.tickConfigs=null,this.timeExtent=null,this.timeVisible=!1,this.view=null,this.viewModel=new T}initialize(){this.own([l((()=>this._slider.values),(e=>{if(this._ignoreNextSliderUpdate)return void(this._ignoreNextSliderUpdate=!1);const t=this.viewModel.valuesToTimeExtent(e);o(this.timeExtent)?o(t)?this.timeExtent.equals(t)||(this.timeExtent=t):this.timeExtent=null:o(t)&&(this.timeExtent=t)})),l((()=>this.effectiveStops),(()=>this._updateSliderSteps()),m)])}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-action.js"),import("@esri/calcite-components/dist/components/calcite-action-menu.js")])}destroy(){this._slider.destroy(),this._tickFormat=null}get interactive(){return!this.disabled&&this.viewModel&&"disabled"!==this.viewModel.state}set layout(e){-1===["auto","compact","wide"].indexOf(e)&&(e="auto"),this._set("layout",e)}static async getPropertiesFromWebMap(e,t){return T.getPropertiesFromWebMap(e,t)}next(){}play(){}previous(){}stop(){return null}render(){const{_slider:e,actions:t,domNode:s,effectiveStops:n,fullTimeExtent:l,interactive:m,messages:u,messagesCommon:d,mode:c,tickConfigs:p,timeExtent:v,timeVisible:w,viewModel:{state:y,timeExtentValues:f}}=this;if(o(l)){const{start:t,end:i}=l;if(o(t)&&o(i)){const s=t.getTime(),n=i.getTime(),a=e.min!==s||e.max!==n;if(a&&(e.min=s,e.max=n),o(p))e.tickConfigs!==p&&(e.tickConfigs=p);else{var x;const t=(n-s)/((null==(x=e.trackElement)?void 0:x.offsetWidth)||400),i=C.find((e=>e.minor.toMilliseconds()>M*t)),o=this._tickFormat!==i&&null!=i;if(o&&(this._tickFormat=i),a||o){const t={mode:"position",values:this._getTickPositions(i.minor),labelsVisible:!1,tickCreatedFunction:(e,t)=>{t.classList.add(S.sliderMinorTick)}},s={mode:"position",values:this._getTickPositions(i.major),labelsVisible:!0,tickCreatedFunction:(e,t)=>{t.classList.add(S.sliderMajorTick)},labelFormatFunction:e=>h(e,i.format)};e.tickConfigs=[t,s]}}}}const b=a(this.fullTimeExtent)||a(this.timeExtent)||this.timeExtent.isAllTime||this.timeExtent.isEmpty||o(this.timeExtent.start)&&(this.timeExtent.start<this.fullTimeExtent.start||this.timeExtent.start>this.fullTimeExtent.end)||o(this.timeExtent.end)&&(this.timeExtent.end>this.fullTimeExtent.end||this.timeExtent.end<this.fullTimeExtent.start);if(b)switch(this._ignoreNextSliderUpdate=!0,c){case"time-window":e.values=[e.min,e.max];break;case"instant":case"cumulative-from-end":e.values=[e.min];break;case"cumulative-from-start":e.values=[e.max]}else o(f)?i(e.values,f)||(e.values=f):e.values=null;e.disabled=!m;const _="ready"===y,T="playing"===y,E=b||!m||a(n)||0===n.length,D="auto"===this.layout?s.clientWidth<$?"compact":"wide":this.layout,F=g("div",{class:S.animation},g("button",{"aria-disabled":E?"true":"false","aria-label":T?d.control.stop:d.control.play,bind:this,class:this.classes(S.geosceneWidgetButton,S.animationButton,E&&S.esriButtonDisabled),disabled:E,title:T?d.control.stop:d.control.play,onclick:this._playOrStopClick,type:"button"},g("div",{class:this.classes((_||E)&&S.animationPlay,T&&S.animationPause)}))),B=o(this.labelFormatFunction)?g("div",{key:"extent",bind:this,class:S.timeExtentDate,"data-type":"extent","data-layout":D,"data-date":r(v,(e=>[e.start,e.end])),afterCreate:this._createLabel,afterUpdate:this._createLabel}):a(v)||o(v)&&v.isAllTime?[g("div",{class:this.classes(S.warning,S.warningIcon)}),g("div",{key:"warning-text",class:S.warningText},u.noTimeExtent)]:v.isEmpty?[g("div",{class:this.classes(S.warning,S.warningIcon)}),g("div",{key:"warning-text",class:S.warningText},u.emptyTimeExtent)]:[o(v.start)&&g("div",{key:"start-date-group",class:S.timeExtentGroup},g("div",{key:"start-date",class:S.timeExtentDate},this._formatDate(v.start)),w&&g("div",{key:"start-time",class:S.timeExtentTime},this._formatTime(v.start))),o(v.start)&&o(v.end)&&v.start.getTime()!==v.end.getTime()&&g("div",{key:"separator",class:S.timeExtentSeparator},"–"),o(v.end)&&(a(v.start)||v.start.getTime()!==v.end.getTime())&&g("div",{key:"end-date-group",class:S.timeExtentGroup},g("div",{key:"end-date",class:S.timeExtentDate},this._formatDate(v.end)),w&&g("div",{key:"end-time",class:S.timeExtentTime},this._formatTime(v.end)))],L=g("div",{class:this.classes(S.timeExtent,!m&&S.esriButtonDisabled)},[B]),U=o(this.labelFormatFunction)?g("div",{key:"min-date",bind:this,class:S.minDate,"data-date":r(l,(e=>e.start)),"data-type":"min","data-layout":D,afterCreate:this._createLabel,afterUpdate:this._createLabel}):o(l)&&o(l.start)&&[g("div",{key:"min-date",class:S.minDate},this._formatDate(l.start)),w&&g("div",{key:"min-time",class:S.minTime},this._formatTime(l.start))],W=g("div",{class:this.classes(S.min,!m&&S.esriButtonDisabled)},[U]),I=g("div",{class:S.slider},e.render()),O=o(this.labelFormatFunction)?g("div",{key:"max-date",bind:this,class:S.maxDate,"data-date":r(l,(e=>e.end)),"data-type":"max","data-layout":D,afterCreate:this._createLabel,afterUpdate:this._createLabel}):o(l)&&o(l.end)&&[g("div",{key:"max-date",class:S.maxDate},this._formatDate(l.end)),w&&g("div",{key:"max-time",class:S.maxTime},this._formatTime(l.end))],P=g("div",{class:this.classes(S.max,!m&&S.esriButtonDisabled)},[O]),A=g("div",{class:S.previous},g("button",{"aria-disabled":E?"true":"false","aria-label":d.pagination.previous,bind:this,class:this.classes(S.geosceneWidgetButton,S.previousButton,(T||E)&&S.esriButtonDisabled),disabled:E,title:d.pagination.previous,onclick:this._previousClick,type:"button"},g("div",{class:S.previousIcon}))),R=g("div",{class:S.next},g("button",{"aria-disabled":E?"true":"false","aria-label":d.pagination.next,bind:this,class:this.classes(S.geosceneWidgetButton,S.nextButton,(T||E)&&S.esriButtonDisabled),disabled:E,title:d.pagination.next,onclick:this._nextClick,type:"button"},g("div",{class:S.nextIcon}))),V=(null==t?void 0:t.length)>0,N=V&&g("div",{class:S.actions,title:d.options},g("calcite-action-menu",{label:d.options,class:S.actionsButton},t.toArray().map((e=>g("calcite-action",{bind:this,icon:e.icon,id:e.id,onCalciteActionClick:()=>this.viewModel.triggerAction(e),text:e.title,textEnabled:!0})))));return g("div",{class:this.classes(S.timeSlider,S.geosceneWidget,`${S.timeSliderMode}${c}`,`${S.timeSliderLayout}${D}`,!m&&S.esriDisabled,b&&S.timeSliderOutOfBounds,V&&S.hasActions,j()),afterCreate:e=>{this.own(k(e,(()=>this.scheduleRender())))},"aria-label":u.widgetLabel},"wide"===D&&g("div",{class:S.timeSliderRow},g("div",{class:S.playbackControls},[F,L,W,I,P,A,R]),N),"compact"===D&&[g("div",{key:"time-slider-row-1",class:S.timeSliderRow},[L,N]),g("div",{key:"time-slider-row-2",class:S.timeSliderRow},[I]),g("div",{key:"time-slider-row-3",class:S.timeSliderRow},[W,A,F,R,P])])}updateWebDocument(e){var t;null==(t=this.viewModel)||t.updateWebDocument(e)}_createLabel(e){if(a(this.labelFormatFunction))return;const t=e.getAttribute("data-type"),i=e.getAttribute("data-layout"),s=e["data-date"];this.labelFormatFunction(s,t,e,i)}_getTickPositions(e){const{fullTimeExtent:t}=this;if(a(t)||a(t.start)||a(t.end))return[];const{start:i,end:s}=t,n=[],{value:o,unit:r}=e;let l=u(i,r);for(;l.getTime()<=s.getTime();)l.getTime()>=i.getTime()&&n.push(l.getTime()),l=d(l,o,r);return n}_formatDate(e){return e?h(e,w("short-date")):null}_formatTime(e){return e?h(e,w("long-time")):null}_updateSliderSteps(){this._slider.steps=o(this.effectiveStops)&&this.effectiveStops.length>0?this.effectiveStops.map((e=>e.getTime())):null}_playOrStopClick(){switch(this.viewModel.state){case"ready":this.viewModel.play();break;case"playing":this.viewModel.stop();break;case"disabled":break;default:n(this.viewModel.state)}}_previousClick(){this.viewModel.previous()}_nextClick(){this.viewModel.next()}};e([c("viewModel.actions")],D.prototype,"actions",void 0),e([p()],D.prototype,"disabled",void 0),e([c("viewModel.effectiveStops")],D.prototype,"effectiveStops",void 0),e([c("viewModel.fullTimeExtent")],D.prototype,"fullTimeExtent",void 0),e([p()],D.prototype,"iconClass",void 0),e([p({readOnly:!0})],D.prototype,"interactive",null),e([p({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],D.prototype,"label",void 0),e([p()],D.prototype,"labelFormatFunction",void 0),e([p({value:"auto"})],D.prototype,"layout",null),e([c("viewModel.loop")],D.prototype,"loop",void 0),e([p(),b("geoscene/widgets/TimeSlider/t9n/TimeSlider")],D.prototype,"messages",void 0),e([p(),b("geoscene/t9n/common")],D.prototype,"messagesCommon",void 0),e([c("viewModel.mode")],D.prototype,"mode",void 0),e([c("viewModel.playRate")],D.prototype,"playRate",void 0),e([c("viewModel.stops")],D.prototype,"stops",void 0),e([p()],D.prototype,"tickConfigs",void 0),e([c("viewModel.timeExtent")],D.prototype,"timeExtent",void 0),e([p({nonNullable:!0})],D.prototype,"timeVisible",void 0),e([c("viewModel.view")],D.prototype,"view",void 0),e([p({type:T}),_("trigger-action")],D.prototype,"viewModel",void 0),e([c("viewModel.next")],D.prototype,"next",null),e([c("viewModel.play")],D.prototype,"play",null),e([c("viewModel.previous")],D.prototype,"previous",null),e([c("viewModel.stop")],D.prototype,"stop",null),e([x()],D.prototype,"_playOrStopClick",null),e([x()],D.prototype,"_previousClick",null),e([x()],D.prototype,"_nextClick",null),D=e([v("geoscene.widgets.TimeSlider")],D);const F=D;export{F as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../TimeInterval.js";import{equals as i}from"../core/arrayUtils.js";import s from"../core/Collection.js";import{neverReached as n}from"../core/compilerUtils.js";import{isSome as o,isNone as a,applySome as r}from"../core/maybe.js";import{watch as l,initial as m}from"../core/reactiveUtils.js";import{truncateDate as u,offsetDate as d}from"../core/timeUtils.js";import{aliasOf as c}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import{subclass as v}from"../core/accessorSupport/decorators/subclass.js";import{formatDate as h,convertDateFormatToIntlOptions as w}from"../intl/date.js";import y from"./Slider.js";import f from"./Widget.js";import{accessibleHandler as x}from"./support/decorators/accessibleHandler.js";import{messageBundle as b}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{vmEvent as _}from"./support/decorators/vmEvent.js";import{tsx as g}from"./support/jsxFactory.js";import{onResize as k}from"./support/widgetUtils.js";import{getCalciteThemeClass as j}from"./support/widgetThemeUtils.js";import T from"./TimeSlider/TimeSliderViewModel.js";const E="geoscene-time-slider",S={widgetIcon:"geoscene-icon-time-clock",geosceneWidget:"geoscene-widget",geosceneWidgetButton:"geoscene-widget--button",esriButtonDisabled:"geoscene-button--disabled",esriDisabled:"geoscene-disabled",timeSlider:`${E}`,timeSliderOutOfBounds:`${E}--out-of-bounds`,timeSliderMode:`${E}__mode--`,timeSliderLayout:`${E}__layout--`,timeSliderRow:`${E}__row`,animation:`${E}__animation`,animationButton:`${E}__animation-button`,animationPlay:"geoscene-icon-play",animationPause:"geoscene-icon-pause",timeExtent:`${E}__time-extent`,timeExtentGroup:`${E}__time-extent-group`,timeExtentDate:`${E}__time-extent-date`,timeExtentTime:`${E}__time-extent-time`,timeExtentSeparator:`${E}__time-extent-separator`,playbackControls:`${E}__playback-controls`,min:`${E}__min`,minDate:`${E}__min-date`,minTime:`${E}__min-time`,slider:`${E}__slider`,sliderMajorTick:"majorTick",sliderMinorTick:"minorTick",max:`${E}__max`,maxDate:`${E}__max-date`,maxTime:`${E}__max-time`,previous:`${E}__previous`,previousButton:`${E}__previous-button`,previousIcon:"geoscene-icon-reverse",next:`${E}__next`,nextButton:`${E}__next-button`,nextIcon:"geoscene-icon-forward",warning:`${E}__warning`,warningIcon:"geoscene-icon-notice-triangle",warningText:`${E}__warning-text`,hasActions:`${E}--has-actions`,actions:`${E}__actions`,actionsButton:`${E}__actions-button`},M=3,$=858,C=new s([{minor:new t({value:100,unit:"milliseconds"}),major:new t({value:1,unit:"seconds"}),format:{second:"numeric"}},{minor:new t({value:500,unit:"milliseconds"}),major:new t({value:5,unit:"seconds"}),format:{second:"numeric"}},{minor:new t({value:1,unit:"seconds"}),major:new t({value:20,unit:"seconds"}),format:{minute:"numeric",second:"numeric"}},{minor:new t({value:2,unit:"seconds"}),major:new t({value:30,unit:"seconds"}),format:{minute:"numeric",second:"numeric"}},{minor:new t({value:10,unit:"seconds"}),major:new t({value:1,unit:"minutes"}),format:{minute:"numeric"}},{minor:new t({value:15,unit:"seconds"}),major:new t({value:5,unit:"minutes"}),format:{hour:"numeric",minute:"numeric"}},{minor:new t({value:1,unit:"minutes"}),major:new t({value:20,unit:"minutes"}),format:{hour:"numeric",minute:"numeric"}},{minor:new t({value:5,unit:"minutes"}),major:new t({value:2,unit:"hours"}),format:{hour:"numeric",minute:"numeric"}},{minor:new t({value:15,unit:"minutes"}),major:new t({value:6,unit:"hours"}),format:{hour:"numeric",minute:"numeric"}},{minor:new t({value:1,unit:"hours"}),major:new t({value:1,unit:"days"}),format:{day:"numeric",month:"short"}},{minor:new t({value:6,unit:"hours"}),major:new t({value:1,unit:"weeks"}),format:{day:"numeric",month:"short"}},{minor:new t({value:1,unit:"days"}),major:new t({value:1,unit:"months"}),format:{month:"long"}},{minor:new t({value:2,unit:"days"}),major:new t({value:1,unit:"months"}),format:{month:"short"}},{minor:new t({value:3,unit:"days"}),major:new t({value:1,unit:"months"}),format:{month:"short"}},{minor:new t({value:4,unit:"days"}),major:new t({value:3,unit:"months"}),format:{month:"short",year:"numeric"}},{minor:new t({value:1,unit:"weeks"}),major:new t({value:1,unit:"years"}),format:{year:"numeric"}},{minor:new t({value:1,unit:"months"}),major:new t({value:1,unit:"years"}),format:{year:"numeric"}},{minor:new t({value:2,unit:"months"}),major:new t({value:2,unit:"years"}),format:{year:"numeric"}},{minor:new t({value:1,unit:"years"}),major:new t({value:1,unit:"decades"}),format:{year:"numeric"}},{minor:new t({value:2,unit:"years"}),major:new t({value:5,unit:"decades"}),format:{year:"numeric"}},{minor:new t({value:5,unit:"decades"}),major:new t({value:10,unit:"centuries"}),format:{era:"short",year:"numeric"}},{minor:new t({value:1,unit:"centuries"}),major:new t({value:10,unit:"centuries"}),format:{era:"short",year:"numeric"}},{minor:new t({value:2,unit:"centuries"}),major:new t({value:20,unit:"centuries"}),format:{era:"short",year:"numeric"}},{minor:new t({value:5,unit:"centuries"}),major:new t({value:50,unit:"centuries"}),format:{era:"short",year:"numeric"}},{minor:new t({value:10,unit:"centuries"}),major:new t({value:100,unit:"centuries"}),format:{era:"short",year:"numeric"}},{minor:new t({value:20,unit:"centuries"}),major:new t({value:200,unit:"centuries"}),format:{era:"short",year:"numeric"}},{minor:new t({value:50,unit:"centuries"}),major:new t({value:500,unit:"centuries"}),format:{era:"short",year:"numeric"}},{minor:new t({value:100,unit:"centuries"}),major:new t({value:1e3,unit:"centuries"}),format:{era:"short",year:"numeric"}},{minor:new t({value:200,unit:"centuries"}),major:new t({value:1e3,unit:"centuries"}),format:{era:"short",year:"numeric"}},{minor:new t({value:500,unit:"centuries"}),major:new t({value:5e3,unit:"centuries"}),format:{era:"short",year:"numeric"}},{minor:new t({value:1e3,unit:"centuries"}),major:new t({value:1e4,unit:"centuries"}),format:{era:"short",year:"numeric"}}]);let D=class extends f{constructor(e,t){super(e,t),this._ignoreNextSliderUpdate=!1,this._slider=new y({precision:0,visibleElements:{rangeLabels:!1},rangeLabelInputsEnabled:!1,thumbsConstrained:!1}),this._tickFormat=null,this.actions=null,this.disabled=!1,this.effectiveStops=null,this.fullTimeExtent=null,this.iconClass=S.widgetIcon,this.label=void 0,this.labelFormatFunction=null,this.loop=!1,this.messages=null,this.messagesCommon=null,this.mode="time-window",this.playRate=1e3,this.stops={count:10},this.tickConfigs=null,this.timeExtent=null,this.timeVisible=!1,this.view=null,this.viewModel=new T}initialize(){this.own([l((()=>this._slider.values),(e=>{if(this._ignoreNextSliderUpdate)return void(this._ignoreNextSliderUpdate=!1);const t=this.viewModel.valuesToTimeExtent(e);o(this.timeExtent)?o(t)?this.timeExtent.equals(t)||(this.timeExtent=t):this.timeExtent=null:o(t)&&(this.timeExtent=t)})),l((()=>this.effectiveStops),(()=>this._updateSliderSteps()),m)])}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-action.js"),import("@esri/calcite-components/dist/components/calcite-action-menu.js")])}destroy(){this._slider.destroy(),this._tickFormat=null}get interactive(){return!this.disabled&&this.viewModel&&"disabled"!==this.viewModel.state}set layout(e){-1===["auto","compact","wide"].indexOf(e)&&(e="auto"),this._set("layout",e)}static async getPropertiesFromWebMap(e,t){return T.getPropertiesFromWebMap(e,t)}next(){}play(){}previous(){}stop(){return null}render(){const{_slider:e,actions:t,domNode:s,effectiveStops:n,fullTimeExtent:l,interactive:m,messages:u,messagesCommon:d,mode:c,tickConfigs:p,timeExtent:v,timeVisible:w,viewModel:{state:y,timeExtentValues:f}}=this;if(o(l)){const{start:t,end:i}=l;if(o(t)&&o(i)){const s=t.getTime(),n=i.getTime(),a=e.min!==s||e.max!==n;if(a&&(e.min=s,e.max=n),o(p))e.tickConfigs!==p&&(e.tickConfigs=p);else{var x;const t=(n-s)/((null==(x=e.trackElement)?void 0:x.offsetWidth)||400),i=C.find((e=>e.minor.toMilliseconds()>M*t)),o=this._tickFormat!==i&&null!=i;if(o&&(this._tickFormat=i),a||o){const t={mode:"position",values:this._getTickPositions(i.minor),labelsVisible:!1,tickCreatedFunction:(e,t)=>{t.classList.add(S.sliderMinorTick)}},s={mode:"position",values:this._getTickPositions(i.major),labelsVisible:!0,tickCreatedFunction:(e,t)=>{t.classList.add(S.sliderMajorTick)},labelFormatFunction:e=>h(e,i.format)};e.tickConfigs=[t,s]}}}}const b=a(this.fullTimeExtent)||a(this.timeExtent)||this.timeExtent.isAllTime||this.timeExtent.isEmpty||o(this.timeExtent.start)&&(this.timeExtent.start<this.fullTimeExtent.start||this.timeExtent.start>this.fullTimeExtent.end)||o(this.timeExtent.end)&&(this.timeExtent.end>this.fullTimeExtent.end||this.timeExtent.end<this.fullTimeExtent.start);if(b)switch(this._ignoreNextSliderUpdate=!0,c){case"time-window":e.values=[e.min,e.max];break;case"instant":case"cumulative-from-end":e.values=[e.min];break;case"cumulative-from-start":e.values=[e.max]}else o(f)?i(e.values,f)||(e.values=f):e.values=null;e.disabled=!m;const _="ready"===y,T="playing"===y,E=b||!m||a(n)||0===n.length,D="auto"===this.layout?s.clientWidth<$?"compact":"wide":this.layout,F=g("div",{class:S.animation},g("button",{"aria-disabled":E?"true":"false","aria-label":T?d.control.stop:d.control.play,bind:this,class:this.classes(S.geosceneWidgetButton,S.animationButton,E&&S.esriButtonDisabled),disabled:E,title:T?d.control.stop:d.control.play,onclick:this._playOrStopClick,type:"button"},g("div",{class:this.classes((_||E)&&S.animationPlay,T&&S.animationPause)}))),B=o(this.labelFormatFunction)?g("div",{key:"extent",bind:this,class:S.timeExtentDate,"data-type":"extent","data-layout":D,"data-date":r(v,(e=>[e.start,e.end])),afterCreate:this._createLabel,afterUpdate:this._createLabel}):a(v)||o(v)&&v.isAllTime?[g("div",{class:this.classes(S.warning,S.warningIcon)}),g("div",{key:"warning-text",class:S.warningText},u.noTimeExtent)]:v.isEmpty?[g("div",{class:this.classes(S.warning,S.warningIcon)}),g("div",{key:"warning-text",class:S.warningText},u.emptyTimeExtent)]:[o(v.start)&&g("div",{key:"start-date-group",class:S.timeExtentGroup},g("div",{key:"start-date",class:S.timeExtentDate},this._formatDate(v.start)),w&&g("div",{key:"start-time",class:S.timeExtentTime},this._formatTime(v.start))),o(v.start)&&o(v.end)&&v.start.getTime()!==v.end.getTime()&&g("div",{key:"separator",class:S.timeExtentSeparator},"–"),o(v.end)&&(a(v.start)||v.start.getTime()!==v.end.getTime())&&g("div",{key:"end-date-group",class:S.timeExtentGroup},g("div",{key:"end-date",class:S.timeExtentDate},this._formatDate(v.end)),w&&g("div",{key:"end-time",class:S.timeExtentTime},this._formatTime(v.end)))],L=g("div",{class:this.classes(S.timeExtent,!m&&S.esriButtonDisabled)},[B]),U=o(this.labelFormatFunction)?g("div",{key:"min-date",bind:this,class:S.minDate,"data-date":r(l,(e=>e.start)),"data-type":"min","data-layout":D,afterCreate:this._createLabel,afterUpdate:this._createLabel}):o(l)&&o(l.start)&&[g("div",{key:"min-date",class:S.minDate},this._formatDate(l.start)),w&&g("div",{key:"min-time",class:S.minTime},this._formatTime(l.start))],W=g("div",{class:this.classes(S.min,!m&&S.esriButtonDisabled)},[U]),I=g("div",{class:S.slider},e.render()),O=o(this.labelFormatFunction)?g("div",{key:"max-date",bind:this,class:S.maxDate,"data-date":r(l,(e=>e.end)),"data-type":"max","data-layout":D,afterCreate:this._createLabel,afterUpdate:this._createLabel}):o(l)&&o(l.end)&&[g("div",{key:"max-date",class:S.maxDate},this._formatDate(l.end)),w&&g("div",{key:"max-time",class:S.maxTime},this._formatTime(l.end))],P=g("div",{class:this.classes(S.max,!m&&S.esriButtonDisabled)},[O]),A=g("div",{class:S.previous},g("button",{"aria-disabled":E?"true":"false","aria-label":d.pagination.previous,bind:this,class:this.classes(S.geosceneWidgetButton,S.previousButton,(T||E)&&S.esriButtonDisabled),disabled:E,title:d.pagination.previous,onclick:this._previousClick,type:"button"},g("div",{class:S.previousIcon}))),R=g("div",{class:S.next},g("button",{"aria-disabled":E?"true":"false","aria-label":d.pagination.next,bind:this,class:this.classes(S.geosceneWidgetButton,S.nextButton,(T||E)&&S.esriButtonDisabled),disabled:E,title:d.pagination.next,onclick:this._nextClick,type:"button"},g("div",{class:S.nextIcon}))),V=(null==t?void 0:t.length)>0,N=V&&g("div",{class:S.actions,title:d.options},g("calcite-action-menu",{label:d.options,class:S.actionsButton},t.toArray().map((e=>g("calcite-action",{bind:this,icon:e.icon,id:e.id,onCalciteActionClick:()=>this.viewModel.triggerAction(e),text:e.title,textEnabled:!0})))));return g("div",{class:this.classes(S.timeSlider,S.geosceneWidget,`${S.timeSliderMode}${c}`,`${S.timeSliderLayout}${D}`,!m&&S.esriDisabled,b&&S.timeSliderOutOfBounds,V&&S.hasActions,j()),afterCreate:e=>{this.own(k(e,(()=>this.scheduleRender())))},"aria-label":u.widgetLabel},"wide"===D&&g("div",{class:S.timeSliderRow},g("div",{class:S.playbackControls},[F,L,W,I,P,A,R]),N),"compact"===D&&[g("div",{key:"time-slider-row-1",class:S.timeSliderRow},[L,N]),g("div",{key:"time-slider-row-2",class:S.timeSliderRow},[I]),g("div",{key:"time-slider-row-3",class:S.timeSliderRow},[W,A,F,R,P])])}updateWebDocument(e){var t;null==(t=this.viewModel)||t.updateWebDocument(e)}_createLabel(e){if(a(this.labelFormatFunction))return;const t=e.getAttribute("data-type"),i=e.getAttribute("data-layout"),s=e["data-date"];this.labelFormatFunction(s,t,e,i)}_getTickPositions(e){const{fullTimeExtent:t}=this;if(a(t)||a(t.start)||a(t.end))return[];const{start:i,end:s}=t,n=[],{value:o,unit:r}=e;let l=u(i,r);for(;l.getTime()<=s.getTime();)l.getTime()>=i.getTime()&&n.push(l.getTime()),l=d(l,o,r);return n}_formatDate(e){return e?h(e,w("short-date")):null}_formatTime(e){return e?h(e,w("long-time")):null}_updateSliderSteps(){this._slider.steps=o(this.effectiveStops)&&this.effectiveStops.length>0?this.effectiveStops.map((e=>e.getTime())):null}_playOrStopClick(){switch(this.viewModel.state){case"ready":this.viewModel.play();break;case"playing":this.viewModel.stop();break;case"disabled":break;default:n(this.viewModel.state)}}_previousClick(){this.viewModel.previous()}_nextClick(){this.viewModel.next()}};e([c("viewModel.actions")],D.prototype,"actions",void 0),e([p()],D.prototype,"disabled",void 0),e([c("viewModel.effectiveStops")],D.prototype,"effectiveStops",void 0),e([c("viewModel.fullTimeExtent")],D.prototype,"fullTimeExtent",void 0),e([p()],D.prototype,"iconClass",void 0),e([p({readOnly:!0})],D.prototype,"interactive",null),e([p({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],D.prototype,"label",void 0),e([p()],D.prototype,"labelFormatFunction",void 0),e([p({value:"auto"})],D.prototype,"layout",null),e([c("viewModel.loop")],D.prototype,"loop",void 0),e([p(),b("geoscene/widgets/TimeSlider/t9n/TimeSlider")],D.prototype,"messages",void 0),e([p(),b("geoscene/t9n/common")],D.prototype,"messagesCommon",void 0),e([c("viewModel.mode")],D.prototype,"mode",void 0),e([c("viewModel.playRate")],D.prototype,"playRate",void 0),e([c("viewModel.stops")],D.prototype,"stops",void 0),e([p()],D.prototype,"tickConfigs",void 0),e([c("viewModel.timeExtent")],D.prototype,"timeExtent",void 0),e([p({nonNullable:!0})],D.prototype,"timeVisible",void 0),e([c("viewModel.view")],D.prototype,"view",void 0),e([p({type:T}),_("trigger-action")],D.prototype,"viewModel",void 0),e([c("viewModel.next")],D.prototype,"next",null),e([c("viewModel.play")],D.prototype,"play",null),e([c("viewModel.previous")],D.prototype,"previous",null),e([c("viewModel.stop")],D.prototype,"stop",null),e([x()],D.prototype,"_playOrStopClick",null),e([x()],D.prototype,"_previousClick",null),e([x()],D.prototype,"_nextClick",null),D=e([v("geoscene.widgets.TimeSlider")],D);const F=D;export{F as default};
|
package/widgets/Track.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 i}from"../core/accessorSupport/decorators/subclass.js";import s from"./Widget.js";import{accessibleHandler as r}from"./support/decorators/accessibleHandler.js";import{messageBundle as a}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{vmEvent as n}from"./support/decorators/vmEvent.js";import{tsx as l}from"./support/jsxFactory.js";import"./support/widgetUtils.js";import c from"./Track/TrackViewModel.js";const d={base:"
|
|
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 i}from"../core/accessorSupport/decorators/subclass.js";import s from"./Widget.js";import{accessibleHandler as r}from"./support/decorators/accessibleHandler.js";import{messageBundle as a}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{vmEvent as n}from"./support/decorators/vmEvent.js";import{tsx as l}from"./support/jsxFactory.js";import"./support/widgetUtils.js";import c from"./Track/TrackViewModel.js";const d={base:"geoscene-track geoscene-widget--button geoscene-widget",text:"geoscene-icon-font-fallback-text",icon:"geoscene-icon",loading:"geoscene-icon-loading-indicator",rotating:"geoscene-rotating",startTrackingIcon:"geoscene-icon-tracking",stopTrackingIcon:"geoscene-icon-pause",widgetIcon:"geoscene-icon-tracking",disabled:"geoscene-disabled",hidden:"geoscene-hidden"};let p=class extends s{constructor(o,e){super(o,e),this.geolocationOptions=null,this.goToLocationEnabled=null,this.goToOverride=null,this.graphic=null,this.iconClass=d.widgetIcon,this.label=void 0,this.messages=null,this.scale=null,this.tracking=null,this.useHeadingEnabled=null,this.view=null,this.viewModel=new c}start(){}stop(){}render(){const o=this.get("viewModel.state"),e={[d.disabled]:"disabled"===o,[d.hidden]:"feature-unsupported"===o},t="tracking"===o,i={[d.startTrackingIcon]:!t&&"waiting"!==o,[d.stopTrackingIcon]:t,[d.rotating]:"waiting"===o,[d.loading]:"waiting"===o},{messages:s}=this,r=t?s.stopTracking:s.startTracking;return l("div",{bind:this,class:this.classes(d.base,e),hidden:"feature-unsupported"===o,onclick:this._toggleTracking,onkeydown:this._toggleTracking,role:"button",tabIndex:0,"aria-label":r,title:r},l("span",{"aria-hidden":"true",class:this.classes(d.icon,i)}),l("span",{class:d.text},r))}_toggleTracking(){const o=this.viewModel;o&&"feature-unsupported"!==o.state&&"disabled"!==o.state&&("tracking"!==o.state&&"waiting"!==o.state?this.viewModel.start():this.viewModel.stop())}};o([e("viewModel.geolocationOptions")],p.prototype,"geolocationOptions",void 0),o([e("viewModel.goToLocationEnabled")],p.prototype,"goToLocationEnabled",void 0),o([e("viewModel.goToOverride")],p.prototype,"goToOverride",void 0),o([e("viewModel.graphic")],p.prototype,"graphic",void 0),o([t()],p.prototype,"iconClass",void 0),o([t({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],p.prototype,"label",void 0),o([t(),a("geoscene/widgets/Track/t9n/Track")],p.prototype,"messages",void 0),o([e("viewModel.scale")],p.prototype,"scale",void 0),o([e("viewModel.tracking")],p.prototype,"tracking",void 0),o([e("viewModel.useHeadingEnabled")],p.prototype,"useHeadingEnabled",void 0),o([e("viewModel.view")],p.prototype,"view",void 0),o([t({type:c}),n(["track","track-error"])],p.prototype,"viewModel",void 0),o([e("viewModel.start")],p.prototype,"start",null),o([e("viewModel.stop")],p.prototype,"stop",null),o([r()],p.prototype,"_toggleTracking",null),p=o([i("geoscene.widgets.Track")],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{HandleOwnerMixin as t}from"../core/HandleOwner.js";import{whenFalse as s,watch as i}from"../core/watchUtils.js";import{aliasOf as l}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import a from"./Widget.js";import{storeNode as n}from"./support/widgetUtils.js";import{messageBundle as c}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{vmEvent as h}from"./support/decorators/vmEvent.js";import{tsx as d}from"./support/jsxFactory.js";import u from"./UtilityNetworkTrace/UtilityNetworkTraceViewModel.js";import{GraphicHandler as p}from"./UtilityNetworkTrace/support/GraphicHandler.js";const g={base:"esri-utility-trace-network",loaderContainer:"esri-utility-trace-network__loader-container",loader:"esri-utility-trace-network__loader",fadeIn:"esri-utility-trace-network--fade-in",addButtonContainer:"esri-utility-trace-network__add-button-container",noticeContainer:"esri-utility-trace-network__notice-container",listContainer:"esri-utility-trace-network__list-container",resultsContainer:"esri-utility-trace-network__results-container",flow:"esri-utility-trace-network__flow",geosceneWidget:"esri-widget",geosceneWidgetPanel:"esri-widget--panel",geosceneWidgetDisabled:"esri-widget--disabled",esriButton:"esri-button",esriButtonTertiary:"esri-button--tertiary",esriInput:"esri-input",esriMatchHeight:"esri-match-height",iconHandle:"geoscene-icon-handle-vertical",iconPlus:"geoscene-icon-plus",iconEdit:"geoscene-icon-edit",iconHandleHorizontal:"geoscene-icon-handle-horizontal",iconRefresh:"geoscene-icon-refresh",iconLink:"geoscene-icon-link",iconRemove:"geoscene-icon-erase",widgetIcon:"geoscene-icon-UtilityNetworkTrace",header:"esri-widget__heading",loading:"geoscene-icon-loading-indicator",rotating:"esri-rotating"},m="geoscene.widgets.UtilityNetworkTrace";function w(e){return{height:e+"px"}}function _(e){return{width:e+"px"}}function v(){return{textAlign:"center"}}let b=class extends(t(a)){constructor(e,t){super(e,t),this._tracesExists=!0,this._graphicHandler=null,this._selectToolActive=!1,this._activeTrace=null,this._activeSwatch="",this._traceHeaderForFlow="",this._assetGroupHeader="",this._assetTypeHeader="",this._traceResultsFunctions=[],this._traceResultsAssetGroup=[],this._traceResultsAssetType=[],this._traceResultsIndividual=[],this._showTraceResultFunctions=!1,this._showTraceResultAssetGroup=!1,this._showTraceResultAssetType=!1,this._showIndividualRecords=!1,this._activeTab="input",this._flagViewType="starting-point",this._alertRemoveModal=!1,this._warningNoFlag=!1,this._warningNoTraceSelected=!1,this._warningNoStartAssetFound=!1,this._warningNoBarrierAssetFound=!1,this._confirmReset=!1,this._showResultOptions=!1,this._resultDisplayField="objectid",this._resultSortField="objectid",this._resultSortOrder="desc",this._swatchNode=null,this._individualResultNode=null,this._symbolStartFlag=null,this._symbolBarrier=null,this._watchHandler=null,this.defaultGraphicColor={color:[255,255,0,.6],haloOpacity:.9,fillOpacity:.2,hex:"#FFFF00"},this.disabled=!0,this.flags=[],this.gdbVersion="sde.DEFAULT",this.goToOverride=null,this.iconClass=g.widgetIcon,this.inputSettings=[],this.label=void 0,this.messages=null,this.messagesCommon=null,this.selectedTraces=[],this.selectOnComplete=!0,this.showGraphicsOnComplete=!0,this.showSelectionAttributes=!0,this.view=null,this.viewModel=new u}initialize(){this._utilityNetworkTraceInitialized(),this._graphicHandler=new p}async checkCanTrace(){this._confirmReset=!1;const e=this.viewModel.checkCanTrace();e.status?(this._warningNoFlag=!1,this._warningNoTraceSelected=!1,this._warningNoTraceSelected=!1,this._showTraceResultFunctions=!1,this._showTraceResultAssetGroup=!1,this._showTraceResultAssetType=!1,this._showIndividualRecords=!1,this.switchTab("result"),this.viewModel._activeProgress=!0,await this.viewModel.callTrace(),this.viewModel._activeProgress=!1):e.issues.forEach((e=>{"noStart"===e?this._warningNoFlag=!0:this._warningNoTraceSelected=!0})),this.scheduleRender()}confirmReset(){this._confirmReset=!0}render(){const{state:e}=this.viewModel;this._mixCustomStrings(),this._overrideFlagSymbol();const t="loading"===e?this.renderLoading():this.renderUtilityNetworkTrace();return d("div",{class:this.classes(g.base,g.geosceneWidget,g.geosceneWidgetPanel,{[g.geosceneWidgetDisabled]:this.disabled})},t)}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-action.js"),import("@esri/calcite-components/dist/components/calcite-action-group.js"),import("@esri/calcite-components/dist/components/calcite-action-pad.js"),import("@esri/calcite-components/dist/components/calcite-checkbox.js"),import("@esri/calcite-components/dist/components/calcite-color-picker-swatch.js"),import("@esri/calcite-components/dist/components/calcite-combobox.js"),import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),import("@esri/calcite-components/dist/components/calcite-block.js"),import("@esri/calcite-components/dist/components/calcite-block-section.js"),import("@esri/calcite-components/dist/components/calcite-button.js"),import("@esri/calcite-components/dist/components/calcite-flow.js"),import("@esri/calcite-components/dist/components/calcite-icon.js"),import("@esri/calcite-components/dist/components/calcite-label.js"),import("@esri/calcite-components/dist/components/calcite-list.js"),import("@esri/calcite-components/dist/components/calcite-list-item.js"),import("@esri/calcite-components/dist/components/calcite-modal.js"),import("@esri/calcite-components/dist/components/calcite-notice.js"),import("@esri/calcite-components/dist/components/calcite-option.js"),import("@esri/calcite-components/dist/components/calcite-panel.js"),import("@esri/calcite-components/dist/components/calcite-popover.js"),import("@esri/calcite-components/dist/components/calcite-popover-manager.js"),import("@esri/calcite-components/dist/components/calcite-select.js"),import("@esri/calcite-components/dist/components/calcite-tabs.js"),import("@esri/calcite-components/dist/components/calcite-tab.js"),import("@esri/calcite-components/dist/components/calcite-tab-nav.js"),import("@esri/calcite-components/dist/components/calcite-tab-title.js")])}switchTab(e){this._activeTab=e,this.scheduleRender()}switchToFunctions(e,t){this._traceResultsFunctions=e,this._showTraceResultFunctions=t,this.scheduleRender()}switchToAssetGroup(e,t,s){this._traceHeaderForFlow=t,this._traceResultsAssetGroup=e,this._showTraceResultAssetGroup=s,this.scheduleRender()}switchToAssetType(e,t,s){this._assetGroupHeader=t,this._traceResultsAssetType=e,this._showTraceResultAssetType=s,this.scheduleRender()}switchToIndividualRecords(e,t,s){this._assetTypeHeader=t,this._traceResultsIndividual=e,this._showIndividualRecords=s,this.scheduleRender()}renderLoading(){return d("div",{class:g.loaderContainer,key:"loader"},d("div",{class:g.loader}))}renderUtilityNetworkTrace(){const{messages:e}=this;let t=d("calcite-tabs",{position:"above",layout:"center",class:g.esriMatchHeight},d("calcite-tab-nav",{slot:"tab-nav"},d("calcite-tab-title",{active:"input"===this._activeTab,onclick:()=>{this.switchTab("input")}},e.inputsStrings.headerTabInputs),d("calcite-tab-title",{active:"result"===this._activeTab,onclick:()=>{this.switchTab("result")}},e.resultsStrings.headerTabResults)),d("calcite-tab",{active:"input"===this._activeTab,class:g.esriMatchHeight},this.renderInputPanel()),d("calcite-tab",{active:"result"===this._activeTab,class:g.esriMatchHeight},this.viewModel._activeProgress?d("calcite-loader",{active:!0,label:e.alertsStrings.traceExecuting,text:e.alertsStrings.traceExecuting,type:"indeterminate"}):this.viewModel._traceResults.length>0?this.renderResultPanel():this.renderWarningMessage("noTraceExecuted",!1),d("calcite-modal",{active:this._confirmReset,color:"blue",scale:"m",width:"s","intl-close":"Close",onCalciteModalClose:()=>{this._confirmReset=!1}},d("h3",{slot:"header"},e.resultsStrings.startOverButton),d("div",{slot:"content"},e.resultsStrings.startOverValidation),d("calcite-button",{slot:"secondary",width:"full",appearance:"outline",onclick:()=>{this._confirmReset=!1}},e.globalStrings.cancel),d("calcite-button",{slot:"primary",width:"full",onclick:()=>{this._confirmReset=!1,this.viewModel.reset(),this.switchTab("input")}},e.globalStrings.ok))));return this._tracesExists||(t=d("calcite-panel",null,this.renderWarningMessage("noTraceConfig",!1))),t}renderInputPanel(){const{messages:e}=this;return d("calcite-flow",{class:g.flow},d("calcite-panel",null,this._warningNoFlag?this.renderWarningMessage("flag",!0):null,this._warningNoTraceSelected?this.renderWarningMessage("trace",!0):null,this.renderTraceSelectorContainer(),this.renderStartFlagsContainer(),this.renderBarriersFlagsContainer(),this._warningNoFlag&&this._warningNoTraceSelected?d("div",{styles:w(10)}):null,d("calcite-button",{slot:"footer",scale:"m",color:"blue",width:"full",onclick:()=>{this.checkCanTrace()}},e.tracingStrings.runTrace)),this._selectToolActive?this.renderActiveTool():null)}renderResultPanel(){return d("div",{class:this.classes(g.esriMatchHeight,g.resultsContainer)},d("calcite-flow",null,this.renderTraceResults(),this._showTraceResultFunctions?this.renderTraceResultFunctions():null,this._showTraceResultAssetGroup?this.renderTraceResultByAssetGroup():null,this._showTraceResultAssetType?this.renderTraceResultByAssetType():null,this._showIndividualRecords?this.renderTraceResultIndividual():null))}renderStartFlagsContainer(){const{messages:e}=this,t=[];let s=[];s=this.viewModel._flags.filter((e=>"starting-point"===e.type)),s.forEach((e=>{e.displayValue&&t.push(this.renderFlagRow(e,"start"))}));let i=null;return this._symbolStartFlag&&(i=this._getSymbolIcon(this._symbolStartFlag)),d("calcite-block",{heading:e.inputsStrings.headerStartingPoint+" ("+s.length+")",open:!0,collapsible:!0},d("div",{slot:"icon"},i||d("calcite-icon",{icon:"pin",scale:"s"})),d("div",null,e.inputsStrings.startingPointHint),d("div",{class:g.listContainer},t),this._warningNoStartAssetFound?this.renderWarningMessage("noStartAsset",!0):null,d("div",{class:g.addButtonContainer},d("calcite-button",{alignment:"center",appearance:"outline","icon-start":"plus",scale:"m",href:"",label:e.inputsStrings.addPointOption,onclick:()=>{this._flagViewType="starting-point",this._selectToolActive=!0,this._warningNoStartAssetFound=!1,this.viewModel.addFlagByHit("starting-point",this._symbolStartFlag).then((e=>{e||(this._warningNoStartAssetFound=!0),this._selectToolActive=!1,this.scheduleRender()}))},round:!0})))}renderBarriersFlagsContainer(){const{messages:e}=this,t=[];let s=[];s=this.viewModel._flags.filter((e=>"barrier"===e.type)),s.forEach((e=>{e.displayValue&&t.push(this.renderFlagRow(e,"barrier"))}));let i=null;return this._symbolBarrier&&(i=this._getSymbolIcon(this._symbolBarrier)),d("calcite-block",{heading:e.inputsStrings.headerBarrier+" ("+s.length+")",open:!1,collapsible:!0},d("div",{slot:"icon"},i||d("calcite-icon",{icon:"x-circle-f",scale:"s"})),d("div",null,e.inputsStrings.barrierPointHint),d("div",{class:g.listContainer},t),this._warningNoBarrierAssetFound?this.renderWarningMessage("noBarrierAsset",!0):null,d("div",{class:g.addButtonContainer},d("calcite-button",{alignment:"center",appearance:"outline",color:"blue","icon-start":"plus",scale:"m",href:"",round:!0,label:e.inputsStrings.addPointOption,onclick:()=>{this._flagViewType="barrier",this._selectToolActive=!0,this._warningNoBarrierAssetFound=!1,this.viewModel.addFlagByHit("barrier",this._symbolBarrier).then((e=>{e||(this._warningNoBarrierAssetFound=!0),this._selectToolActive=!1,this.scheduleRender()}))}})))}renderFlagRow(e,t){const{messages:s}=this,i=[];let l=!1;return null!==e.allTerminals&&void 0!==e.allTerminals&&e.allTerminals.terminals.length>0&&(l=!0,e.allTerminals.terminals.forEach((t=>{let s=!1;e.selectedTerminals.find((e=>e===t.id))&&(s=!0),i.push(d("calcite-combobox-item",{key:t.name,selected:s,value:t.id,"text-label":t.name,onclick:t=>{this.viewModel.addTerminal(t.target.value,e)}}))}))),d("calcite-block",{key:"pop"+e.globalId+e.type+e.id+t,heading:e.displayValue.value,collapsible:null!==e.allTerminals||"barrier"===e.type},d("calcite-action",{textEnabled:!0,slot:"header-menu-actions",text:s.globalStrings.remove,label:s.globalStrings.remove,onCalciteListItemChange:()=>{this.viewModel.removeFlag(e)},onclick:()=>{this.viewModel.removeFlag(e)},scale:"s",icon:"trash"}),d("calcite-action",{textEnabled:!0,slot:"header-menu-actions",text:s.globalStrings.zoomToFeature,label:s.globalStrings.zoomToFeature,onCalciteListItemChange:()=>{this.viewModel.zoomToAsset(e.details.geometry)},onclick:()=>{this.viewModel.zoomToAsset(e.details.geometry)},scale:"s",icon:"zoom-to-object"}),"barrier"===e.type?d("calcite-label",{scale:"s",layout:"inline"},d("calcite-checkbox",{checked:e.isFilterBarrier,scale:"s",onclick:()=>{this.viewModel.manageFilterBarrier(!e.isFilterBarrier,e)}}),s.inputsStrings.barrierFilter):null,l?d("calcite-combobox",{label:s.globalStrings.selectTerminalPlaceholder,placeholder:s.globalStrings.selectTerminalPlaceholder,"selection-mode":"multi",scale:"s",maxItems:0,onCalciteComboboxChipDismiss:t=>{this.viewModel.removeTerminal(t.target.value,e)}},i):null)}renderActiveTool(){const{messages:e}=this;let t=null;return"starting-point"===this._flagViewType?this._symbolStartFlag&&(t=this._getSymbolIcon(this._symbolStartFlag)):this._symbolBarrier&&(t=this._getSymbolIcon(this._symbolBarrier)),d("calcite-panel",{"height-scale":"s",onCalcitePanelBackClick:()=>{this.viewModel._clickHandler&&(this.viewModel._clickHandler.remove(),this.view.popup.autoOpenEnabled=!0),this._selectToolActive=!1},heading:e.inputsStrings.addPointOption},d("calcite-block",{open:!0,collapsible:!1,heading:""},d("div",{styles:v()},t||d("calcite-icon",{icon:"starting-point"===this._flagViewType?"pin":"x-circle-f",scale:"s"})),d("div",{styles:v()},e.inputsStrings.addPointHint)))}renderTraceSelectorContainer(){const{messages:e}=this,t=[];return this.viewModel._traces.length>0&&this.viewModel._traces.forEach((e=>{t.push(d("calcite-combobox-item",{key:e.globalId,selected:e.selected,value:e.globalId,"text-label":e.title,onCalciteComboboxItemChange:t=>{const s=t.target;this.viewModel.selectTraces(s.selected,e.globalId),this.viewModel._traces.length>0&&(this._warningNoTraceSelected=!1)}}))})),d("calcite-block",{heading:e.tracingStrings.traceOperation,open:!0,collapsible:!0},d("calcite-combobox",{label:e.inputsStrings.selectTraces,placeholder:e.inputsStrings.selectTraces,"selection-mode":"multi",scale:"s",maxItems:0,onCalciteComboboxChipDismiss:e=>{this.viewModel.selectTraces(!1,e.target.value),this.viewModel._traces.length>0&&(this._warningNoTraceSelected=!1)}},t))}renderStartOverContainer(){const{messages:e}=this;return d("calcite-button",{slot:"footer",scale:"m",color:"blue",width:"full",onclick:()=>{this.confirmReset()}},e.resultsStrings.startOverButton)}renderWarningMessage(e,t,s){const{messages:i}=this;let l=i.alertsStrings.NoRunAlertHeader,r=i.alertsStrings.noResultsInfo;switch(e){case"flag":l=i.alertsStrings.startingPointAlertHeader,r=i.alertsStrings.startingPointAlert;break;case"trace":l=i.alertsStrings.selectTraceAlertHeader,r=i.alertsStrings.selectTraceAlert;break;case"noTraceExecuted":l=i.alertsStrings.NoRunAlertHeader,r=i.alertsStrings.noResultsInfo;break;case"noBarrierAsset":case"noStartAsset":l=i.alertsStrings.noAssetsFoundHeader,r=i.alertsStrings.noAssetFound;break;case"noTraceConfig":l="",r=i.alertsStrings.noTraceSupported;break;default:l=i.alertsStrings.genericResultHeader,r=s||""}return d("div",{class:g.noticeContainer,key:e},d("calcite-notice",{open:!0,key:e,active:!0,dismissible:t,icon:!0,scale:"s",width:"auto",color:"red",onCalciteNoticeClose:()=>{switch(e){case"flag":this._warningNoFlag=!1;break;case"trace":this._warningNoTraceSelected=!1;break;case"noStartAsset":this._warningNoStartAssetFound=!1;break;case"noBarrierAsset":this._warningNoBarrierAssetFound=!1}}},d("div",{slot:"title"},l),d("div",{slot:"message"},r)))}renderRemoveTraceContainer(e){const{messages:t}=this;return d("calcite-action",{textEnabled:!0,slot:"header-menu-actions",text:t.globalStrings.clearResults,label:t.globalStrings.clearResults,onCalciteListItemChange:()=>{this._alertRemoveModal=!0,this._activeTrace=e.trace},onclick:()=>{this._alertRemoveModal=!0,this._activeTrace=e.trace},scale:"s",icon:"trash"})}renderHighlightColorPicker(e,t){const{messages:s}=this;return d("calcite-action-pad",{position:"start",layout:"grid",expandDisabled:!0},d("calcite-action-group",{layout:"grid",columns:4},d("calcite-action",{text:s.resultsStrings.graphicColor,label:s.resultsStrings.graphicColor,scale:"s",onclick:()=>{this.viewModel.changeResultGraphicColor(this._graphicHandler.getHighlightColor(0),t)}},d("calcite-color-picker-swatch",{scale:"s",color:this._graphicHandler.getHighlightColor(0).hex,active:e.color===this._graphicHandler.getHighlightColor(0).color})),d("calcite-action",{text:"",scale:"s",onclick:()=>{this.viewModel.changeResultGraphicColor(this._graphicHandler.getHighlightColor(1),t)}},d("calcite-color-picker-swatch",{scale:"s",color:this._graphicHandler.getHighlightColor(1).hex,active:e.color===this._graphicHandler.getHighlightColor(1).color})),d("calcite-action",{text:"",scale:"s",onclick:()=>{this.viewModel.changeResultGraphicColor(this._graphicHandler.getHighlightColor(2),t)}},d("calcite-color-picker-swatch",{scale:"s",color:this._graphicHandler.getHighlightColor(2).hex,active:e.color===this._graphicHandler.getHighlightColor(2).color})),d("calcite-action",{text:"",scale:"s",onclick:()=>{this.viewModel.changeResultGraphicColor(this._graphicHandler.getHighlightColor(3),t)}},d("calcite-color-picker-swatch",{scale:"s",color:this._graphicHandler.getHighlightColor(3).hex,active:e.color===this._graphicHandler.getHighlightColor(3).color})),d("calcite-action",{text:"",scale:"s",onclick:()=>{this.viewModel.changeResultGraphicColor(this._graphicHandler.getHighlightColor(4),t)}},d("calcite-color-picker-swatch",{scale:"s",color:this._graphicHandler.getHighlightColor(4).hex,active:e.color===this._graphicHandler.getHighlightColor(4).color}))))}renderTraceResults(){const{messages:e}=this,t=this.viewModel._traceResults,s=[];return t.forEach(((t,i)=>{let l=[],r=[],o=!1,a=!1,n=!1;null!==t.results&&t.results.hasOwnProperty("elements")?(null!==t.results.aggregatedGeometry&&(a=!0),null!==t.results.globalFunctionResults&&t.results.globalFunctionResults.length>0&&(r=t.results.globalFunctionResults,r.length>0&&(n=!0)),t.results.elements.length>0&&(l=t.results.elements,l.length>0&&(o=!0)),s.push(d("calcite-block",{key:t.trace.title,heading:t.trace.title,summary:t.trace.description,collapsible:!1,open:!0,intlOptions:e.resultsStrings.ellipsesOptions},this.renderRemoveTraceContainer(t),d("calcite-list",null,n?d("calcite-list-item",{label:e.resultsStrings.functionHeader+" ("+r.length+")",onclick:()=>{this.switchToFunctions(r,!0)}},d("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"})):null,o&&this.viewModel.showSelectionAttributes?d("calcite-list-item",{key:this.id,label:e.resultsStrings.viewFeatures+" ("+l.length+")",onclick:()=>{this.switchToAssetGroup(this._groupResultsByAssetGroup(t),t.trace.title+" ("+l.length+")",!0)}},d("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"})):this.viewModel.showSelectionAttributes?d("calcite-label",{layout:"inline",scale:"s"},e.resultsStrings.noSelectionResults):null),d("div",{styles:w(10)}),o?d("calcite-label",{layout:"inline",scale:"s",onclick:e=>{e.preventDefault(),e.stopPropagation(),this.viewModel.mergeSelection(!t.selectionEnabled,t.trace)}},d("calcite-checkbox",{checked:t.selectionEnabled,scale:"m",onclick:e=>{e.preventDefault(),e.stopPropagation(),this.viewModel.mergeSelection(!t.selectionEnabled,t.trace)}}),this.viewModel.showSelectionAttributes?e.resultsStrings.selectFeatures:e.resultsStrings.selectFeatures+" ("+l.length+")"):null,a?d("calcite-block-section",{"toggle-display":"switch",text:e.resultsStrings.highlightTrace,open:t.graphicEnabled,onCalciteBlockSectionToggle:e=>{e.target.open?this.viewModel.changeResultGraphicColor(t.graphicColor,t):this.viewModel.removeResultGraphicFromView(t)}},d("calcite-popover-manager",{key:"aggGeom_"+t.trace.globalId,autoClose:!0},d("calcite-action",{text:e.resultsStrings.graphicColor,label:e.resultsStrings.graphicColor,scale:"s",onclick:e=>{const t=e.target;this._swatchNode=t,this._activeSwatch="aggGeom_"+i,this.scheduleRender()}},d("calcite-color-picker-swatch",{scale:"s",color:t.graphicColor.hex})),d("calcite-popover",{label:e.resultsStrings.graphicColor,text:e.resultsStrings.graphicColor,referenceElement:this._swatchNode,placement:"auto",offsetDistance:5,offsetSkidding:0,open:this._activeSwatch==="aggGeom_"+i,onCalcitePopoverClose:()=>{this._swatchNode=null,this._activeSwatch=null}},this.renderHighlightColorPicker(t.graphicColor,t)))):null))):s.push(d("calcite-block",{key:"error-"+i,heading:t.trace.title,collapsible:!1,open:!0},this.renderRemoveTraceContainer(t),this.renderWarningMessage("noController",!1,t.status)))})),d("calcite-panel",{key:"traceResults"},s,this.renderStartOverContainer(),d("calcite-modal",{active:this._alertRemoveModal,color:"blue",scale:"m",width:"s","intl-close":"Close",onCalciteModalClose:()=>{this._alertRemoveModal=!1,this.scheduleRender()}},d("h3",{slot:"header"},e.globalStrings.clearResults),d("div",{slot:"content"},e.alertsStrings.clearResultsAlert),d("calcite-button",{slot:"secondary",width:"full",appearance:"outline",onclick:()=>{this._alertRemoveModal=!1,this.scheduleRender()}},e.globalStrings.cancel),d("calcite-button",{slot:"primary",width:"full",onclick:()=>{this.viewModel.clearResult(this._activeTrace),this._alertRemoveModal=!1,0===this.viewModel._traceResults.length?this.switchTab("input"):(this._activeTrace=this.viewModel._traceResults[0].trace,this._showTraceResultFunctions=!1,this._showTraceResultAssetGroup=!1,this._showTraceResultAssetType=!1,this._showIndividualRecords=!1),this.scheduleRender()}},e.globalStrings.ok)))}renderTraceResultFunctions(){const{messages:e}=this,t=this._traceResultsFunctions,s=[];return t.forEach((e=>{s.push(this.renderResultRowFunctions(e))})),d("calcite-panel",{key:"functionResultMultiple",onCalcitePanelBackClick:()=>{this.switchToFunctions([],!1)},heading:e.resultsStrings.functionHeader},s,this.renderStartOverContainer())}renderTraceResultByAssetGroup(){const e=this._traceResultsAssetGroup,t=[];for(const s in e){const i=e[s];for(const e in i)t.push(this.renderResultRowAssetGroup(i[e]))}return d("calcite-panel",{key:"assetGroupResultMultiple",onCalcitePanelBackClick:()=>{this.switchToAssetGroup([],"",!1)},heading:this._traceHeaderForFlow},d("calcite-list",null,t),this.renderStartOverContainer())}renderTraceResultByAssetType(){const e=this._traceResultsAssetType,t=[];for(const s in e)e[s].length>0&&t.push(this.renderResultRowAssetType(e[s]));return d("calcite-panel",{key:"assetTypeResult",onCalcitePanelBackClick:()=>{this.switchToAssetType([],"",!1)},heading:this._assetGroupHeader},t,this.renderStartOverContainer())}renderTraceResultIndividual(){const{messages:e}=this,t=this._traceResultsIndividual;t.sort(this._compare(this._resultSortField,this._resultSortOrder));const s=[],i=[],l=[];return t.length>0&&(t[0].details.fields.forEach((e=>{i.push(d("calcite-option",{key:"display"+e.name,label:e.alias,value:e.name,selected:e.name===this._resultDisplayField})),l.push(d("calcite-option",{key:"sort"+e.name,label:e.alias,value:e.name,selected:e.name===this._resultSortField}))})),t.forEach((e=>{s.push(this.renderResultRowIndividual(e))}))),d("calcite-popover-manager",{class:g.esriMatchHeight,key:"popIndividualResult",autoClose:!0},d("calcite-panel",{key:"individualResult",onCalcitePanelBackClick:()=>{this._showResultOptions=!1,this.switchToIndividualRecords([],"",!1)},heading:this._assetTypeHeader},d("calcite-action",{"text-enabled":!0,slot:"header-actions-end",text:e.resultsStrings.displayAttribute,onCalciteListItemChange:()=>{this._showResultOptions=!0},onclick:()=>{this._showResultOptions=!0},scale:"s",icon:"gear",label:e.resultsStrings.displayAttribute,id:"field_options",afterCreate:n,bind:this,"data-node-ref":"_individualResultNode"}),s,this.renderStartOverContainer()),d("calcite-popover",{label:e.resultsStrings.displayAttribute,referenceElement:this._individualResultNode,placement:"auto",offsetDistance:5,offsetSkidding:0,open:this._showResultOptions,styles:_(.75*this.domNode.clientWidth)},d("calcite-block",{heading:e.resultsStrings.resultsListOptions,collapsible:!1,open:!0},d("calcite-label",{scale:"s"},e.resultsStrings.displayAttribute,d("calcite-select",{label:e.resultsStrings.displayAttribute,onCalciteSelectChange:e=>{const t=e.target;this._resultDisplayField=t.selectedOption.value,this._showResultOptions=!1}},i)),d("calcite-label",null,e.resultsStrings.sortBy,d("calcite-select",{label:e.resultsStrings.sortBy,onCalciteSelectChange:e=>{const s=e.target;this._resultSortField=s.selectedOption.value,t.sort(this._compare(this._resultSortField,this._resultSortOrder)),this._traceResultsIndividual=t,this._showResultOptions=!1}},l)))))}renderResultRow(e){let t=e[0].assetGroupCode;const s=this.viewModel.getValidSources().filter((t=>t.sourceId===e[0].networkSourceId));if(s.length>0){const i=s[0].assetGroups.filter((t=>t.assetGroupCode===e[0].assetGroupCode));i.length>0&&(t=i[0].assetGroupName)}return d("calcite-list-item",{label:t+" ("+e.length+")",onclick:()=>{this.switchToAssetType(this._groupResultsByAssetType(e),t+" ("+e.length+")",!0)}},d("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}renderResultRowFunctions(e){return d("calcite-block",{heading:e.networkAttributeName+" "+e.functionType+" = "+e.result,collapsible:!1})}renderResultRowAssetGroup(e){let t=e[0].assetGroupCode;const s=e[0].assetGroupCode,i=this.viewModel.getValidSources().filter((t=>t.sourceId===e[0].networkSourceId));if(i.length>0){const e=i[0].assetGroups.filter((e=>e.assetGroupCode===s));e.length>0&&(t=e[0].assetGroupName)}return d("calcite-list-item",{label:t+" ("+e.length+")",onclick:()=>{this.switchToAssetType(this._groupResultsByAssetType(e),t+" ("+e.length+")",!0)}},d("calcite-icon",{slot:"content-end",icon:"chevron-right",scale:"s"}))}renderResultRowAssetType(e){let t=e[0].assetTypeCode;const s=e[0].assetGroupCode,i=this.viewModel.getValidSources().filter((t=>t.sourceId===e[0].networkSourceId));if(i.length>0){const l=i[0].assetGroups.filter((e=>e.assetGroupCode===s));if(l.length>0){const s=l[0].assetTypes.filter((t=>t.assetTypeCode===e[0].assetTypeCode));s.length>0&&(t=s[0].assetTypeName)}}return d("calcite-list-item",{label:t+" ("+e.length+")",onclick:()=>{this.viewModel.queryFeaturesById(e).then((s=>{if(null!==s){const i=this._appendAttributes(e,s.featureSet,"objectId");this.switchToIndividualRecords(i,t+" ("+e.length+")",!0)}else this.switchToIndividualRecords(e,t+" ("+e.length+")",!0)}))}},d("calcite-icon",{slot:"content-end",icon:"chevron-right",scale:"s"}))}renderResultRowIndividual(e){const{messages:t}=this;let s=e.details.attributes[this._resultDisplayField];return s&&""!==s&&null!==s||(s=t.resultsStrings.noValue),d("calcite-list-item",{label:s,onclick:()=>{this.viewModel.zoomToAsset(e.details.geometry)}},d("calcite-icon",{icon:"zoom-to-object","text-label":t.globalStrings.zoomToFeature,scale:"s",slot:"content-end"}))}_mixCustomStrings(){const{messages:e}=this;this.inputSettings.length>0&&this.inputSettings.forEach((t=>{"starting-point"===t.type&&(e.inputsStrings.headerStartingPoint=t.label,e.inputsStrings.startingPointHint=t.description),"barrier"===t.type&&(e.inputsStrings.headerBarrier=t.label,e.inputsStrings.barrierPointHint=t.description)}))}_overrideFlagSymbol(){this.inputSettings.length>0&&this.inputSettings.forEach((e=>{"starting-point"===e.type?this._symbolStartFlag=e.symbol:this._symbolBarrier=e.symbol,this.viewModel.changeFlagSymbol(e.type,e.symbol)}))}_utilityNetworkTraceInitialized(){return this.viewModel.loadUtilityNetwork().then((e=>e?(this.viewModel.selectTracesOnLoad(),this._registerWatchers(),this.viewModel._traces.length<=0&&(this._tracesExists=!1),this.viewModel.flags.length>0?this.view.when().then((()=>{this._watchHandler=s(this.view,"updating",(async()=>{this._warningNoFlag=!1,this._warningNoBarrierAssetFound=!1,this._warningNoStartAssetFound=!1;const e=await this.viewModel.addFlagsOnLoad();e.includes("barrier")&&(this._warningNoBarrierAssetFound=!0),e.includes("starting-point")&&(this._warningNoStartAssetFound=!0),this.disabled=!1,null!==this._watchHandler&&this._watchHandler.remove(),this.scheduleRender()}))})):this.view.when().then((()=>{this._watchHandler=s(this.view,"updating",(()=>{this.disabled=!1,null!==this._watchHandler&&this._watchHandler.remove()}))}))):(this._tracesExists=!1,this.view.when().then((()=>{this._watchHandler=s(this.view,"updating",(()=>{this.disabled=!1,null!==this._watchHandler&&this._watchHandler.remove()}))})))))}_registerWatchers(){i(this,"selectedTraces",(()=>{this.viewModel.selectTracesOnLoad(),this.scheduleRender()})),i(this,"defaultGraphicColor",(()=>{this.viewModel._traceResults.length>0&&this.viewModel._traceResults.forEach((e=>{this.viewModel.changeResultGraphicColor(this.viewModel.defaultGraphicColor,e)})),this.scheduleRender()}))}_groupResultsByAssetGroup(e){const t=[],s=e.results.elements,i=this._groupBy(s,"networkSourceId");for(const l in i)t.push(this._groupBy(i[l],"assetGroupCode"));return t}_groupResultsByAssetType(e){return this._groupBy(e,"assetTypeCode")}_appendAttributes(e,t,s){const i=[];return e.forEach((e=>{t.features.forEach((l=>{e[s]===l.attributes[s.toLowerCase()]&&(e.details=l,e.details.fields=t.fields,i.push(e))}))})),i}_compare(e,t){return(s,i)=>{let l=0,r=s.details.attributes[e],o=i.details.attributes[e];return isNaN(r)&&(r=r.toLowerCase()),isNaN(o)&&(o=o.toLowerCase()),"desc"===t?r>o?l=1:r<o&&(l=-1):r<o?l=1:r>o&&(l=-1),l}}_groupBy(e,t){return e.reduce((function(e,s){return(e[s[t]]=e[s[t]]||[]).push(s),e}),{})}_getSymbolIcon(e){return"picture-marker"===e.type?d("img",{src:e.url,width:e.width,height:e.height}):null}};e([r()],b.prototype,"_confirmReset",void 0),e([l("viewModel.defaultGraphicColor")],b.prototype,"defaultGraphicColor",void 0),e([r()],b.prototype,"disabled",void 0),e([l("viewModel.flags")],b.prototype,"flags",void 0),e([l("viewModel.gdbVersion")],b.prototype,"gdbVersion",void 0),e([l("viewModel.goToOverride")],b.prototype,"goToOverride",void 0),e([r()],b.prototype,"iconClass",void 0),e([r()],b.prototype,"inputSettings",void 0),e([r({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],b.prototype,"label",void 0),e([r(),c("geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace")],b.prototype,"messages",void 0),e([r(),c("geoscene/t9n/common")],b.prototype,"messagesCommon",void 0),e([l("viewModel.selectedTraces")],b.prototype,"selectedTraces",void 0),e([l("viewModel.selectOnComplete")],b.prototype,"selectOnComplete",void 0),e([l("viewModel.showGraphicsOnComplete")],b.prototype,"showGraphicsOnComplete",void 0),e([l("viewModel.showSelectionAttributes")],b.prototype,"showSelectionAttributes",void 0),e([l("viewModel.view")],b.prototype,"view",void 0),e([h(["add-flag","add-flag-complete","add-flag-error","select-features","clear-selection"]),r({type:u})],b.prototype,"viewModel",void 0),b=e([o(m)],b);const y=b;export{y as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import{HandleOwnerMixin as t}from"../core/HandleOwner.js";import{whenFalse as s,watch as i}from"../core/watchUtils.js";import{aliasOf as l}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import a from"./Widget.js";import{storeNode as n}from"./support/widgetUtils.js";import{messageBundle as c}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{vmEvent as h}from"./support/decorators/vmEvent.js";import{tsx as d}from"./support/jsxFactory.js";import u from"./UtilityNetworkTrace/UtilityNetworkTraceViewModel.js";import{GraphicHandler as p}from"./UtilityNetworkTrace/support/GraphicHandler.js";const g={base:"geoscene-utility-trace-network",loaderContainer:"geoscene-utility-trace-network__loader-container",loader:"geoscene-utility-trace-network__loader",fadeIn:"geoscene-utility-trace-network--fade-in",addButtonContainer:"geoscene-utility-trace-network__add-button-container",noticeContainer:"geoscene-utility-trace-network__notice-container",listContainer:"geoscene-utility-trace-network__list-container",resultsContainer:"geoscene-utility-trace-network__results-container",flow:"geoscene-utility-trace-network__flow",geosceneWidget:"geoscene-widget",geosceneWidgetPanel:"geoscene-widget--panel",geosceneWidgetDisabled:"geoscene-widget--disabled",esriButton:"geoscene-button",esriButtonTertiary:"geoscene-button--tertiary",esriInput:"geoscene-input",esriMatchHeight:"geoscene-match-height",iconHandle:"geoscene-icon-handle-vertical",iconPlus:"geoscene-icon-plus",iconEdit:"geoscene-icon-edit",iconHandleHorizontal:"geoscene-icon-handle-horizontal",iconRefresh:"geoscene-icon-refresh",iconLink:"geoscene-icon-link",iconRemove:"geoscene-icon-erase",widgetIcon:"geoscene-icon-UtilityNetworkTrace",header:"geoscene-widget__heading",loading:"geoscene-icon-loading-indicator",rotating:"geoscene-rotating"},m="geoscene.widgets.UtilityNetworkTrace";function w(e){return{height:e+"px"}}function _(e){return{width:e+"px"}}function v(){return{textAlign:"center"}}let b=class extends(t(a)){constructor(e,t){super(e,t),this._tracesExists=!0,this._graphicHandler=null,this._selectToolActive=!1,this._activeTrace=null,this._activeSwatch="",this._traceHeaderForFlow="",this._assetGroupHeader="",this._assetTypeHeader="",this._traceResultsFunctions=[],this._traceResultsAssetGroup=[],this._traceResultsAssetType=[],this._traceResultsIndividual=[],this._showTraceResultFunctions=!1,this._showTraceResultAssetGroup=!1,this._showTraceResultAssetType=!1,this._showIndividualRecords=!1,this._activeTab="input",this._flagViewType="starting-point",this._alertRemoveModal=!1,this._warningNoFlag=!1,this._warningNoTraceSelected=!1,this._warningNoStartAssetFound=!1,this._warningNoBarrierAssetFound=!1,this._confirmReset=!1,this._showResultOptions=!1,this._resultDisplayField="objectid",this._resultSortField="objectid",this._resultSortOrder="desc",this._swatchNode=null,this._individualResultNode=null,this._symbolStartFlag=null,this._symbolBarrier=null,this._watchHandler=null,this.defaultGraphicColor={color:[255,255,0,.6],haloOpacity:.9,fillOpacity:.2,hex:"#FFFF00"},this.disabled=!0,this.flags=[],this.gdbVersion="sde.DEFAULT",this.goToOverride=null,this.iconClass=g.widgetIcon,this.inputSettings=[],this.label=void 0,this.messages=null,this.messagesCommon=null,this.selectedTraces=[],this.selectOnComplete=!0,this.showGraphicsOnComplete=!0,this.showSelectionAttributes=!0,this.view=null,this.viewModel=new u}initialize(){this._utilityNetworkTraceInitialized(),this._graphicHandler=new p}async checkCanTrace(){this._confirmReset=!1;const e=this.viewModel.checkCanTrace();e.status?(this._warningNoFlag=!1,this._warningNoTraceSelected=!1,this._warningNoTraceSelected=!1,this._showTraceResultFunctions=!1,this._showTraceResultAssetGroup=!1,this._showTraceResultAssetType=!1,this._showIndividualRecords=!1,this.switchTab("result"),this.viewModel._activeProgress=!0,await this.viewModel.callTrace(),this.viewModel._activeProgress=!1):e.issues.forEach((e=>{"noStart"===e?this._warningNoFlag=!0:this._warningNoTraceSelected=!0})),this.scheduleRender()}confirmReset(){this._confirmReset=!0}render(){const{state:e}=this.viewModel;this._mixCustomStrings(),this._overrideFlagSymbol();const t="loading"===e?this.renderLoading():this.renderUtilityNetworkTrace();return d("div",{class:this.classes(g.base,g.geosceneWidget,g.geosceneWidgetPanel,{[g.geosceneWidgetDisabled]:this.disabled})},t)}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-action.js"),import("@esri/calcite-components/dist/components/calcite-action-group.js"),import("@esri/calcite-components/dist/components/calcite-action-pad.js"),import("@esri/calcite-components/dist/components/calcite-checkbox.js"),import("@esri/calcite-components/dist/components/calcite-color-picker-swatch.js"),import("@esri/calcite-components/dist/components/calcite-combobox.js"),import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),import("@esri/calcite-components/dist/components/calcite-block.js"),import("@esri/calcite-components/dist/components/calcite-block-section.js"),import("@esri/calcite-components/dist/components/calcite-button.js"),import("@esri/calcite-components/dist/components/calcite-flow.js"),import("@esri/calcite-components/dist/components/calcite-icon.js"),import("@esri/calcite-components/dist/components/calcite-label.js"),import("@esri/calcite-components/dist/components/calcite-list.js"),import("@esri/calcite-components/dist/components/calcite-list-item.js"),import("@esri/calcite-components/dist/components/calcite-modal.js"),import("@esri/calcite-components/dist/components/calcite-notice.js"),import("@esri/calcite-components/dist/components/calcite-option.js"),import("@esri/calcite-components/dist/components/calcite-panel.js"),import("@esri/calcite-components/dist/components/calcite-popover.js"),import("@esri/calcite-components/dist/components/calcite-popover-manager.js"),import("@esri/calcite-components/dist/components/calcite-select.js"),import("@esri/calcite-components/dist/components/calcite-tabs.js"),import("@esri/calcite-components/dist/components/calcite-tab.js"),import("@esri/calcite-components/dist/components/calcite-tab-nav.js"),import("@esri/calcite-components/dist/components/calcite-tab-title.js")])}switchTab(e){this._activeTab=e,this.scheduleRender()}switchToFunctions(e,t){this._traceResultsFunctions=e,this._showTraceResultFunctions=t,this.scheduleRender()}switchToAssetGroup(e,t,s){this._traceHeaderForFlow=t,this._traceResultsAssetGroup=e,this._showTraceResultAssetGroup=s,this.scheduleRender()}switchToAssetType(e,t,s){this._assetGroupHeader=t,this._traceResultsAssetType=e,this._showTraceResultAssetType=s,this.scheduleRender()}switchToIndividualRecords(e,t,s){this._assetTypeHeader=t,this._traceResultsIndividual=e,this._showIndividualRecords=s,this.scheduleRender()}renderLoading(){return d("div",{class:g.loaderContainer,key:"loader"},d("div",{class:g.loader}))}renderUtilityNetworkTrace(){const{messages:e}=this;let t=d("calcite-tabs",{position:"above",layout:"center",class:g.esriMatchHeight},d("calcite-tab-nav",{slot:"tab-nav"},d("calcite-tab-title",{active:"input"===this._activeTab,onclick:()=>{this.switchTab("input")}},e.inputsStrings.headerTabInputs),d("calcite-tab-title",{active:"result"===this._activeTab,onclick:()=>{this.switchTab("result")}},e.resultsStrings.headerTabResults)),d("calcite-tab",{active:"input"===this._activeTab,class:g.esriMatchHeight},this.renderInputPanel()),d("calcite-tab",{active:"result"===this._activeTab,class:g.esriMatchHeight},this.viewModel._activeProgress?d("calcite-loader",{active:!0,label:e.alertsStrings.traceExecuting,text:e.alertsStrings.traceExecuting,type:"indeterminate"}):this.viewModel._traceResults.length>0?this.renderResultPanel():this.renderWarningMessage("noTraceExecuted",!1),d("calcite-modal",{active:this._confirmReset,color:"blue",scale:"m",width:"s","intl-close":"Close",onCalciteModalClose:()=>{this._confirmReset=!1}},d("h3",{slot:"header"},e.resultsStrings.startOverButton),d("div",{slot:"content"},e.resultsStrings.startOverValidation),d("calcite-button",{slot:"secondary",width:"full",appearance:"outline",onclick:()=>{this._confirmReset=!1}},e.globalStrings.cancel),d("calcite-button",{slot:"primary",width:"full",onclick:()=>{this._confirmReset=!1,this.viewModel.reset(),this.switchTab("input")}},e.globalStrings.ok))));return this._tracesExists||(t=d("calcite-panel",null,this.renderWarningMessage("noTraceConfig",!1))),t}renderInputPanel(){const{messages:e}=this;return d("calcite-flow",{class:g.flow},d("calcite-panel",null,this._warningNoFlag?this.renderWarningMessage("flag",!0):null,this._warningNoTraceSelected?this.renderWarningMessage("trace",!0):null,this.renderTraceSelectorContainer(),this.renderStartFlagsContainer(),this.renderBarriersFlagsContainer(),this._warningNoFlag&&this._warningNoTraceSelected?d("div",{styles:w(10)}):null,d("calcite-button",{slot:"footer",scale:"m",color:"blue",width:"full",onclick:()=>{this.checkCanTrace()}},e.tracingStrings.runTrace)),this._selectToolActive?this.renderActiveTool():null)}renderResultPanel(){return d("div",{class:this.classes(g.esriMatchHeight,g.resultsContainer)},d("calcite-flow",null,this.renderTraceResults(),this._showTraceResultFunctions?this.renderTraceResultFunctions():null,this._showTraceResultAssetGroup?this.renderTraceResultByAssetGroup():null,this._showTraceResultAssetType?this.renderTraceResultByAssetType():null,this._showIndividualRecords?this.renderTraceResultIndividual():null))}renderStartFlagsContainer(){const{messages:e}=this,t=[];let s=[];s=this.viewModel._flags.filter((e=>"starting-point"===e.type)),s.forEach((e=>{e.displayValue&&t.push(this.renderFlagRow(e,"start"))}));let i=null;return this._symbolStartFlag&&(i=this._getSymbolIcon(this._symbolStartFlag)),d("calcite-block",{heading:e.inputsStrings.headerStartingPoint+" ("+s.length+")",open:!0,collapsible:!0},d("div",{slot:"icon"},i||d("calcite-icon",{icon:"pin",scale:"s"})),d("div",null,e.inputsStrings.startingPointHint),d("div",{class:g.listContainer},t),this._warningNoStartAssetFound?this.renderWarningMessage("noStartAsset",!0):null,d("div",{class:g.addButtonContainer},d("calcite-button",{alignment:"center",appearance:"outline","icon-start":"plus",scale:"m",href:"",label:e.inputsStrings.addPointOption,onclick:()=>{this._flagViewType="starting-point",this._selectToolActive=!0,this._warningNoStartAssetFound=!1,this.viewModel.addFlagByHit("starting-point",this._symbolStartFlag).then((e=>{e||(this._warningNoStartAssetFound=!0),this._selectToolActive=!1,this.scheduleRender()}))},round:!0})))}renderBarriersFlagsContainer(){const{messages:e}=this,t=[];let s=[];s=this.viewModel._flags.filter((e=>"barrier"===e.type)),s.forEach((e=>{e.displayValue&&t.push(this.renderFlagRow(e,"barrier"))}));let i=null;return this._symbolBarrier&&(i=this._getSymbolIcon(this._symbolBarrier)),d("calcite-block",{heading:e.inputsStrings.headerBarrier+" ("+s.length+")",open:!1,collapsible:!0},d("div",{slot:"icon"},i||d("calcite-icon",{icon:"x-circle-f",scale:"s"})),d("div",null,e.inputsStrings.barrierPointHint),d("div",{class:g.listContainer},t),this._warningNoBarrierAssetFound?this.renderWarningMessage("noBarrierAsset",!0):null,d("div",{class:g.addButtonContainer},d("calcite-button",{alignment:"center",appearance:"outline",color:"blue","icon-start":"plus",scale:"m",href:"",round:!0,label:e.inputsStrings.addPointOption,onclick:()=>{this._flagViewType="barrier",this._selectToolActive=!0,this._warningNoBarrierAssetFound=!1,this.viewModel.addFlagByHit("barrier",this._symbolBarrier).then((e=>{e||(this._warningNoBarrierAssetFound=!0),this._selectToolActive=!1,this.scheduleRender()}))}})))}renderFlagRow(e,t){const{messages:s}=this,i=[];let l=!1;return null!==e.allTerminals&&void 0!==e.allTerminals&&e.allTerminals.terminals.length>0&&(l=!0,e.allTerminals.terminals.forEach((t=>{let s=!1;e.selectedTerminals.find((e=>e===t.id))&&(s=!0),i.push(d("calcite-combobox-item",{key:t.name,selected:s,value:t.id,"text-label":t.name,onclick:t=>{this.viewModel.addTerminal(t.target.value,e)}}))}))),d("calcite-block",{key:"pop"+e.globalId+e.type+e.id+t,heading:e.displayValue.value,collapsible:null!==e.allTerminals||"barrier"===e.type},d("calcite-action",{textEnabled:!0,slot:"header-menu-actions",text:s.globalStrings.remove,label:s.globalStrings.remove,onCalciteListItemChange:()=>{this.viewModel.removeFlag(e)},onclick:()=>{this.viewModel.removeFlag(e)},scale:"s",icon:"trash"}),d("calcite-action",{textEnabled:!0,slot:"header-menu-actions",text:s.globalStrings.zoomToFeature,label:s.globalStrings.zoomToFeature,onCalciteListItemChange:()=>{this.viewModel.zoomToAsset(e.details.geometry)},onclick:()=>{this.viewModel.zoomToAsset(e.details.geometry)},scale:"s",icon:"zoom-to-object"}),"barrier"===e.type?d("calcite-label",{scale:"s",layout:"inline"},d("calcite-checkbox",{checked:e.isFilterBarrier,scale:"s",onclick:()=>{this.viewModel.manageFilterBarrier(!e.isFilterBarrier,e)}}),s.inputsStrings.barrierFilter):null,l?d("calcite-combobox",{label:s.globalStrings.selectTerminalPlaceholder,placeholder:s.globalStrings.selectTerminalPlaceholder,"selection-mode":"multi",scale:"s",maxItems:0,onCalciteComboboxChipDismiss:t=>{this.viewModel.removeTerminal(t.target.value,e)}},i):null)}renderActiveTool(){const{messages:e}=this;let t=null;return"starting-point"===this._flagViewType?this._symbolStartFlag&&(t=this._getSymbolIcon(this._symbolStartFlag)):this._symbolBarrier&&(t=this._getSymbolIcon(this._symbolBarrier)),d("calcite-panel",{"height-scale":"s",onCalcitePanelBackClick:()=>{this.viewModel._clickHandler&&(this.viewModel._clickHandler.remove(),this.view.popup.autoOpenEnabled=!0),this._selectToolActive=!1},heading:e.inputsStrings.addPointOption},d("calcite-block",{open:!0,collapsible:!1,heading:""},d("div",{styles:v()},t||d("calcite-icon",{icon:"starting-point"===this._flagViewType?"pin":"x-circle-f",scale:"s"})),d("div",{styles:v()},e.inputsStrings.addPointHint)))}renderTraceSelectorContainer(){const{messages:e}=this,t=[];return this.viewModel._traces.length>0&&this.viewModel._traces.forEach((e=>{t.push(d("calcite-combobox-item",{key:e.globalId,selected:e.selected,value:e.globalId,"text-label":e.title,onCalciteComboboxItemChange:t=>{const s=t.target;this.viewModel.selectTraces(s.selected,e.globalId),this.viewModel._traces.length>0&&(this._warningNoTraceSelected=!1)}}))})),d("calcite-block",{heading:e.tracingStrings.traceOperation,open:!0,collapsible:!0},d("calcite-combobox",{label:e.inputsStrings.selectTraces,placeholder:e.inputsStrings.selectTraces,"selection-mode":"multi",scale:"s",maxItems:0,onCalciteComboboxChipDismiss:e=>{this.viewModel.selectTraces(!1,e.target.value),this.viewModel._traces.length>0&&(this._warningNoTraceSelected=!1)}},t))}renderStartOverContainer(){const{messages:e}=this;return d("calcite-button",{slot:"footer",scale:"m",color:"blue",width:"full",onclick:()=>{this.confirmReset()}},e.resultsStrings.startOverButton)}renderWarningMessage(e,t,s){const{messages:i}=this;let l=i.alertsStrings.NoRunAlertHeader,r=i.alertsStrings.noResultsInfo;switch(e){case"flag":l=i.alertsStrings.startingPointAlertHeader,r=i.alertsStrings.startingPointAlert;break;case"trace":l=i.alertsStrings.selectTraceAlertHeader,r=i.alertsStrings.selectTraceAlert;break;case"noTraceExecuted":l=i.alertsStrings.NoRunAlertHeader,r=i.alertsStrings.noResultsInfo;break;case"noBarrierAsset":case"noStartAsset":l=i.alertsStrings.noAssetsFoundHeader,r=i.alertsStrings.noAssetFound;break;case"noTraceConfig":l="",r=i.alertsStrings.noTraceSupported;break;default:l=i.alertsStrings.genericResultHeader,r=s||""}return d("div",{class:g.noticeContainer,key:e},d("calcite-notice",{open:!0,key:e,active:!0,dismissible:t,icon:!0,scale:"s",width:"auto",color:"red",onCalciteNoticeClose:()=>{switch(e){case"flag":this._warningNoFlag=!1;break;case"trace":this._warningNoTraceSelected=!1;break;case"noStartAsset":this._warningNoStartAssetFound=!1;break;case"noBarrierAsset":this._warningNoBarrierAssetFound=!1}}},d("div",{slot:"title"},l),d("div",{slot:"message"},r)))}renderRemoveTraceContainer(e){const{messages:t}=this;return d("calcite-action",{textEnabled:!0,slot:"header-menu-actions",text:t.globalStrings.clearResults,label:t.globalStrings.clearResults,onCalciteListItemChange:()=>{this._alertRemoveModal=!0,this._activeTrace=e.trace},onclick:()=>{this._alertRemoveModal=!0,this._activeTrace=e.trace},scale:"s",icon:"trash"})}renderHighlightColorPicker(e,t){const{messages:s}=this;return d("calcite-action-pad",{position:"start",layout:"grid",expandDisabled:!0},d("calcite-action-group",{layout:"grid",columns:4},d("calcite-action",{text:s.resultsStrings.graphicColor,label:s.resultsStrings.graphicColor,scale:"s",onclick:()=>{this.viewModel.changeResultGraphicColor(this._graphicHandler.getHighlightColor(0),t)}},d("calcite-color-picker-swatch",{scale:"s",color:this._graphicHandler.getHighlightColor(0).hex,active:e.color===this._graphicHandler.getHighlightColor(0).color})),d("calcite-action",{text:"",scale:"s",onclick:()=>{this.viewModel.changeResultGraphicColor(this._graphicHandler.getHighlightColor(1),t)}},d("calcite-color-picker-swatch",{scale:"s",color:this._graphicHandler.getHighlightColor(1).hex,active:e.color===this._graphicHandler.getHighlightColor(1).color})),d("calcite-action",{text:"",scale:"s",onclick:()=>{this.viewModel.changeResultGraphicColor(this._graphicHandler.getHighlightColor(2),t)}},d("calcite-color-picker-swatch",{scale:"s",color:this._graphicHandler.getHighlightColor(2).hex,active:e.color===this._graphicHandler.getHighlightColor(2).color})),d("calcite-action",{text:"",scale:"s",onclick:()=>{this.viewModel.changeResultGraphicColor(this._graphicHandler.getHighlightColor(3),t)}},d("calcite-color-picker-swatch",{scale:"s",color:this._graphicHandler.getHighlightColor(3).hex,active:e.color===this._graphicHandler.getHighlightColor(3).color})),d("calcite-action",{text:"",scale:"s",onclick:()=>{this.viewModel.changeResultGraphicColor(this._graphicHandler.getHighlightColor(4),t)}},d("calcite-color-picker-swatch",{scale:"s",color:this._graphicHandler.getHighlightColor(4).hex,active:e.color===this._graphicHandler.getHighlightColor(4).color}))))}renderTraceResults(){const{messages:e}=this,t=this.viewModel._traceResults,s=[];return t.forEach(((t,i)=>{let l=[],r=[],o=!1,a=!1,n=!1;null!==t.results&&t.results.hasOwnProperty("elements")?(null!==t.results.aggregatedGeometry&&(a=!0),null!==t.results.globalFunctionResults&&t.results.globalFunctionResults.length>0&&(r=t.results.globalFunctionResults,r.length>0&&(n=!0)),t.results.elements.length>0&&(l=t.results.elements,l.length>0&&(o=!0)),s.push(d("calcite-block",{key:t.trace.title,heading:t.trace.title,summary:t.trace.description,collapsible:!1,open:!0,intlOptions:e.resultsStrings.ellipsesOptions},this.renderRemoveTraceContainer(t),d("calcite-list",null,n?d("calcite-list-item",{label:e.resultsStrings.functionHeader+" ("+r.length+")",onclick:()=>{this.switchToFunctions(r,!0)}},d("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"})):null,o&&this.viewModel.showSelectionAttributes?d("calcite-list-item",{key:this.id,label:e.resultsStrings.viewFeatures+" ("+l.length+")",onclick:()=>{this.switchToAssetGroup(this._groupResultsByAssetGroup(t),t.trace.title+" ("+l.length+")",!0)}},d("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"})):this.viewModel.showSelectionAttributes?d("calcite-label",{layout:"inline",scale:"s"},e.resultsStrings.noSelectionResults):null),d("div",{styles:w(10)}),o?d("calcite-label",{layout:"inline",scale:"s",onclick:e=>{e.preventDefault(),e.stopPropagation(),this.viewModel.mergeSelection(!t.selectionEnabled,t.trace)}},d("calcite-checkbox",{checked:t.selectionEnabled,scale:"m",onclick:e=>{e.preventDefault(),e.stopPropagation(),this.viewModel.mergeSelection(!t.selectionEnabled,t.trace)}}),this.viewModel.showSelectionAttributes?e.resultsStrings.selectFeatures:e.resultsStrings.selectFeatures+" ("+l.length+")"):null,a?d("calcite-block-section",{"toggle-display":"switch",text:e.resultsStrings.highlightTrace,open:t.graphicEnabled,onCalciteBlockSectionToggle:e=>{e.target.open?this.viewModel.changeResultGraphicColor(t.graphicColor,t):this.viewModel.removeResultGraphicFromView(t)}},d("calcite-popover-manager",{key:"aggGeom_"+t.trace.globalId,autoClose:!0},d("calcite-action",{text:e.resultsStrings.graphicColor,label:e.resultsStrings.graphicColor,scale:"s",onclick:e=>{const t=e.target;this._swatchNode=t,this._activeSwatch="aggGeom_"+i,this.scheduleRender()}},d("calcite-color-picker-swatch",{scale:"s",color:t.graphicColor.hex})),d("calcite-popover",{label:e.resultsStrings.graphicColor,text:e.resultsStrings.graphicColor,referenceElement:this._swatchNode,placement:"auto",offsetDistance:5,offsetSkidding:0,open:this._activeSwatch==="aggGeom_"+i,onCalcitePopoverClose:()=>{this._swatchNode=null,this._activeSwatch=null}},this.renderHighlightColorPicker(t.graphicColor,t)))):null))):s.push(d("calcite-block",{key:"error-"+i,heading:t.trace.title,collapsible:!1,open:!0},this.renderRemoveTraceContainer(t),this.renderWarningMessage("noController",!1,t.status)))})),d("calcite-panel",{key:"traceResults"},s,this.renderStartOverContainer(),d("calcite-modal",{active:this._alertRemoveModal,color:"blue",scale:"m",width:"s","intl-close":"Close",onCalciteModalClose:()=>{this._alertRemoveModal=!1,this.scheduleRender()}},d("h3",{slot:"header"},e.globalStrings.clearResults),d("div",{slot:"content"},e.alertsStrings.clearResultsAlert),d("calcite-button",{slot:"secondary",width:"full",appearance:"outline",onclick:()=>{this._alertRemoveModal=!1,this.scheduleRender()}},e.globalStrings.cancel),d("calcite-button",{slot:"primary",width:"full",onclick:()=>{this.viewModel.clearResult(this._activeTrace),this._alertRemoveModal=!1,0===this.viewModel._traceResults.length?this.switchTab("input"):(this._activeTrace=this.viewModel._traceResults[0].trace,this._showTraceResultFunctions=!1,this._showTraceResultAssetGroup=!1,this._showTraceResultAssetType=!1,this._showIndividualRecords=!1),this.scheduleRender()}},e.globalStrings.ok)))}renderTraceResultFunctions(){const{messages:e}=this,t=this._traceResultsFunctions,s=[];return t.forEach((e=>{s.push(this.renderResultRowFunctions(e))})),d("calcite-panel",{key:"functionResultMultiple",onCalcitePanelBackClick:()=>{this.switchToFunctions([],!1)},heading:e.resultsStrings.functionHeader},s,this.renderStartOverContainer())}renderTraceResultByAssetGroup(){const e=this._traceResultsAssetGroup,t=[];for(const s in e){const i=e[s];for(const e in i)t.push(this.renderResultRowAssetGroup(i[e]))}return d("calcite-panel",{key:"assetGroupResultMultiple",onCalcitePanelBackClick:()=>{this.switchToAssetGroup([],"",!1)},heading:this._traceHeaderForFlow},d("calcite-list",null,t),this.renderStartOverContainer())}renderTraceResultByAssetType(){const e=this._traceResultsAssetType,t=[];for(const s in e)e[s].length>0&&t.push(this.renderResultRowAssetType(e[s]));return d("calcite-panel",{key:"assetTypeResult",onCalcitePanelBackClick:()=>{this.switchToAssetType([],"",!1)},heading:this._assetGroupHeader},t,this.renderStartOverContainer())}renderTraceResultIndividual(){const{messages:e}=this,t=this._traceResultsIndividual;t.sort(this._compare(this._resultSortField,this._resultSortOrder));const s=[],i=[],l=[];return t.length>0&&(t[0].details.fields.forEach((e=>{i.push(d("calcite-option",{key:"display"+e.name,label:e.alias,value:e.name,selected:e.name===this._resultDisplayField})),l.push(d("calcite-option",{key:"sort"+e.name,label:e.alias,value:e.name,selected:e.name===this._resultSortField}))})),t.forEach((e=>{s.push(this.renderResultRowIndividual(e))}))),d("calcite-popover-manager",{class:g.esriMatchHeight,key:"popIndividualResult",autoClose:!0},d("calcite-panel",{key:"individualResult",onCalcitePanelBackClick:()=>{this._showResultOptions=!1,this.switchToIndividualRecords([],"",!1)},heading:this._assetTypeHeader},d("calcite-action",{"text-enabled":!0,slot:"header-actions-end",text:e.resultsStrings.displayAttribute,onCalciteListItemChange:()=>{this._showResultOptions=!0},onclick:()=>{this._showResultOptions=!0},scale:"s",icon:"gear",label:e.resultsStrings.displayAttribute,id:"field_options",afterCreate:n,bind:this,"data-node-ref":"_individualResultNode"}),s,this.renderStartOverContainer()),d("calcite-popover",{label:e.resultsStrings.displayAttribute,referenceElement:this._individualResultNode,placement:"auto",offsetDistance:5,offsetSkidding:0,open:this._showResultOptions,styles:_(.75*this.domNode.clientWidth)},d("calcite-block",{heading:e.resultsStrings.resultsListOptions,collapsible:!1,open:!0},d("calcite-label",{scale:"s"},e.resultsStrings.displayAttribute,d("calcite-select",{label:e.resultsStrings.displayAttribute,onCalciteSelectChange:e=>{const t=e.target;this._resultDisplayField=t.selectedOption.value,this._showResultOptions=!1}},i)),d("calcite-label",null,e.resultsStrings.sortBy,d("calcite-select",{label:e.resultsStrings.sortBy,onCalciteSelectChange:e=>{const s=e.target;this._resultSortField=s.selectedOption.value,t.sort(this._compare(this._resultSortField,this._resultSortOrder)),this._traceResultsIndividual=t,this._showResultOptions=!1}},l)))))}renderResultRow(e){let t=e[0].assetGroupCode;const s=this.viewModel.getValidSources().filter((t=>t.sourceId===e[0].networkSourceId));if(s.length>0){const i=s[0].assetGroups.filter((t=>t.assetGroupCode===e[0].assetGroupCode));i.length>0&&(t=i[0].assetGroupName)}return d("calcite-list-item",{label:t+" ("+e.length+")",onclick:()=>{this.switchToAssetType(this._groupResultsByAssetType(e),t+" ("+e.length+")",!0)}},d("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}renderResultRowFunctions(e){return d("calcite-block",{heading:e.networkAttributeName+" "+e.functionType+" = "+e.result,collapsible:!1})}renderResultRowAssetGroup(e){let t=e[0].assetGroupCode;const s=e[0].assetGroupCode,i=this.viewModel.getValidSources().filter((t=>t.sourceId===e[0].networkSourceId));if(i.length>0){const e=i[0].assetGroups.filter((e=>e.assetGroupCode===s));e.length>0&&(t=e[0].assetGroupName)}return d("calcite-list-item",{label:t+" ("+e.length+")",onclick:()=>{this.switchToAssetType(this._groupResultsByAssetType(e),t+" ("+e.length+")",!0)}},d("calcite-icon",{slot:"content-end",icon:"chevron-right",scale:"s"}))}renderResultRowAssetType(e){let t=e[0].assetTypeCode;const s=e[0].assetGroupCode,i=this.viewModel.getValidSources().filter((t=>t.sourceId===e[0].networkSourceId));if(i.length>0){const l=i[0].assetGroups.filter((e=>e.assetGroupCode===s));if(l.length>0){const s=l[0].assetTypes.filter((t=>t.assetTypeCode===e[0].assetTypeCode));s.length>0&&(t=s[0].assetTypeName)}}return d("calcite-list-item",{label:t+" ("+e.length+")",onclick:()=>{this.viewModel.queryFeaturesById(e).then((s=>{if(null!==s){const i=this._appendAttributes(e,s.featureSet,"objectId");this.switchToIndividualRecords(i,t+" ("+e.length+")",!0)}else this.switchToIndividualRecords(e,t+" ("+e.length+")",!0)}))}},d("calcite-icon",{slot:"content-end",icon:"chevron-right",scale:"s"}))}renderResultRowIndividual(e){const{messages:t}=this;let s=e.details.attributes[this._resultDisplayField];return s&&""!==s&&null!==s||(s=t.resultsStrings.noValue),d("calcite-list-item",{label:s,onclick:()=>{this.viewModel.zoomToAsset(e.details.geometry)}},d("calcite-icon",{icon:"zoom-to-object","text-label":t.globalStrings.zoomToFeature,scale:"s",slot:"content-end"}))}_mixCustomStrings(){const{messages:e}=this;this.inputSettings.length>0&&this.inputSettings.forEach((t=>{"starting-point"===t.type&&(e.inputsStrings.headerStartingPoint=t.label,e.inputsStrings.startingPointHint=t.description),"barrier"===t.type&&(e.inputsStrings.headerBarrier=t.label,e.inputsStrings.barrierPointHint=t.description)}))}_overrideFlagSymbol(){this.inputSettings.length>0&&this.inputSettings.forEach((e=>{"starting-point"===e.type?this._symbolStartFlag=e.symbol:this._symbolBarrier=e.symbol,this.viewModel.changeFlagSymbol(e.type,e.symbol)}))}_utilityNetworkTraceInitialized(){return this.viewModel.loadUtilityNetwork().then((e=>e?(this.viewModel.selectTracesOnLoad(),this._registerWatchers(),this.viewModel._traces.length<=0&&(this._tracesExists=!1),this.viewModel.flags.length>0?this.view.when().then((()=>{this._watchHandler=s(this.view,"updating",(async()=>{this._warningNoFlag=!1,this._warningNoBarrierAssetFound=!1,this._warningNoStartAssetFound=!1;const e=await this.viewModel.addFlagsOnLoad();e.includes("barrier")&&(this._warningNoBarrierAssetFound=!0),e.includes("starting-point")&&(this._warningNoStartAssetFound=!0),this.disabled=!1,null!==this._watchHandler&&this._watchHandler.remove(),this.scheduleRender()}))})):this.view.when().then((()=>{this._watchHandler=s(this.view,"updating",(()=>{this.disabled=!1,null!==this._watchHandler&&this._watchHandler.remove()}))}))):(this._tracesExists=!1,this.view.when().then((()=>{this._watchHandler=s(this.view,"updating",(()=>{this.disabled=!1,null!==this._watchHandler&&this._watchHandler.remove()}))})))))}_registerWatchers(){i(this,"selectedTraces",(()=>{this.viewModel.selectTracesOnLoad(),this.scheduleRender()})),i(this,"defaultGraphicColor",(()=>{this.viewModel._traceResults.length>0&&this.viewModel._traceResults.forEach((e=>{this.viewModel.changeResultGraphicColor(this.viewModel.defaultGraphicColor,e)})),this.scheduleRender()}))}_groupResultsByAssetGroup(e){const t=[],s=e.results.elements,i=this._groupBy(s,"networkSourceId");for(const l in i)t.push(this._groupBy(i[l],"assetGroupCode"));return t}_groupResultsByAssetType(e){return this._groupBy(e,"assetTypeCode")}_appendAttributes(e,t,s){const i=[];return e.forEach((e=>{t.features.forEach((l=>{e[s]===l.attributes[s.toLowerCase()]&&(e.details=l,e.details.fields=t.fields,i.push(e))}))})),i}_compare(e,t){return(s,i)=>{let l=0,r=s.details.attributes[e],o=i.details.attributes[e];return isNaN(r)&&(r=r.toLowerCase()),isNaN(o)&&(o=o.toLowerCase()),"desc"===t?r>o?l=1:r<o&&(l=-1):r<o?l=1:r>o&&(l=-1),l}}_groupBy(e,t){return e.reduce((function(e,s){return(e[s[t]]=e[s[t]]||[]).push(s),e}),{})}_getSymbolIcon(e){return"picture-marker"===e.type?d("img",{src:e.url,width:e.width,height:e.height}):null}};e([r()],b.prototype,"_confirmReset",void 0),e([l("viewModel.defaultGraphicColor")],b.prototype,"defaultGraphicColor",void 0),e([r()],b.prototype,"disabled",void 0),e([l("viewModel.flags")],b.prototype,"flags",void 0),e([l("viewModel.gdbVersion")],b.prototype,"gdbVersion",void 0),e([l("viewModel.goToOverride")],b.prototype,"goToOverride",void 0),e([r()],b.prototype,"iconClass",void 0),e([r()],b.prototype,"inputSettings",void 0),e([r({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],b.prototype,"label",void 0),e([r(),c("geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace")],b.prototype,"messages",void 0),e([r(),c("geoscene/t9n/common")],b.prototype,"messagesCommon",void 0),e([l("viewModel.selectedTraces")],b.prototype,"selectedTraces",void 0),e([l("viewModel.selectOnComplete")],b.prototype,"selectOnComplete",void 0),e([l("viewModel.showGraphicsOnComplete")],b.prototype,"showGraphicsOnComplete",void 0),e([l("viewModel.showSelectionAttributes")],b.prototype,"showSelectionAttributes",void 0),e([l("viewModel.view")],b.prototype,"view",void 0),e([h(["add-flag","add-flag-complete","add-flag-error","select-features","clear-selection"]),r({type:u})],b.prototype,"viewModel",void 0),b=e([o(m)],b);const y=b;export{y as default};
|
package/widgets/Weather/css.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
|
-
const e="
|
|
5
|
+
const e="geoscene-weather",r={base:`${e}`,geosceneWidget:"geoscene-widget",geosceneWidgetDisabled:"geoscene-widget--disabled",widgetIcon:"geoscene-icon-partly-cloudy",content:`${e}__content`,selector:`${e}__selector`,error:`${e}__error`,warning:`${e}__warning`},i={base:`${`${e}__coverage-slider`}`};export{i as COVERAGE_SLIDER_CSS,r as CSS};
|
package/widgets/Widget.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 e}from"../chunks/tslib.es6.js";import"../intl.js";import{deprecated as t}from"../core/deprecate.js";import{byId as r}from"../core/domUtils.js";import o from"../core/Evented.js";import s from"../core/Handles.js";import"../core/has.js";import{clone as i}from"../core/lang.js";import n from"../core/Logger.js";import{destroyMaybe as a}from"../core/maybe.js";import{EsriPromiseMixin as d}from"../core/Promise.js";import{debounce as l,throwIfNotAbortError as c,eachAlways as p}from"../core/promiseUtils.js";import{watch as h,when as m,initial as u}from"../core/reactiveUtils.js";import{generateUUID as g}from"../core/uuid.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import{cast as v}from"../core/accessorSupport/decorators/cast.js";import{subclass as _}from"../core/accessorSupport/decorators/subclass.js";import{runTracked as f}from"../core/accessorSupport/tracking.js";import{SimpleTrackingTarget as j}from"../core/accessorSupport/tracking/SimpleTrackingTarget.js";import{createAdvancedProjector as w}from"../libs/maquette-advanced-projector/projector.js";import{commitAssetPath as k}from"./support/componentsUtils.js";import{isWidgetConstructor as b,processWidgets as R,WIDGET_SYMBOL as S}from"./support/jsxWidgetSupport.js";import{getVNodeCache as C,setVNodeCache as T,deleteVNodeCache as H,clearVNodeCache as P}from"./support/vnodeCache.js";import{classes as E}from"./support/widgetUtils.js";import{getThemeName as L}from"./support/widgetThemeUtils.js";import{onLocaleChange as N}from"../intl/locale.js";import{fetchMessageBundle as I}from"../intl/messages.js";const U="geoscene.widgets.Widget",F=n.getLogger(U);let $=0;const x={widgetIcon:"geoscene-icon-checkbox-unchecked"};function z(e,t){for(const r in t)null!=e[r]&&("object"==typeof e[r]&&"object"==typeof t[r]?z(e[r],t[r]):e[r]=t[r]);return e}const A=w({postProcessProjectionOptions(e){const t=e.eventHandlerInterceptor,r=/capture$/i;e.eventHandlerInterceptor=(e,o,s,i)=>{const n=t(e,o,s,i),a=r.test(e);if(!((e=e.replace(r,"")).toLowerCase()in s)||a){const t=e[2].toLowerCase()+e.slice(3),r=e=>n.call(s,e);s.addEventListener(t,r,a);const o=()=>s.removeEventListener(t,r,a),d=i.afterRemoved;i.afterRemoved=e=>{null==d||d(e),o()}}return n}},handleInterceptedEvent(e,t,r,o){const{eventPhase:s,type:i}=o,n=s===Event.CAPTURING_PHASE;let a=`on${i}${n?"capture":""}`;const d=t.properties;(a in d||(a=`on${i[0].toUpperCase()}${i.slice(1)}${n?"Capture":""}`,a in d))&&(P(),e.scheduleRender(),d[a].call(d.bind||r,o))}});let M=!1,O=class extends(d(o.EventedAccessor)){constructor(e,r){super(e,r),this._attached=!1,this._internalHandles=new s,this._projector=A,this._readyForTrueRender=!1,this.domNode=null,this.iconClass=x.widgetIcon,this.label=this.declaredClass.split(".").pop(),this.visible=!0,this.key=this,this._loadLocale=l((async()=>{if(this._messageBundleProps&&this._messageBundleProps.length){const e=await p(this._messageBundleProps.map((async({bundlePath:e,propertyName:t})=>{let r=await I(e);this.uiStrings&&Object.keys(this.uiStrings)&&(r=z(i(r),this.uiStrings)),this[t]=r})));for(const t of e)t.error&&F.error("widget-intl:locale-error",this.declaredClass,t.error)}await this.loadLocale()})),k();const o=["light","dark"],n=L()||"light";o.includes(n)||t(F,"The following themes are deprecated: light-blue, dark-blue, light-green, dark-green, light-purple, dark-purple, light-red, and dark-red.",{version:"4.19",warnOnce:!0,see:"https://developers.geoscene.cn/javascript/latest/styling/"});const a="
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{deprecated as t}from"../core/deprecate.js";import{byId as r}from"../core/domUtils.js";import o from"../core/Evented.js";import s from"../core/Handles.js";import"../core/has.js";import{clone as i}from"../core/lang.js";import n from"../core/Logger.js";import{destroyMaybe as a}from"../core/maybe.js";import{EsriPromiseMixin as d}from"../core/Promise.js";import{debounce as l,throwIfNotAbortError as c,eachAlways as p}from"../core/promiseUtils.js";import{watch as h,when as m,initial as u}from"../core/reactiveUtils.js";import{generateUUID as g}from"../core/uuid.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import{cast as v}from"../core/accessorSupport/decorators/cast.js";import{subclass as _}from"../core/accessorSupport/decorators/subclass.js";import{runTracked as f}from"../core/accessorSupport/tracking.js";import{SimpleTrackingTarget as j}from"../core/accessorSupport/tracking/SimpleTrackingTarget.js";import{createAdvancedProjector as w}from"../libs/maquette-advanced-projector/projector.js";import{commitAssetPath as k}from"./support/componentsUtils.js";import{isWidgetConstructor as b,processWidgets as R,WIDGET_SYMBOL as S}from"./support/jsxWidgetSupport.js";import{getVNodeCache as C,setVNodeCache as T,deleteVNodeCache as H,clearVNodeCache as P}from"./support/vnodeCache.js";import{classes as E}from"./support/widgetUtils.js";import{getThemeName as L}from"./support/widgetThemeUtils.js";import{onLocaleChange as N}from"../intl/locale.js";import{fetchMessageBundle as I}from"../intl/messages.js";const U="geoscene.widgets.Widget",F=n.getLogger(U);let $=0;const x={widgetIcon:"geoscene-icon-checkbox-unchecked"};function z(e,t){for(const r in t)null!=e[r]&&("object"==typeof e[r]&&"object"==typeof t[r]?z(e[r],t[r]):e[r]=t[r]);return e}const A=w({postProcessProjectionOptions(e){const t=e.eventHandlerInterceptor,r=/capture$/i;e.eventHandlerInterceptor=(e,o,s,i)=>{const n=t(e,o,s,i),a=r.test(e);if(!((e=e.replace(r,"")).toLowerCase()in s)||a){const t=e[2].toLowerCase()+e.slice(3),r=e=>n.call(s,e);s.addEventListener(t,r,a);const o=()=>s.removeEventListener(t,r,a),d=i.afterRemoved;i.afterRemoved=e=>{null==d||d(e),o()}}return n}},handleInterceptedEvent(e,t,r,o){const{eventPhase:s,type:i}=o,n=s===Event.CAPTURING_PHASE;let a=`on${i}${n?"capture":""}`;const d=t.properties;(a in d||(a=`on${i[0].toUpperCase()}${i.slice(1)}${n?"Capture":""}`,a in d))&&(P(),e.scheduleRender(),d[a].call(d.bind||r,o))}});let M=!1,O=class extends(d(o.EventedAccessor)){constructor(e,r){super(e,r),this._attached=!1,this._internalHandles=new s,this._projector=A,this._readyForTrueRender=!1,this.domNode=null,this.iconClass=x.widgetIcon,this.label=this.declaredClass.split(".").pop(),this.visible=!0,this.key=this,this._loadLocale=l((async()=>{if(this._messageBundleProps&&this._messageBundleProps.length){const e=await p(this._messageBundleProps.map((async({bundlePath:e,propertyName:t})=>{let r=await I(e);this.uiStrings&&Object.keys(this.uiStrings)&&(r=z(i(r),this.uiStrings)),this[t]=r})));for(const t of e)t.error&&F.error("widget-intl:locale-error",this.declaredClass,t.error)}await this.loadLocale()})),k();const o=["light","dark"],n=L()||"light";o.includes(n)||t(F,"The following themes are deprecated: light-blue, dark-blue, light-green, dark-green, light-purple, dark-purple, light-red, and dark-red.",{version:"4.19",warnOnce:!0,see:"https://developers.geoscene.cn/javascript/latest/styling/"});const a="geoscene-widget-uid-"+g(),d=this.render.bind(this);this._trackingTarget=new j((()=>this.scheduleRender()));const c=()=>{var e;if(!this._readyForTrueRender||this.destroyed)return null;if(!this.visible)return{vnodeSelector:"div",properties:{key:a,class:"",styles:{display:"none"}},domNode:void 0,children:void 0,text:void 0};const t=d();let{properties:r}=t;r||(t.properties=r={});let{key:o,styles:s}=r;o||(r.key=a),s||(r.styles=s={}),s.display||(s.display="");let i=0;return null==(e=t.children)||e.forEach((e=>{if(b(e.vnodeSelector))return;let{properties:t}=e;t||(e.properties=t={}),t.key||(t.key=`${this.id}--${i++}`)})),R(this,t)};this.render=()=>{if(M)return c();let e=C(this);if(e)return e;this._trackingTarget.clear(),M=!0;try{e=f(this._trackingTarget,c)}finally{M=!1}return T(this,e),e},this.addResolvingPromise(this._resourcesFetch=this.beforeFirstRender().then((()=>{this._readyForTrueRender=!0,this._postInitialize()})))}normalizeCtorArgs(e,t){const r={...e};return t&&(r.container=t),r}postInitialize(){}beforeFirstRender(){return Promise.all([this.loadDependencies(),this._loadLocale()]).then((()=>{})).catch(c)}async loadDependencies(){}async loadLocale(){}destroy(){this.destroyed||(this._trackingTarget=a(this._trackingTarget),this.viewModel=a(this.viewModel),this._detach(this.container),this._set("container",null),this._internalHandles.destroy(),this._emitter.clear(),this.render=()=>null,this._projector=null,H(this))}set container(e){this._get("container")||this._set("container",e)}castContainer(e){return r(e)}get id(){return this._get("id")||this.get("container.id")||Date.now().toString(16)+"-widget-"+$++}set id(e){e&&this._set("id",e)}get renderable(){return this._resourcesFetch}get test(){return{projector:this._projector,handles:this._internalHandles}}render(){throw new Error("not implemented")}scheduleRender(){this.destroyed||(H(this),this._projector.scheduleRender())}classes(...e){return E.apply(this,e)}own(e){arguments.length>1&&(e=Array.prototype.slice.call(arguments)),this._internalHandles.add(e)}renderNow(){H(this),this._projector.renderNow()}_postInitialize(){var e;if(this.destroyed)return;this.scheduleRender(),null!=(e=this._delegatedEventNames)&&e.length&&this._internalHandles.add(h((()=>this.viewModel),((e,t)=>{t&&this._internalHandles.remove("delegated-events"),e&&this._internalHandles.add(this._delegatedEventNames.map((t=>e.on(t,(e=>{this.emit(t,e)})))),"delegated-events")}),u)),this.postInitialize();const t=async()=>{await this._loadLocale().catch(c),this.scheduleRender()};this._internalHandles.add([N(t),h((()=>this.uiStrings),t),m((()=>this.container),(e=>{this.destroyed||this._attach(e)}),{initial:!0,once:!0})])}_attach(e){e&&(this._projector.merge(e,this.render),this._attached=!0)}_detach(e){e&&this._attached&&(this._projector.detach(this.render),e.parentNode&&e.parentNode.removeChild(e),this._attached=!1)}};O[S]=!0,e([y()],O.prototype,"_readyForTrueRender",void 0),e([y({value:null})],O.prototype,"container",null),e([v("container")],O.prototype,"castContainer",null),e([y({aliasOf:"container"})],O.prototype,"domNode",void 0),e([y()],O.prototype,"iconClass",void 0),e([y()],O.prototype,"id",null),e([y()],O.prototype,"label",void 0),e([y()],O.prototype,"renderable",null),e([y()],O.prototype,"uiStrings",void 0),e([y()],O.prototype,"viewModel",void 0),e([y()],O.prototype,"visible",void 0),e([y()],O.prototype,"key",void 0),e([y()],O.prototype,"children",void 0),e([y()],O.prototype,"afterCreate",void 0),e([y()],O.prototype,"afterUpdate",void 0),e([y()],O.prototype,"afterRemoved",void 0),O=e([_(U)],O);const B=O;export{B 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 t}from"../../chunks/tslib.es6.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import e from"../Widget.js";import{accessibleHandler as i}from"../support/decorators/accessibleHandler.js";import"../../core/Logger.js";import{tsx as r}from"../support/jsxFactory.js";import"../support/widgetUtils.js";const c={button:"
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import e from"../Widget.js";import{accessibleHandler as i}from"../support/decorators/accessibleHandler.js";import"../../core/Logger.js";import{tsx as r}from"../support/jsxFactory.js";import"../support/widgetUtils.js";const c={button:"geoscene-widget--button geoscene-widget",disabled:"geoscene-disabled",interactive:"geoscene-interactive",iconText:"geoscene-icon-font-fallback-text",icon:"geoscene-icon"};let n=class extends e{constructor(){super(...arguments),this.enabled=!0,this.iconClass="",this.title=""}render(){const t=this.enabled?0:-1,s={[c.disabled]:!this.enabled,[c.interactive]:this.enabled},o={[this.iconClass]:!!this.iconClass};return r("div",{bind:this,class:this.classes(c.button,s),onclick:this._triggerAction,onkeydown:this._triggerAction,role:"button",tabIndex:t,title:this.title},r("span",{"aria-hidden":"true",role:"presentation",class:this.classes(c.icon,o)}),r("span",{class:c.iconText},this.title))}_triggerAction(){this.action.call(this)}};t([s()],n.prototype,"action",void 0),t([s()],n.prototype,"enabled",void 0),t([s()],n.prototype,"iconClass",void 0),t([s()],n.prototype,"title",void 0),t([i()],n.prototype,"_triggerAction",null),n=t([o("geoscene.widgets.IconButton")],n);const a=n;export{a as default};
|
package/widgets/Zoom.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 t}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 e}from"../core/accessorSupport/decorators/subclass.js";import i from"./Widget.js";import"./support/widgetUtils.js";import{messageBundle as r}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{tsx as n}from"./support/jsxFactory.js";import a from"./Zoom/IconButton.js";import m from"./Zoom/ZoomViewModel.js";const l={base:"
|
|
5
|
+
import{_ as o}from"../chunks/tslib.es6.js";import{aliasOf as t}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 e}from"../core/accessorSupport/decorators/subclass.js";import i from"./Widget.js";import"./support/widgetUtils.js";import{messageBundle as r}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{tsx as n}from"./support/jsxFactory.js";import a from"./Zoom/IconButton.js";import m from"./Zoom/ZoomViewModel.js";const l={base:"geoscene-zoom geoscene-widget",horizontalLayout:"geoscene-zoom--horizontal",zoomInIcon:"geoscene-icon-plus",zoomOutIcon:"geoscene-icon-minus",widgetIcon:"geoscene-icon-zoom-in-magnifying-glass"};let u=class extends i{constructor(o,t){super(o,t),this.iconClass=l.widgetIcon,this.label=void 0,this.messages=null,this.view=null,this.viewModel=new m}initialize(){this._zoomInButton=new a({action:this.zoomIn.bind(this),iconClass:l.zoomInIcon}),this._zoomOutButton=new a({action:this.zoomOut.bind(this),iconClass:l.zoomOutIcon})}destroy(){this._zoomInButton.destroy(),this._zoomOutButton.destroy(),this._zoomInButton=null,this._zoomOutButton=null}set layout(o){"horizontal"!==o&&(o="vertical"),this._set("layout",o)}render(){const o=this.viewModel,t={[l.horizontalLayout]:"horizontal"===this.layout};return this._zoomInButton.enabled="ready"===o.state&&o.canZoomIn,this._zoomOutButton.enabled="ready"===o.state&&o.canZoomOut,this._zoomInButton.title=this.messages.zoomIn,this._zoomOutButton.title=this.messages.zoomOut,n("div",{class:this.classes(l.base,t)},this._zoomInButton.render(),this._zoomOutButton.render())}zoomIn(){return this.viewModel.zoomIn()}zoomOut(){return this.viewModel.zoomOut()}};o([s()],u.prototype,"iconClass",void 0),o([s({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],u.prototype,"label",void 0),o([s({value:"vertical"})],u.prototype,"layout",null),o([s(),r("geoscene/widgets/Zoom/t9n/Zoom")],u.prototype,"messages",void 0),o([t("viewModel.view")],u.prototype,"view",void 0),o([s({type:m})],u.prototype,"viewModel",void 0),u=o([e("geoscene.widgets.Zoom")],u);const c=u;export{c 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 r from"../../Color.js";import{isSome as i}from"../../core/maybe.js";import{aliasOf as s}from"../../core/accessorSupport/decorators/aliasOf.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{cast as o}from"../../core/accessorSupport/decorators/cast.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import l from"../../renderers/visualVariables/support/SizeStop.js";import{getCIMSymbolColor as n}from"../../symbols/support/cimSymbolUtils.js";import{SmartMappingSliderBase as d}from"./SmartMappingSliderBase.js";import p from"./BinaryColorSizeSlider/BinaryColorSizeSliderViewModel.js";import{getSizesFromVariable as m,getFillFromColor as c,getDynamicPathForSizeStops as u}from"./support/utils.js";import{storeNode as y}from"../support/widgetUtils.js";import{messageBundle as h}from"../support/decorators/messageBundle.js";import"../../core/Logger.js";import{tsx as b}from"../support/jsxFactory.js";var v;const g={base:"
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import r from"../../Color.js";import{isSome as i}from"../../core/maybe.js";import{aliasOf as s}from"../../core/accessorSupport/decorators/aliasOf.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{cast as o}from"../../core/accessorSupport/decorators/cast.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import l from"../../renderers/visualVariables/support/SizeStop.js";import{getCIMSymbolColor as n}from"../../symbols/support/cimSymbolUtils.js";import{SmartMappingSliderBase as d}from"./SmartMappingSliderBase.js";import p from"./BinaryColorSizeSlider/BinaryColorSizeSliderViewModel.js";import{getSizesFromVariable as m,getFillFromColor as c,getDynamicPathForSizeStops as u}from"./support/utils.js";import{storeNode as y}from"../support/widgetUtils.js";import{messageBundle as h}from"../support/decorators/messageBundle.js";import"../../core/Logger.js";import{tsx as b}from"../support/jsxFactory.js";var v;const g={base:"geoscene-binary-color-size-slider",rampElement:"geoscene-binary-color-size-slider__ramp",sliderContainer:"geoscene-binary-color-size-slider__slider-container",histogramContainer:"geoscene-binary-color-size-slider__histogram-container",zoomCapTop:"geoscene-binary-color-size-slider__zoom-cap-top",zoomCapBottom:"geoscene-binary-color-size-slider__zoom-cap-bottom",zoomCapLine:"geoscene-binary-color-size-slider__zoom-cap-line",zoomCapMask:"geoscene-binary-color-size-slider__zoom-cap-mask",zoomCapUnderline:"geoscene-binary-color-size-slider__zoom-cap-underline",primaryHandle:"geoscene-binary-color-size-slider--primary-handle",track:"geoscene-binary-color-size-slider--interactive-track",geosceneWidget:"geoscene-widget",geosceneWidgetPanel:"geoscene-widget--panel",widgetIcon:"geoscene-icon-edit",disabled:"geoscene-disabled"},f={trackBackgroundColor:new r([224,224,224]),trackAboveFillColor:new r([149,149,149]),trackBelowFillColor:new r([149,149,149])};let z=v=class extends d{constructor(e,r){super(e,r),this._minRampFillWidth=.2,this._rampNode=null,this._rampFillId=null,this.handlesSyncedToPrimary=null,this.label=void 0,this.messages=null,this.persistSizeRangeEnabled=null,this.stops=null,this.style={...f},this.viewModel=new p,this.zoomOptions=null,this._rampFillId=`${this.id}-linear-gradient`}castStyle(e){return{...f,...e}}static fromRendererResult(e,r){const{size:{visualVariables:i},statistics:s}=e,{avg:o,stddev:t}=s,a=i[0].stops,l=e.renderer.authoringInfo.visualVariables[0],d=l.minSliderValue,p=l.maxSliderValue,m=e.renderer.classBreakInfos;let c,u,y=null;const h=e=>{if("cim"===e.type)return n(e);if(e.symbolLayers){var r,i;return null==(i=(null==(r=e.symbolLayers)?void 0:r.getItemAt(0)).material)?void 0:i.color}return e.color};if(m.length>1){const e=m[0].symbol,r=m[1].symbol;u=h(e),c=h(r)}return 1===m.length&&(y=h(m[0].symbol)),new v({max:p,min:d,stops:a,histogramConfig:{average:o,standardDeviation:t,bins:r?r.bins:[]},style:{trackAboveFillColor:c,trackBelowFillColor:u,trackFillColor:y},handlesSyncedToPrimary:!0,persistSizeRangeEnabled:!0})}updateFromRendererResult(e,r){const{size:{visualVariables:i},statistics:s}=e,{avg:o,stddev:t}=s,a=i[0].stops,l=e.renderer.authoringInfo.visualVariables[0],d=l.minSliderValue,p=l.maxSliderValue,m=e.renderer.classBreakInfos;let c,u,y=null;const h=e=>{if("cim"===e.type)return n(e);if(e.symbolLayers){var r,i;return null==(i=(null==(r=e.symbolLayers)?void 0:r.getItemAt(0)).material)?void 0:i.color}return e.color};if(m.length>1){const e=m[0].symbol,r=m[1].symbol;u=h(e),c=h(r)}1===m.length&&(y=h(m[0].symbol)),this.set({max:p,min:d,stops:a,histogramConfig:{average:o,standardDeviation:t,bins:r?r.bins:[]},style:{trackAboveFillColor:c,trackBelowFillColor:u,trackFillColor:y},handlesSyncedToPrimary:!0,persistSizeRangeEnabled:!0})}updateRenderer(e){var r,i;if("univariate-color-size"!==(null==(r=e.authoringInfo)?void 0:r.type)||"above-and-below"!==(null==(i=e.authoringInfo)?void 0:i.univariateTheme))return console.error("Input renderer must be a univariate renderer with an above-and-below theme."),null;const s=e.clone(),o=s.visualVariables.find((e=>"size"===e.type&&"outline"!==e.target&&e.stops)),{stops:t}=this;if(!o||!t)return console.error("No size stops available."),null;const a=s.visualVariables.indexOf(o);s.visualVariables.splice(a,1),o.stops=t,s.visualVariables.push(o);const l=t[5===t.length?2:1].value;return s.classBreakInfos[0].maxValue=l,s.classBreakInfos[1].minValue=l,s}updateFromVisualVariable(e){if(!e)return;const{maxDataValue:r,minDataValue:i,stops:s}=e;if(s)this.stops=s;else{const[s,o]=m(e);this.stops=[new l({value:i,size:o}),new l({value:r,size:s})]}}render(){const{label:e,state:r,viewModel:{primaryHandleEnabled:i},visibleElements:s}=this,o="disabled"===r,t=this.classes(g.base,g.geosceneWidget,g.geosceneWidgetPanel,{[g.disabled]:o,[g.primaryHandle]:i,[g.track]:s.interactiveTrack});return b("div",{"aria-label":e,class:t},o?null:this.renderContent(this.renderRamp(),g.sliderContainer,g.histogramContainer))}renderRamp(){const{style:{trackBackgroundColor:e},zoomOptions:r}=this;return b("div",{afterCreate:y,bind:this,class:g.rampElement,"data-node-ref":"_rampNode"},b("svg",{key:"ramp-svg",xmlns:"http://www.w3.org/2000/svg"},b("rect",{x:"0",y:"0",fill:c(e),height:"100%",width:"100%"}),this.renderPrimaryRamp(),this.renderPath()),r?this.renderZoomCaps():null)}renderPrimaryRamp(){const{_rampFillId:e,style:{trackAboveFillColor:r,trackBelowFillColor:i},viewModel:s}=this;return[b("defs",null,this.renderRampFillDefinition(e,s.getGradientStopInfo(r,i)))]}renderPath(){if(!this._rampNode)return;const{offsetHeight:e=0,offsetWidth:r=0}=this._rampNode;if(!i(e)||!i(r))return;const{stops:s,viewModel:{max:o,min:t},_rampFillId:a,_minRampFillWidth:l}=this,n=u({max:o,min:t,pathHeight:e,pathWidth:r,stops:s,padding:l});return b("path",{d:n,fill:`url(#${a})`})}};e([s("viewModel.handlesSyncedToPrimary")],z.prototype,"handlesSyncedToPrimary",void 0),e([t({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],z.prototype,"label",void 0),e([t(),h("geoscene/widgets/smartMapping/SizeSlider/t9n/SizeSlider")],z.prototype,"messages",void 0),e([s("viewModel.persistSizeRangeEnabled")],z.prototype,"persistSizeRangeEnabled",void 0),e([s("viewModel.stops")],z.prototype,"stops",void 0),e([t()],z.prototype,"style",void 0),e([o("style")],z.prototype,"castStyle",null),e([t()],z.prototype,"viewModel",void 0),e([s("viewModel.zoomOptions")],z.prototype,"zoomOptions",void 0),z=v=e([a("geoscene.widgets.smartMapping.BinaryColorSizeSlider")],z);const w=z;export{w 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 r}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 i}from"../../core/accessorSupport/decorators/subclass.js";import o from"../../renderers/support/ClassBreakInfo.js";import{SmartMappingSliderBase as t}from"./SmartMappingSliderBase.js";import l from"./ClassedColorSlider/ClassedColorSliderViewModel.js";import"../support/widgetUtils.js";import{messageBundle as a}from"../support/decorators/messageBundle.js";import"../../core/Logger.js";import{tsx as n}from"../support/jsxFactory.js";var d;const c={base:"
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import{aliasOf as r}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 i}from"../../core/accessorSupport/decorators/subclass.js";import o from"../../renderers/support/ClassBreakInfo.js";import{SmartMappingSliderBase as t}from"./SmartMappingSliderBase.js";import l from"./ClassedColorSlider/ClassedColorSliderViewModel.js";import"../support/widgetUtils.js";import{messageBundle as a}from"../support/decorators/messageBundle.js";import"../../core/Logger.js";import{tsx as n}from"../support/jsxFactory.js";var d;const c={base:"geoscene-classed-color-slider",rampElement:"geoscene-classed-color-slider__ramp",sliderContainer:"geoscene-classed-color-slider__slider-container",histogramContainer:"geoscene-classed-color-slider__histogram-container",track:"geoscene-classed-color-slider--interactive-track",geosceneWidget:"geoscene-widget",geosceneWidgetPanel:"geoscene-widget--panel",widgetIcon:"geoscene-icon-edit",disabled:"geoscene-disabled"};let m=d=class extends t{constructor(e,r){super(e,r),this._bgFillId=null,this._rampFillId=null,this.breaks=null,this.label=void 0,this.messages=null,this.viewModel=new l,this._bgFillId=`${this.id}-bg-fill`,this._rampFillId=`${this.id}-linear-gradient`}static fromRendererResult(e,r){const{renderer:{classBreakInfos:s}}=e,i=s.map((e=>{const r=e.symbol.color;return{min:e.minValue,max:e.maxValue,color:r}}));return new d({breaks:i,histogramConfig:{bins:r?r.bins:[]}})}updateClassBreakInfos(e){const r=this.breaks;if(r.length===e.length)return e.map(((e,s)=>{const i=e.symbol;return i.color=r[s].color,new o({minValue:r[s].min,maxValue:r[s].max,symbol:i})}));console.error(`Number of input breakInfos must match number of slider breaks: ${r.length}`)}updateFromRendererResult(e,r){const{renderer:{classBreakInfos:s}}=e,i=s.map((e=>{const r=e.symbol.color;return{min:e.minValue,max:e.maxValue,color:r}}));this.set({breaks:i}),null!=r&&r.bins&&(this.histogramConfig.bins=r.bins)}render(){const{state:e,label:r,visibleElements:s}=this,i="disabled"===e,o=this.classes(c.base,c.geosceneWidget,c.geosceneWidgetPanel,{[c.disabled]:i,[c.track]:s.interactiveTrack});return n("div",{"aria-label":r,class:o},i?null:this.renderContent(this.renderRamp(),c.sliderContainer,c.histogramContainer))}renderRamp(){const{_bgFillId:e,_rampFillId:r,viewModel:s}=this,i=s.getStopInfo();return n("div",{class:c.rampElement},n("svg",{xmlns:"http://www.w3.org/2000/svg"},n("defs",null,this.renderRampFillDefinition(r,i),this.renderBackgroundFillDefinition(e)),n("rect",{x:"0",y:"0",fill:`url(#${e})`,height:"100%",width:"100%"}),n("rect",{x:"0",y:"0",fill:`url(#${r})`,height:"100%",width:"100%"})))}};e([r("viewModel.breaks")],m.prototype,"breaks",void 0),e([s({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],m.prototype,"label",void 0),e([s(),a("geoscene/widgets/smartMapping/ClassedColorSlider/t9n/ClassedColorSlider")],m.prototype,"messages",void 0),e([s()],m.prototype,"viewModel",void 0),m=d=e([i("geoscene.widgets.smartMapping.ClassedColorSlider")],m);const p=m;export{p as default};
|