cr vc-time-picker
parent
82b4715e95
commit
8f29e5e594
|
@ -44,8 +44,8 @@ const Combobox = {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onItemChange(type, itemValue) {
|
onItemChange(type, itemValue) {
|
||||||
const { defaultOpenValue, use12Hours, isAM } = this;
|
const { defaultOpenValue, use12Hours, value: propValue, isAM } = this;
|
||||||
const value = (this.value || defaultOpenValue).clone();
|
const value = (propValue || defaultOpenValue).clone();
|
||||||
|
|
||||||
if (type === 'hour') {
|
if (type === 'hour') {
|
||||||
if (use12Hours) {
|
if (use12Hours) {
|
||||||
|
@ -106,17 +106,24 @@ const Combobox = {
|
||||||
selectedIndex={hourOptionsAdj.indexOf(hourAdj)}
|
selectedIndex={hourOptionsAdj.indexOf(hourAdj)}
|
||||||
type="hour"
|
type="hour"
|
||||||
onSelect={this.onItemChange}
|
onSelect={this.onItemChange}
|
||||||
onMouseenter={this.onEnterSelectPanel.bind(this, 'hour')}
|
onMouseenter={() => this.onEnterSelectPanel('hour')}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
getMinuteSelect(minute) {
|
getMinuteSelect(minute) {
|
||||||
const { prefixCls, minuteOptions, disabledMinutes, defaultOpenValue, showMinute } = this;
|
const {
|
||||||
|
prefixCls,
|
||||||
|
minuteOptions,
|
||||||
|
disabledMinutes,
|
||||||
|
defaultOpenValue,
|
||||||
|
showMinute,
|
||||||
|
value: propValue,
|
||||||
|
} = this;
|
||||||
if (!showMinute) {
|
if (!showMinute) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const value = this.value || defaultOpenValue;
|
const value = propValue || defaultOpenValue;
|
||||||
const disabledOptions = disabledMinutes(value.hour());
|
const disabledOptions = disabledMinutes(value.hour());
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -126,17 +133,24 @@ const Combobox = {
|
||||||
selectedIndex={minuteOptions.indexOf(minute)}
|
selectedIndex={minuteOptions.indexOf(minute)}
|
||||||
type="minute"
|
type="minute"
|
||||||
onSelect={this.onItemChange}
|
onSelect={this.onItemChange}
|
||||||
onMouseenter={this.onEnterSelectPanel.bind(this, 'minute')}
|
onMouseenter={() => this.onEnterSelectPanel('minute')}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
getSecondSelect(second) {
|
getSecondSelect(second) {
|
||||||
const { prefixCls, secondOptions, disabledSeconds, showSecond, defaultOpenValue } = this;
|
const {
|
||||||
|
prefixCls,
|
||||||
|
secondOptions,
|
||||||
|
disabledSeconds,
|
||||||
|
showSecond,
|
||||||
|
defaultOpenValue,
|
||||||
|
value: propValue,
|
||||||
|
} = this;
|
||||||
if (!showSecond) {
|
if (!showSecond) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const value = this.value || defaultOpenValue;
|
const value = propValue || defaultOpenValue;
|
||||||
const disabledOptions = disabledSeconds(value.hour(), value.minute());
|
const disabledOptions = disabledSeconds(value.hour(), value.minute());
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -146,7 +160,7 @@ const Combobox = {
|
||||||
selectedIndex={secondOptions.indexOf(second)}
|
selectedIndex={secondOptions.indexOf(second)}
|
||||||
type="second"
|
type="second"
|
||||||
onSelect={this.onItemChange}
|
onSelect={this.onItemChange}
|
||||||
onMouseenter={this.onEnterSelectPanel.bind(this, 'second')}
|
onMouseenter={() => this.onEnterSelectPanel('second')}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -170,15 +184,15 @@ const Combobox = {
|
||||||
selectedIndex={selected}
|
selectedIndex={selected}
|
||||||
type="ampm"
|
type="ampm"
|
||||||
onSelect={this.onItemChange}
|
onSelect={this.onItemChange}
|
||||||
onMouseenter={this.onEnterSelectPanel.bind(this, 'ampm')}
|
onMouseenter={() => this.onEnterSelectPanel('ampm')}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { prefixCls, defaultOpenValue } = this;
|
const { prefixCls, defaultOpenValue, value: propValue } = this;
|
||||||
const value = this.value || defaultOpenValue;
|
const value = propValue || defaultOpenValue;
|
||||||
return (
|
return (
|
||||||
<div class={`${prefixCls}-combobox`}>
|
<div class={`${prefixCls}-combobox`}>
|
||||||
{this.getHourSelect(value.hour())}
|
{this.getHourSelect(value.hour())}
|
||||||
|
|
|
@ -199,7 +199,6 @@ const Panel = {
|
||||||
disabledMinutes={disabledMinutes}
|
disabledMinutes={disabledMinutes}
|
||||||
disabledSeconds={disabledSeconds}
|
disabledSeconds={disabledSeconds}
|
||||||
onChange={this.onChange}
|
onChange={this.onChange}
|
||||||
onClear={clear}
|
|
||||||
allowEmpty={allowEmpty}
|
allowEmpty={allowEmpty}
|
||||||
focusOnOpen={focusOnOpen}
|
focusOnOpen={focusOnOpen}
|
||||||
onKeydown={keydown}
|
onKeydown={keydown}
|
||||||
|
|
|
@ -67,7 +67,7 @@ const Select = {
|
||||||
[`${prefixCls}-select-option-disabled`]: item.disabled,
|
[`${prefixCls}-select-option-disabled`]: item.disabled,
|
||||||
});
|
});
|
||||||
const onClick = item.disabled
|
const onClick = item.disabled
|
||||||
? undefined
|
? noop
|
||||||
: () => {
|
: () => {
|
||||||
this.onSelect(item.value);
|
this.onSelect(item.value);
|
||||||
};
|
};
|
||||||
|
@ -106,14 +106,14 @@ const Select = {
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
if (this.options.length === 0) {
|
const { prefixCls, options, active } = this;
|
||||||
|
if (options.length === 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { prefixCls } = this;
|
|
||||||
const cls = {
|
const cls = {
|
||||||
[`${prefixCls}-select`]: 1,
|
[`${prefixCls}-select`]: 1,
|
||||||
[`${prefixCls}-select-active`]: this.active,
|
[`${prefixCls}-select-active`]: active,
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -24,7 +24,7 @@ const MultipleSelector = {
|
||||||
searchValue: PropTypes.string,
|
searchValue: PropTypes.string,
|
||||||
labelInValue: PropTypes.bool,
|
labelInValue: PropTypes.bool,
|
||||||
maxTagCount: PropTypes.number,
|
maxTagCount: PropTypes.number,
|
||||||
maxTagPlaceholder: PropTypes.oneOfType([PropTypes.any, PropTypes.func]),
|
maxTagPlaceholder: PropTypes.any,
|
||||||
|
|
||||||
// onChoiceAnimationLeave: PropTypes.func,
|
// onChoiceAnimationLeave: PropTypes.func,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue