Skip to content

Commit 27f402e

Browse files
committed
feat(QDatetimePicker): RTL support
1 parent dfdabc8 commit 27f402e

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

src/components/datetime/QDatetimePicker.mat.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
dense
109109
flat
110110
class="q-datetime-arrow"
111-
:icon="$q.icon.datetime.arrowLeft"
111+
:icon="dateArrow[0]"
112112
:repeatTimeout="__repeatTimeout"
113113
:disable="beforeMinDays > 0 || disable || readonly"
114114
@click="setMonth(month - 1)"
@@ -121,7 +121,7 @@
121121
dense
122122
flat
123123
class="q-datetime-arrow"
124-
:icon="$q.icon.datetime.arrowRight"
124+
:icon="dateArrow[1]"
125125
:repeatTimeout="__repeatTimeout"
126126
:disable="afterMaxDays > 0 || disable || readonly"
127127
@click="setMonth(month + 1)"
@@ -287,6 +287,10 @@ export default {
287287
this.color && cls.push(`text-${this.color}`)
288288
return cls
289289
},
290+
dateArrow () {
291+
const val = [ this.$q.icon.datetime.arrowLeft, this.$q.icon.datetime.arrowRight ]
292+
return this.$q.i18n.rtl ? val.reverse() : val
293+
},
290294
computedFormat24h () {
291295
return this.format24h !== 0
292296
? this.format24h

src/components/datetime/datetime.ios.styl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
text-align right
2222
position relative
2323
padding 0
24+
direction ltr /* rtl:ignore */
2425

2526
.q-datetime-col
2627
display block
@@ -65,6 +66,9 @@
6566
backface-visibility hidden
6667
transform-origin center center -110px
6768

69+
[dir=rtl] .q-datetime-col-month .q-datetime-item
70+
padding-right 5px
71+
6872
.q-datetime-mask
6973
position absolute
7074
top 0

src/components/datetime/datetime.mat.styl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ div + .q-datetime-time
4444

4545
.q-datetime-clockstring
4646
font-size 2.7rem
47+
direction: ltr /* rtl:ignore */
4748

4849
.q-datetime-selector
4950
height 310px
@@ -179,7 +180,7 @@ body.desktop .q-datetime-dark .q-datetime-clock-position:not(.active):hover
179180
line-height 32px
180181
margin 0
181182
padding 0
182-
transform translate(-50%, -50%)
183+
transform translate(-50%, -50%) /* rtl:ignore */
183184
border-radius 50%
184185
&:not(.active)
185186
color black
@@ -194,13 +195,13 @@ for $pos in 0..12
194195
$degree = (270 + 30 * $pos)
195196
.q-datetime-clock-pos-{$pos}
196197
top round(((1 + sin($degree * 1deg)) * 100%) / 2, 2)
197-
left round(((1 + cos($degree * 1deg)) * 100%) / 2, 2)
198+
left round(((1 + cos($degree * 1deg)) * 100%) / 2, 2) /* rtl:ignore */
198199

199200
for $pos in 0..23
200201
$degree = (270 + 15 * $pos)
201202
.q-datetime-clock-pos-{$pos}.fmt24
202203
top round(((1 + sin($degree * 1deg)) * 100%) / 2, 2)
203-
left round(((1 + cos($degree * 1deg)) * 100%) / 2, 2)
204+
left round(((1 + cos($degree * 1deg)) * 100%) / 2, 2) /* rtl:ignore */
204205

205206
.q-datetime-range
206207
&.row

0 commit comments

Comments
 (0)