-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path7610-es2015.45fe930bacea421e4b5a.js
1 lines (1 loc) · 6.39 KB
/
7610-es2015.45fe930bacea421e4b5a.js
1
(self.webpackChunkv2x_frontend=self.webpackChunkv2x_frontend||[]).push([[7610],{7610:function(t,e,i){"use strict";i.r(e),i.d(e,{ion_datetime_button:function(){return l}});var a=i(1429),n=i(8931),s=i(1444),r=i(3397),o=i(4881),d=i(3595);const l=class{constructor(t){(0,a.r)(this,t),this.datetimeEl=null,this.overlayEl=null,this.datetimePresentation="date-time",this.datetimeActive=!1,this.color="primary",this.disabled=!1,this.getParsedDateValues=t=>""===t||null==t?[]:Array.isArray(t)?t:[t],this.setDateTimeText=()=>{const{datetimeEl:t,datetimePresentation:e}=this;if(!t)return;const{value:i,locale:a,hourCycle:n,preferWheel:s,multiple:o,titleSelectedDatesFormatter:l}=t,c=this.getParsedDateValues(i),m=(0,d.q)(c.length>0?c:[(0,d.t)()]),p=m[0],h=(0,d.J)(a,n);switch(m.forEach(t=>{t.tzOffset=void 0}),this.dateText=this.timeText=void 0,e){case"date-time":case"time-date":const t=(0,d.T)(a,p),e=(0,d.K)(a,p,h);s?this.dateText=`${t} ${e}`:(this.dateText=t,this.timeText=e);break;case"date":if(o&&1!==c.length){let t=`${c.length} days`;if(void 0!==l)try{t=l(c)}catch(g){(0,r.b)("Exception in provided `titleSelectedDatesFormatter`: ",g)}this.dateText=t}else this.dateText=(0,d.T)(a,p);break;case"time":this.timeText=(0,d.K)(a,p,h);break;case"month-year":this.dateText=(0,d.G)(a,p);break;case"month":this.dateText=(0,d.S)(a,p,{month:"long"});break;case"year":this.dateText=(0,d.S)(a,p,{year:"numeric"})}},this.waitForDatetimeChanges=async()=>{const{datetimeEl:t}=this;return t?new Promise(e=>{(0,s.a)(t,"ionRender",e,{once:!0})}):Promise.resolve()},this.handleDateClick=async t=>{const{datetimeEl:e,datetimePresentation:i}=this;if(!e)return;let a=!1;switch(i){case"date-time":case"time-date":const t="date"!==e.presentation;!e.preferWheel&&t&&(e.presentation="date",a=!0)}this.selectedButton="date",this.presentOverlay(t,a,this.dateTargetEl)},this.handleTimeClick=t=>{const{datetimeEl:e,datetimePresentation:i}=this;if(!e)return;let a=!1;switch(i){case"date-time":case"time-date":"time"!==e.presentation&&(e.presentation="time",a=!0)}this.selectedButton="time",this.presentOverlay(t,a,this.timeTargetEl)},this.presentOverlay=async(t,e,i)=>{const{overlayEl:a}=this;a&&("ION-POPOVER"===a.tagName?(e&&await this.waitForDatetimeChanges(),a.present(Object.assign(Object.assign({},t),{detail:{ionShadowTarget:i}}))):a.present())}}async componentWillLoad(){const{datetime:t}=this;if(!t)return void(0,r.b)("An ID associated with an ion-datetime instance is required for ion-datetime-button to function properly.",this.el);const e=this.datetimeEl=document.getElementById(t);if(!e)return void(0,r.b)(`No ion-datetime instance found for ID '${t}'.`,this.el);new IntersectionObserver(t=>{this.datetimeActive=t[0].isIntersecting},{threshold:.01}).observe(e);const i=this.overlayEl=e.closest("ion-modal, ion-popover");i&&i.classList.add("ion-datetime-button-overlay"),(0,s.c)(e,()=>{const t=this.datetimePresentation=e.presentation||"date-time";switch(this.setDateTimeText(),(0,s.a)(e,"ionChange",this.setDateTimeText),t){case"date-time":case"date":case"month-year":case"month":case"year":this.selectedButton="date";break;case"time-date":case"time":this.selectedButton="time"}})}render(){const{color:t,dateText:e,timeText:i,selectedButton:s,datetimeActive:r,disabled:d}=this,l=(0,n.b)(this);return(0,a.h)(a.H,{class:(0,o.c)(t,{[l]:!0,[`${s}-active`]:r,"datetime-button-disabled":d})},e&&(0,a.h)("button",{class:"ion-activatable",id:"date-button","aria-expanded":r?"true":"false",onClick:this.handleDateClick,disabled:d,part:"native",ref:t=>this.dateTargetEl=t},(0,a.h)("slot",{name:"date-target"},e),"md"===l&&(0,a.h)("ion-ripple-effect",null)),i&&(0,a.h)("button",{class:"ion-activatable",id:"time-button","aria-expanded":r?"true":"false",onClick:this.handleTimeClick,disabled:d,part:"native",ref:t=>this.timeTargetEl=t},(0,a.h)("slot",{name:"time-target"},i),"md"===l&&(0,a.h)("ion-ripple-effect",null)))}get el(){return(0,a.i)(this)}};l.style={ios:":host{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}:host button{border-radius:8px;padding-left:12px;padding-right:12px;padding-top:6px;padding-bottom:6px;margin-left:2px;margin-right:2px;margin-top:0px;margin-bottom:0px;position:relative;-webkit-transition:150ms color ease-in-out;transition:150ms color ease-in-out;border:none;background:var(--ion-color-step-300, #edeef0);color:var(--ion-text-color, #000);font-family:inherit;font-size:inherit;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;overflow:hidden}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){:host button{padding-left:unset;padding-right:unset;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px}}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){:host button{margin-left:unset;margin-right:unset;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px}}:host(.time-active) #time-button,:host(.date-active) #date-button{color:var(--ion-color-base)}:host(.datetime-button-disabled){pointer-events:none}:host(.datetime-button-disabled) button{opacity:0.4}",md:":host{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}:host button{border-radius:8px;padding-left:12px;padding-right:12px;padding-top:6px;padding-bottom:6px;margin-left:2px;margin-right:2px;margin-top:0px;margin-bottom:0px;position:relative;-webkit-transition:150ms color ease-in-out;transition:150ms color ease-in-out;border:none;background:var(--ion-color-step-300, #edeef0);color:var(--ion-text-color, #000);font-family:inherit;font-size:inherit;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;overflow:hidden}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){:host button{padding-left:unset;padding-right:unset;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px}}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){:host button{margin-left:unset;margin-right:unset;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px}}:host(.time-active) #time-button,:host(.date-active) #date-button{color:var(--ion-color-base)}:host(.datetime-button-disabled){pointer-events:none}:host(.datetime-button-disabled) button{opacity:0.4}"}}}]);