mirror of
https://github.com/tenrok/vue2-datepicker.git
synced 2026-06-23 15:40:35 +03:00
Merge pull request #525 from t-tomek/master
chore: rename t() to transtlateFn()
This commit is contained in:
@@ -125,7 +125,7 @@ export default {
|
|||||||
},
|
},
|
||||||
mixins: [emitter],
|
mixins: [emitter],
|
||||||
inject: {
|
inject: {
|
||||||
t: {
|
translateFn: {
|
||||||
default: () => getLocaleFieldValue,
|
default: () => getLocaleFieldValue,
|
||||||
},
|
},
|
||||||
prefixClass: {
|
prefixClass: {
|
||||||
@@ -207,9 +207,9 @@ export default {
|
|||||||
return this.panel === 'date';
|
return this.panel === 'date';
|
||||||
},
|
},
|
||||||
dateHeader() {
|
dateHeader() {
|
||||||
const monthBeforeYear = this.t('monthBeforeYear');
|
const monthBeforeYear = this.translateFn('monthBeforeYear');
|
||||||
const yearFormat = this.t('yearFormat');
|
const yearFormat = this.translateFn('yearFormat');
|
||||||
const monthFormat = this.t('monthFormat') || 'MMM';
|
const monthFormat = this.translateFn('monthFormat') || 'MMM';
|
||||||
const yearLabel = {
|
const yearLabel = {
|
||||||
panel: 'year',
|
panel: 'year',
|
||||||
label: this.formatDate(this.innerCalendar, yearFormat),
|
label: this.formatDate(this.innerCalendar, yearFormat),
|
||||||
@@ -235,7 +235,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
formatDate(date, fmt) {
|
formatDate(date, fmt) {
|
||||||
return format(date, fmt, { locale: this.t('formatLocale') });
|
return format(date, fmt, { locale: this.translateFn('formatLocale') });
|
||||||
},
|
},
|
||||||
initCalendar() {
|
initCalendar() {
|
||||||
let calendarDate = this.calendar;
|
let calendarDate = this.calendar;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ import { getLocaleFieldValue } from '../locale';
|
|||||||
export default {
|
export default {
|
||||||
name: 'TableDate',
|
name: 'TableDate',
|
||||||
inject: {
|
inject: {
|
||||||
t: {
|
translateFn: {
|
||||||
default: () => getLocaleFieldValue,
|
default: () => getLocaleFieldValue,
|
||||||
},
|
},
|
||||||
getWeek: {
|
getWeek: {
|
||||||
@@ -85,10 +85,10 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
firstDayOfWeek() {
|
firstDayOfWeek() {
|
||||||
return this.t('formatLocale.firstDayOfWeek') || 0;
|
return this.translateFn('formatLocale.firstDayOfWeek') || 0;
|
||||||
},
|
},
|
||||||
days() {
|
days() {
|
||||||
const days = this.t('days') || this.t('formatLocale.weekdaysMin');
|
const days = this.translateFn('days') || this.translateFn('formatLocale.weekdaysMin');
|
||||||
return days.concat(days).slice(this.firstDayOfWeek, this.firstDayOfWeek + 7);
|
return days.concat(days).slice(this.firstDayOfWeek, this.firstDayOfWeek + 7);
|
||||||
},
|
},
|
||||||
dates() {
|
dates() {
|
||||||
@@ -125,7 +125,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
formatDate(date, fmt) {
|
formatDate(date, fmt) {
|
||||||
return format(date, fmt, { locale: this.t('formatLocale') });
|
return format(date, fmt, { locale: this.translateFn('formatLocale') });
|
||||||
},
|
},
|
||||||
handleCellClick(evt) {
|
handleCellClick(evt) {
|
||||||
let { target } = evt;
|
let { target } = evt;
|
||||||
@@ -148,7 +148,7 @@ export default {
|
|||||||
const year = this.calendarYear;
|
const year = this.calendarYear;
|
||||||
const month = this.calendarMonth;
|
const month = this.calendarMonth;
|
||||||
const date = createDate(year, month, day);
|
const date = createDate(year, month, day);
|
||||||
return this.getWeek(date, this.t('formatLocale'));
|
return this.getWeek(date, this.translateFn('formatLocale'));
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import { getLocaleFieldValue } from '../locale';
|
|||||||
export default {
|
export default {
|
||||||
name: 'TableMonth',
|
name: 'TableMonth',
|
||||||
inject: {
|
inject: {
|
||||||
t: {
|
translateFn: {
|
||||||
default: () => getLocaleFieldValue,
|
default: () => getLocaleFieldValue,
|
||||||
},
|
},
|
||||||
prefixClass: {
|
prefixClass: {
|
||||||
@@ -38,7 +38,8 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
months() {
|
months() {
|
||||||
const monthsLocale = this.t('months') || this.t('formatLocale.monthsShort');
|
const monthsLocale =
|
||||||
|
this.translateFn('months') || this.translateFn('formatLocale.monthsShort');
|
||||||
const months = monthsLocale.map((text, month) => {
|
const months = monthsLocale.map((text, month) => {
|
||||||
return { text, month };
|
return { text, month };
|
||||||
});
|
});
|
||||||
|
|||||||
+1
-1
@@ -151,7 +151,7 @@ export default {
|
|||||||
},
|
},
|
||||||
provide() {
|
provide() {
|
||||||
return {
|
return {
|
||||||
t: this.getLocaleFieldValue,
|
translateFn: this.getLocaleFieldValue,
|
||||||
getWeek: this.getWeek,
|
getWeek: this.getWeek,
|
||||||
prefixClass: this.prefixClass,
|
prefixClass: this.prefixClass,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export default {
|
|||||||
name: 'ListOptions',
|
name: 'ListOptions',
|
||||||
components: { ScrollbarVertical },
|
components: { ScrollbarVertical },
|
||||||
inject: {
|
inject: {
|
||||||
t: {
|
translateFn: {
|
||||||
default: () => getLocaleFieldValue,
|
default: () => getLocaleFieldValue,
|
||||||
},
|
},
|
||||||
prefixClass: {
|
prefixClass: {
|
||||||
@@ -99,7 +99,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
formatDate(date, fmt) {
|
formatDate(date, fmt) {
|
||||||
return format(date, fmt, { locale: this.t('formatLocale') });
|
return format(date, fmt, { locale: this.translateFn('formatLocale') });
|
||||||
},
|
},
|
||||||
scrollToSelected() {
|
scrollToSelected() {
|
||||||
const element = this.$el.querySelector('.active');
|
const element = this.$el.querySelector('.active');
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export default {
|
|||||||
name: 'TimePanel',
|
name: 'TimePanel',
|
||||||
components: { ListColumns, ListOptions },
|
components: { ListColumns, ListOptions },
|
||||||
inject: {
|
inject: {
|
||||||
t: {
|
translateFn: {
|
||||||
default: () => getLocaleFieldValue,
|
default: () => getLocaleFieldValue,
|
||||||
},
|
},
|
||||||
prefixClass: {
|
prefixClass: {
|
||||||
@@ -149,7 +149,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
formatDate(date, fmt) {
|
formatDate(date, fmt) {
|
||||||
return format(date, fmt, { locale: this.t('formatLocale') });
|
return format(date, fmt, { locale: this.translateFn('formatLocale') });
|
||||||
},
|
},
|
||||||
isDisabled(date) {
|
isDisabled(date) {
|
||||||
return this.disabledTime(new Date(date));
|
return this.disabledTime(new Date(date));
|
||||||
|
|||||||
Reference in New Issue
Block a user