Skip to content

Commit

Permalink
vuetify version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
talal424 committed Jun 19, 2021
1 parent baa810a commit d6581b6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 20 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vuetify-umalqura",
"version": "0.0.5",
"version": "0.0.6",
"description": "a vuetify date picker for umalqura calendar",
"main": "dist/v-hijri-date-picker.esm.js",
"module": "dist/v-hijri-date-picker.esm.js",
Expand Down Expand Up @@ -40,7 +40,7 @@
},
"peerDependencies": {
"vue": "^2.6.11",
"vuetify": "^2.4.4",
"vuetify": "^2.5.4",
"@umalqura/core": "0.0.7"
}
}
18 changes: 9 additions & 9 deletions src/VHijriDatePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default {
data() {
const now = umalqura();
return {
activePicker: this.type.toUpperCase(),
internalActivePicker: this.type.toUpperCase(),
inputDay: null,
inputMonth: null,
inputYear: null,
Expand Down Expand Up @@ -116,7 +116,7 @@ export default {
this.tableDate = `${value}-${pad(this.tableMonth || 1)}`;
}

this.activePicker = 'MONTH';
this.internalActivePicker = 'MONTH';

if (this.reactive && !this.readonly && !this.isMultiple && this.isDateAllowed(this.inputDate)) {
this.$emit('input', this.inputDate);
Expand All @@ -133,7 +133,7 @@ export default {
}

this.tableDate = value;
this.activePicker = 'DATE';
this.internalActivePicker = 'DATE';

if (this.reactive && !this.readonly && !this.isMultiple && this.isDateAllowed(this.inputDate)) {
this.$emit('input', this.inputDate);
Expand All @@ -160,16 +160,16 @@ export default {
format: this.headerDateFormat,
light: this.light,
locale: this.locale,
min: this.activePicker === 'DATE' ? this.minMonth : this.minYear,
max: this.activePicker === 'DATE' ? this.maxMonth : this.maxYear,
nextAriaLabel: this.activePicker === 'DATE' ? this.nextMonthAriaLabel : this.nextYearAriaLabel,
prevAriaLabel: this.activePicker === 'DATE' ? this.prevMonthAriaLabel : this.prevYearAriaLabel,
min: this.internalActivePicker === 'DATE' ? this.minMonth : this.minYear,
max: this.internalActivePicker === 'DATE' ? this.maxMonth : this.maxYear,
nextAriaLabel: this.internalActivePicker === 'DATE' ? this.nextMonthAriaLabel : this.nextYearAriaLabel,
prevAriaLabel: this.internalActivePicker === 'DATE' ? this.prevMonthAriaLabel : this.prevYearAriaLabel,
prevIcon: this.prevIcon,
readonly: this.readonly,
value: this.activePicker === 'DATE' ? `${pad(this.tableYear, 4)}-${pad(this.tableMonth)}` : `${pad(this.tableYear, 4)}`
value: this.internalActivePicker === 'DATE' ? `${pad(this.tableYear, 4)}-${pad(this.tableMonth)}` : `${pad(this.tableYear, 4)}`
},
on: {
toggle: () => this.activePicker = this.activePicker === 'DATE' ? 'MONTH' : 'YEAR',
toggle: () => this.internalActivePicker = this.internalActivePicker === 'DATE' ? 'MONTH' : 'YEAR',
input: value => this.tableDate = value
}
});
Expand Down
7 changes: 4 additions & 3 deletions src/VHijriDatePickerDateTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default {
const prevMonthYear = this.displayedMonth === 1 ? this.displayedYear - 1 : this.displayedYear;
const prevMonth = this.displayedMonth === 1 ? 12 : this.displayedMonth - 1;
const firstDayFromPreviousMonth = daysInMonth(prevMonthYear, prevMonth);
const cellsInRow = this.showWeek ? 8 : 7

while (day--) {
const date = `${prevMonthYear}-${pad(prevMonth)}-${pad(firstDayFromPreviousMonth - day)}`;
Expand All @@ -42,11 +43,11 @@ export default {
const date = `${this.displayedYear}-${pad(this.displayedMonth)}-${pad(day)}`;
rows.push(this.$createElement('td', [this.genButton(date, true, 'date', this.formatter)]));

if (rows.length % (this.showWeek ? 8 : 7) === 0) {
if (rows.length % cellsInRow === 0) {
children.push(this.genTR(rows));
rows = [];

if (this.showWeek && day < daysInCurrentMonth) {
if (this.showWeek && (day < daysInCurrentMonth || this.showAdjacentMonths)) {
rows.push(this.genWeekNumber(this.getWeekNumber((day + 7) > daysInCurrentMonth ? daysInCurrentMonth : (day + 7))));
}
}
Expand All @@ -56,7 +57,7 @@ export default {
const nextMonth = this.displayedMonth === 12 ? 1 : this.displayedMonth + 1;
let nextMonthDay = 1;

while (rows.length < 7) {
while (rows.length < cellsInRow) {
const date = `${nextMonthYear}-${pad(nextMonth)}-${pad(nextMonthDay++)}`;
rows.push(this.$createElement('td', this.showAdjacentMonths ? [this.genButton(date, true, 'date', this.formatter, true)] : []));
}
Expand Down
10 changes: 4 additions & 6 deletions src/util/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { createItemTypeListeners, pad } from 'vuetify/lib/components/VDatePicker/util';
export { createItemTypeListeners, pad } from 'vuetify/lib/components/VDatePicker/util';

import isDateAllowed from 'vuetify/lib/components/VDatePicker/util/isDateAllowed';
export { default as isDateAllowed } from 'vuetify/lib/components/VDatePicker/util/isDateAllowed';

import { wrapInArray } from 'vuetify/lib/util/helpers';
export { wrapInArray } from 'vuetify/lib/util/helpers';

import { daysInMonth, firstDayOfTheMonth, weekOfYear, createFormatter } from './dateTimeUtils';

export { createFormatter, pad, createItemTypeListeners, isDateAllowed, daysInMonth, firstDayOfTheMonth, weekOfYear, wrapInArray };
export { daysInMonth, firstDayOfTheMonth, weekOfYear, createFormatter } from './dateTimeUtils';

0 comments on commit d6581b6

Please sign in to comment.