@novemberizing/bootstrap
Advanced tools
Comparing version 0.0.18 to 0.0.19
@@ -1,1 +0,1 @@ | ||
const t={parent:(t,e)=>{for(;t&&t.nodeName&&t.nodeName.toLowerCase()!==e;)t=t.parentNode;return t},previous:(t,e)=>{for(;t&&t.nodeName.toLowerCase()!==e;)t=t.previousElementSibling;return t},children:{remove:t=>{for(;t.firstChild;)t.lastChild.remove()}}},e={equal:(t,e)=>t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate(),str:(t,e="/")=>{function n(t){return t<10?`0${t}`:t}return`${t.getFullYear()}${e}${n(t.getMonth()+1)}${e}${n(t.getDate())}`},next:(t,e=1)=>(t.setDate(t.getDate()+e),t),month:{str:t=>{return`${t.getFullYear()}/${e=t.getMonth()+1,e<10?`0${e}`:e}`;var e},begin:t=>(t.setDate(1),t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t),previous:t=>(t.setMonth(t.getMonth()-1),t.setDate(1),t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t),next:t=>(t.setMonth(t.getMonth()+1),t.setDate(1),t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t)},week:{begin:t=>(t.setDate(t.getDate()-t.getDay()),t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t)}};class n{static#t='<p class="d-inline-flex gap-1 star"></p>';static#e='<button type="button"></button>';static#n='<i class="fa-solid fa-star"></i>';static#s='<i class="fa-regular fa-star"></i>';static{const t=new DOMParser;n.#t=t.parseFromString(n.#t,"text/html").querySelector("p"),n.#e=t.parseFromString(n.#e,"text/html").querySelector("button"),n.#n=t.parseFromString(n.#n,"text/html").querySelector("i"),n.#s=t.parseFromString(n.#s,"text/html").querySelector("i")}#o=null;#i=null;#a=null;#r=null;#l=null;#c=null;#d=null;static load(t){const e=document.querySelectorAll("input[type='range'].form-control.star");for(const s of e)new n(s,"function"==typeof t?t(s):t)}static#u(){return n.#t.cloneNode(!0)}static#h(e,s){const o=n.#e.cloneNode(!0);return o.setAttribute("data-value",e+1),o.setAttribute("aria-pressed",s),s?o.appendChild(n.#n.cloneNode(!0)):o.appendChild(n.#s.cloneNode(!0)),o.addEventListener("click",(e=>{const n=t.parent(e.target,"button"),s=t.parent(n,"p"),o=t.previous(s,"input"),i=parseInt(n.getAttribute("data-value")),a=n.getAttribute("aria-pressed"),r=n.nextElementSibling;"true"===a?r&&"true"===r.getAttribute("aria-pressed")?o.setAttribute("value",i):o.setAttribute("value",i-1):o.setAttribute("value",i);const l=parseInt(o.getAttribute("value")),c=s.querySelectorAll("button");for(const t of c){const e=t.querySelector("i");l<parseInt(t.getAttribute("data-value"))?(e.classList.contains("fa-solid")&&e.classList.replace("fa-solid","fa-regular"),t.setAttribute("aria-pressed","false")):(e.classList.contains("fa-regular")&&e.classList.replace("fa-regular","fa-solid"),t.setAttribute("aria-pressed","true"))}})),o}constructor(t,e){this.#a=t,this.#r=e,"string"==typeof this.#a&&(this.#a=document.getElementById(this.#a)),this.#o=this.#a.parentNode,this.#i=this.#a.nextSibling,this.#l=parseInt(this.#a.max),this.#c=parseInt(this.#a.min),this.#d=parseInt(this.#a.defaultValue);const s=n.#u();for(let t=this.#c;t<this.#l;t++){const e=n.#h(t,t<this.#d);s.appendChild(e)}this.#a.style.display="none",this.#o.insertBefore(s,this.#i)}}class s{static#b='<div class="calendar">\n <div class="input-group">\n <input type="text" class="form-control" data-date="" disabled>\n <span class="input-group-text">\n <button type="button" class="btn btn-link"><i class="fa-regular fa-calendar"></i></button>\n </span>\n </div>\n <div class="form small hide" data-focus-date="">\n <div class="calendar-header d-flex justify-content-between mb-3">\n <button type="button" class="btn btn-light btn-sm text-start month fw-bold"></button>\n <div>\n <button type="button" class="btn btn-light btn-sm up"><i class="fa-solid fa-caret-up"></i></button>\n <button type="button" class="btn btn-light btn-sm down"><i class="fa-solid fa-caret-down"></i></button>\n </div>\n </div>\n <div class="calendar-body mb-2">\n <table class="table">\n <thead>\n <tr>\n <th scope="col">Sun</th>\n <th scope="col">Mon</th>\n <th scope="col">Tue</th>\n <th scope="col">Wed</th>\n <th scope="col">Thu</th>\n <th scope="col">Fri</th>\n <th scope="col">Sat</th>\n </tr>\n </thead>\n </table>\n <div class="calendar-date">\n <table class="table">\n <tbody>\n <tr>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n <div class="calendar-footer d-flex justify-content-between">\n <button type="button" class="btn btn-light btn-sm erase">삭제</button>\n <button type="button" class="btn btn-light btn-sm today">오늘</button>\n </div>\n </div>\n</div>';static#t=null;static#m=null;static{const t=new DOMParser;s.#b=t.parseFromString(s.#b,"text/html"),s.#t=s.#b.querySelector("div.calendar");const e=s.#t.querySelector("div.calendar-date"),n=e.querySelector("tr");s.#m=n.querySelector("td"),s.#m=s.#m.cloneNode(!0),n.remove()}static load(t){const e=document.querySelectorAll('input[type="date"].form-control');for(const n of e)new s(n,"function"==typeof t?t(n):t)}#a=null;#r=null;#o=null;#i=null;#p=null;#f=null;#g=null;#y=null;#w(){this.#g.classList.contains("show")?this.#g.classList.replace("show","hide"):this.#g.classList.add("hide"),t.children.remove(this.#y);const n=e.month.begin(new Date);this.#g.setAttribute("data-focus-date",n),e.week.begin(new Date(n)),this.#g.querySelector("div.calendar-header button.month").textContent=e.month.str(n)}#v(t,n,o,i=null){let a=new Date(t);for(let t=0;t<6;t++)if(n.querySelector(`tr[data-date="${a}"]`))a=e.next(a,7);else{const t=document.createElement("tr");t.setAttribute("data-date",a);for(let n=0;n<7;n++){const n=s.#m.cloneNode(!0),o=n.querySelector("button");o.appendChild(document.createTextNode(a.getDate()));const i=new Date(a);o.addEventListener("click",(t=>{this.#g.classList.contains("show")?this.#g.classList.replace("show","hide"):this.#g.classList.add("hide");const n=e.month.begin(new Date(i));this.#g.setAttribute("data-focus-date",n),this.#f.setAttribute("value",e.str(i)),this.#f.setAttribute("data-date",i),this.#a.setAttribute("value",e.str(i,"-"))})),t.appendChild(n),a=e.next(a)}n.insertBefore(t,i)}a=new Date(t);const r=new Date(this.#f.getAttribute("data-date"));for(let t=0;t<6;t++){let t=n.querySelector(`tr[data-date="${a}"]`).querySelector("td");for(let n=0;n<7;n++){const n=t.querySelector("button");n.classList.remove("active"),n.classList.remove("fw-bold"),a.getMonth()!==o?n.classList.contains("not-current")||n.classList.add("not-current"):(n.classList.contains("not-current")&&n.classList.remove("not-current"),e.equal(a,r)&&(n.classList.add("active"),n.classList.add("fw-bold"))),a=e.next(a),t=t.nextElementSibling}}}#S(t){t.scrollIntoView({behavior:"smooth"})}#D(t){const n=new Date(this.#g.getAttribute("data-focus-date")),s=e.month.previous(new Date(n)),o=e.week.begin(new Date(s)),i=e.week.begin(e.month.begin(new Date(n))),a=this.#y.querySelector(`tr[data-date="${i}"]`);this.#v(o,this.#y,s.getMonth(),a),this.#g.setAttribute("data-focus-date",s),this.#g.querySelector("div.calendar-header button.month").textContent=e.month.str(s),this.#S(this.#y.querySelector(`tr[data-date="${o}"]`))}#x(t){const n=new Date(this.#g.getAttribute("data-focus-date")),s=e.month.next(new Date(n)),o=e.week.begin(new Date(s)),i=e.next(new Date(o),42),a=this.#y.querySelector(`tr[data-date="${i}"]`);this.#v(o,this.#y,s.getMonth(),a),this.#g.setAttribute("data-focus-date",s),this.#g.querySelector("div.calendar-header button.month").textContent=e.month.str(s),this.#S(this.#y.querySelector(`tr[data-date="${o}"]`))}#L(){const t=this.#f.getBoundingClientRect();this.#g.style.top=`${t.top+t.height+window.scrollY+5}px`,this.#g.style.left=`${t.left+5}px`}#A(n){const o=e.month.begin(new Date(n)),i=e.week.begin(new Date(o));this.#p=s.#t.cloneNode(!0);const a=this.#p.querySelector("div.input-group button");this.#f=this.#p.querySelector("div.input-group input"),this.#g=this.#p.querySelector("div.form"),this.#y=this.#g.querySelector("div.form div.calendar-date tbody");for(const t of this.#a.attributes)this.#f.setAttribute(t.name,t.value);this.#f.setAttribute("type","text"),this.#f.removeAttribute("id"),this.#g.querySelector("div.calendar-header button.up").addEventListener("click",(t=>this.#D(t))),this.#g.querySelector("div.calendar-header button.down").addEventListener("click",(t=>this.#x(t))),this.#g.querySelector("div.calendar-header button.month").textContent=e.month.str(o),this.#g.querySelector("div.calendar-footer button.today").addEventListener("click",(t=>{const n=new Date,s=e.month.begin(new Date(n));this.#g.setAttribute("data-focus-date",s),this.#f.setAttribute("value",e.str(n)),this.#f.setAttribute("data-date",n),this.#a.setAttribute("value",e.str(n,"-")),this.#g.classList.contains("show")?this.#g.classList.replace("show","hide"):(this.#g.classList.replace("hide","show"),this.#L())})),this.#g.querySelector("div.calendar-footer button.erase").addEventListener("click",(t=>{const n=new Date,s=e.month.begin(new Date(n));this.#g.setAttribute("data-focus-date",s),this.#f.setAttribute("value",""),this.#f.setAttribute("data-date",""),this.#a.setAttribute("value",""),this.#g.classList.contains("show")?this.#g.classList.replace("show","hide"):(this.#g.classList.replace("hide","show"),this.#L())})),this.#g.setAttribute("data-focus-date",o),a.addEventListener("click",(n=>{if(this.#g.classList.contains("show")){this.#g.classList.replace("show","hide"),t.children.remove(this.#y);const n=e.month.begin(new Date);this.#g.setAttribute("data-focus-date",n),e.week.begin(new Date(n)),this.#g.querySelector("div.calendar-header button.month").textContent=e.month.str(n)}else if(this.#g.classList.contains("hide")){t.children.remove(this.#y);const n=new Date(this.#g.getAttribute("data-focus-date")),s=e.week.begin(new Date(n)),o=this.#y.querySelector(`tr[data-date="${s}"]`);this.#v(s,this.#y,n.getMonth(),o),this.#g.querySelector("div.calendar-header button.month").textContent=e.month.str(n),this.#g.classList.replace("hide","show"),this.#L()}})),this.#v(i,this.#y,o.getMonth()),this.#o.insertBefore(this.#p,this.#i)}constructor(t,e){this.#a=t,this.#r=e,"string"==typeof this.#a&&(this.#a=document.getElementById(this.#a)),this.#o=this.#a.parentNode,this.#i=this.#a.nextSibling;const n=this.#a.getAttribute("value")||this.#a.getAttribute("defaultValue");this.#A(n?new Date(n):new Date),this.#a.style.display="none"}}class o{static on(e,n){const s=document.getElementById(n);s.classList.contains("hide")?s.classList.replace("hide","show"):s.classList.add("show");const o=t.parent(e.target,"button").getBoundingClientRect();s.style.left=`${o.left}px`,s.style.top=o.top-o.height-16+"px"}static toggle(e,n){const s=document.getElementById(n);s.classList.contains("hide")?s.classList.replace("hide","show"):s.classList.contains("show")?s.classList.replace("show","hide"):s.classList.add("show");const o=t.parent(e.target,"button").getBoundingClientRect();s.style.left=`${o.left}px`,s.style.top=o.top-o.height-16+"px"}}void 0===window.novemberizing?console.error("need to ..."):(console.log(1),void 0===window.novemberizing.bootstrap?window.novemberizing.bootstrap={Star:n,Date:s,popover:o}:(window.novemberizing.bootstrap.Star=n,window.novemberizing.bootstrap.Date=s,window.novemberizing.bootstrap.popover=o)); | ||
const t={parent:(t,e)=>{for(;t&&t.nodeName&&t.nodeName.toLowerCase()!==e;)t=t.parentNode;return t},previous:(t,e)=>{for(;t&&t.nodeName.toLowerCase()!==e;)t=t.previousElementSibling;return t},children:{remove:t=>{for(;t.firstChild;)t.lastChild.remove()}}},e={equal:(t,e)=>t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate(),str:(t,e="/")=>{function n(t){return t<10?`0${t}`:t}return`${t.getFullYear()}${e}${n(t.getMonth()+1)}${e}${n(t.getDate())}`},next:(t,e=1)=>(t.setDate(t.getDate()+e),t),month:{str:t=>{return`${t.getFullYear()}/${e=t.getMonth()+1,e<10?`0${e}`:e}`;var e},begin:t=>(t.setDate(1),t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t),previous:t=>(t.setMonth(t.getMonth()-1),t.setDate(1),t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t),next:t=>(t.setMonth(t.getMonth()+1),t.setDate(1),t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t)},week:{begin:t=>(t.setDate(t.getDate()-t.getDay()),t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t)}};class n{static#t='<p class="d-inline-flex gap-1 star"></p>';static#e='<button type="button"></button>';static#n='<i class="fa-solid fa-star"></i>';static#s='<i class="fa-regular fa-star"></i>';static{const t=new DOMParser;n.#t=t.parseFromString(n.#t,"text/html").querySelector("p"),n.#e=t.parseFromString(n.#e,"text/html").querySelector("button"),n.#n=t.parseFromString(n.#n,"text/html").querySelector("i"),n.#s=t.parseFromString(n.#s,"text/html").querySelector("i")}#o=null;#i=null;#a=null;#r=null;#l=null;#c=null;#d=null;static load(t){const e=document.querySelectorAll("input[type='range'].form-control.star");for(const s of e)new n(s,"function"==typeof t?t(s):t)}static#u(){return n.#t.cloneNode(!0)}static#h(e,s){const o=n.#e.cloneNode(!0);return o.setAttribute("data-value",e+1),o.setAttribute("aria-pressed",s),s?o.appendChild(n.#n.cloneNode(!0)):o.appendChild(n.#s.cloneNode(!0)),o.addEventListener("click",(e=>{const n=t.parent(e.target,"button"),s=t.parent(n,"p"),o=t.previous(s,"input"),i=parseInt(n.getAttribute("data-value")),a=n.getAttribute("aria-pressed"),r=n.nextElementSibling;"true"===a?r&&"true"===r.getAttribute("aria-pressed")?o.setAttribute("value",i):o.setAttribute("value",i-1):o.setAttribute("value",i);const l=parseInt(o.getAttribute("value")),c=s.querySelectorAll("button");for(const t of c){const e=t.querySelector("i");l<parseInt(t.getAttribute("data-value"))?(e.classList.contains("fa-solid")&&e.classList.replace("fa-solid","fa-regular"),t.setAttribute("aria-pressed","false")):(e.classList.contains("fa-regular")&&e.classList.replace("fa-regular","fa-solid"),t.setAttribute("aria-pressed","true"))}})),o}constructor(t,e){this.#a=t,this.#r=e,"string"==typeof this.#a&&(this.#a=document.getElementById(this.#a)),this.#o=this.#a.parentNode,this.#i=this.#a.nextSibling,this.#l=parseInt(this.#a.max),this.#c=parseInt(this.#a.min),this.#d=parseInt(this.#a.defaultValue);const s=n.#u();for(let t=this.#c;t<this.#l;t++){const e=n.#h(t,t<this.#d);s.appendChild(e)}this.#a.style.display="none",this.#o.insertBefore(s,this.#i)}}class s{static#b='<div class="calendar">\n <div class="input-group">\n <input type="text" class="form-control" data-date="" disabled>\n <span class="input-group-text">\n <button type="button" class="btn btn-link"><i class="fa-regular fa-calendar"></i></button>\n </span>\n </div>\n <div class="form small hide" data-focus-date="">\n <div class="calendar-header d-flex justify-content-between mb-3">\n <button type="button" class="btn btn-light btn-sm text-start month fw-bold"></button>\n <div>\n <button type="button" class="btn btn-light btn-sm up"><i class="fa-solid fa-caret-up"></i></button>\n <button type="button" class="btn btn-light btn-sm down"><i class="fa-solid fa-caret-down"></i></button>\n </div>\n </div>\n <div class="calendar-body mb-2">\n <table class="table">\n <thead>\n <tr>\n <th scope="col">Sun</th>\n <th scope="col">Mon</th>\n <th scope="col">Tue</th>\n <th scope="col">Wed</th>\n <th scope="col">Thu</th>\n <th scope="col">Fri</th>\n <th scope="col">Sat</th>\n </tr>\n </thead>\n </table>\n <div class="calendar-date">\n <table class="table">\n <tbody>\n <tr>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n <div class="calendar-footer d-flex justify-content-between">\n <button type="button" class="btn btn-light btn-sm erase">삭제</button>\n <button type="button" class="btn btn-light btn-sm today">오늘</button>\n </div>\n </div>\n</div>';static#t=null;static#m=null;static{const t=new DOMParser;s.#b=t.parseFromString(s.#b,"text/html"),s.#t=s.#b.querySelector("div.calendar");const e=s.#t.querySelector("div.calendar-date"),n=e.querySelector("tr");s.#m=n.querySelector("td"),s.#m=s.#m.cloneNode(!0),n.remove()}static load(t){const e=document.querySelectorAll('input[type="date"].form-control');for(const n of e)new s(n,"function"==typeof t?t(n):t)}#a=null;#r=null;#o=null;#i=null;#p=null;#f=null;#g=null;#y=null;#w(){this.#g.classList.contains("show")?this.#g.classList.replace("show","hide"):this.#g.classList.add("hide"),t.children.remove(this.#y);const n=e.month.begin(new Date);this.#g.setAttribute("data-focus-date",n),e.week.begin(new Date(n)),this.#g.querySelector("div.calendar-header button.month").textContent=e.month.str(n)}#v(t,n,o,i=null){let a=new Date(t);for(let t=0;t<6;t++)if(n.querySelector(`tr[data-date="${a}"]`))a=e.next(a,7);else{const t=document.createElement("tr");t.setAttribute("data-date",a);for(let n=0;n<7;n++){const n=s.#m.cloneNode(!0),o=n.querySelector("button");o.appendChild(document.createTextNode(a.getDate()));const i=new Date(a);o.addEventListener("click",(t=>{this.#g.classList.contains("show")?this.#g.classList.replace("show","hide"):this.#g.classList.add("hide");const n=e.month.begin(new Date(i));this.#g.setAttribute("data-focus-date",n),this.#f.setAttribute("value",e.str(i)),this.#f.setAttribute("data-date",i),this.#a.setAttribute("value",e.str(i,"-"))})),t.appendChild(n),a=e.next(a)}n.insertBefore(t,i)}a=new Date(t);const r=new Date(this.#f.getAttribute("data-date"));for(let t=0;t<6;t++){let t=n.querySelector(`tr[data-date="${a}"]`).querySelector("td");for(let n=0;n<7;n++){const n=t.querySelector("button");n.classList.remove("active"),n.classList.remove("fw-bold"),a.getMonth()!==o?n.classList.contains("not-current")||n.classList.add("not-current"):(n.classList.contains("not-current")&&n.classList.remove("not-current"),e.equal(a,r)&&(n.classList.add("active"),n.classList.add("fw-bold"))),a=e.next(a),t=t.nextElementSibling}}}#S(t){t.scrollIntoView({behavior:"smooth"})}#D(t){const n=new Date(this.#g.getAttribute("data-focus-date")),s=e.month.previous(new Date(n)),o=e.week.begin(new Date(s)),i=e.week.begin(e.month.begin(new Date(n))),a=this.#y.querySelector(`tr[data-date="${i}"]`);this.#v(o,this.#y,s.getMonth(),a),this.#g.setAttribute("data-focus-date",s),this.#g.querySelector("div.calendar-header button.month").textContent=e.month.str(s),this.#S(this.#y.querySelector(`tr[data-date="${o}"]`))}#x(t){const n=new Date(this.#g.getAttribute("data-focus-date")),s=e.month.next(new Date(n)),o=e.week.begin(new Date(s)),i=e.next(new Date(o),42),a=this.#y.querySelector(`tr[data-date="${i}"]`);this.#v(o,this.#y,s.getMonth(),a),this.#g.setAttribute("data-focus-date",s),this.#g.querySelector("div.calendar-header button.month").textContent=e.month.str(s),this.#S(this.#y.querySelector(`tr[data-date="${o}"]`))}#L(){const t=this.#f.getBoundingClientRect();this.#g.style.top=`${t.top+t.height+window.scrollY+5}px`,this.#g.style.left=`${t.left+5}px`}#A(n){const o=e.month.begin(new Date(n)),i=e.week.begin(new Date(o));this.#p=s.#t.cloneNode(!0);const a=this.#p.querySelector("div.input-group button");this.#f=this.#p.querySelector("div.input-group input"),this.#g=this.#p.querySelector("div.form"),this.#y=this.#g.querySelector("div.form div.calendar-date tbody");for(const t of this.#a.attributes)this.#f.setAttribute(t.name,t.value);this.#f.setAttribute("type","text"),this.#f.removeAttribute("id"),this.#g.querySelector("div.calendar-header button.up").addEventListener("click",(t=>this.#D(t))),this.#g.querySelector("div.calendar-header button.down").addEventListener("click",(t=>this.#x(t))),this.#g.querySelector("div.calendar-header button.month").textContent=e.month.str(o),this.#g.querySelector("div.calendar-footer button.today").addEventListener("click",(t=>{const n=new Date,s=e.month.begin(new Date(n));this.#g.setAttribute("data-focus-date",s),this.#f.setAttribute("value",e.str(n)),this.#f.setAttribute("data-date",n),this.#a.setAttribute("value",e.str(n,"-")),this.#g.classList.contains("show")?this.#g.classList.replace("show","hide"):(this.#g.classList.replace("hide","show"),this.#L())})),this.#g.querySelector("div.calendar-footer button.erase").addEventListener("click",(t=>{const n=new Date,s=e.month.begin(new Date(n));this.#g.setAttribute("data-focus-date",s),this.#f.setAttribute("value",""),this.#f.setAttribute("data-date",""),this.#a.setAttribute("value",""),this.#g.classList.contains("show")?this.#g.classList.replace("show","hide"):(this.#g.classList.replace("hide","show"),this.#L())})),this.#g.setAttribute("data-focus-date",o),a.addEventListener("click",(n=>{if(this.#g.classList.contains("show")){this.#g.classList.replace("show","hide"),t.children.remove(this.#y);const n=e.month.begin(new Date);this.#g.setAttribute("data-focus-date",n),e.week.begin(new Date(n)),this.#g.querySelector("div.calendar-header button.month").textContent=e.month.str(n)}else if(this.#g.classList.contains("hide")){t.children.remove(this.#y);const n=new Date(this.#g.getAttribute("data-focus-date")),s=e.week.begin(new Date(n)),o=this.#y.querySelector(`tr[data-date="${s}"]`);this.#v(s,this.#y,n.getMonth(),o),this.#g.querySelector("div.calendar-header button.month").textContent=e.month.str(n),this.#g.classList.replace("hide","show"),this.#L()}})),this.#v(i,this.#y,o.getMonth()),this.#o.insertBefore(this.#p,this.#i)}constructor(t,e){this.#a=t,this.#r=e,"string"==typeof this.#a&&(this.#a=document.getElementById(this.#a)),this.#o=this.#a.parentNode,this.#i=this.#a.nextSibling;const n=this.#a.getAttribute("value")||this.#a.getAttribute("defaultValue");this.#A(n?new Date(n):new Date),this.#a.style.display="none"}}class o{static on(e,n){const s=document.getElementById(n);s.classList.contains("hide")?s.classList.replace("hide","show"):s.classList.add("show");const o=t.parent(e.target,"button").getBoundingClientRect();s.style.left=`${o.left}px`,s.style.top=o.top-o.height-16+"px"}static toggle(e,n){const s=document.getElementById(n);s.classList.contains("hide")?s.classList.replace("hide","show"):s.classList.contains("show")?s.classList.replace("show","hide"):s.classList.add("show");const o=t.parent(e.target,"button").getBoundingClientRect();s.style.left=`${o.left}px`,s.style.top=o.top+window.scrollY-o.height-16+"px"}}void 0===window.novemberizing?console.error("need to ..."):(console.log(1),void 0===window.novemberizing.bootstrap?window.novemberizing.bootstrap={Star:n,Date:s,popover:o}:(window.novemberizing.bootstrap.Star=n,window.novemberizing.bootstrap.Date=s,window.novemberizing.bootstrap.popover=o)); |
{ | ||
"name": "@novemberizing/bootstrap", | ||
"version": "0.0.18", | ||
"version": "0.0.19", | ||
"description": "novemberizing's bootstrap plugin", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
@@ -28,4 +28,4 @@ import novemberizing from "./novemberizing.js"; | ||
target.style.left = `${rect.left}px`; | ||
target.style.top = `${rect.top - rect.height - 16}px`; | ||
target.style.top = `${rect.top + window.scrollY - rect.height - 16}px`; | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56992