Skip to content

Commit 8f29e5e

Browse files
committed
cr vc-time-picker
1 parent 82b4715 commit 8f29e5e

File tree

4 files changed

+31
-18
lines changed

4 files changed

+31
-18
lines changed

components/vc-time-picker/Combobox.jsx

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ const Combobox = {
4444
},
4545
methods: {
4646
onItemChange(type, itemValue) {
47-
const { defaultOpenValue, use12Hours, isAM } = this;
48-
const value = (this.value || defaultOpenValue).clone();
47+
const { defaultOpenValue, use12Hours, value: propValue, isAM } = this;
48+
const value = (propValue || defaultOpenValue).clone();
4949

5050
if (type === 'hour') {
5151
if (use12Hours) {
@@ -106,17 +106,24 @@ const Combobox = {
106106
selectedIndex={hourOptionsAdj.indexOf(hourAdj)}
107107
type="hour"
108108
onSelect={this.onItemChange}
109-
onMouseenter={this.onEnterSelectPanel.bind(this, 'hour')}
109+
onMouseenter={() => this.onEnterSelectPanel('hour')}
110110
/>
111111
);
112112
},
113113

114114
getMinuteSelect(minute) {
115-
const { prefixCls, minuteOptions, disabledMinutes, defaultOpenValue, showMinute } = this;
115+
const {
116+
prefixCls,
117+
minuteOptions,
118+
disabledMinutes,
119+
defaultOpenValue,
120+
showMinute,
121+
value: propValue,
122+
} = this;
116123
if (!showMinute) {
117124
return null;
118125
}
119-
const value = this.value || defaultOpenValue;
126+
const value = propValue || defaultOpenValue;
120127
const disabledOptions = disabledMinutes(value.hour());
121128

122129
return (
@@ -126,17 +133,24 @@ const Combobox = {
126133
selectedIndex={minuteOptions.indexOf(minute)}
127134
type="minute"
128135
onSelect={this.onItemChange}
129-
onMouseenter={this.onEnterSelectPanel.bind(this, 'minute')}
136+
onMouseenter={() => this.onEnterSelectPanel('minute')}
130137
/>
131138
);
132139
},
133140

134141
getSecondSelect(second) {
135-
const { prefixCls, secondOptions, disabledSeconds, showSecond, defaultOpenValue } = this;
142+
const {
143+
prefixCls,
144+
secondOptions,
145+
disabledSeconds,
146+
showSecond,
147+
defaultOpenValue,
148+
value: propValue,
149+
} = this;
136150
if (!showSecond) {
137151
return null;
138152
}
139-
const value = this.value || defaultOpenValue;
153+
const value = propValue || defaultOpenValue;
140154
const disabledOptions = disabledSeconds(value.hour(), value.minute());
141155

142156
return (
@@ -146,7 +160,7 @@ const Combobox = {
146160
selectedIndex={secondOptions.indexOf(second)}
147161
type="second"
148162
onSelect={this.onItemChange}
149-
onMouseenter={this.onEnterSelectPanel.bind(this, 'second')}
163+
onMouseenter={() => this.onEnterSelectPanel('second')}
150164
/>
151165
);
152166
},
@@ -170,15 +184,15 @@ const Combobox = {
170184
selectedIndex={selected}
171185
type="ampm"
172186
onSelect={this.onItemChange}
173-
onMouseenter={this.onEnterSelectPanel.bind(this, 'ampm')}
187+
onMouseenter={() => this.onEnterSelectPanel('ampm')}
174188
/>
175189
);
176190
},
177191
},
178192

179193
render() {
180-
const { prefixCls, defaultOpenValue } = this;
181-
const value = this.value || defaultOpenValue;
194+
const { prefixCls, defaultOpenValue, value: propValue } = this;
195+
const value = propValue || defaultOpenValue;
182196
return (
183197
<div class={`${prefixCls}-combobox`}>
184198
{this.getHourSelect(value.hour())}

components/vc-time-picker/Panel.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ const Panel = {
199199
disabledMinutes={disabledMinutes}
200200
disabledSeconds={disabledSeconds}
201201
onChange={this.onChange}
202-
onClear={clear}
203202
allowEmpty={allowEmpty}
204203
focusOnOpen={focusOnOpen}
205204
onKeydown={keydown}

components/vc-time-picker/Select.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const Select = {
6767
[`${prefixCls}-select-option-disabled`]: item.disabled,
6868
});
6969
const onClick = item.disabled
70-
? undefined
70+
? noop
7171
: () => {
7272
this.onSelect(item.value);
7373
};
@@ -106,14 +106,14 @@ const Select = {
106106
},
107107

108108
render() {
109-
if (this.options.length === 0) {
109+
const { prefixCls, options, active } = this;
110+
if (options.length === 0) {
110111
return null;
111112
}
112113

113-
const { prefixCls } = this;
114114
const cls = {
115115
[`${prefixCls}-select`]: 1,
116-
[`${prefixCls}-select-active`]: this.active,
116+
[`${prefixCls}-select-active`]: active,
117117
};
118118

119119
return (

components/vc-tree-select/src/Selector/MultipleSelector/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const MultipleSelector = {
2424
searchValue: PropTypes.string,
2525
labelInValue: PropTypes.bool,
2626
maxTagCount: PropTypes.number,
27-
maxTagPlaceholder: PropTypes.oneOfType([PropTypes.any, PropTypes.func]),
27+
maxTagPlaceholder: PropTypes.any,
2828

2929
// onChoiceAnimationLeave: PropTypes.func,
3030
},

0 commit comments

Comments
 (0)