forms-reactive
Version:
Reactive Form Web Component
2 lines • 2.33 kB
JavaScript
import{r as e,c as t,h as s,H as o,e as i}from"./p-3e1171f6.js";const l=":host{display:flex;height:100%;overflow-x:scroll;scroll-snap-type:x mandatory;scrollbar-width:none;-ms-overflow-style:none}:host::-webkit-scrollbar{display:none}:host(.segment-view-disabled){touch-action:none;overflow-x:hidden}:host(.segment-view-scroll-disabled){pointer-events:none}:host(.segment-view-disabled){opacity:0.3}";const n=l;const a=":host{display:flex;height:100%;overflow-x:scroll;scroll-snap-type:x mandatory;scrollbar-width:none;-ms-overflow-style:none}:host::-webkit-scrollbar{display:none}:host(.segment-view-disabled){touch-action:none;overflow-x:hidden}:host(.segment-view-scroll-disabled){pointer-events:none}:host(.segment-view-disabled){opacity:0.3}";const r=a;const h=class{constructor(s){e(this,s);this.ionSegmentViewScroll=t(this,"ionSegmentViewScroll",7);this.scrollEndTimeout=null;this.isTouching=false;this.disabled=false;this.isManualScroll=undefined}handleScroll(e){var t;const{scrollLeft:s,scrollWidth:o,clientWidth:i}=e.target;const l=s/(o-i);this.ionSegmentViewScroll.emit({scrollRatio:l,isManualScroll:(t=this.isManualScroll)!==null&&t!==void 0?t:true});this.resetScrollEndTimeout()}handleScrollStart(){if(this.scrollEndTimeout){clearTimeout(this.scrollEndTimeout);this.scrollEndTimeout=null}this.isTouching=true}handleTouchEnd(){this.isTouching=false}resetScrollEndTimeout(){if(this.scrollEndTimeout){clearTimeout(this.scrollEndTimeout);this.scrollEndTimeout=null}this.scrollEndTimeout=setTimeout((()=>{this.checkForScrollEnd()}),100)}checkForScrollEnd(){if(!this.isTouching){this.isManualScroll=undefined}}async setContent(e,t=true){const s=this.getSegmentContents();const o=s.findIndex((t=>t.id===e));if(o===-1)return;this.isManualScroll=false;this.resetScrollEndTimeout();const i=this.el.offsetWidth;this.el.scrollTo({top:0,left:o*i,behavior:t?"smooth":"instant"})}getSegmentContents(){return Array.from(this.el.querySelectorAll("ion-segment-content"))}render(){const{disabled:e,isManualScroll:t}=this;return s(o,{key:"fa528d2d9ae0f00fc3067defe2a047dce77c814a",class:{"segment-view-disabled":e,"segment-view-scroll-disabled":t===false}},s("slot",{key:"74dc8b4d073caeff1bab272d11b9ea3e1a215954"}))}get el(){return i(this)}};h.style={ios:n,md:r};export{h as ion_segment_view};
//# sourceMappingURL=p-b1c92381.entry.js.map