@geoblink/design-system
Version:
Geoblink Design System for Vue.js
1 lines • 13.8 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["components/GeoCalendarPicker"]=t():e["components/GeoCalendarPicker"]=t()}(window,function(){return r={},e.m=t={"/Tr7":function(e,t,r){"use strict";function n(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))}r.d(t,"a",function(){return n})},"/h9T":function(e,t,r){"use strict";function n(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)}r.d(t,"a",function(){return n})},"2Ktv":function(e,t,r){"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,r){e.exports=r("7f9a")},"7f9a":function(e,t,r){"use strict";r.r(t);var n=r("d60l"),a=r("2Ktv"),i=r("qSxj"),o=r("m9Aq"),c=r("dLU1"),u=r("zbbA"),s=r("cHAT"),l=r("cnyc"),d=r("/h9T"),f=r("sdC+"),h={name:"GeoCalendarPicker",status:"ready",release:"23.2.0",mixins:[a.a,i.a,o.a],props:{calendarNavigationSelectIcon:{type:Array,required:!0},currentInitialYearInRange:{type:Number,required:!0},currentEndYearInRange:{type:Number,required:!0},nextDateInSelectedGranularityIcon:{type:Array,required:!0},previousDateInSelectedGranularityIcon:{type:Array,required:!0},selectedFromDay:{type:Date,required:!1},selectedToDay:{type:Date,required:!1}},computed:{currentDate:function(){return new Date(this.currentYear,this.currentMonth)},canSelectNextDates:function(){if(!this.latestDate)return!0;switch(this.pickerDateUnit){case n.PICKER_DATE_UNITS.day:case n.PICKER_DATE_UNITS.month:return Object(n.isBefore)(Object(c.a)(new Date(this.currentYear,this.currentMonth),1),this.latestDate);case n.PICKER_DATE_UNITS.year:return Object(n.isBefore)(new Date(this.currentEndYearInRange,this.currentMonth),this.latestDate);default:throw new Error("Unknown pickerDateUnit «".concat(this.pickerDateUnit,"»"))}},canSelectPastDates:function(){if(!this.earliestDate)return!0;switch(this.pickerDateUnit){case n.PICKER_DATE_UNITS.day:case n.PICKER_DATE_UNITS.month:return Object(n.isAfter)(new Date(this.currentYear,this.currentMonth),this.earliestDate);case n.PICKER_DATE_UNITS.year:return Object(n.isAfter)(Object(f.a)(new Date(this.currentInitialYearInRange,this.currentMonth),1),this.earliestDate);default:throw new Error("Unknown pickerDateUnit «".concat(this.pickerDateUnit,"»"))}}},methods:{goToNextPickerDate:function(){if(this.canSelectNextDates)switch(this.pickerDateUnit){case n.PICKER_DATE_UNITS.day:if(11===this.currentMonth){var e=Object(l.a)(Object(u.a)(this.currentDate,1));this.goToYear(e)}var t=Object(s.a)(Object(c.a)(this.currentDate,1));this.goToMonth(t);break;case n.PICKER_DATE_UNITS.month:var r=Object(l.a)(Object(u.a)(this.currentDate,1));this.goToYear(r);break;case n.PICKER_DATE_UNITS.year:var a=this.currentInitialYearInRange+n.YEAR_GRID_CONSTANTS.YEARS_IN_GRID,i=this.currentEndYearInRange+n.YEAR_GRID_CONSTANTS.YEARS_IN_GRID;if(a>Object(l.a)(this.latestDate))return;this.goToYearRange([a,i])}},goToPreviousPickerDate:function(){if(this.canSelectPastDates)switch(this.pickerDateUnit){case n.PICKER_DATE_UNITS.day:if(0===this.currentMonth){var e=Object(l.a)(Object(f.a)(this.currentDate,1));this.goToYear(e)}var t=Object(s.a)(function(e,t){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(d.a)(t);return Object(c.a)(e,-r)}(this.currentDate,1));this.goToMonth(t);break;case n.PICKER_DATE_UNITS.month:var r=Object(l.a)(Object(f.a)(this.currentDate,1));this.goToYear(r);break;case n.PICKER_DATE_UNITS.year:var a=this.currentInitialYearInRange-n.YEAR_GRID_CONSTANTS.YEARS_IN_GRID,i=this.currentEndYearInRange-n.YEAR_GRID_CONSTANTS.YEARS_IN_GRID;if(i<Object(l.a)(this.earliestDate))return;this.goToYearRange([a,i])}},goToMonth:function(e){this.$emit("go-to-month",e)},goToYear:function(e){this.$emit("go-to-year",e)},goToYearRange:function(e){this.$emit("go-to-year-range",e)},selectDay:function(e){this.$emit("select-day",e)},selectMonth:function(e){this.$emit("select-month",e)},selectQuarter:function(e){this.$emit("select-quarter",e)},selectWeek:function(e){var t=e.fromDate,r=e.toDate;this.$emit("select-week",{fromDate:t,toDate:r})},selectYear:function(e){this.$emit("select-year",e)},emitDayUnitMouseover:function(e){this.$emit("day-unit-mouseover",e)},emitMonthUnitMouseover:function(e){this.$emit("month-unit-mouseover",e)},emitYearUnitMouseover:function(e){this.$emit("year-unit-mouseover",e)}}},p=r("KHd+"),g=Object(p.a)(h,function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"geo-calendar-picker"},[r("geo-calendar-navigation",{ref:"calendarNavigationWrapper",attrs:{"calendar-navigation-select-icon":e.calendarNavigationSelectIcon,"current-month":e.currentMonth,"current-year":e.currentYear,"current-initial-year-in-range":e.currentInitialYearInRange,"current-end-year-in-range":e.currentEndYearInRange,"earliest-date":e.earliestDate,"is-next-picker-date-selector-disabled":!e.canSelectNextDates,"is-previous-picker-date-selector-disabled":!e.canSelectPastDates,"latest-date":e.latestDate,locale:e.locale,"next-date-in-selected-granularity-icon":e.nextDateInSelectedGranularityIcon,"picker-date-unit":e.pickerDateUnit,"previous-date-in-selected-granularity-icon":e.previousDateInSelectedGranularityIcon},on:{"go-to-next-picker-date":e.goToNextPickerDate,"go-to-previous-picker-date":e.goToPreviousPickerDate,"go-to-month":e.goToMonth,"go-to-year":e.goToYear,"go-to-year-range":e.goToYearRange}}),e._v(" "),r("geo-calendar-grid",{attrs:{"current-month":e.currentMonth,"current-year":e.currentYear,"current-initial-year-in-range":e.currentInitialYearInRange,"current-end-year-in-range":e.currentEndYearInRange,"earliest-date":e.earliestDate,"granularity-id":e.granularityId,"latest-date":e.latestDate,locale:e.locale,"picker-date-unit":e.pickerDateUnit,"selected-from-day":e.selectedFromDay,"selected-to-day":e.selectedToDay},on:{"select-day":function(t){return e.selectDay(t)},"select-week":function(t){return e.selectWeek(t)},"select-month":e.selectMonth,"select-quarter":function(t){return e.selectQuarter(t)},"select-year":function(t){return e.selectYear(t)},"day-unit-mouseover":function(t){return e.emitDayUnitMouseover(t)},"month-unit-mouseover":function(t){return e.emitMonthUnitMouseover(t)},"year-unit-mouseover":function(t){return e.emitYearUnitMouseover(t)}}})],1)},[],!1,null,null,null);t.default=g.exports},"KHd+":function(e,t,r){"use strict";function n(e,t,r,n,a,i,o,c){var u,s="function"==typeof e?e.options:e;if(t&&(s.render=t,s.staticRenderFns=r,s._compiled=!0),n&&(s.functional=!0),i&&(s._scopeId="data-v-"+i),o?(u=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)},s._ssrRegister=u):a&&(u=c?function(){a.call(this,this.$root.$options.shadowRoot)}:a),u)if(s.functional){s._injectStyles=u;var l=s.render;s.render=function(e,t){return u.call(t),l(e,t)}}else{var d=s.beforeCreate;s.beforeCreate=d?[].concat(d,u):[u]}return{exports:e,options:s}}r.d(t,"a",function(){return n})},M34a:function(e,t,r){"use strict";r.d(t,"a",function(){return a});var n=r("/Tr7");function a(e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var t=Object(n.a)(e);return t.setHours(0,0,0,0),t}},cHAT:function(e,t,r){"use strict";r.d(t,"a",function(){return a});var n=r("/Tr7");function a(e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");return Object(n.a)(e).getMonth()}},cnyc:function(e,t,r){"use strict";r.d(t,"a",function(){return a});var n=r("/Tr7");function a(e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");return Object(n.a)(e).getFullYear()}},d60l:function(e,t,r){"use strict";r.r(t),r.d(t,"PICKER_DATE_UNITS",function(){return i}),r.d(t,"GRANULARITY_IDS",function(){return o}),r.d(t,"YEAR_GRID_CONSTANTS",function(){return c}),r.d(t,"DAY_GRID_CONSTANTS",function(){return u}),r.d(t,"MONTH_GRID_CONSTANTS",function(){return s}),r.d(t,"FOCUSABLE_INPUT_FIELDS",function(){return l}),r.d(t,"isDayUnavailable",function(){return d}),r.d(t,"isBefore",function(){return f}),r.d(t,"isAfter",function(){return h}),r.d(t,"isEqual",function(){return p}),r.d(t,"isWithinInterval",function(){return g});var n=r("/Tr7"),a=r("M34a"),i={day:"day",month:"month",year:"year"},o={day:"day",week:"week",month:"month",quarter:"quarter",year:"year"},c={MAX_YEAR:2099,MIN_YEAR:1970,YEARS_IN_GRID:16},u={TOTAL_DAYS_IN_WEEK:7,MONDAY_INDEX_IN_WEEK:1},s={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)||h(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 r=Object(n.a)(e),a=Object(n.a)(t);return r.getTime()<a.getTime()}(Object(a.a)(e),Object(a.a)(t))},h=function(e,t){return function(e,t){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(n.a)(e),a=Object(n.a)(t);return r.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 r=Object(n.a)(e),a=Object(n.a)(t);return r.getTime()===a.getTime()}(Object(a.a)(e),Object(a.a)(t))},g=function(e,t){var r=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 r=t||{},a=Object(n.a)(e).getTime(),i=Object(n.a)(r.start).getTime(),o=Object(n.a)(r.end).getTime();if(!(i<=o))throw new RangeError("Invalid interval");return i<=a&&a<=o}(Object(a.a)(e),{start:Object(a.a)(r),end:Object(a.a)(i)})}},dLU1:function(e,t,r){"use strict";r.d(t,"a",function(){return i});var n=r("/h9T"),a=r("/Tr7");function i(e,t){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(a.a)(e),i=Object(n.a)(t),o=r.getMonth()+i,c=new Date(0);c.setFullYear(r.getFullYear(),o,1),c.setHours(0,0,0,0);var u=function(e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var t=Object(a.a)(e),r=t.getFullYear(),n=t.getMonth(),i=new Date(0);return i.setFullYear(r,n+1,0),i.setHours(0,0,0,0),i.getDate()}(c);return r.setMonth(o,Math.min(u,r.getDate())),r}},i4Qp:function(e,t,r){"use strict";function n(e){var t={type:String,validator:function(t){if(e.checkUndefined&&void 0===t)return!0;var r=Object.values(e.enumDictionary);if(r.includes(t))return!0;var n=r.map(function(e){return"«".concat(e,"»")}).join(", ");return console.warn("".concat(e.componentName," [component] :: Unsupported value («").concat(t,"») for «").concat(e.propertyName,"» property. Use one of ").concat(n)),!1}};return"defaultValue"in e&&(t.default=e.defaultValue),"required"in e&&(t.required=!!e.required),t}r.d(t,"a",function(){return n})},m9Aq:function(e,t,r){"use strict";var n=r("d60l"),a=r("i4Qp");t.a={props:{pickerDateUnit:Object(a.a)({componentName:"GeoCalendar",propertyName:"pickerDateUnit",enumDictionary:n.PICKER_DATE_UNITS,required:!0})}}},qSxj:function(e,t,r){"use strict";var n=r("d60l"),a=r("i4Qp");t.a={props:{granularityId:Object(a.a)({componentName:"GeoCalendarGranularityId",propertyName:"granularityId",enumDictionary:n.GRANULARITY_IDS,required:!0})}}},"sdC+":function(e,t,r){"use strict";r.d(t,"a",function(){return i});var n=r("/h9T"),a=r("zbbA");function i(e,t){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(n.a)(t);return Object(a.a)(e,-r)}},zbbA:function(e,t,r){"use strict";r.d(t,"a",function(){return i});var n=r("/h9T"),a=r("dLU1");function i(e,t){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var r=Object(n.a)(t);return Object(a.a)(e,12*r)}}},e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var a in t)e.d(n,a,function(e){return t[e]}.bind(null,a));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},e.p="/",e(e.s=35);function e(n){if(r[n])return r[n].exports;var a=r[n]={i:n,l:!1,exports:{}};return t[n].call(a.exports,a,a.exports,e),a.l=!0,a.exports}var t,r});