Skip to content

Commit

Permalink
Added change year list step
Browse files Browse the repository at this point in the history
  • Loading branch information
ManukMinasyan committed Aug 21, 2019
1 parent 7e6ca79 commit 7443184
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ ___
| isTypeable | Boolean | false | true | Enable manually date typing function, working only with prop isModal |
| changeMonthFunction | Boolean | false | true | Enable changed month with list, function |
| changeYearFunction | Boolean | false | true | Enable changed year with list, function |
| changeYearStep | Number | 12 | 6 | Change year list step count |
| applyStylesheet | Boolean | true | false | Disable default styles |
| markedDates | Array | [] | ['10/12/2018', '12/12/2018'] OR [{date: '10/1/2019', class: 'marked-class'},{date: '12/1/2019', class: 'marked-class-2'}] | Marked dates array |
| markedDateRange | Object | {start: false, end: false} | {start: '12/12/2018', end: '20/12/2018'} | Marked date with range |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"name": "vue-functional-calendar",
"description": "Lightweight, high-performance calendar component based on Vue.js",
"version": "2.5.8",
"version": "2.5.9",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion src/Demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
:disabled-dates="['10/10/2019']"
v-slot:default="props"
:is-auto-closeable="true"
:is-modal="true"
:is-modal="false"
:change-year-step="5"
>
<span style="text-align: center">
{{ props.day.day }}
Expand Down
11 changes: 8 additions & 3 deletions src/components/FunctionalCalendar.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<div :class="{'vfc-styles-conditional-class': fConfigs.applyStylesheet}">
<div class="vfc-multiple-input" :class="{'vfc-dark': fConfigs.isDark}" v-if="fConfigs.isModal && fConfigs.isDateRange">
<div class="vfc-multiple-input" :class="{'vfc-dark': fConfigs.isDark}"
v-if="fConfigs.isModal && fConfigs.isDateRange">
<input type="text" title="Start Date"
v-model="input.dateRange.start.date"
:placeholder="fConfigs.placeholder"
Expand Down Expand Up @@ -707,7 +708,9 @@
if (!this.allowPreDate)
return false;
this.calendar.currentDate = new Date(this.calendar.currentDate.getFullYear() - 1, this.calendar.currentDate.getMonth());
let step = this.showYearPicker ? this.fConfigs.changeYearStep : 1;
this.calendar.currentDate = new Date(this.calendar.currentDate.getFullYear() - step, this.calendar.currentDate.getMonth());
this.initCalendar();
this.$emit('changedYear', this.calendar.currentDate);
},
Expand All @@ -718,7 +721,9 @@
if (!this.allowNextDate)
return false;
this.calendar.currentDate = new Date(this.calendar.currentDate.getFullYear() + 1, this.calendar.currentDate.getMonth());
let step = this.showYearPicker ? this.fConfigs.changeYearStep : 1;
this.calendar.currentDate = new Date(this.calendar.currentDate.getFullYear() + step, this.calendar.currentDate.getMonth());
this.initCalendar();
this.$emit('changedYear', this.calendar.currentDate);
},
Expand Down
5 changes: 5 additions & 0 deletions src/mixins/propsAndData.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ export const propsAndData = {
type: Boolean,
default: () => false
},
changeYearStep: {
type: Number,
default: () => 12
},
applyStylesheet: {
type: Boolean,
default: () => true
Expand Down Expand Up @@ -182,6 +186,7 @@ export const propsAndData = {

changeMonthFunction: false,
changeYearFunction: false,
changeYearStep: 12,

applyStylesheet: true,

Expand Down

0 comments on commit 7443184

Please sign in to comment.