|
1 | 1 | <template> |
2 | | - <div class="vdp-datepicker" :class="wrapperClass"> |
| 2 | + <div class="vdp-datepicker" :class="['wrapperClass',isRtl ? 'rtl' : '']"> |
3 | 3 | <div :class="{'input-group' : bootstrapStyling}"> |
4 | 4 | <span class="vdp-datepicker__calendar-button" :class="{'input-group-addon' : bootstrapStyling}" v-if="calendarButton" @click="showCalendar"><i :class="calendarButtonIcon"><span v-if="calendarButtonIcon.length === 0">…</span></i></span> |
5 | 5 | <input |
|
21 | 21 | <div :class="[calendarClass, 'vdp-datepicker__calendar']" v-show="showDayView" v-bind:style="calendarStyle"> |
22 | 22 | <header> |
23 | 23 | <span |
24 | | - @click="previousMonth" |
| 24 | + @click="isRtl ? nextMonth() : previousMonth()" |
25 | 25 | class="prev" |
26 | | - v-bind:class="{ 'disabled' : previousMonthDisabled(pageDate) }"><</span> |
| 26 | + v-bind:class="{ 'disabled' : isRtl ? nextMonthDisabled(pageDate) : previousMonthDisabled(pageDate) }"><</span> |
27 | 27 | <span @click="showMonthCalendar" :class="!dayViewOnly ? 'up' : ''">{{ currMonthName }} {{ currYear }} |
28 | 28 | </span> |
29 | 29 | <span |
30 | | - @click="nextMonth" |
| 30 | + @click="isRtl ? previousMonth() : nextMonth()" |
31 | 31 | class="next" |
32 | | - v-bind:class="{ 'disabled' : nextMonthDisabled(pageDate) }">></span> |
| 32 | + v-bind:class="{ 'disabled' : isRtl ? previousMonthDisabled(pageDate) : nextMonthDisabled(pageDate) }">></span> |
33 | 33 | </header> |
34 | | - <span class="cell day-header" v-for="d in daysOfWeek">{{ d }}</span> |
35 | | - <span class="cell day blank" v-for="d in blankDays"></span><!-- |
36 | | - --><span class="cell day" |
37 | | - v-for="day in days" |
38 | | - track-by="timestamp" |
39 | | - v-bind:class="dayClasses(day)" |
40 | | - @click="selectDate(day)">{{ day.date }}</span> |
| 34 | + <div :class="isRtl ? 'flex-rtl' : ''"> |
| 35 | + <span class="cell day-header" v-for="d in daysOfWeek">{{ d }}</span> |
| 36 | + <span class="cell day blank" v-for="d in blankDays"></span><!-- |
| 37 | + --><span class="cell day" |
| 38 | + v-for="day in days" |
| 39 | + track-by="timestamp" |
| 40 | + v-bind:class="dayClasses(day)" |
| 41 | + @click="selectDate(day)">{{ day.date }}</span> |
| 42 | + </div> |
41 | 43 | </div> |
42 | 44 |
|
43 | 45 | <!-- Month View --> |
@@ -300,6 +302,10 @@ export default { |
300 | 302 | }, |
301 | 303 | isInline () { |
302 | 304 | return typeof this.inline !== 'undefined' && this.inline |
| 305 | + }, |
| 306 | + isRtl () { |
| 307 | + if (this.translation.rtl === true) return true |
| 308 | + return false |
303 | 309 | } |
304 | 310 | }, |
305 | 311 | methods: { |
@@ -835,6 +841,8 @@ export default { |
835 | 841 |
|
836 | 842 | $width = 300px |
837 | 843 |
|
| 844 | +.rtl |
| 845 | + direction:rtl |
838 | 846 | .vdp-datepicker |
839 | 847 | position relative |
840 | 848 | text-align left |
@@ -893,6 +901,10 @@ $width = 300px |
893 | 901 | .disabled |
894 | 902 | color #ddd |
895 | 903 | cursor default |
| 904 | + .flex-rtl |
| 905 | + display flex |
| 906 | + width inherit |
| 907 | + flex-wrap wrap |
896 | 908 |
|
897 | 909 | .cell |
898 | 910 | display inline-block |
|
0 commit comments