-
Notifications
You must be signed in to change notification settings - Fork 0
/
7602.0ed1b2b42a8bcf12.js
1 lines (1 loc) · 7.27 KB
/
7602.0ed1b2b42a8bcf12.js
1
"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[7602],{7602:(C,g,d)=>{d.r(g),d.d(g,{ion_picker_column_internal:()=>s});var v=d(5861),c=d(1308),f=d(5179),p=d(5730),m=d(7864),b=d(2854);const s=class{constructor(n){(0,c.r)(this,n),this.ionChange=(0,c.e)(this,"ionChange",7),this.isScrolling=!1,this.isColumnVisible=!1,this.canExitInputMode=!0,this.isActive=!1,this.items=[],this.color="primary",this.numericInput=!1,this.centerPickerItemInView=(e,t=!0,i=!0)=>{const{el:l,isColumnVisible:a}=this;if(a){const h=e.offsetTop-3*e.clientHeight+e.clientHeight/2;l.scrollTop!==h&&(this.canExitInputMode=i,l.scroll({top:h,left:0,behavior:t?"smooth":void 0}))}},this.inputModeChange=e=>{if(!this.numericInput)return;const{useInputMode:t,inputModeColumn:i}=e.detail;this.setInputModeActive(!(!t||void 0!==i&&i!==this.el))},this.setInputModeActive=e=>{this.isScrolling?this.scrollEndCallback=()=>{this.isActive=e}:this.isActive=e},this.initializeScrollListener=()=>{const{el:e}=this;let t,i=this.activeItem;const l=()=>{(0,p.r)(()=>{t&&(clearTimeout(t),t=void 0),this.isScrolling||((0,m.a)(),this.isScrolling=!0);const a=e.getBoundingClientRect(),u=e.shadowRoot.elementFromPoint(a.x+a.width/2,a.y+a.height/2);null!==i&&i.classList.remove(o),null!==u&&!u.disabled&&(u!==i&&((0,m.b)(),this.canExitInputMode&&this.exitInputMode()),i=u,u.classList.add(o),t=setTimeout(()=>{this.isScrolling=!1,(0,m.h)();const{scrollEndCallback:y}=this;y&&(y(),this.scrollEndCallback=void 0),this.canExitInputMode=!0;const x=u.getAttribute("data-index");if(null===x)return;const E=parseInt(x,10),I=this.items[E];I.value!==this.value&&this.setValue(I.value)},250))})};(0,p.r)(()=>{e.addEventListener("scroll",l),this.destroyScrollListener=()=>{e.removeEventListener("scroll",l)}})},this.exitInputMode=()=>{const{parentEl:e}=this;null!=e&&(e.exitInputMode(),this.el.classList.remove("picker-column-active"))}}valueChange(){this.isColumnVisible&&this.scrollActiveItemIntoView()}componentWillLoad(){new IntersectionObserver(t=>{var i;t[0].isIntersecting?(this.isColumnVisible=!0,(0,p.g)(this.el).querySelector(`.${o}`)?.classList.remove(o),this.scrollActiveItemIntoView(),null===(i=this.activeItem)||void 0===i||i.classList.add(o),this.initializeScrollListener()):(this.isColumnVisible=!1,this.destroyScrollListener&&(this.destroyScrollListener(),this.destroyScrollListener=void 0))},{threshold:.001}).observe(this.el);const e=this.parentEl=this.el.closest("ion-picker-internal");null!==e&&e.addEventListener("ionInputModeChange",t=>this.inputModeChange(t))}componentDidRender(){var n;const{activeItem:e,items:t,isColumnVisible:i,value:l}=this;i&&(e?this.scrollActiveItemIntoView():(null===(n=t[0])||void 0===n?void 0:n.value)!==l&&this.setValue(t[0].value))}scrollActiveItemIntoView(){var n=this;return(0,v.Z)(function*(){const e=n.activeItem;e&&n.centerPickerItemInView(e,!1,!1)})()}setValue(n){var e=this;return(0,v.Z)(function*(){const{items:t}=e;e.value=n;const i=t.find(l=>l.value===n&&!0!==l.disabled);i&&e.ionChange.emit(i)})()}get activeItem(){return(0,p.g)(this.el).querySelector(`.picker-item[data-value="${this.value}"]:not([disabled])`)}render(){const{items:n,color:e,isActive:t,numericInput:i}=this,l=(0,f.b)(this);return(0,c.h)(c.H,{tabindex:0,class:(0,b.c)(e,{[l]:!0,"picker-column-active":t,"picker-column-numeric-input":i})},(0,c.h)("div",{class:"picker-item picker-item-empty"},"\xa0"),(0,c.h)("div",{class:"picker-item picker-item-empty"},"\xa0"),(0,c.h)("div",{class:"picker-item picker-item-empty"},"\xa0"),n.map((a,h)=>(0,c.h)("button",{tabindex:"-1",class:{"picker-item":!0,"picker-item-disabled":a.disabled||!1},"data-value":a.value,"data-index":h,onClick:_=>{this.centerPickerItemInView(_.target,!0)},disabled:a.disabled},a.text)),(0,c.h)("div",{class:"picker-item picker-item-empty"},"\xa0"),(0,c.h)("div",{class:"picker-item picker-item-empty"},"\xa0"),(0,c.h)("div",{class:"picker-item picker-item-empty"},"\xa0"))}get el(){return(0,c.i)(this)}static get watchers(){return{value:["valueChange"]}}},o="picker-item-active";s.style={ios:":host{padding-left:16px;padding-right:16px;padding-top:0px;padding-bottom:0px;height:200px;outline:none;font-size:22px;-webkit-scroll-snap-type:y mandatory;-ms-scroll-snap-type:y mandatory;scroll-snap-type:y mandatory;overflow-x:hidden;overflow-y:scroll;scrollbar-width:none;text-align:center}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px}}:host::-webkit-scrollbar{display:none}:host .picker-item{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:block;width:100%;height:34px;border:0px;outline:none;background:transparent;color:inherit;font-family:var(--ion-font-family, inherit);font-size:inherit;line-height:34px;text-align:inherit;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;overflow:hidden;scroll-snap-align:center}:host .picker-item-empty,:host .picker-item.picker-item-disabled{scroll-snap-align:none;cursor:default}:host .picker-item.picker-item-disabled{opacity:0.4}:host(.picker-column-active) .picker-item.picker-item-active{color:var(--ion-color-base)}@media (any-hover: hover){:host(:focus){outline:none;background:rgba(var(--ion-color-base-rgb), 0.2)}}",md:":host{padding-left:16px;padding-right:16px;padding-top:0px;padding-bottom:0px;height:200px;outline:none;font-size:22px;-webkit-scroll-snap-type:y mandatory;-ms-scroll-snap-type:y mandatory;scroll-snap-type:y mandatory;overflow-x:hidden;overflow-y:scroll;scrollbar-width:none;text-align:center}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px}}:host::-webkit-scrollbar{display:none}:host .picker-item{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:block;width:100%;height:34px;border:0px;outline:none;background:transparent;color:inherit;font-family:var(--ion-font-family, inherit);font-size:inherit;line-height:34px;text-align:inherit;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;overflow:hidden;scroll-snap-align:center}:host .picker-item-empty,:host .picker-item.picker-item-disabled{scroll-snap-align:none;cursor:default}:host .picker-item.picker-item-disabled{opacity:0.4}:host(.picker-column-active) .picker-item.picker-item-active{color:var(--ion-color-base)}@media (any-hover: hover){:host(:focus){outline:none;background:rgba(var(--ion-color-base-rgb), 0.2)}}:host .picker-item-active{color:var(--ion-color-base)}"}},2854:(C,g,d)=>{d.d(g,{c:()=>f,g:()=>m,h:()=>c,o:()=>k});var v=d(5861);const c=(r,s)=>null!==s.closest(r),f=(r,s)=>"string"==typeof r&&r.length>0?Object.assign({"ion-color":!0,[`ion-color-${r}`]:!0},s):s,m=r=>{const s={};return(r=>void 0!==r?(Array.isArray(r)?r:r.split(" ")).filter(o=>null!=o).map(o=>o.trim()).filter(o=>""!==o):[])(r).forEach(o=>s[o]=!0),s},b=/^[a-z][a-z0-9+\-.]*:/,k=function(){var r=(0,v.Z)(function*(s,o,n,e){if(null!=s&&"#"!==s[0]&&!b.test(s)){const t=document.querySelector("ion-router");if(t)return o?.preventDefault(),t.push(s,n,e)}return!1});return function(o,n,e,t){return r.apply(this,arguments)}}()}}]);