1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import _extends from 'babel-runtime/helpers/extends';
import PropTypes from '../../../_util/vue-types';
import BasePopup from '../Base/BasePopup';
import SearchInput from '../SearchInput';
import { createRef } from '../util';
var SinglePopup = {
name: 'SinglePopup',
props: _extends({}, BasePopup.props, SearchInput.props, {
searchValue: PropTypes.string,
showSearch: PropTypes.bool,
dropdownPrefixCls: PropTypes.string,
disabled: PropTypes.bool,
searchPlaceholder: PropTypes.string
}),
created: function created() {
this.inputRef = createRef();
},
methods: {
onPlaceholderClick: function onPlaceholderClick() {
this.inputRef.current.focus();
},
_renderPlaceholder: function _renderPlaceholder() {
var h = this.$createElement;
var _$props = this.$props,
searchPlaceholder = _$props.searchPlaceholder,
searchValue = _$props.searchValue,
prefixCls = _$props.prefixCls;
if (!searchPlaceholder) {
return null;
}
return h(
'span',
{
style: {
display: searchValue ? 'none' : 'block'
},
on: {
'click': this.onPlaceholderClick
},
'class': prefixCls + '-search__field__placeholder'
},
[searchPlaceholder]
);
},
_renderSearch: function _renderSearch() {
var h = this.$createElement;
var _$props2 = this.$props,
showSearch = _$props2.showSearch,
dropdownPrefixCls = _$props2.dropdownPrefixCls;
if (!showSearch) {
return null;
}
return h(
'span',
{ 'class': dropdownPrefixCls + '-search' },
[h(SearchInput, {
props: _extends({}, this.$props, { renderPlaceholder: this._renderPlaceholder }),
on: this.$listeners,
directives: [{
name: 'ant-ref',
value: this.inputRef
}]
})]
);
}
},
render: function render() {
var h = arguments[0];
return h(BasePopup, {
props: _extends({}, this.$props, { renderSearch: this._renderSearch, __propsSymbol__: Symbol() }),
on: this.$listeners
});
}
};
export default SinglePopup;