PickerTrigger.js
2.13 KB
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
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import * as React from 'react';
import classNames from 'classnames';
import Trigger from 'rc-trigger';
var BUILT_IN_PLACEMENTS = {
bottomLeft: {
points: ['tl', 'bl'],
offset: [0, 4],
overflow: {
adjustX: 1,
adjustY: 1
}
},
bottomRight: {
points: ['tr', 'br'],
offset: [0, 4],
overflow: {
adjustX: 1,
adjustY: 1
}
},
topLeft: {
points: ['bl', 'tl'],
offset: [0, -4],
overflow: {
adjustX: 0,
adjustY: 1
}
},
topRight: {
points: ['br', 'tr'],
offset: [0, -4],
overflow: {
adjustX: 0,
adjustY: 1
}
}
};
function PickerTrigger(_ref) {
var _classNames;
var prefixCls = _ref.prefixCls,
popupElement = _ref.popupElement,
popupStyle = _ref.popupStyle,
visible = _ref.visible,
dropdownClassName = _ref.dropdownClassName,
dropdownAlign = _ref.dropdownAlign,
transitionName = _ref.transitionName,
getPopupContainer = _ref.getPopupContainer,
children = _ref.children,
range = _ref.range,
popupPlacement = _ref.popupPlacement,
direction = _ref.direction;
var dropdownPrefixCls = "".concat(prefixCls, "-dropdown");
var getPopupPlacement = function getPopupPlacement() {
if (popupPlacement !== undefined) {
return popupPlacement;
}
return direction === 'rtl' ? 'bottomRight' : 'bottomLeft';
};
return /*#__PURE__*/React.createElement(Trigger, {
showAction: [],
hideAction: [],
popupPlacement: getPopupPlacement(),
builtinPlacements: BUILT_IN_PLACEMENTS,
prefixCls: dropdownPrefixCls,
popupTransitionName: transitionName,
popup: popupElement,
popupAlign: dropdownAlign,
popupVisible: visible,
popupClassName: classNames(dropdownClassName, (_classNames = {}, _defineProperty(_classNames, "".concat(dropdownPrefixCls, "-range"), range), _defineProperty(_classNames, "".concat(dropdownPrefixCls, "-rtl"), direction === 'rtl'), _classNames)),
popupStyle: popupStyle,
getPopupContainer: getPopupContainer
}, children);
}
export default PickerTrigger;