Adam Shaw 7 rokov pred
rodič
commit
057e120507

+ 1 - 0
src/agenda/TimeGrid.ts

@@ -219,6 +219,7 @@ export default class TimeGrid extends StandardDateComponent {
     this.dayTable = new DayTable(
       dateProfile,
       this.view.dateProfileGenerator,
+      this.isRtl,
       false
     )
 

+ 1 - 0
src/basic/DayGrid.ts

@@ -132,6 +132,7 @@ export default class DayGrid extends StandardDateComponent {
     this.dayTable = new DayTable(
       dateProfile,
       this.view.dateProfileGenerator,
+      this.isRtl,
       (this.props as any).breakOnWeeks // HACK
     )
 

+ 6 - 3
src/component/DayTable.ts

@@ -6,10 +6,11 @@ import DateProfileGenerator, { DateProfile } from 'src/DateProfileGenerator'
 computes date/index/cell information.
 doesn't do any rendering.
 */
-export default class DayTable { // TODO: rename file
+export default class DayTable {
 
   dayDates: DateMarker[] // whole-day dates for each column. left to right
   dayIndices: any // for each day from start, the offset
+  isRtl: boolean
   daysPerRow: any
   rowCnt: any
   colCnt: any
@@ -17,7 +18,7 @@ export default class DayTable { // TODO: rename file
 
   // Populates internal variables used for date calculation and rendering
   // breakOnWeeks - should create a new row for each week? not specified, so default is FALSY
-  constructor(dateProfile: DateProfile, dateProfileGenerator: DateProfileGenerator, breakOnWeeks: boolean) {
+  constructor(dateProfile: DateProfile, dateProfileGenerator: DateProfileGenerator, isRtl: boolean, breakOnWeeks: boolean) {
     let date: DateMarker = dateProfile.renderRange.start
     let end: DateMarker = dateProfile.renderRange.end
     let dayIndex = -1
@@ -27,6 +28,8 @@ export default class DayTable { // TODO: rename file
     let firstDay
     let rowCnt
 
+    this.isRtl = isRtl
+
     while (date < end) { // loop each day from start to end
       if (dateProfileGenerator.isHiddenDay(date)) {
         dayIndices.push(dayIndex + 0.5) // mark that it's between indices
@@ -89,7 +92,7 @@ export default class DayTable { // TODO: rename file
 
   // Returns the numner of day cells, chronologically, from the first cell in *any given row*
   getColDayIndex(col) {
-    if ((this as any).isRtl) {
+    if (this.isRtl) {
       return this.colCnt - 1 - col
     } else {
       return col