-
Notifications
You must be signed in to change notification settings - Fork 0
/
8645-es2015.8ecc506104b6b8f6641e.js
1 lines (1 loc) · 7.38 KB
/
8645-es2015.8ecc506104b6b8f6641e.js
1
(self.webpackChunkv2x_frontend=self.webpackChunkv2x_frontend||[]).push([[8645],{8645:function(t,i,e){"use strict";e.r(i),e.d(i,{ion_picker_column_internal:function(){return a}});var n=e(1429),s=e(8931),r=e(1444),o=e(7744),l=e(4881);const a=class{constructor(t){(0,n.r)(this,t),this.ionChange=(0,n.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=(t,i=!0,e=!0)=>{const{el:n,isColumnVisible:s}=this;if(s){const s=t.offsetTop-3*t.clientHeight+t.clientHeight/2;n.scrollTop!==s&&(this.canExitInputMode=e,n.scroll({top:s,left:0,behavior:i?"smooth":void 0}))}},this.inputModeChange=t=>{if(!this.numericInput)return;const{useInputMode:i,inputModeColumn:e}=t.detail;this.setInputModeActive(!(!i||void 0!==e&&e!==this.el))},this.setInputModeActive=t=>{this.isScrolling?this.scrollEndCallback=()=>{this.isActive=t}:this.isActive=t},this.initializeScrollListener=()=>{const{el:t}=this;let i,e=this.activeItem;const n=()=>{(0,r.r)(()=>{i&&(clearTimeout(i),i=void 0),this.isScrolling||((0,o.a)(),this.isScrolling=!0);const n=t.getBoundingClientRect(),s=t.shadowRoot.elementFromPoint(n.x+n.width/2,n.y+n.height/2);null!==e&&e.classList.remove(c),null===s||s.disabled||(s!==e&&((0,o.b)(),this.canExitInputMode&&this.exitInputMode()),e=s,s.classList.add(c),i=setTimeout(()=>{this.isScrolling=!1,(0,o.h)();const{scrollEndCallback:t}=this;t&&(t(),this.scrollEndCallback=void 0),this.canExitInputMode=!0;const i=s.getAttribute("data-index");if(null===i)return;const e=parseInt(i,10),n=this.items[e];n.value!==this.value&&this.setValue(n.value)},250))})};(0,r.r)(()=>{t.addEventListener("scroll",n),this.destroyScrollListener=()=>{t.removeEventListener("scroll",n)}})},this.exitInputMode=()=>{const{parentEl:t}=this;null!=t&&(t.exitInputMode(),this.el.classList.remove("picker-column-active"))}}valueChange(){this.isColumnVisible&&this.scrollActiveItemIntoView()}componentWillLoad(){new IntersectionObserver(t=>{var i;if(t[0].isIntersecting){this.isColumnVisible=!0;const t=(0,r.g)(this.el).querySelector(`.${c}`);null==t||t.classList.remove(c),this.scrollActiveItemIntoView(),null===(i=this.activeItem)||void 0===i||i.classList.add(c),this.initializeScrollListener()}else this.isColumnVisible=!1,this.destroyScrollListener&&(this.destroyScrollListener(),this.destroyScrollListener=void 0)},{threshold:.001}).observe(this.el);const t=this.parentEl=this.el.closest("ion-picker-internal");null!==t&&t.addEventListener("ionInputModeChange",t=>this.inputModeChange(t))}componentDidRender(){var t;const{activeItem:i,items:e,isColumnVisible:n,value:s}=this;n&&(i?this.scrollActiveItemIntoView():(null===(t=e[0])||void 0===t?void 0:t.value)!==s&&this.setValue(e[0].value))}async scrollActiveItemIntoView(){const t=this.activeItem;t&&this.centerPickerItemInView(t,!1,!1)}async setValue(t){const{items:i}=this;this.value=t;const e=i.find(i=>i.value===t&&!0!==i.disabled);e&&this.ionChange.emit(e)}get activeItem(){return(0,r.g)(this.el).querySelector(`.picker-item[data-value="${this.value}"]:not([disabled])`)}render(){const{items:t,color:i,isActive:e,numericInput:r}=this,o=(0,s.b)(this);return(0,n.h)(n.H,{tabindex:0,class:(0,l.c)(i,{[o]:!0,"picker-column-active":e,"picker-column-numeric-input":r})},(0,n.h)("div",{class:"picker-item picker-item-empty","aria-hidden":"true"},"\xa0"),(0,n.h)("div",{class:"picker-item picker-item-empty","aria-hidden":"true"},"\xa0"),(0,n.h)("div",{class:"picker-item picker-item-empty","aria-hidden":"true"},"\xa0"),t.map((t,i)=>(0,n.h)("button",{tabindex:"-1",class:{"picker-item":!0,"picker-item-disabled":t.disabled||!1},"data-value":t.value,"data-index":i,onClick:t=>{this.centerPickerItemInView(t.target,!0)},disabled:t.disabled},t.text)),(0,n.h)("div",{class:"picker-item picker-item-empty","aria-hidden":"true"},"\xa0"),(0,n.h)("div",{class:"picker-item picker-item-empty","aria-hidden":"true"},"\xa0"),(0,n.h)("div",{class:"picker-item picker-item-empty","aria-hidden":"true"},"\xa0"))}get el(){return(0,n.i)(this)}static get watchers(){return{value:["valueChange"]}}},c="picker-item-active";a.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)}"}},4881:function(t,i,e){"use strict";e.d(i,{c:function(){return s},g:function(){return r},h:function(){return n},o:function(){return l}});const n=(t,i)=>null!==i.closest(t),s=(t,i)=>"string"==typeof t&&t.length>0?Object.assign({"ion-color":!0,[`ion-color-${t}`]:!0},i):i,r=t=>{const i={};return(t=>void 0!==t?(Array.isArray(t)?t:t.split(" ")).filter(t=>null!=t).map(t=>t.trim()).filter(t=>""!==t):[])(t).forEach(t=>i[t]=!0),i},o=/^[a-z][a-z0-9+\-.]*:/,l=async(t,i,e,n)=>{if(null!=t&&"#"!==t[0]&&!o.test(t)){const s=document.querySelector("ion-router");if(s)return null!=i&&i.preventDefault(),s.push(t,e,n)}return!1}}}]);