@nrk/core-datepicker
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.coreDatepicker=t()}(this,function(){"use strict";var e="undefined"!=typeof window,t=(e&&/(android)/i.test(navigator.userAgent),e&&/iPad|iPhone|iPod/.test(String(navigator.platform)),function(e){void 0===e&&(e=!1);try{window.addEventListener("test",null,{get passive(){e=!0}})}catch(e){}return e}());function n(e,n,r,a){void 0===a&&(a=!1),"undefined"==typeof window||window[e=e+"-"+n]||(t||"object"!=typeof a||(a=Boolean(a.capture)),("resize"===n?window:document).addEventListener(window[e]=n,r,a))}var r={"&":"&","<":"<",">":">",'"':""","/":"/","'":"'"};function a(e){return String(e||"").replace(/[&<>"'/]/g,function(e){return r[e]})}var i="prevent_recursive_dispatch_maximum_callstack";function o(e,t){if(void 0===t&&(t=document),e){if(e.nodeType)return[e];if("string"==typeof e)return[].slice.call(t.querySelectorAll(e));if(e.length)return[].slice.call(e)}return[]}"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var u,d=(function(e,t){var n,r,a,i;e.exports=(n={year:"FullYear",month:"Month",week:"Date",day:"Date",hour:"Hours",minute:"Minutes",second:"Seconds"},r=/([+-]\s*\d+)\s*(second|minute|hour|day|week|month|year)|(mon)|(tue)|(wed)|(thu)|(fri)|(sat)|(sun)/g,a=/([-\dy]+)[-/.]([\dm]+)[-/.]([\dd]+)/,i=/([\dh]+):([\dm]+):?([\ds]+)?/,function(e,t){if(isFinite(e))return new Date(Number(e));var o=String(e).toLowerCase(),u=new Date(isFinite(t)&&-1===o.indexOf("now")?Number(t):Date.now()),d=o.match(a)||[],s=d[1];void 0===s&&(s="y");var c=d[2];void 0===c&&(c="m");var m=d[3];void 0===m&&(m="d");var l=o.match(i)||[],f=l[1];void 0===f&&(f="h");var h=l[2];void 0===h&&(h="m");var g=l[3];void 0===g&&(g="s");var p={year:s,month:c,day:m,hour:f,minute:h,second:g};Object.keys(p).forEach(function(e){var t="month"===e?1:0,r=""+(u["get"+n[e]]()+t);p[e]=p[e].replace(/[^-\d]+/g,function(e,t,n){return t?r.substr(r.length-n.length+t,e.length):r.substr(0,Math.max(0,r.length-n.length+e.length))})-t});var v=new Date(p.year,Math.min(12,p.month+1),0).getDate();for(u.setFullYear(p.year,Math.min(11,p.month),Math.max(1,Math.min(v,p.day))),u.setHours(Math.min(24,p.hour),Math.min(59,p.minute),Math.min(59,p.second));null!==(p=r.exec(o));){var y=p[2],b=String(p[1]).replace(/\s/g,"")*("week"===y?7:1),w=p.slice(2).indexOf(p[0]);y?u["set"+n[y]](u["get"+n[y]]()+b):u.setDate(u.getDate()-(u.getDay()||7)+w)}return u})}(u={exports:{}},u.exports),u.exports),s="data-@nrk/core-datepicker-1.0.0".replace(/\W+/g,"-"),c={33:"-1month",34:"+1month",35:"y-m-99",36:"y-m-1",37:"-1day",38:"-1week",39:"+1day",40:"+1week"},m={year:"*-m-d",month:"y-*-d",day:"y-m-*",hour:"*:m",minute:"h:*",second:"h:m:*",timestamp:"*"},l=6e4,f="data-core-datepicker",h=f+"-type";function g(e,t){return o(e).map(function(e){var n=d(e.getAttribute(s)||Date.now()),r=d(void 0===t?n:t,n),u=n.getTime()===r.getTime()||function(e,t,n){void 0===n&&(n={});var r,a=""+i+t;return!!e[a]||(e[a]=!0,"function"==typeof window.CustomEvent?r=new window.CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n}):(r=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,n),e.dispatchEvent(r),e[a]=null,!r.defaultPrevented)}(e,"datepicker.change",{prevDate:n,nextDate:r})?r:d(e.getAttribute(s)||Date.now()),c=new Date(u.getTime()-u.getTimezoneOffset()*l).toJSON().match(/\d+/g),m={year:u.getFullYear(),month:c[1],day:c[2],hour:c[3],minute:c[4],second:c[5],timestamp:u.getTime()};return e.setAttribute(s,m.timestamp),o("select",e).forEach(function(e){return function(e,t){e.firstElementChild||(e.innerHTML=g.months.map(function(e,t){return'<option value="y-'+(t+1)+'-d">'+a(e)+"</option>"}).join(""));o(e.children).forEach(function(e){e.selected=d(e.value,t).getTime()===t.getTime()})}(e,u)}),o("input",e).forEach(function(e){return function(e,t,n){var r=e.getAttribute(h)||e.getAttribute("type");"radio"===r||"checkbox"===r?e.checked=d(e.value,t).getTime()===t.getTime():n[r]&&(e.setAttribute("type","number"),e.setAttribute(h,r),e.value=n[r])}(e,u,m)}),o("table",e).forEach(function(e){return function(e,t){e.firstElementChild||(e.innerHTML="\n <caption></caption><thead><tr><th>"+g.days.map(a).join("</th><th>")+"</th></tr></thead>\n <tbody>"+Array(7).join("<tr>"+Array(8).join("<td><button></button></td>")+"</tr>")+"</tbody>");var n=t.getMonth(),r=(new Date).toJSON().slice(0,10),i=d("y-m-1 mon",t);e.caption.textContent=a(g.months[n])+", "+t.getFullYear(),o("button",e).forEach(function(e){var a=i.toJSON().slice(0,10)===r,o=i.getTime()===t.getTime(),u=i.getDate();e.textContent=u,e.value=i.getFullYear()+"-"+(i.getMonth()+1)+"-"+u,e.setAttribute("tabindex",o-1),e.setAttribute("aria-pressed",o),e.setAttribute("aria-current",a&&"date"),e.setAttribute("aria-disabled",n!==i.getMonth()),i.setDate(u+1)})}(e,u)}),e})}function p(e){for(var t=e.target,n=t;n;n=n.parentElement){var r=document.getElementById(n.getAttribute(f))||n,a=r.hasAttribute(s)&&(m[t.getAttribute(h)]||"*");if(a)return g(r,a.replace("*",t.value))}}return g.parse=d,g.months=["januar","februar","mars","april","mai","juni","juli","august","september","oktober","november","desember"],g.days=["man","tirs","ons","tors","fre","lør","søn"],n(s,"change",p),n(s,"click",function(e){for(var t=e.target;t;t=t.parentElement)if("BUTTON"===t.nodeName)return p({target:t})}),n(s,"keydown",function(e){if(!(e.ctrlKey||e.metaKey||e.shitKey||e.altKey)&&c[e.keyCode])for(var t=e.target,n=void 0;t;t=t.parentElement)if(n||"TABLE"!==t.nodeName||(n=t),n&&t.hasAttribute(s)){g(t,c[e.keyCode]),n.querySelector('[aria-pressed="true"]').focus(),e.preventDefault();break}}),g}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.coreDatepicker=t()}(this,function(){"use strict";var e="undefined"!=typeof window,t=(e&&/(android)/i.test(navigator.userAgent),e&&/iPad|iPhone|iPod/.test(String(navigator.platform)),function(e){void 0===e&&(e=!1);try{window.addEventListener("test",null,{get passive(){e=!0}})}catch(e){}return e}());function n(e,n,r,a){(void 0===a&&(a=!1),"undefined"==typeof window||window[e=e+"-"+n])||(t||"object"!=typeof a||(a=Boolean(a.capture)),("resize"===n||"load"===n?window:document).addEventListener(window[e]=n,r,a))}var r={"&":"&","<":"<",">":">",'"':""","/":"/","'":"'"};function a(e){return String(e||"").replace(/[&<>"'/]/g,function(e){return r[e]})}var i="prevent_recursive_dispatch_maximum_callstack";function o(e,t){if(void 0===t&&(t=document),e){if(e.nodeType)return[e];if("string"==typeof e)return[].slice.call(t.querySelectorAll(e));if(e.length)return[].slice.call(e)}return[]}"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var u,d=(function(e,t){var n,r,a,i;e.exports=(n={year:"FullYear",month:"Month",week:"Date",day:"Date",hour:"Hours",minute:"Minutes",second:"Seconds"},r=/([+-]\s*\d+)\s*(second|minute|hour|day|week|month|year)|(mon)|(tue)|(wed)|(thu)|(fri)|(sat)|(sun)/g,a=/([-\dy]+)[-/.]([\dm]+)[-/.]([\dd]+)/,i=/([\dh]+):([\dm]+):?([\ds]+)?/,function(e,t){if(isFinite(e))return new Date(Number(e));var o=String(e).toLowerCase(),u=new Date(isFinite(t)&&-1===o.indexOf("now")?Number(t):Date.now()),d=o.match(a)||[],s=d[1];void 0===s&&(s="y");var c=d[2];void 0===c&&(c="m");var m=d[3];void 0===m&&(m="d");var l=o.match(i)||[],f=l[1];void 0===f&&(f="h");var h=l[2];void 0===h&&(h="m");var g=l[3];void 0===g&&(g="s");var p={year:s,month:c,day:m,hour:f,minute:h,second:g};Object.keys(p).forEach(function(e){var t="month"===e?1:0,r=""+(u["get"+n[e]]()+t);p[e]=p[e].replace(/[^-\d]+/g,function(e,t,n){return t?r.substr(r.length-n.length+t,e.length):r.substr(0,Math.max(0,r.length-n.length+e.length))})-t});var v=new Date(p.year,Math.min(12,p.month+1),0).getDate();for(u.setFullYear(p.year,Math.min(11,p.month),Math.max(1,Math.min(v,p.day))),u.setHours(Math.min(24,p.hour),Math.min(59,p.minute),Math.min(59,p.second));null!==(p=r.exec(o));){var y=p[2],b=String(p[1]).replace(/\s/g,"")*("week"===y?7:1),w=p.slice(2).indexOf(p[0]);y?u["set"+n[y]](u["get"+n[y]]()+b):u.setDate(u.getDate()-(u.getDay()||7)+w)}return u})}(u={exports:{}},u.exports),u.exports),s="data-@nrk/core-datepicker-1.0.0".replace(/\W+/g,"-"),c={33:"-1month",34:"+1month",35:"y-m-99",36:"y-m-1",37:"-1day",38:"-1week",39:"+1day",40:"+1week"},m={year:"*-m-d",month:"y-*-d",day:"y-m-*",hour:"*:m",minute:"h:*",second:"h:m:*",timestamp:"*"},l=6e4,f="data-core-datepicker",h=f+"-type";function g(e,t){return o(e).map(function(e){var n=d(e.getAttribute(s)||Date.now()),r=d(void 0===t?n:t,n),u=n.getTime()===r.getTime()||function(e,t,n){void 0===n&&(n={});var r,a=""+i+t;if(e[a])return!0;e[a]=!0,"function"==typeof window.CustomEvent?r=new window.CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n}):(r=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,n);var o=e.dispatchEvent(r);return e[a]=null,o}(e,"datepicker.change",{prevDate:n,nextDate:r})?r:d(e.getAttribute(s)||Date.now()),c=new Date(u.getTime()-u.getTimezoneOffset()*l).toJSON().match(/\d+/g),m={year:u.getFullYear(),month:c[1],day:c[2],hour:c[3],minute:c[4],second:c[5],timestamp:u.getTime()};return e.setAttribute(s,m.timestamp),o("select",e).forEach(function(e){return function(e,t){e.firstElementChild||(e.innerHTML=g.months.map(function(e,t){return'<option value="y-'+(t+1)+'-d">'+a(e)+"</option>"}).join(""));o(e.children).forEach(function(e){e.selected=d(e.value,t).getTime()===t.getTime()})}(e,u)}),o("input",e).forEach(function(e){return function(e,t,n){var r=e.getAttribute(h)||e.getAttribute("type");"radio"===r||"checkbox"===r?e.checked=d(e.value,t).getTime()===t.getTime():n[r]&&(e.setAttribute("type","number"),e.setAttribute(h,r),e.value=n[r])}(e,u,m)}),o("table",e).forEach(function(e){return function(e,t){e.firstElementChild||(e.innerHTML="\n <caption></caption><thead><tr><th>"+g.days.map(a).join("</th><th>")+"</th></tr></thead>\n <tbody>"+Array(7).join("<tr>"+Array(8).join("<td><button></button></td>")+"</tr>")+"</tbody>");var n=t.getMonth(),r=(new Date).toJSON().slice(0,10),i=d("y-m-1 mon",t);e.caption.textContent=a(g.months[n])+", "+t.getFullYear(),o("button",e).forEach(function(e){var a=i.toJSON().slice(0,10)===r,o=i.getTime()===t.getTime(),u=i.getDate();e.textContent=u,e.value=i.getFullYear()+"-"+(i.getMonth()+1)+"-"+u,e.setAttribute("tabindex",o-1),e.setAttribute("aria-pressed",o),e.setAttribute("aria-current",a&&"date"),e.setAttribute("aria-disabled",n!==i.getMonth()),i.setDate(u+1)})}(e,u)}),e})}function p(e){for(var t=e.target,n=t;n;n=n.parentElement){var r=document.getElementById(n.getAttribute(f))||n,a=r.hasAttribute(s)&&(m[t.getAttribute(h)]||"*");if(a)return g(r,a.replace("*",t.value))}}return g.parse=d,g.months=["januar","februar","mars","april","mai","juni","juli","august","september","oktober","november","desember"],g.days=["man","tirs","ons","tors","fre","lør","søn"],n(s,"change",p),n(s,"click",function(e){for(var t=e.target;t;t=t.parentElement)if("BUTTON"===t.nodeName)return p({target:t})}),n(s,"keydown",function(e){if(!(e.ctrlKey||e.metaKey||e.shitKey||e.altKey)&&c[e.keyCode])for(var t=e.target,n=void 0;t;t=t.parentElement)if(n||"TABLE"!==t.nodeName||(n=t),n&&t.hasAttribute(s)){g(t,c[e.keyCode]),n.querySelector('[aria-pressed="true"]').focus(),e.preventDefault();break}}),g}); | ||
//# sourceMappingURL=core-datepicker.min.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):e.CoreDatepicker=t(e.React)}(this,function(e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var t="undefined"!=typeof window,n=(t&&/(android)/i.test(navigator.userAgent),t&&/iPad|iPhone|iPod/.test(String(navigator.platform)),function(e){void 0===e&&(e=!1);try{window.addEventListener("test",null,{get passive(){e=!0}})}catch(e){}return e}());function r(e,t,r,o){void 0===o&&(o=!1),"undefined"==typeof window||window[e=e+"-"+t]||(n||"object"!=typeof o||(o=Boolean(o.capture)),("resize"===t?window:document).addEventListener(window[e]=t,r,o))}var o={"&":"&","<":"<",">":">",'"':""","/":"/","'":"'"};function i(e){return String(e||"").replace(/[&<>"'/]/g,function(e){return o[e]})}var a="prevent_recursive_dispatch_maximum_callstack";function u(e,t){if(void 0===t&&(t=document),e){if(e.nodeType)return[e];if("string"==typeof e)return[].slice.call(t.querySelectorAll(e));if(e.length)return[].slice.call(e)}return[]}"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var d,s=(function(e,t){var n,r,o,i;e.exports=(n={year:"FullYear",month:"Month",week:"Date",day:"Date",hour:"Hours",minute:"Minutes",second:"Seconds"},r=/([+-]\s*\d+)\s*(second|minute|hour|day|week|month|year)|(mon)|(tue)|(wed)|(thu)|(fri)|(sat)|(sun)/g,o=/([-\dy]+)[-/.]([\dm]+)[-/.]([\dd]+)/,i=/([\dh]+):([\dm]+):?([\ds]+)?/,function(e,t){if(isFinite(e))return new Date(Number(e));var a=String(e).toLowerCase(),u=new Date(isFinite(t)&&-1===a.indexOf("now")?Number(t):Date.now()),d=a.match(o)||[],s=d[1];void 0===s&&(s="y");var c=d[2];void 0===c&&(c="m");var m=d[3];void 0===m&&(m="d");var l=a.match(i)||[],p=l[1];void 0===p&&(p="h");var h=l[2];void 0===h&&(h="m");var f=l[3];void 0===f&&(f="s");var y={year:s,month:c,day:m,hour:p,minute:h,second:f};Object.keys(y).forEach(function(e){var t="month"===e?1:0,r=""+(u["get"+n[e]]()+t);y[e]=y[e].replace(/[^-\d]+/g,function(e,t,n){return t?r.substr(r.length-n.length+t,e.length):r.substr(0,Math.max(0,r.length-n.length+e.length))})-t});var g=new Date(y.year,Math.min(12,y.month+1),0).getDate();for(u.setFullYear(y.year,Math.min(11,y.month),Math.max(1,Math.min(g,y.day))),u.setHours(Math.min(24,y.hour),Math.min(59,y.minute),Math.min(59,y.second));null!==(y=r.exec(a));){var v=y[2],b=String(y[1]).replace(/\s/g,"")*("week"===v?7:1),w=y.slice(2).indexOf(y[0]);v?u["set"+n[v]](u["get"+n[v]]()+b):u.setDate(u.getDate()-(u.getDay()||7)+w)}return u})}(d={exports:{}},d.exports),d.exports),c="data-@nrk/core-datepicker-1.0.0".replace(/\W+/g,"-"),m={33:"-1month",34:"+1month",35:"y-m-99",36:"y-m-1",37:"-1day",38:"-1week",39:"+1day",40:"+1week"},l={year:"*-m-d",month:"y-*-d",day:"y-m-*",hour:"*:m",minute:"h:*",second:"h:m:*",timestamp:"*"},p=6e4,h="data-core-datepicker",f=h+"-type";function y(e,t){return u(e).map(function(e){var n=s(e.getAttribute(c)||Date.now()),r=s(void 0===t?n:t,n),o=n.getTime()===r.getTime()||function(e,t,n){void 0===n&&(n={});var r,o=""+a+t;return!!e[o]||(e[o]=!0,"function"==typeof window.CustomEvent?r=new window.CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n}):(r=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,n),e.dispatchEvent(r),e[o]=null,!r.defaultPrevented)}(e,"datepicker.change",{prevDate:n,nextDate:r})?r:s(e.getAttribute(c)||Date.now()),d=new Date(o.getTime()-o.getTimezoneOffset()*p).toJSON().match(/\d+/g),m={year:o.getFullYear(),month:d[1],day:d[2],hour:d[3],minute:d[4],second:d[5],timestamp:o.getTime()};return e.setAttribute(c,m.timestamp),u("select",e).forEach(function(e){return function(e,t){e.firstElementChild||(e.innerHTML=y.months.map(function(e,t){return'<option value="y-'+(t+1)+'-d">'+i(e)+"</option>"}).join(""));u(e.children).forEach(function(e){e.selected=s(e.value,t).getTime()===t.getTime()})}(e,o)}),u("input",e).forEach(function(e){return function(e,t,n){var r=e.getAttribute(f)||e.getAttribute("type");"radio"===r||"checkbox"===r?e.checked=s(e.value,t).getTime()===t.getTime():n[r]&&(e.setAttribute("type","number"),e.setAttribute(f,r),e.value=n[r])}(e,o,m)}),u("table",e).forEach(function(e){return function(e,t){e.firstElementChild||(e.innerHTML="\n <caption></caption><thead><tr><th>"+y.days.map(i).join("</th><th>")+"</th></tr></thead>\n <tbody>"+Array(7).join("<tr>"+Array(8).join("<td><button></button></td>")+"</tr>")+"</tbody>");var n=t.getMonth(),r=(new Date).toJSON().slice(0,10),o=s("y-m-1 mon",t);e.caption.textContent=i(y.months[n])+", "+t.getFullYear(),u("button",e).forEach(function(e){var i=o.toJSON().slice(0,10)===r,a=o.getTime()===t.getTime(),u=o.getDate();e.textContent=u,e.value=o.getFullYear()+"-"+(o.getMonth()+1)+"-"+u,e.setAttribute("tabindex",a-1),e.setAttribute("aria-pressed",a),e.setAttribute("aria-current",i&&"date"),e.setAttribute("aria-disabled",n!==o.getMonth()),o.setDate(u+1)})}(e,o)}),e})}function g(e){for(var t=e.target,n=t;n;n=n.parentElement){var r=document.getElementById(n.getAttribute(h))||n,o=r.hasAttribute(c)&&(l[t.getAttribute(f)]||"*");if(o)return y(r,o.replace("*",t.value))}}y.parse=s,y.months=["januar","februar","mars","april","mai","juni","juli","august","september","oktober","november","desember"],y.days=["man","tirs","ons","tors","fre","lør","søn"],r(c,"change",g),r(c,"click",function(e){for(var t=e.target;t;t=t.parentElement)if("BUTTON"===t.nodeName)return g({target:t})}),r(c,"keydown",function(e){if(!(e.ctrlKey||e.metaKey||e.shitKey||e.altKey)&&m[e.keyCode])for(var t=e.target,n=void 0;t;t=t.parentElement)if(n||"TABLE"!==t.nodeName||(n=t),n&&t.hasAttribute(c)){y(t,m[e.keyCode]),n.querySelector('[aria-pressed="true"]').focus(),e.preventDefault();break}});var v={date:null,onChange:null},b=function(t){function n(){t.apply(this,arguments)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.componentDidMount=function(){this.el.addEventListener("datepicker.change",this.props.onChange),y(this.el,this.props.date)},n.prototype.componentDidUpdate=function(){y(this.el,this.props.date)},n.prototype.componentWillUnmount=function(){this.el.removeEventListener("datepicker.change",this.props.onChange)},n.prototype.render=function(){var t=this,n=function(e,t,n){return void 0===n&&(n={}),Object.keys(e).reduce(function(n,r){return t.hasOwnProperty(r)||(n[r]=e[r]),n},n)}(this.props,v,{ref:function(e){return t.el=e}});return e.createElement("div",n,this.props.children)},n}(e.Component);return b.parse=y.parse,b.months=y.months,b.days=y.days,b}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):e.CoreDatepicker=t(e.React)}(this,function(e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var t="undefined"!=typeof window,n=(t&&/(android)/i.test(navigator.userAgent),t&&/iPad|iPhone|iPod/.test(String(navigator.platform)),function(e){void 0===e&&(e=!1);try{window.addEventListener("test",null,{get passive(){e=!0}})}catch(e){}return e}());function r(e,t,r,o){(void 0===o&&(o=!1),"undefined"==typeof window||window[e=e+"-"+t])||(n||"object"!=typeof o||(o=Boolean(o.capture)),("resize"===t||"load"===t?window:document).addEventListener(window[e]=t,r,o))}var o={"&":"&","<":"<",">":">",'"':""","/":"/","'":"'"};function i(e){return String(e||"").replace(/[&<>"'/]/g,function(e){return o[e]})}var a="prevent_recursive_dispatch_maximum_callstack";function u(e,t){if(void 0===t&&(t=document),e){if(e.nodeType)return[e];if("string"==typeof e)return[].slice.call(t.querySelectorAll(e));if(e.length)return[].slice.call(e)}return[]}"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var d,s=(function(e,t){var n,r,o,i;e.exports=(n={year:"FullYear",month:"Month",week:"Date",day:"Date",hour:"Hours",minute:"Minutes",second:"Seconds"},r=/([+-]\s*\d+)\s*(second|minute|hour|day|week|month|year)|(mon)|(tue)|(wed)|(thu)|(fri)|(sat)|(sun)/g,o=/([-\dy]+)[-/.]([\dm]+)[-/.]([\dd]+)/,i=/([\dh]+):([\dm]+):?([\ds]+)?/,function(e,t){if(isFinite(e))return new Date(Number(e));var a=String(e).toLowerCase(),u=new Date(isFinite(t)&&-1===a.indexOf("now")?Number(t):Date.now()),d=a.match(o)||[],s=d[1];void 0===s&&(s="y");var c=d[2];void 0===c&&(c="m");var m=d[3];void 0===m&&(m="d");var l=a.match(i)||[],p=l[1];void 0===p&&(p="h");var h=l[2];void 0===h&&(h="m");var f=l[3];void 0===f&&(f="s");var y={year:s,month:c,day:m,hour:p,minute:h,second:f};Object.keys(y).forEach(function(e){var t="month"===e?1:0,r=""+(u["get"+n[e]]()+t);y[e]=y[e].replace(/[^-\d]+/g,function(e,t,n){return t?r.substr(r.length-n.length+t,e.length):r.substr(0,Math.max(0,r.length-n.length+e.length))})-t});var g=new Date(y.year,Math.min(12,y.month+1),0).getDate();for(u.setFullYear(y.year,Math.min(11,y.month),Math.max(1,Math.min(g,y.day))),u.setHours(Math.min(24,y.hour),Math.min(59,y.minute),Math.min(59,y.second));null!==(y=r.exec(a));){var v=y[2],b=String(y[1]).replace(/\s/g,"")*("week"===v?7:1),w=y.slice(2).indexOf(y[0]);v?u["set"+n[v]](u["get"+n[v]]()+b):u.setDate(u.getDate()-(u.getDay()||7)+w)}return u})}(d={exports:{}},d.exports),d.exports),c="data-@nrk/core-datepicker-1.0.0".replace(/\W+/g,"-"),m={33:"-1month",34:"+1month",35:"y-m-99",36:"y-m-1",37:"-1day",38:"-1week",39:"+1day",40:"+1week"},l={year:"*-m-d",month:"y-*-d",day:"y-m-*",hour:"*:m",minute:"h:*",second:"h:m:*",timestamp:"*"},p=6e4,h="data-core-datepicker",f=h+"-type";function y(e,t){return u(e).map(function(e){var n=s(e.getAttribute(c)||Date.now()),r=s(void 0===t?n:t,n),o=n.getTime()===r.getTime()||function(e,t,n){void 0===n&&(n={});var r,o=""+a+t;if(e[o])return!0;e[o]=!0,"function"==typeof window.CustomEvent?r=new window.CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n}):(r=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,n);var i=e.dispatchEvent(r);return e[o]=null,i}(e,"datepicker.change",{prevDate:n,nextDate:r})?r:s(e.getAttribute(c)||Date.now()),d=new Date(o.getTime()-o.getTimezoneOffset()*p).toJSON().match(/\d+/g),m={year:o.getFullYear(),month:d[1],day:d[2],hour:d[3],minute:d[4],second:d[5],timestamp:o.getTime()};return e.setAttribute(c,m.timestamp),u("select",e).forEach(function(e){return function(e,t){e.firstElementChild||(e.innerHTML=y.months.map(function(e,t){return'<option value="y-'+(t+1)+'-d">'+i(e)+"</option>"}).join(""));u(e.children).forEach(function(e){e.selected=s(e.value,t).getTime()===t.getTime()})}(e,o)}),u("input",e).forEach(function(e){return function(e,t,n){var r=e.getAttribute(f)||e.getAttribute("type");"radio"===r||"checkbox"===r?e.checked=s(e.value,t).getTime()===t.getTime():n[r]&&(e.setAttribute("type","number"),e.setAttribute(f,r),e.value=n[r])}(e,o,m)}),u("table",e).forEach(function(e){return function(e,t){e.firstElementChild||(e.innerHTML="\n <caption></caption><thead><tr><th>"+y.days.map(i).join("</th><th>")+"</th></tr></thead>\n <tbody>"+Array(7).join("<tr>"+Array(8).join("<td><button></button></td>")+"</tr>")+"</tbody>");var n=t.getMonth(),r=(new Date).toJSON().slice(0,10),o=s("y-m-1 mon",t);e.caption.textContent=i(y.months[n])+", "+t.getFullYear(),u("button",e).forEach(function(e){var i=o.toJSON().slice(0,10)===r,a=o.getTime()===t.getTime(),u=o.getDate();e.textContent=u,e.value=o.getFullYear()+"-"+(o.getMonth()+1)+"-"+u,e.setAttribute("tabindex",a-1),e.setAttribute("aria-pressed",a),e.setAttribute("aria-current",i&&"date"),e.setAttribute("aria-disabled",n!==o.getMonth()),o.setDate(u+1)})}(e,o)}),e})}function g(e){for(var t=e.target,n=t;n;n=n.parentElement){var r=document.getElementById(n.getAttribute(h))||n,o=r.hasAttribute(c)&&(l[t.getAttribute(f)]||"*");if(o)return y(r,o.replace("*",t.value))}}y.parse=s,y.months=["januar","februar","mars","april","mai","juni","juli","august","september","oktober","november","desember"],y.days=["man","tirs","ons","tors","fre","lør","søn"],r(c,"change",g),r(c,"click",function(e){for(var t=e.target;t;t=t.parentElement)if("BUTTON"===t.nodeName)return g({target:t})}),r(c,"keydown",function(e){if(!(e.ctrlKey||e.metaKey||e.shitKey||e.altKey)&&m[e.keyCode])for(var t=e.target,n=void 0;t;t=t.parentElement)if(n||"TABLE"!==t.nodeName||(n=t),n&&t.hasAttribute(c)){y(t,m[e.keyCode]),n.querySelector('[aria-pressed="true"]').focus(),e.preventDefault();break}});var v={date:null,onChange:null},b=function(t){function n(){t.apply(this,arguments)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.componentDidMount=function(){this.el.addEventListener("datepicker.change",this.props.onChange),y(this.el,this.props.date)},n.prototype.componentDidUpdate=function(){y(this.el,this.props.date)},n.prototype.componentWillUnmount=function(){this.el.removeEventListener("datepicker.change",this.props.onChange)},n.prototype.render=function(){var t=this,n=function(e,t,n){return void 0===n&&(n={}),Object.keys(e).reduce(function(n,r){return t.hasOwnProperty(r)||(n[r]=e[r]),n},n)}(this.props,v,{ref:function(e){return t.el=e}});return e.createElement("div",n,this.props.children)},n}(e.Component);return b.parse=y.parse,b.months=y.months,b.days=y.days,b}); | ||
//# sourceMappingURL=index.js.map |
@@ -5,3 +5,3 @@ { | ||
"author": "NRK <opensource@nrk.no> (https://www.nrk.no/)", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "main": "core-datepicker.min.js", |
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
85647