cas-ds-web-components 1.2.172 → 1.2.174
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cas-date-picker.js +1 -1
- package/build/cas-ds-web-components.js +799 -797
- package/build/cas-header.js +29 -29
- package/build/cas-select.js +4 -4
- package/package.json +2 -2
package/build/cas-date-picker.js
CHANGED
|
@@ -329,7 +329,7 @@
|
|
|
329
329
|
Licensed under the MIT License (MIT), see
|
|
330
330
|
http://jedwatson.github.io/classnames
|
|
331
331
|
*/(function(n){(function(){var t={}.hasOwnProperty;function e(){for(var r="",o=0;o<arguments.length;o++){var d=arguments[o];d&&(r=i(r,s(d)))}return r}function s(r){if(typeof r=="string"||typeof r=="number")return r;if(typeof r!="object")return"";if(Array.isArray(r))return e.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var o="";for(var d in r)t.call(r,d)&&r[d]&&(o=i(o,d));return o}function i(r,o){return o?r?r+" "+o:r+o:r}n.exports?(e.default=e,n.exports=e):window.classNames=e})()})(Qt);var Pe=Qt.exports;const Te=Me(Pe),Xt=(n,t)=>new Date(n,t,0).getDate(),te=({year:n,month:t,day:e})=>{const s=t<10?`0${t}`:t,i=e<10?`0${e}`:e;return`${n}-${s}-${i}`};function Ue({disablePrevious:n,disableNext:t}){const e=new Date,s=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],i=["Dom","Lun","Mar","Mie","Jue","Vie","Sab"],r=e.getFullYear(),o=e.getMonth()+1,l=(()=>{if(n){const c=new Date(n).getFullYear();return[...Array(10).keys()].map(h=>h+c)}if(t){const c=new Date(t).getFullYear()-9;return[...Array(10).keys()].map(h=>h+c)}return[...Array(10).keys()].map(a=>a+r)})();return{date:e,weekdays:i,currentYear:r,currentMonth:o,month_names:s,years:l}}function Oe({month:n,year:t,selectValue:e,disablePast:s,disableWeekends:i,availableDays:r,disablePrevious:o,disableNext:d}){const l=[],a=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],c=Xt(t,n),h=new Date,u=new Date(t,n-1,1),p=new Date(t,n-1,0).getDate();for(let g=u.getDay();g>0;g--)l.push({name:p+1-g,isCurrentMonth:!1,isCurrentDay:!1,isToday:!1});for(let g=0;g<c;g++){const At=r==null?void 0:r.includes(g+1),ee=h.getDate()===g+1&&h.getMonth()===n-1,$=e===te({year:t,month:n,day:g+1}),v=new Date(t,n-1,g+1),V=(()=>{if(o){const _=new Date(o);if(_.setHours(0,0,0,0),v<=_)return!0}if(d){const _=new Date(d);if(_.setHours(0,0,0,0),v>_)return!0}if(s){const _=new Date;if(_.setHours(0,0,0,0),v<_)return!0}if(i){const _=v.getDay();if(_===0||_===6)return!0}return!1})(),E=te({year:t,month:n,day:g+1});l.push({value:E,name:1+g,isCurrentMonth:!0,isCurrentDay:g+1===h.getDate(),isToday:ee,isAvailable:At,date:v,disabled:V,selected:$})}const T=l.length%7===0?0:7-l.length%7;for(let g=0;g<T;g++)l.push({name:g+1,isCurrentMonth:!1,isCurrentDay:!1,isToday:!1});return{year:t,month:a[n-1],days:Xt(t,n),calendar:l}}function Re(n){const{isAvailable:t,isCurrentMonth:e,isToday:s,disabled:i,selected:r}=n;return{dayStyles:Te({"item-day":!0,"current-month":e,available:t,today:s,disabled:i,selected:r})}}class z extends I{constructor(){var t;super(),this.open=!1,this.label="date picker",this.name=((t=this.getAttribute("label"))==null?void 0:t.toLowerCase().replace(" ","-"))||"date-picker",this.value="",this.year=new Date().getFullYear(),this.month=new Date().getMonth()+1,this.initialValue="",this.disabled=!1,this.disablePrevious="",this.disableNext="",this.showLegend="true"}handleOpen(){this.open=!0}handleClose(){this.open=!1}changeMonthPrev(){if(this.disableControls)return null;this.month===1?(this.year=this.year-1,this.month=12):this.month=this.month-1,this.requestUpdate()}changeMonthNext(){if(this.disableControls)return null;this.month===12?(this.year=this.year+1,this.month=1):this.month=this.month+1,this.requestUpdate()}onChange(t){this.value=t.target.value,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}updated(){const t=this.disabled==="true"||this.disabled===!0,e=this.shadowRoot.querySelector("cas-input");t?e==null||e.setAttribute("disabled",!0):e==null||e.removeAttribute("disabled")}render(){const{disablePast:t,disableWeekends:e,open:s,year:i,month:r,disablePrevious:o,disableNext:d}=this,{weekdays:l,month_names:a,years:c}=Ue({disablePrevious:o,disableNext:d}),h=Oe({month:r,year:i,selectValue:this.value,disablePast:t,disableWeekends:e,disablePrevious:o,disableNext:d});document.addEventListener("click",$=>{$.composedPath().includes(this)||this.handleClose()});const u=()=>{this.shadowRoot.querySelectorAll(".dropdown").forEach(v=>{v.classList.remove("open")})},p=$=>{const{dayStyles:v}=Re($);return w`
|
|
332
|
-
<button type="button" class=${v} @click=${V=>{if(u(),$.isCurrentMonth&&!$.disabled){const E=V.target.parentNode.querySelectorAll("button");for(let _=0;_<E.length;_++)E[_].classList.remove("selected");V.target.classList.add("selected"),this.value=$.value,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("callback",{detail:{value:$.value,name:this.name,message:"Success",success:!0,error:!1},bubbles:!0,composed:!0}))}else console.log("not available")}} >
|
|
332
|
+
<button type="button" class=${v} @click=${V=>{if(u(),this.handleClose(),$.isCurrentMonth&&!$.disabled){const E=V.target.parentNode.querySelectorAll("button");for(let _=0;_<E.length;_++)E[_].classList.remove("selected");V.target.classList.add("selected"),this.value=$.value,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("callback",{detail:{value:$.value,name:this.name,message:"Success",success:!0,error:!1},bubbles:!0,composed:!0}))}else console.log("not available")}} >
|
|
333
333
|
${$.name}
|
|
334
334
|
</button>
|
|
335
335
|
`},T=()=>w`
|