cas-ds-web-components 1.2.90 → 1.2.91
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
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(y,A){typeof exports=="object"&&typeof module<"u"?A(exports):typeof define=="function"&&define.amd?define(["exports"],A):(y=typeof globalThis<"u"?globalThis:y||self,A(y["cas-date-picker"]={}))})(this,function(y){"use strict";var
|
|
1
|
+
(function(y,A){typeof exports=="object"&&typeof module<"u"?A(exports):typeof define=="function"&&define.amd?define(["exports"],A):(y=typeof globalThis<"u"?globalThis:y||self,A(y["cas-date-picker"]={}))})(this,function(y){"use strict";var Le=Object.defineProperty;var Be=(y,A,S)=>A in y?Le(y,A,{enumerable:!0,configurable:!0,writable:!0,value:S}):y[A]=S;var X=(y,A,S)=>(Be(y,typeof A!="symbol"?A+"":A,S),S);/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/var vt;const nt=window,
|
|
19
|
+
*/var vt;const nt=window,L=nt.trustedTypes,Lt=L?L.createPolicy("lit-html",{createHTML:n=>n}):void 0,ft="$lit$",F=`lit$${(Math.random()+"").slice(9)}$`,Bt="?"+F,_e=`<${Bt}>`,D=document,Z=()=>D.createComment(""),Y=n=>n===null||typeof n!="object"&&typeof n!="function",jt=Array.isArray,Ae=n=>jt(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",gt=`[
|
|
20
20
|
\f\r]`,K=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,It=/-->/g,zt=/>/g,M=RegExp(`>|${gt}(?:([^\\s"'>=/]+)(${gt}*=${gt}*(?:[^
|
|
21
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Vt=/'/g,Wt=/"/g,qt=/^(?:script|style|textarea|title)$/i,
|
|
21
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Vt=/'/g,Wt=/"/g,qt=/^(?:script|style|textarea|title)$/i,B=Symbol.for("lit-noChange"),m=Symbol.for("lit-nothing"),Jt=new WeakMap,P=D.createTreeWalker(D,129,null,!1);function Zt(n,t){if(!Array.isArray(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Lt!==void 0?Lt.createHTML(t):t}const ye=(n,t)=>{const e=n.length-1,s=[];let i,r=t===2?"<svg>":"",o=K;for(let d=0;d<e;d++){const l=n[d];let a,c,h=-1,u=0;for(;u<l.length&&(o.lastIndex=u,c=o.exec(l),c!==null);)u=o.lastIndex,o===K?c[1]==="!--"?o=It:c[1]!==void 0?o=zt:c[2]!==void 0?(qt.test(c[2])&&(i=RegExp("</"+c[2],"g")),o=M):c[3]!==void 0&&(o=M):o===M?c[0]===">"?(o=i??K,h=-1):c[1]===void 0?h=-2:(h=o.lastIndex-c[2].length,a=c[1],o=c[3]===void 0?M:c[3]==='"'?Wt:Vt):o===Wt||o===Vt?o=M:o===It||o===zt?o=K:(o=M,i=void 0);const p=o===M&&n[d+1].startsWith("/>")?" ":"";r+=o===K?l+_e:h>=0?(s.push(a),l.slice(0,h)+ft+l.slice(h)+F+p):l+F+(h===-2?(s.push(void 0),d):p)}return[Zt(n,r+(n[e]||"<?>")+(t===2?"</svg>":"")),s]};class G{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let r=0,o=0;const d=t.length-1,l=this.parts,[a,c]=ye(t,e);if(this.el=G.createElement(a,s),P.currentNode=this.el.content,e===2){const h=this.el.content,u=h.firstChild;u.remove(),h.append(...u.childNodes)}for(;(i=P.nextNode())!==null&&l.length<d;){if(i.nodeType===1){if(i.hasAttributes()){const h=[];for(const u of i.getAttributeNames())if(u.endsWith(ft)||u.startsWith(F)){const p=c[o++];if(h.push(u),p!==void 0){const T=i.getAttribute(p.toLowerCase()+ft).split(F),b=/([.?@])?(.*)/.exec(p);l.push({type:1,index:r,name:b[2],strings:T,ctor:b[1]==="."?xe:b[1]==="?"?Ee:b[1]==="@"?Se:ot})}else l.push({type:6,index:r})}for(const u of h)i.removeAttribute(u)}if(qt.test(i.tagName)){const h=i.textContent.split(F),u=h.length-1;if(u>0){i.textContent=L?L.emptyScript:"";for(let p=0;p<u;p++)i.append(h[p],Z()),P.nextNode(),l.push({type:2,index:++r});i.append(h[u],Z())}}}else if(i.nodeType===8)if(i.data===Bt)l.push({type:2,index:r});else{let h=-1;for(;(h=i.data.indexOf(F,h+1))!==-1;)l.push({type:7,index:r}),h+=F.length-1}r++}}static createElement(t,e){const s=D.createElement("template");return s.innerHTML=t,s}}function j(n,t,e=n,s){var i,r,o,d;if(t===B)return t;let l=s!==void 0?(i=e._$Co)===null||i===void 0?void 0:i[s]:e._$Cl;const a=Y(t)?void 0:t._$litDirective$;return(l==null?void 0:l.constructor)!==a&&((r=l==null?void 0:l._$AO)===null||r===void 0||r.call(l,!1),a===void 0?l=void 0:(l=new a(n),l._$AT(n,e,s)),s!==void 0?((o=(d=e)._$Co)!==null&&o!==void 0?o:d._$Co=[])[s]=l:e._$Cl=l),l!==void 0&&(t=j(n,l._$AS(n,t.values),l,s)),t}class be{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:s},parts:i}=this._$AD,r=((e=t==null?void 0:t.creationScope)!==null&&e!==void 0?e:D).importNode(s,!0);P.currentNode=r;let o=P.nextNode(),d=0,l=0,a=i[0];for(;a!==void 0;){if(d===a.index){let c;a.type===2?c=new Q(o,o.nextSibling,this,t):a.type===1?c=new a.ctor(o,a.name,a.strings,this,t):a.type===6&&(c=new Ce(o,this,t)),this._$AV.push(c),a=i[++l]}d!==(a==null?void 0:a.index)&&(o=P.nextNode(),d++)}return P.currentNode=D,r}v(t){let e=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class Q{constructor(t,e,s,i){var r;this.type=2,this._$AH=m,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cp=(r=i==null?void 0:i.isConnected)===null||r===void 0||r}get _$AU(){var t,e;return(e=(t=this._$AM)===null||t===void 0?void 0:t._$AU)!==null&&e!==void 0?e:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=j(this,t,e),Y(t)?t===m||t==null||t===""?(this._$AH!==m&&this._$AR(),this._$AH=m):t!==this._$AH&&t!==B&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):Ae(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==m&&Y(this._$AH)?this._$AA.nextSibling.data=t:this.$(D.createTextNode(t)),this._$AH=t}g(t){var e;const{values:s,_$litType$:i}=t,r=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=G.createElement(Zt(i.h,i.h[0]),this.options)),i);if(((e=this._$AH)===null||e===void 0?void 0:e._$AD)===r)this._$AH.v(s);else{const o=new be(r,this),d=o.u(this.options);o.v(s),this.$(d),this._$AH=o}}_$AC(t){let e=Jt.get(t.strings);return e===void 0&&Jt.set(t.strings,e=new G(t)),e}T(t){jt(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;for(const r of t)i===e.length?e.push(s=new Q(this.k(Z()),this.k(Z()),this,this.options)):s=e[i],s._$AI(r),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){var s;for((s=this._$AP)===null||s===void 0||s.call(this,!1,!0,e);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this._$Cp=t,(e=this._$AP)===null||e===void 0||e.call(this,t))}}class ot{constructor(t,e,s,i,r){this.type=1,this._$AH=m,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=r,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=m}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,s,i){const r=this.strings;let o=!1;if(r===void 0)t=j(this,t,e,0),o=!Y(t)||t!==this._$AH&&t!==B,o&&(this._$AH=t);else{const d=t;let l,a;for(t=r[0],l=0;l<r.length-1;l++)a=j(this,d[s+l],e,l),a===B&&(a=this._$AH[l]),o||(o=!Y(a)||a!==this._$AH[l]),a===m?t=m:t!==m&&(t+=(a??"")+r[l+1]),this._$AH[l]=a}o&&!i&&this.j(t)}j(t){t===m?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class xe extends ot{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===m?void 0:t}}const we=L?L.emptyScript:"";class Ee extends ot{constructor(){super(...arguments),this.type=4}j(t){t&&t!==m?this.element.setAttribute(this.name,we):this.element.removeAttribute(this.name)}}class Se extends ot{constructor(t,e,s,i,r){super(t,e,s,i,r),this.type=5}_$AI(t,e=this){var s;if((t=(s=j(this,t,e,0))!==null&&s!==void 0?s:m)===B)return;const i=this._$AH,r=t===m&&i!==m||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,o=t!==m&&(i===m||r);r&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,s;typeof this._$AH=="function"?this._$AH.call((s=(e=this.options)===null||e===void 0?void 0:e.host)!==null&&s!==void 0?s:this.element,t):this._$AH.handleEvent(t)}}class Ce{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){j(this,t)}}const Yt=nt.litHtmlPolyfillSupport;Yt==null||Yt(G,Q),((vt=nt.litHtmlVersions)!==null&&vt!==void 0?vt:nt.litHtmlVersions=[]).push("2.8.0");const Fe=(n,t,e)=>{var s,i;const r=(s=e==null?void 0:e.renderBefore)!==null&&s!==void 0?s:t;let o=r._$litPart$;if(o===void 0){const d=(i=e==null?void 0:e.renderBefore)!==null&&i!==void 0?i:null;r._$litPart$=o=new Q(t.insertBefore(Z(),d),d,void 0,e??{})}return o._$AI(n),o};/**
|
|
22
22
|
* @license
|
|
23
23
|
* Copyright 2017 Google LLC
|
|
24
24
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
25
|
-
*/var mt,_t;let I=class extends U{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const s=super.createRenderRoot();return(t=(e=this.renderOptions).renderBefore)!==null&&t!==void 0||(e.renderBefore=s.firstChild),s}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Fe(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!1)}render(){return
|
|
25
|
+
*/var mt,_t;let I=class extends U{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const s=super.createRenderRoot();return(t=(e=this.renderOptions).renderBefore)!==null&&t!==void 0||(e.renderBefore=s.firstChild),s}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Fe(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!1)}render(){return B}};I.finalized=!0,I._$litElement$=!0,(mt=globalThis.litElementHydrateSupport)===null||mt===void 0||mt.call(globalThis,{LitElement:I});const Kt=globalThis.litElementPolyfillSupport;Kt==null||Kt({LitElement:I}),((_t=globalThis.litElementVersions)!==null&&_t!==void 0?_t:globalThis.litElementVersions=[]).push("3.3.3");/**
|
|
26
26
|
* @license
|
|
27
27
|
* Copyright 2020 Google LLC
|
|
28
28
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -328,7 +328,7 @@
|
|
|
328
328
|
Copyright (c) 2018 Jed Watson.
|
|
329
329
|
Licensed under the MIT License (MIT), see
|
|
330
330
|
http://jedwatson.github.io/classnames
|
|
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(){const n=new Date,t=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],e=["Dom","Lun","Mar","Mie","Jue","Vie","Sab"],s=n.getFullYear(),i=n.getMonth()+1,r=[...Array(10).keys()].map(o=>o+s);return{date:n,weekdays:e,currentYear:s,currentMonth:i,month_names:t,years:r}}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 f=u.getDay();f>0;f--)l.push({name:p+1-f,isCurrentMonth:!1,isCurrentDay:!1,isToday:!1});for(let f=0;f<c;f++){const At=r==null?void 0:r.includes(f+1),ee=h.getDate()===f+1&&h.getMonth()===n-1,$=e===te({year:t,month:n,day:f+1}),v=new Date(t,n-1,f+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:f+1});l.push({value:E,name:1+f,isCurrentMonth:!0,isCurrentDay:f+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 f=0;f<T;f++)l.push({name:f+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=""}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}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(),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`
|
|
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(){const n=new Date,t=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],e=["Dom","Lun","Mar","Mie","Jue","Vie","Sab"],s=n.getFullYear(),i=n.getMonth()+1,r=[...Array(10).keys()].map(o=>o+s);return{date:n,weekdays:e,currentYear:s,currentMonth:i,month_names:t,years:r}}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 f=u.getDay();f>0;f--)l.push({name:p+1-f,isCurrentMonth:!1,isCurrentDay:!1,isToday:!1});for(let f=0;f<c;f++){const At=r==null?void 0:r.includes(f+1),ee=h.getDate()===f+1&&h.getMonth()===n-1,$=e===te({year:t,month:n,day:f+1}),v=new Date(t,n-1,f+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:f+1});l.push({value:E,name:1+f,isCurrentMonth:!0,isCurrentDay:f+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 f=0;f<T;f++)l.push({name:f+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}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(),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
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("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>
|
|
@@ -381,7 +381,7 @@
|
|
|
381
381
|
<div class="list-days">
|
|
382
382
|
${(v=$.calendar)==null?void 0:v.map(x=>p(x))}
|
|
383
383
|
</div>
|
|
384
|
-
${T()}
|
|
384
|
+
${this.showLegend==="true"?T():null}
|
|
385
385
|
</div>
|
|
386
386
|
`};return w`
|
|
387
387
|
<div class="datepicker-container">
|
|
@@ -409,4 +409,4 @@
|
|
|
409
409
|
</section>
|
|
410
410
|
`:null}
|
|
411
411
|
</div>
|
|
412
|
-
`}}X(z,"formAssociated",!0),X(z,"styles",De),X(z,"shadowRootOptions",{...I.shadowRootOptions,mode:"open"}),X(z,"properties",{label:{type:String},open:{type:Boolean},name:{type:String},value:{type:String},year:{type:Number},month:{type:Number},disabled:{type:String},disablePast:{type:Boolean},disableControls:{type:Boolean},initialValue:{type:String},disablePrevious:{type:String},disableNext:{type:String},disableWeekends:{type:Boolean}}),customElements.get("cas-date-picker")||customElements.define("cas-date-picker",z),y.CasDatePicker=z,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
|
|
412
|
+
`}}X(z,"formAssociated",!0),X(z,"styles",De),X(z,"shadowRootOptions",{...I.shadowRootOptions,mode:"open"}),X(z,"properties",{label:{type:String},open:{type:Boolean},name:{type:String},value:{type:String},year:{type:Number},month:{type:Number},disabled:{type:String},disablePast:{type:Boolean},disableControls:{type:Boolean},initialValue:{type:String},disablePrevious:{type:String},disableNext:{type:String},disableWeekends:{type:Boolean},showLegend:{type:String}}),customElements.get("cas-date-picker")||customElements.define("cas-date-picker",z),y.CasDatePicker=z,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(b,J){typeof exports=="object"&&typeof module<"u"?J(exports):typeof define=="function"&&define.amd?define(["exports"],J):(b=typeof globalThis<"u"?globalThis:b||self,J(b["all-components"]={}))})(this,function(b){"use strict";var Sv=Object.defineProperty;var Tv=(b,J,J1)=>J in b?Sv(b,J,{enumerable:!0,configurable:!0,writable:!0,value:J1}):b[J]=J1;var g=(b,J,J1)=>(Tv(b,typeof J!="symbol"?J+"":J,J1),J1);var I3,EC;(()=>{const i=document.createElement("link");i.setAttribute("href","https://fonts.googleapis.com/css2?family=Rubik:ital,wght@0,300..900;1,300..900&display=swap"),i.setAttribute("rel","stylesheet"),document.head.appendChild(i)})();const Y5={name:"@eloisa-ds/all-components",version:"1.0.
|
|
1
|
+
(function(b,J){typeof exports=="object"&&typeof module<"u"?J(exports):typeof define=="function"&&define.amd?define(["exports"],J):(b=typeof globalThis<"u"?globalThis:b||self,J(b["all-components"]={}))})(this,function(b){"use strict";var Sv=Object.defineProperty;var Tv=(b,J,J1)=>J in b?Sv(b,J,{enumerable:!0,configurable:!0,writable:!0,value:J1}):b[J]=J1;var g=(b,J,J1)=>(Tv(b,typeof J!="symbol"?J+"":J,J1),J1);var I3,EC;(()=>{const i=document.createElement("link");i.setAttribute("href","https://fonts.googleapis.com/css2?family=Rubik:ital,wght@0,300..900;1,300..900&display=swap"),i.setAttribute("rel","stylesheet"),document.head.appendChild(i)})();const Y5={name:"@eloisa-ds/all-components",version:"1.0.93",dependencies:{},main:"./index.js",module:"./index.mjs",typings:"./index.d.ts",private:!0};/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -13986,7 +13986,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|
|
13986
13986
|
padding: 16px;
|
|
13987
13987
|
}
|
|
13988
13988
|
}
|
|
13989
|
-
`,zC=(i,C)=>new Date(i,C,0).getDate(),kC=({year:i,month:C,day:t})=>{const e=C<10?`0${C}`:C,o=t<10?`0${t}`:t;return`${i}-${e}-${o}`};function xv(){const i=new Date,C=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],t=["Dom","Lun","Mar","Mie","Jue","Vie","Sab"],e=i.getFullYear(),o=i.getMonth()+1,a=[...Array(10).keys()].map(l=>l+e);return{date:i,weekdays:t,currentYear:e,currentMonth:o,month_names:C,years:a}}function _v({month:i,year:C,selectValue:t,disablePast:e,disableWeekends:o,availableDays:a,disablePrevious:l,disableNext:h}){const n=[],r=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],d=zC(C,i),c=new Date,p=new Date(C,i-1,1),v=new Date(C,i-1,0).getDate();for(let m=p.getDay();m>0;m--)n.push({name:v+1-m,isCurrentMonth:!1,isCurrentDay:!1,isToday:!1});for(let m=0;m<d;m++){const z=a==null?void 0:a.includes(m+1),$=c.getDate()===m+1&&c.getMonth()===i-1,_=t===kC({year:C,month:i,day:m+1}),k=new Date(C,i-1,m+1),K=(()=>{if(l){const x=new Date(l);if(x.setHours(0,0,0,0),k<=x)return!0}if(h){const x=new Date(h);if(x.setHours(0,0,0,0),k>x)return!0}if(e){const x=new Date;if(x.setHours(0,0,0,0),k<x)return!0}if(o){const x=k.getDay();if(x===0||x===6)return!0}return!1})(),Z=kC({year:C,month:i,day:m+1});n.push({value:Z,name:1+m,isCurrentMonth:!0,isCurrentDay:m+1===c.getDate(),isToday:$,isAvailable:z,date:k,disabled:K,selected:_})}const u=n.length%7===0?0:7-n.length%7;for(let m=0;m<u;m++)n.push({name:m+1,isCurrentMonth:!1,isCurrentDay:!1,isToday:!1});return{year:C,month:r[i-1],days:zC(C,i),calendar:n}}function bv(i){const{isAvailable:C,isCurrentMonth:t,isToday:e,disabled:o,selected:a}=i;return{dayStyles:q({"item-day":!0,"current-month":t,available:C,today:e,disabled:o,selected:a})}}class P2 extends f{constructor(){var C;super(),this.open=!1,this.label="date picker",this.name=((C=this.getAttribute("label"))==null?void 0:C.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=""}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(C){this.value=C.target.value}updated(){const C=this.disabled==="true"||this.disabled===!0,t=this.shadowRoot.querySelector("cas-input");C?t==null||t.setAttribute("disabled",!0):t==null||t.removeAttribute("disabled")}render(){const{disablePast:C,disableWeekends:t,open:e,year:o,month:a,disablePrevious:l,disableNext:h}=this,{weekdays:n,month_names:r,years:d}=xv(),c=_v({month:a,year:o,selectValue:this.value,disablePast:C,disableWeekends:t,disablePrevious:l,disableNext:h});document.addEventListener("click",_=>{_.composedPath().includes(this)||this.handleClose()});const p=()=>{this.shadowRoot.querySelectorAll(".dropdown").forEach(k=>{k.classList.remove("open")})},v=_=>{const{dayStyles:k}=bv(_);return M`
|
|
13989
|
+
`,zC=(i,C)=>new Date(i,C,0).getDate(),kC=({year:i,month:C,day:t})=>{const e=C<10?`0${C}`:C,o=t<10?`0${t}`:t;return`${i}-${e}-${o}`};function xv(){const i=new Date,C=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],t=["Dom","Lun","Mar","Mie","Jue","Vie","Sab"],e=i.getFullYear(),o=i.getMonth()+1,a=[...Array(10).keys()].map(l=>l+e);return{date:i,weekdays:t,currentYear:e,currentMonth:o,month_names:C,years:a}}function _v({month:i,year:C,selectValue:t,disablePast:e,disableWeekends:o,availableDays:a,disablePrevious:l,disableNext:h}){const n=[],r=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],d=zC(C,i),c=new Date,p=new Date(C,i-1,1),v=new Date(C,i-1,0).getDate();for(let m=p.getDay();m>0;m--)n.push({name:v+1-m,isCurrentMonth:!1,isCurrentDay:!1,isToday:!1});for(let m=0;m<d;m++){const z=a==null?void 0:a.includes(m+1),$=c.getDate()===m+1&&c.getMonth()===i-1,_=t===kC({year:C,month:i,day:m+1}),k=new Date(C,i-1,m+1),K=(()=>{if(l){const x=new Date(l);if(x.setHours(0,0,0,0),k<=x)return!0}if(h){const x=new Date(h);if(x.setHours(0,0,0,0),k>x)return!0}if(e){const x=new Date;if(x.setHours(0,0,0,0),k<x)return!0}if(o){const x=k.getDay();if(x===0||x===6)return!0}return!1})(),Z=kC({year:C,month:i,day:m+1});n.push({value:Z,name:1+m,isCurrentMonth:!0,isCurrentDay:m+1===c.getDate(),isToday:$,isAvailable:z,date:k,disabled:K,selected:_})}const u=n.length%7===0?0:7-n.length%7;for(let m=0;m<u;m++)n.push({name:m+1,isCurrentMonth:!1,isCurrentDay:!1,isToday:!1});return{year:C,month:r[i-1],days:zC(C,i),calendar:n}}function bv(i){const{isAvailable:C,isCurrentMonth:t,isToday:e,disabled:o,selected:a}=i;return{dayStyles:q({"item-day":!0,"current-month":t,available:C,today:e,disabled:o,selected:a})}}class P2 extends f{constructor(){var C;super(),this.open=!1,this.label="date picker",this.name=((C=this.getAttribute("label"))==null?void 0:C.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(C){this.value=C.target.value}updated(){const C=this.disabled==="true"||this.disabled===!0,t=this.shadowRoot.querySelector("cas-input");C?t==null||t.setAttribute("disabled",!0):t==null||t.removeAttribute("disabled")}render(){const{disablePast:C,disableWeekends:t,open:e,year:o,month:a,disablePrevious:l,disableNext:h}=this,{weekdays:n,month_names:r,years:d}=xv(),c=_v({month:a,year:o,selectValue:this.value,disablePast:C,disableWeekends:t,disablePrevious:l,disableNext:h});document.addEventListener("click",_=>{_.composedPath().includes(this)||this.handleClose()});const p=()=>{this.shadowRoot.querySelectorAll(".dropdown").forEach(k=>{k.classList.remove("open")})},v=_=>{const{dayStyles:k}=bv(_);return M`
|
|
13990
13990
|
<button type="button" class=${k} @click=${K=>{if(p(),_.isCurrentMonth&&!_.disabled){const Z=K.target.parentNode.querySelectorAll("button");for(let x=0;x<Z.length;x++)Z[x].classList.remove("selected");K.target.classList.add("selected"),this.value=_.value,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")}} >
|
|
13991
13991
|
${_.name}
|
|
13992
13992
|
</button>
|
|
@@ -14039,7 +14039,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|
|
14039
14039
|
<div class="list-days">
|
|
14040
14040
|
${(k=_.calendar)==null?void 0:k.map(F=>v(F))}
|
|
14041
14041
|
</div>
|
|
14042
|
-
${u()}
|
|
14042
|
+
${this.showLegend==="true"?u():null}
|
|
14043
14043
|
</div>
|
|
14044
14044
|
`};return M`
|
|
14045
14045
|
<div class="datepicker-container">
|
|
@@ -14067,7 +14067,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|
|
14067
14067
|
</section>
|
|
14068
14068
|
`:null}
|
|
14069
14069
|
</div>
|
|
14070
|
-
`}}g(P2,"formAssociated",!0),g(P2,"styles",Vv),g(P2,"shadowRootOptions",{...f.shadowRootOptions,mode:"open"}),g(P2,"properties",{label:{type:String},open:{type:Boolean},name:{type:String},value:{type:String},year:{type:Number},month:{type:Number},disabled:{type:String},disablePast:{type:Boolean},disableControls:{type:Boolean},initialValue:{type:String},disablePrevious:{type:String},disableNext:{type:String},disableWeekends:{type:Boolean}}),customElements.get("cas-date-picker")||customElements.define("cas-date-picker",P2);const yv=H`
|
|
14070
|
+
`}}g(P2,"formAssociated",!0),g(P2,"styles",Vv),g(P2,"shadowRootOptions",{...f.shadowRootOptions,mode:"open"}),g(P2,"properties",{label:{type:String},open:{type:Boolean},name:{type:String},value:{type:String},year:{type:Number},month:{type:Number},disabled:{type:String},disablePast:{type:Boolean},disableControls:{type:Boolean},initialValue:{type:String},disablePrevious:{type:String},disableNext:{type:String},disableWeekends:{type:Boolean},showLegend:{type:String}}),customElements.get("cas-date-picker")||customElements.define("cas-date-picker",P2);const yv=H`
|
|
14071
14071
|
.datepicker-container {
|
|
14072
14072
|
position: relative;
|
|
14073
14073
|
display: flex;
|