@geoblink/design-system
Version:
Geoblink Design System for Vue.js
1 lines • 10.4 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("lodash")):"function"==typeof define&&define.amd?define(["lodash"],t):"object"==typeof exports?exports["components/GeoCalendarNavigationYear"]=t(require("lodash")):e["components/GeoCalendarNavigationYear"]=t(e.lodash)}(window,function(e){return r={},t.m=n={"/Tr7":function(e,t,n){"use strict";function r(e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):("string"!=typeof e&&"[object String]"!==t||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"),console.warn((new Error).stack)),new Date(NaN))}n.d(t,"a",function(){return r})},"/h9T":function(e,t,n){"use strict";function r(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}n.d(t,"a",function(){return r})},"2Ktv":function(e,t,n){"use strict";t.a={props:{currentMonth:{type:Number,required:!0,validator:function(e){return 0<=e&&e<=11}},currentYear:{type:Number,required:!0},earliestDate:{type:Date,required:!1},latestDate:{type:Date,required:!1},locale:{type:Object,required:!1}}}},35:function(e,t,n){e.exports=n("guLF")},AF4N:function(e,t,n){"use strict";n.d(t,"a",function(){return a});var r=n("/Tr7");function a(e,t){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var n=Object(r.a)(e),a=Object(r.a)(t);return n.getFullYear()-a.getFullYear()}},"KHd+":function(e,t,n){"use strict";function r(e,t,n,r,a,i,o,u){var s,c="function"==typeof e?e.options:e;if(t&&(c.render=t,c.staticRenderFns=n,c._compiled=!0),r&&(c.functional=!0),i&&(c._scopeId="data-v-"+i),o?(s=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),a&&a.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(o)},c._ssrRegister=s):a&&(s=u?function(){a.call(this,this.$root.$options.shadowRoot)}:a),s)if(c.functional){c._injectStyles=s;var l=c.render;c.render=function(e,t){return s.call(t),l(e,t)}}else{var d=c.beforeCreate;c.beforeCreate=d?[].concat(d,s):[s]}return{exports:e,options:c}}n.d(t,"a",function(){return r})},M34a:function(e,t,n){"use strict";n.d(t,"a",function(){return a});var r=n("/Tr7");function a(e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var t=Object(r.a)(e);return t.setHours(0,0,0,0),t}},YLtl:function(t,n){t.exports=e},cnyc:function(e,t,n){"use strict";n.d(t,"a",function(){return a});var r=n("/Tr7");function a(e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");return Object(r.a)(e).getFullYear()}},d60l:function(e,t,n){"use strict";n.r(t),n.d(t,"PICKER_DATE_UNITS",function(){return i}),n.d(t,"GRANULARITY_IDS",function(){return o}),n.d(t,"YEAR_GRID_CONSTANTS",function(){return u}),n.d(t,"DAY_GRID_CONSTANTS",function(){return s}),n.d(t,"MONTH_GRID_CONSTANTS",function(){return c}),n.d(t,"FOCUSABLE_INPUT_FIELDS",function(){return l}),n.d(t,"isDayUnavailable",function(){return d}),n.d(t,"isBefore",function(){return f}),n.d(t,"isAfter",function(){return g}),n.d(t,"isEqual",function(){return p}),n.d(t,"isWithinInterval",function(){return h});var r=n("/Tr7"),a=n("M34a"),i={day:"day",month:"month",year:"year"},o={day:"day",week:"week",month:"month",quarter:"quarter",year:"year"},u={MAX_YEAR:2099,MIN_YEAR:1970,YEARS_IN_GRID:16},s={TOTAL_DAYS_IN_WEEK:7,MONDAY_INDEX_IN_WEEK:1},c={NUMBER_OF_MONTHS_IN_GREGORIAN_CALENDAR:12},l={FROM_DATE:"FROM_DATE",TO_DATE:"TO_DATE"},d=function(e,t){return f(t,e.earliestDate)||g(t,e.latestDate)},f=function(e,t){return function(e,t){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var n=Object(r.a)(e),a=Object(r.a)(t);return n.getTime()<a.getTime()}(Object(a.a)(e),Object(a.a)(t))},g=function(e,t){return function(e,t){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var n=Object(r.a)(e),a=Object(r.a)(t);return n.getTime()>a.getTime()}(Object(a.a)(e),Object(a.a)(t))},p=function(e,t){return function(e,t){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var n=Object(r.a)(e),a=Object(r.a)(t);return n.getTime()===a.getTime()}(Object(a.a)(e),Object(a.a)(t))},h=function(e,t){var n=t.start,i=t.end;return function(e,t){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var n=t||{},a=Object(r.a)(e).getTime(),i=Object(r.a)(n.start).getTime(),o=Object(r.a)(n.end).getTime();if(!(i<=o))throw new RangeError("Invalid interval");return i<=a&&a<=o}(Object(a.a)(e),{start:Object(a.a)(n),end:Object(a.a)(i)})}},dLU1:function(e,t,n){"use strict";n.d(t,"a",function(){return i});var r=n("/h9T"),a=n("/Tr7");function i(e,t){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var n=Object(a.a)(e),i=Object(r.a)(t),o=n.getMonth()+i,u=new Date(0);u.setFullYear(n.getFullYear(),o,1),u.setHours(0,0,0,0);var s=function(e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var t=Object(a.a)(e),n=t.getFullYear(),r=t.getMonth(),i=new Date(0);return i.setFullYear(n,r+1,0),i.setHours(0,0,0,0),i.getDate()}(u);return n.setMonth(o,Math.min(s,n.getDate())),n}},guLF:function(e,t,n){"use strict";n.r(t);var r=n("YLtl"),a=n.n(r),i=n("2Ktv"),o=n("AF4N"),u=n("cnyc"),s=n("sdC+"),c=n("zbbA"),l=n("d60l"),d={name:"GeoCalendarNavigationYear",status:"ready",release:"23.2.0",mixins:[i.a],props:{calendarNavigationSelectIcon:{type:Array,required:!0},currentInitialYearInRange:{type:Number,required:!0},currentEndYearInRange:{type:Number,required:!0},isDisabled:{type:Boolean,required:!0}},data:function(){return{isYearRangeSelectionOpened:!1,displayedInitialYearInRange:null,displayedEndYearInRange:null}},computed:{earliestDateInCalendar:function(){return this.earliestDate?Object(s.a)(this.earliestDate,l.YEAR_GRID_CONSTANTS.YEARS_IN_GRID):new Date(l.YEAR_GRID_CONSTANTS.MIN_YEAR,0)},latestDateInCalendar:function(){return this.latestDate?Object(c.a)(this.latestDate,l.YEAR_GRID_CONSTANTS.YEARS_IN_GRID):new Date(l.YEAR_GRID_CONSTANTS.MAX_YEAR,0)},numberOfYearsWithinConstraints:function(){return Object(o.a)(this.latestDateInCalendar,this.earliestDateInCalendar)},totalYearsGrid:function(){var e=Object(u.a)(this.earliestDateInCalendar);return a.a.chunk(a.a.times(this.numberOfYearsWithinConstraints,function(){return e++}),l.YEAR_GRID_CONSTANTS.YEARS_IN_GRID)},yearsInRanges:function(){return a.a.map(this.totalYearsGrid,function(e){return[a.a.first(e),a.a.last(e)]})},currentGridYearIndex:function(){var e=this;return a.a.findIndex(this.totalYearsGrid,function(t){return a.a.includes(t,e.currentInitialYearInRange||e.currentYear)})}},watch:{currentInitialYearInRange:function(e){this.displayedInitialYearInRange=e},currentEndYearInRange:function(e){this.displayedEndYearInRange=e}},mounted:function(){var e=this.yearsInRanges[this.currentGridYearIndex];this.displayedInitialYearInRange=e[0],this.displayedEndYearInRange=e[1],this.selectYearRange(e)},methods:{closeYearRangeSelection:function(){this.isYearRangeSelectionOpened=!1},selectYearRange:function(e){this.closeYearRangeSelection(),this.$emit("go-to-year-range",e)},toggleYearRangeSelection:function(){this.isDisabled||(this.isYearRangeSelectionOpened=!this.isYearRangeSelectionOpened)}}},f=n("KHd+"),g=Object(f.a)(d,function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"geo-calendar-navigation__selects-container geo-calendar-navigation--year"},[n("geo-select-base",{ref:"selectBase",attrs:{opened:e.isYearRangeSelectionOpened,"fixed-width":!1,"popup-class":"geo-calendar-navigation-selection","data-ut":"year-range-select"},on:{"click-outside":e.closeYearRangeSelection}},[n("geo-link-button",{attrs:{slot:"toggleButton"},on:{click:e.toggleYearRangeSelection},slot:"toggleButton"},[e._v("\n "+e._s(e.displayedInitialYearInRange)+" - "+e._s(e.displayedEndYearInRange)+"\n "),e.isDisabled?e._e():n("font-awesome-icon",{staticClass:"geo-calendar-navigation-toggle-button-icon",attrs:{"fixed-width":"",icon:e.calendarNavigationSelectIcon}})],1),e._v(" "),n("div",e._l(e.yearsInRanges,function(t){return n("geo-list-item",{key:t[0]+"--"+t[1],on:{click:function(n){return e.selectYearRange(t)}}},[e._v("\n "+e._s(t[0])+" - "+e._s(t[1])+"\n ")])}),1)],1)],1)},[],!1,null,null,null);t.default=g.exports},"sdC+":function(e,t,n){"use strict";n.d(t,"a",function(){return i});var r=n("/h9T"),a=n("zbbA");function i(e,t){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var n=Object(r.a)(t);return Object(a.a)(e,-n)}},zbbA:function(e,t,n){"use strict";n.d(t,"a",function(){return i});var r=n("/h9T"),a=n("dLU1");function i(e,t){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var n=Object(r.a)(t);return Object(a.a)(e,12*n)}}},t.c=r,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var a in e)t.d(r,a,function(t){return e[t]}.bind(null,a));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/",t(t.s=35);function t(e){if(r[e])return r[e].exports;var a=r[e]={i:e,l:!1,exports:{}};return n[e].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var n,r});