@novemberizing/bootstrap
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -1,1 +0,1 @@ | ||
const t=(t,e)=>{for(;t&&t.nodeName&&t.nodeName.toLowerCase()!==e;)t=t.parentNode;return t},e=(t,e)=>{for(;t&&t.nodeName.toLowerCase()!==e;)t=t.previousElementSibling;return 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;#a=null;#r=null;#i=null;#l=null;#d=null;#c=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(s,o){const a=n.#e.cloneNode(!0);return a.setAttribute("data-value",s+1),a.setAttribute("aria-pressed",o),o?a.appendChild(n.#n.cloneNode(!0)):a.appendChild(n.#s.cloneNode(!0)),a.addEventListener("click",(n=>{const s=t(n.target,"button"),o=t(s,"p"),a=e(o,"input"),r=parseInt(s.getAttribute("data-value")),i=s.getAttribute("aria-pressed"),l=s.nextElementSibling;"true"===i?l&&"true"===l.getAttribute("aria-pressed")?a.setAttribute("value",r):a.setAttribute("value",r-1):a.setAttribute("value",r);const d=parseInt(a.getAttribute("value")),c=o.querySelectorAll("button");for(const t of c){const e=t.querySelector("i");d<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"))}})),a}constructor(t,e){this.#r=t,this.#i=e,"string"==typeof this.#r&&(this.#r=document.getElementById(this.#r)),this.#o=this.#r.parentNode,this.#a=this.#r.nextSibling,this.#l=parseInt(this.#r.max),this.#d=parseInt(this.#r.min),this.#c=parseInt(this.#r.defaultValue);const s=n.#u();for(let t=this.#d;t<this.#l;t++){const e=n.#h(t,t<this.#c);s.appendChild(e)}this.#r.style.display="none",this.#o.insertBefore(s,this.#a)}}const s={remove:t=>{for(;t.firstChild;)t.lastChild.remove()}},o=(t,e)=>t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate(),a=(t,e="/")=>{function n(t){return t<10?`0${t}`:t}return`${t.getFullYear()}${e}${n(t.getMonth()+1)}${e}${n(t.getDate())}`},r=(t,e=1)=>(t.setDate(t.getDate()+e),t),i={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)},l={begin:t=>(t.setDate(t.getDate()-t.getDay()),t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t)};class d{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;d.#b=t.parseFromString(d.#b,"text/html"),d.#t=d.#b.querySelector("div.calendar");const e=d.#t.querySelector("div.calendar-date"),n=e.querySelector("tr");d.#m=n.querySelector("td"),d.#m=d.#m.cloneNode(!0),n.remove()}static load(t){const e=document.querySelectorAll('input[type="date"].form-control');for(const n of e)new d(n,"function"==typeof t?t(n):t)}#r=null;#i=null;#o=null;#a=null;#p=null;#f=null;#y=null;#g=null;#v(){if(this.#y.classList.contains("show")){this.#y.classList.replace("show","hide");const t=new Date(this.#y.getAttribute("data-focus-date")),e=l.begin(new Date(t));this.#y.querySelector("div.calendar-header button.month").textContent=i.str(t),this.#w(this.#g.querySelector(`tr[data-date="${e}"]`))}else if(this.#y.classList.contains("hide")){s.remove(this.#g);const t=new Date(this.#y.getAttribute("data-focus-date")),e=l.begin(new Date(t)),n=this.#g.querySelector(`tr[data-date="${e}"]`);this.#S(e,this.#g,t.getMonth(),n),this.#y.querySelector("div.calendar-header button.month").textContent=i.str(t),this.#y.classList.replace("hide","show")}}#S(t,e,n,s=null){let l=new Date(t);for(let t=0;t<6;t++)if(e.querySelector(`tr[data-date="${l}"]`))l=r(l,7);else{const t=document.createElement("tr");t.setAttribute("data-date",l);for(let e=0;e<7;e++){const e=d.#m.cloneNode(!0),n=e.querySelector("button");n.appendChild(document.createTextNode(l.getDate()));const s=new Date(l);n.addEventListener("click",(t=>{this.#y.classList.contains("show")?this.#y.classList.replace("show","hide"):this.#y.classList.add("hide");const e=i.begin(new Date(s));this.#y.setAttribute("data-focus-date",e),this.#f.setAttribute("value",a(s)),this.#f.setAttribute("data-date",s),this.#r.setAttribute("value",a(s,"-"))})),t.appendChild(e),l=r(l)}e.insertBefore(t,s)}l=new Date(t);const c=new Date(this.#f.getAttribute("data-date"));for(let t=0;t<6;t++){let t=e.querySelector(`tr[data-date="${l}"]`).querySelector("td");for(let e=0;e<7;e++){const e=t.querySelector("button");e.classList.remove("active"),e.classList.remove("fw-bold"),l.getMonth()!==n?e.classList.contains("not-current")||e.classList.add("not-current"):(e.classList.contains("not-current")&&e.classList.remove("not-current"),o(l,c)&&(e.classList.add("active"),e.classList.add("fw-bold"))),l=r(l),t=t.nextElementSibling}}}#w(t){t.scrollIntoView({behavior:"smooth"})}#D(t){const e=new Date(this.#y.getAttribute("data-focus-date")),n=i.previous(new Date(e)),s=l.begin(new Date(n)),o=l.begin(i.begin(new Date(e))),a=this.#g.querySelector(`tr[data-date="${o}"]`);this.#S(s,this.#g,n.getMonth(),a),this.#y.setAttribute("data-focus-date",n),this.#y.querySelector("div.calendar-header button.month").textContent=i.str(n),this.#w(this.#g.querySelector(`tr[data-date="${s}"]`))}#A(t){const e=new Date(this.#y.getAttribute("data-focus-date")),n=i.next(new Date(e)),s=l.begin(new Date(n)),o=r(new Date(s),42),a=this.#g.querySelector(`tr[data-date="${o}"]`);this.#S(s,this.#g,n.getMonth(),a),this.#y.setAttribute("data-focus-date",n),this.#y.querySelector("div.calendar-header button.month").textContent=i.str(n),this.#w(this.#g.querySelector(`tr[data-date="${s}"]`))}#q(t){const e=i.begin(new Date(t)),n=l.begin(new Date(e));this.#p=d.#t.cloneNode(!0);const o=this.#p.querySelector("div.input-group button");this.#f=this.#p.querySelector("div.input-group input"),this.#y=this.#p.querySelector("div.form"),this.#g=this.#y.querySelector("div.form div.calendar-date tbody"),this.#y.querySelector("div.calendar-header button.up").addEventListener("click",(t=>this.#D(t))),this.#y.querySelector("div.calendar-header button.down").addEventListener("click",(t=>this.#A(t))),this.#y.querySelector("div.calendar-header button.month").textContent=i.str(e),this.#y.querySelector("div.calendar-footer button.today").addEventListener("click",(t=>{const e=new Date,n=i.begin(new Date(e));this.#y.setAttribute("data-focus-date",n),this.#f.setAttribute("value",a(e)),this.#f.setAttribute("data-date",e),this.#r.setAttribute("value",a(e,"-")),this.#y.classList.contains("show")?this.#y.classList.replace("show","hide"):this.#y.classList.replace("hide","show")})),this.#y.querySelector("div.calendar-footer button.erase").addEventListener("click",(t=>{const e=new Date,n=i.begin(new Date(e));this.#y.setAttribute("data-focus-date",n),this.#f.setAttribute("value",""),this.#f.setAttribute("data-date",""),this.#r.setAttribute("value",""),this.#y.classList.contains("show")?this.#y.classList.replace("show","hide"):this.#y.classList.replace("hide","show")})),this.#y.setAttribute("data-focus-date",e),o.addEventListener("click",(t=>{if(this.#y.classList.contains("show")){this.#y.classList.replace("show","hide"),s.remove(this.#g);const t=i.begin(new Date);this.#y.setAttribute("data-focus-date",t),l.begin(new Date(t)),this.#y.querySelector("div.calendar-header button.month").textContent=i.str(t)}else if(this.#y.classList.contains("hide")){s.remove(this.#g);const t=new Date(this.#y.getAttribute("data-focus-date")),e=l.begin(new Date(t)),n=this.#g.querySelector(`tr[data-date="${e}"]`);this.#S(e,this.#g,t.getMonth(),n),this.#y.querySelector("div.calendar-header button.month").textContent=i.str(t),this.#y.classList.replace("hide","show")}})),this.#S(n,this.#g,e.getMonth()),this.#o.insertBefore(this.#p,this.#a)}constructor(t,e){this.#r=t,this.#i=e,"string"==typeof this.#r&&(this.#r=document.getElementById(this.#r)),this.#o=this.#r.parentNode,this.#a=this.#r.nextSibling;const n=this.#r.getAttribute("value")||this.#r.getAttribute("defaultValue");this.#q(n?new Date(n):new Date),this.#r.style.display="none"}}void 0===window.novemberizing?console.error("need to ..."):(console.log(1),void 0===window.novemberizing.bootstrap?window.novemberizing.bootstrap={Star:n,Date:d}:(window.novemberizing.bootstrap.Star=n,window.novemberizing.bootstrap.Date=d)); | ||
const t=(t,e)=>{for(;t&&t.nodeName&&t.nodeName.toLowerCase()!==e;)t=t.parentNode;return t},e=(t,e)=>{for(;t&&t.nodeName.toLowerCase()!==e;)t=t.previousElementSibling;return 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;#a=null;#i=null;#r=null;#l=null;#d=null;#c=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(s,o){const a=n.#e.cloneNode(!0);return a.setAttribute("data-value",s+1),a.setAttribute("aria-pressed",o),o?a.appendChild(n.#n.cloneNode(!0)):a.appendChild(n.#s.cloneNode(!0)),a.addEventListener("click",(n=>{const s=t(n.target,"button"),o=t(s,"p"),a=e(o,"input"),i=parseInt(s.getAttribute("data-value")),r=s.getAttribute("aria-pressed"),l=s.nextElementSibling;"true"===r?l&&"true"===l.getAttribute("aria-pressed")?a.setAttribute("value",i):a.setAttribute("value",i-1):a.setAttribute("value",i);const d=parseInt(a.getAttribute("value")),c=o.querySelectorAll("button");for(const t of c){const e=t.querySelector("i");d<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"))}})),a}constructor(t,e){this.#i=t,this.#r=e,"string"==typeof this.#i&&(this.#i=document.getElementById(this.#i)),this.#o=this.#i.parentNode,this.#a=this.#i.nextSibling,this.#l=parseInt(this.#i.max),this.#d=parseInt(this.#i.min),this.#c=parseInt(this.#i.defaultValue);const s=n.#u();for(let t=this.#d;t<this.#l;t++){const e=n.#h(t,t<this.#c);s.appendChild(e)}this.#i.style.display="none",this.#o.insertBefore(s,this.#a)}}const s={remove:t=>{for(;t.firstChild;)t.lastChild.remove()}},o=(t,e)=>t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate(),a=(t,e="/")=>{function n(t){return t<10?`0${t}`:t}return`${t.getFullYear()}${e}${n(t.getMonth()+1)}${e}${n(t.getDate())}`},i=(t,e=1)=>(t.setDate(t.getDate()+e),t),r={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)},l={begin:t=>(t.setDate(t.getDate()-t.getDay()),t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t)};class d{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;d.#b=t.parseFromString(d.#b,"text/html"),d.#t=d.#b.querySelector("div.calendar");const e=d.#t.querySelector("div.calendar-date"),n=e.querySelector("tr");d.#m=n.querySelector("td"),d.#m=d.#m.cloneNode(!0),n.remove()}static load(t){const e=document.querySelectorAll('input[type="date"].form-control');for(const n of e)new d(n,"function"==typeof t?t(n):t)}#i=null;#r=null;#o=null;#a=null;#p=null;#f=null;#g=null;#y=null;#v(){this.#g.classList.contains("show")?this.#g.classList.replace("show","hide"):this.#g.classList.add("hide"),s.remove(this.#y);const t=r.begin(new Date);this.#g.setAttribute("data-focus-date",t),l.begin(new Date(t)),this.#g.querySelector("div.calendar-header button.month").textContent=r.str(t)}#w(t,e,n,s=null){let l=new Date(t);for(let t=0;t<6;t++)if(e.querySelector(`tr[data-date="${l}"]`))l=i(l,7);else{const t=document.createElement("tr");t.setAttribute("data-date",l);for(let e=0;e<7;e++){const e=d.#m.cloneNode(!0),n=e.querySelector("button");n.appendChild(document.createTextNode(l.getDate()));const s=new Date(l);n.addEventListener("click",(t=>{this.#g.classList.contains("show")?this.#g.classList.replace("show","hide"):this.#g.classList.add("hide");const e=r.begin(new Date(s));this.#g.setAttribute("data-focus-date",e),this.#f.setAttribute("value",a(s)),this.#f.setAttribute("data-date",s),this.#i.setAttribute("value",a(s,"-"))})),t.appendChild(e),l=i(l)}e.insertBefore(t,s)}l=new Date(t);const c=new Date(this.#f.getAttribute("data-date"));for(let t=0;t<6;t++){let t=e.querySelector(`tr[data-date="${l}"]`).querySelector("td");for(let e=0;e<7;e++){const e=t.querySelector("button");e.classList.remove("active"),e.classList.remove("fw-bold"),l.getMonth()!==n?e.classList.contains("not-current")||e.classList.add("not-current"):(e.classList.contains("not-current")&&e.classList.remove("not-current"),o(l,c)&&(e.classList.add("active"),e.classList.add("fw-bold"))),l=i(l),t=t.nextElementSibling}}}#S(t){t.scrollIntoView({behavior:"smooth"})}#D(t){const e=new Date(this.#g.getAttribute("data-focus-date")),n=r.previous(new Date(e)),s=l.begin(new Date(n)),o=l.begin(r.begin(new Date(e))),a=this.#y.querySelector(`tr[data-date="${o}"]`);this.#w(s,this.#y,n.getMonth(),a),this.#g.setAttribute("data-focus-date",n),this.#g.querySelector("div.calendar-header button.month").textContent=r.str(n),this.#S(this.#y.querySelector(`tr[data-date="${s}"]`))}#A(t){const e=new Date(this.#g.getAttribute("data-focus-date")),n=r.next(new Date(e)),s=l.begin(new Date(n)),o=i(new Date(s),42),a=this.#y.querySelector(`tr[data-date="${o}"]`);this.#w(s,this.#y,n.getMonth(),a),this.#g.setAttribute("data-focus-date",n),this.#g.querySelector("div.calendar-header button.month").textContent=r.str(n),this.#S(this.#y.querySelector(`tr[data-date="${s}"]`))}#L(){const t=this.#f.getBoundingClientRect();this.#g.style.top=`${t.top+t.height+5}px`,this.#g.style.left=`${t.left+5}px`}#q(t){const e=r.begin(new Date(t)),n=l.begin(new Date(e));this.#p=d.#t.cloneNode(!0);const o=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"),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.#A(t))),this.#g.querySelector("div.calendar-header button.month").textContent=r.str(e),this.#g.querySelector("div.calendar-footer button.today").addEventListener("click",(t=>{const e=new Date,n=r.begin(new Date(e));this.#g.setAttribute("data-focus-date",n),this.#f.setAttribute("value",a(e)),this.#f.setAttribute("data-date",e),this.#i.setAttribute("value",a(e,"-")),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 e=new Date,n=r.begin(new Date(e));this.#g.setAttribute("data-focus-date",n),this.#f.setAttribute("value",""),this.#f.setAttribute("data-date",""),this.#i.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",e),o.addEventListener("click",(t=>{if(this.#g.classList.contains("show")){this.#g.classList.replace("show","hide"),s.remove(this.#y);const t=r.begin(new Date);this.#g.setAttribute("data-focus-date",t),l.begin(new Date(t)),this.#g.querySelector("div.calendar-header button.month").textContent=r.str(t)}else if(this.#g.classList.contains("hide")){s.remove(this.#y);const t=new Date(this.#g.getAttribute("data-focus-date")),e=l.begin(new Date(t)),n=this.#y.querySelector(`tr[data-date="${e}"]`);this.#w(e,this.#y,t.getMonth(),n),this.#g.querySelector("div.calendar-header button.month").textContent=r.str(t),this.#g.classList.replace("hide","show"),this.#L()}})),this.#w(n,this.#y,e.getMonth()),this.#o.insertBefore(this.#p,this.#a)}constructor(t,e){this.#i=t,this.#r=e,"string"==typeof this.#i&&(this.#i=document.getElementById(this.#i)),this.#o=this.#i.parentNode,this.#a=this.#i.nextSibling;const n=this.#i.getAttribute("value")||this.#i.getAttribute("defaultValue");this.#q(n?new Date(n):new Date),this.#i.style.display="none"}}void 0===window.novemberizing?console.error("need to ..."):(console.log(1),void 0===window.novemberizing.bootstrap?window.novemberizing.bootstrap={Star:n,Date:d}:(window.novemberizing.bootstrap.Star=n,window.novemberizing.bootstrap.Date=d)); |
{ | ||
"name": "@novemberizing/bootstrap", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "novemberizing's bootstrap plugin", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
@@ -161,22 +161,14 @@ | ||
#toggle() { | ||
#hide() { | ||
if(this.#form.classList.contains("show")) { | ||
this.#form.classList.replace("show", "hide"); | ||
const focus = new Date(this.#form.getAttribute("data-focus-date")); | ||
const begin = novemberizing.date.week.begin(new Date(focus)); | ||
const title = this.#form.querySelector("div.calendar-header button.month"); | ||
title.textContent = novemberizing.date.month.str(focus); | ||
this.#scorll(this.#body.querySelector(`tr[data-date="${begin}"]`)); | ||
} else if(this.#form.classList.contains("hide")) { | ||
novemberizing.dom.children.remove(this.#body); | ||
const focus = new Date(this.#form.getAttribute("data-focus-date")); | ||
const begin = novemberizing.date.week.begin(new Date(focus)); | ||
const basis = this.#body.querySelector(`tr[data-date="${begin}"]`); | ||
this.#createDate(begin, this.#body, focus.getMonth(), basis); | ||
const title = this.#form.querySelector("div.calendar-header button.month"); | ||
title.textContent = novemberizing.date.month.str(focus); | ||
this.#form.classList.replace("hide", "show"); | ||
} else { | ||
this.#form.classList.add("hide"); | ||
} | ||
novemberizing.dom.children.remove(this.#body); | ||
const focus = novemberizing.date.month.begin(new Date()); | ||
this.#form.setAttribute("data-focus-date", focus); | ||
const begin = novemberizing.date.week.begin(new Date(focus)); | ||
const title = this.#form.querySelector("div.calendar-header button.month"); | ||
title.textContent = novemberizing.date.month.str(focus); | ||
} | ||
@@ -282,3 +274,8 @@ | ||
#position() { | ||
const rect = this.#input.getBoundingClientRect(); | ||
this.#form.style.top = `${rect.top + rect.height + 5}px`; | ||
this.#form.style.left = `${rect.left + 5}px`; | ||
} | ||
@@ -318,2 +315,3 @@ #create(date) { | ||
this.#form.classList.replace("hide", "show"); | ||
this.#position(); | ||
} | ||
@@ -334,2 +332,3 @@ }); | ||
this.#form.classList.replace("hide", "show"); | ||
this.#position(); | ||
} | ||
@@ -361,2 +360,3 @@ }); | ||
this.#form.classList.replace("hide", "show"); | ||
this.#position(); | ||
} | ||
@@ -363,0 +363,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
571
53277