feat: remove localeCode
parent
889ae305df
commit
8e45eebea4
|
@ -1 +1 @@
|
|||
Subproject commit e705545e455dd81aef96dc293c84f303cff67b21
|
||||
Subproject commit b35f6ab6b59169fa7c0413263f75c185bd62b97c
|
|
@ -170,12 +170,9 @@ const Calendar = defineComponent({
|
|||
);
|
||||
},
|
||||
|
||||
renderCalendar(locale: any, localeCode: string) {
|
||||
renderCalendar(locale: any) {
|
||||
const props: any = { ...getOptionProps(this), ...this.$attrs };
|
||||
const { sValue: value, sMode: mode, $slots } = this;
|
||||
if (value && localeCode) {
|
||||
value.locale(localeCode);
|
||||
}
|
||||
const {
|
||||
prefixCls: customizePrefixCls,
|
||||
fullscreen,
|
||||
|
|
|
@ -59,22 +59,6 @@ function isEmptyArray(arr: any) {
|
|||
return false;
|
||||
}
|
||||
|
||||
function fixLocale(value: RangePickerValue | undefined, localeCode: string | undefined) {
|
||||
if (!localeCode) {
|
||||
return;
|
||||
}
|
||||
if (!value || value.length === 0) {
|
||||
return;
|
||||
}
|
||||
const [start, end] = value;
|
||||
if (start) {
|
||||
start.locale(localeCode);
|
||||
}
|
||||
if (end) {
|
||||
end.locale(localeCode);
|
||||
}
|
||||
}
|
||||
|
||||
export interface RangePickerState {
|
||||
sValue?: RangePickerValue;
|
||||
sShowDate?: RangePickerValue;
|
||||
|
@ -301,7 +285,6 @@ export default defineComponent({
|
|||
showToday,
|
||||
ranges,
|
||||
locale,
|
||||
localeCode,
|
||||
format,
|
||||
separator,
|
||||
inputReadOnly,
|
||||
|
@ -319,8 +302,6 @@ export default defineComponent({
|
|||
this.sTagPrefixCls = tagPrefixCls;
|
||||
|
||||
const dateRender = props.dateRender || $slots.dateRender;
|
||||
fixLocale(value, localeCode);
|
||||
fixLocale(showDate, localeCode);
|
||||
|
||||
const calendarClassName = classNames({
|
||||
[`${prefixCls}-time`]: showTime,
|
||||
|
|
|
@ -148,7 +148,6 @@ export default defineComponent({
|
|||
format,
|
||||
allowClear,
|
||||
locale,
|
||||
localeCode,
|
||||
disabledDate,
|
||||
defaultPickerValue,
|
||||
$data,
|
||||
|
@ -161,10 +160,6 @@ export default defineComponent({
|
|||
const { _value: pickerValue, _open: open } = $data;
|
||||
const { class: className, style, id, onFocus = noop, onBlur = noop } = props as any;
|
||||
|
||||
if (pickerValue && localeCode) {
|
||||
pickerValue.locale(localeCode);
|
||||
}
|
||||
|
||||
const placeholder = hasProp(this, 'placeholder') ? this.placeholder : locale.lang.placeholder;
|
||||
const weekDateRender = this.dateRender || $slots.dateRender || this.weekDateRender;
|
||||
const calendar = (
|
||||
|
|
|
@ -143,7 +143,7 @@ export default function createPicker<P>(
|
|||
suffixIcon = Array.isArray(suffixIcon) ? suffixIcon[0] : suffixIcon;
|
||||
const props: any = omit({ ...getOptionProps(this), ...this.$attrs }, ['onChange']);
|
||||
|
||||
const { prefixCls: customizePrefixCls, locale, localeCode, inputReadOnly } = props;
|
||||
const { prefixCls: customizePrefixCls, locale, inputReadOnly } = props;
|
||||
const getPrefixCls = this.configProvider.getPrefixCls;
|
||||
const prefixCls = getPrefixCls('calendar', customizePrefixCls);
|
||||
this.sPrefixCls = prefixCls;
|
||||
|
@ -159,10 +159,6 @@ export default function createPicker<P>(
|
|||
[`${prefixCls}-month`]: (MonthCalendar as any) === TheCalendar,
|
||||
});
|
||||
|
||||
if (value && localeCode) {
|
||||
value.locale(localeCode);
|
||||
}
|
||||
|
||||
const pickerProps: any = {};
|
||||
const calendarProps: any = {};
|
||||
const pickerStyle: CSSProperties = {};
|
||||
|
|
|
@ -157,7 +157,7 @@ export default function wrapPicker<P>(
|
|||
}
|
||||
},
|
||||
|
||||
renderPicker(locale: any, localeCode: string) {
|
||||
renderPicker(locale: any) {
|
||||
const props: any = { ...getOptionProps(this), ...this.$attrs };
|
||||
this.transformValue(props);
|
||||
const {
|
||||
|
@ -214,7 +214,6 @@ export default function wrapPicker<P>(
|
|||
pickerClass,
|
||||
pickerInputClass,
|
||||
locale,
|
||||
localeCode,
|
||||
timePicker,
|
||||
onOpenChange: this.handleOpenChange,
|
||||
onFocus: this.handleFocus,
|
||||
|
|
|
@ -45,27 +45,23 @@ const MonthCalendar = defineComponent({
|
|||
let value = stateValue;
|
||||
switch (keyCode) {
|
||||
case KeyCode.DOWN:
|
||||
value = stateValue.clone();
|
||||
value.add(3, 'months');
|
||||
value = stateValue.clone().add(3, 'months');
|
||||
break;
|
||||
case KeyCode.UP:
|
||||
value = stateValue.clone();
|
||||
value.add(-3, 'months');
|
||||
value = stateValue.clone().add(-3, 'months');
|
||||
break;
|
||||
case KeyCode.LEFT:
|
||||
value = stateValue.clone();
|
||||
if (ctrlKey) {
|
||||
value.add(-1, 'years');
|
||||
value = stateValue.clone().add(-1, 'years');
|
||||
} else {
|
||||
value.add(-1, 'months');
|
||||
value = stateValue.clone().add(-1, 'months');
|
||||
}
|
||||
break;
|
||||
case KeyCode.RIGHT:
|
||||
value = stateValue.clone();
|
||||
if (ctrlKey) {
|
||||
value.add(1, 'years');
|
||||
value = stateValue.clone().add(1, 'years');
|
||||
} else {
|
||||
value.add(1, 'months');
|
||||
value = stateValue.clone().add(1, 'months');
|
||||
}
|
||||
break;
|
||||
case KeyCode.ENTER:
|
||||
|
|
|
@ -6,14 +6,12 @@ import YearPanel from '../year/YearPanel';
|
|||
import DecadePanel from '../decade/DecadePanel';
|
||||
function noop() {}
|
||||
function goMonth(direction) {
|
||||
const next = this.value.clone();
|
||||
next.add(direction, 'months');
|
||||
const next = this.value.clone().add(direction, 'months');
|
||||
this.__emit('valueChange', next);
|
||||
}
|
||||
|
||||
function goYear(direction) {
|
||||
const next = this.value.clone();
|
||||
next.add(direction, 'years');
|
||||
const next = this.value.clone().add(direction, 'years');
|
||||
this.__emit('valueChange', next);
|
||||
}
|
||||
|
||||
|
|
|
@ -78,15 +78,13 @@ const DateTBody = {
|
|||
const day = month1.day();
|
||||
const lastMonthDiffDay = (day + 7 - value.localeData().firstDayOfWeek()) % 7;
|
||||
// calculate last month
|
||||
const lastMonth1 = month1.clone();
|
||||
lastMonth1.add(0 - lastMonthDiffDay, 'days');
|
||||
const lastMonth1 = month1.clone().add(0 - lastMonthDiffDay, 'days');
|
||||
let passed = 0;
|
||||
for (iIndex = 0; iIndex < DateConstants.DATE_ROW_COUNT; iIndex++) {
|
||||
for (jIndex = 0; jIndex < DateConstants.DATE_COL_COUNT; jIndex++) {
|
||||
current = lastMonth1;
|
||||
if (passed) {
|
||||
current = current.clone();
|
||||
current.add(passed, 'days');
|
||||
current = current.clone().add(passed, 'days');
|
||||
}
|
||||
dateTable.push(current);
|
||||
passed++;
|
||||
|
|
|
@ -4,8 +4,7 @@ const ROW = 4;
|
|||
const COL = 3;
|
||||
function noop() {}
|
||||
function goYear(direction) {
|
||||
const next = this.sValue.clone();
|
||||
next.add(direction, 'years');
|
||||
const next = this.sValue.clone().add(direction, 'years');
|
||||
this.setState({
|
||||
sValue: next,
|
||||
});
|
||||
|
|
|
@ -13,8 +13,9 @@ const defaultDisabledTime = {
|
|||
};
|
||||
|
||||
export function getTodayTime(value) {
|
||||
const today = moment();
|
||||
today.locale(value.locale()).utcOffset(value.utcOffset());
|
||||
const today = moment()
|
||||
.locale(value.locale())
|
||||
.utcOffset(value.utcOffset());
|
||||
return today;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,8 +4,7 @@ const ROW = 4;
|
|||
const COL = 3;
|
||||
function noop() {}
|
||||
function goYear(direction) {
|
||||
const value = this.sValue.clone();
|
||||
value.add(direction, 'year');
|
||||
const value = this.sValue.clone().add(direction, 'year');
|
||||
this.setState({
|
||||
sValue: value,
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue