-
Notifications
You must be signed in to change notification settings - Fork 0
/
7602.2fd96835799bc4c4.js
1 lines (1 loc) · 7.17 KB
/
7602.2fd96835799bc4c4.js
1
"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[7602],{7602:(C,v,d)=>{d.r(v),d.d(v,{ion_picker_column_internal:()=>o});var f=d(5861),c=d(7205),b=d(5729),u=d(3756),m=d(7683),k=d(2854);const o=class{constructor(n){(0,c.r)(this,n),this.ionChange=(0,c.e)(this,"ionChange",7),this.isScrolling=!1,this.isColumnVisible=!1,this.isActive=!1,this.items=[],this.color="primary",this.numericInput=!1,this.centerPickerItemInView=(e,t=!0)=>{const{el:i,isColumnVisible:r}=this;if(r){const s=e.offsetTop-3*e.clientHeight+e.clientHeight/2;i.scrollTop!==s&&i.scroll({top:s,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 r=()=>{(0,u.r)(()=>{t&&(clearTimeout(t),t=void 0),this.isScrolling||((0,m.a)(),this.isScrolling=!0);const s=e.getBoundingClientRect(),g=e.shadowRoot.elementFromPoint(s.x+s.width/2,s.y+s.height/2);null!==i&&i.classList.remove(l),!g.disabled&&(g!==i&&(0,m.b)(),i=g,g.classList.add(l),t=setTimeout(()=>{this.isScrolling=!1,(0,m.h)();const{scrollEndCallback:y}=this;y&&(y(),this.scrollEndCallback=void 0);const I=g.getAttribute("data-index");if(null===I)return;const E=parseInt(I,10),x=this.items[E];x.value!==this.value&&this.setValue(x.value)},250))})};(0,u.r)(()=>{e.addEventListener("scroll",r),this.destroyScrollListener=()=>{e.removeEventListener("scroll",r)}})}}itemsChange(n,e){const{value:t}=this;if(!n.find(r=>r.value===t)){const r=e.findIndex(p=>p.value===t);if(-1===r)return;let s;for(let p=r;p>=0;p--){const h=n[p];if(void 0!==h&&!0!==h.disabled){s=h;break}}if(s)return void this.setValue(s.value)}}valueChange(){this.isColumnVisible&&this.scrollActiveItemIntoView()}componentWillLoad(){new IntersectionObserver(t=>{var i;t[0].isIntersecting?(this.isColumnVisible=!0,(0,u.g)(this.el).querySelector(`.${l}`)?.classList.remove(l),this.scrollActiveItemIntoView(),null===(i=this.activeItem)||void 0===i||i.classList.add(l),this.initializeScrollListener()):(this.isColumnVisible=!1,this.destroyScrollListener&&(this.destroyScrollListener(),this.destroyScrollListener=void 0))},{threshold:.001}).observe(this.el);const e=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:r}=this;i&&(e?this.scrollActiveItemIntoView():(null===(n=t[0])||void 0===n?void 0:n.value)!==r&&this.setValue(t[0].value))}scrollActiveItemIntoView(){var n=this;return(0,f.Z)(function*(){const e=n.activeItem;e&&n.centerPickerItemInView(e,!1)})()}setValue(n){var e=this;return(0,f.Z)(function*(){const{items:t}=e;e.value=n;const i=t.find(r=>r.value===n&&!0!==r.disabled);i&&e.ionChange.emit(i)})()}get activeItem(){return(0,u.g)(this.el).querySelector(`.picker-item[data-value="${this.value}"]:not([disabled])`)}render(){const{items:n,color:e,isActive:t,numericInput:i}=this,r=(0,b.b)(this);return(0,c.h)(c.H,{tabindex:0,class:(0,k.c)(e,{[r]:!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((s,p)=>(0,c.h)("button",{tabindex:"-1",class:{"picker-item":!0,"picker-item-disabled":s.disabled||!1},"data-value":s.value,"data-index":p,onClick:h=>{this.centerPickerItemInView(h.target)},disabled:s.disabled},s.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{items:["itemsChange"],value:["valueChange"]}}},l="picker-item-active";o.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-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-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,v,d)=>{d.d(v,{c:()=>b,g:()=>m,h:()=>c,o:()=>_});var f=d(5861);const c=(a,o)=>null!==o.closest(a),b=(a,o)=>"string"==typeof a&&a.length>0?Object.assign({"ion-color":!0,[`ion-color-${a}`]:!0},o):o,m=a=>{const o={};return(a=>void 0!==a?(Array.isArray(a)?a:a.split(" ")).filter(l=>null!=l).map(l=>l.trim()).filter(l=>""!==l):[])(a).forEach(l=>o[l]=!0),o},k=/^[a-z][a-z0-9+\-.]*:/,_=function(){var a=(0,f.Z)(function*(o,l,n,e){if(null!=o&&"#"!==o[0]&&!k.test(o)){const t=document.querySelector("ion-router");if(t)return l?.preventDefault(),t.push(o,n,e)}return!1});return function(l,n,e,t){return a.apply(this,arguments)}}()}}]);