PickerTrigger.js
2.59 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
"use strict";
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var React = _interopRequireWildcard(require("react"));
var _classnames = _interopRequireDefault(require("classnames"));
var _rcTrigger = _interopRequireDefault(require("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(_rcTrigger.default, {
showAction: [],
hideAction: [],
popupPlacement: getPopupPlacement(),
builtinPlacements: BUILT_IN_PLACEMENTS,
prefixCls: dropdownPrefixCls,
popupTransitionName: transitionName,
popup: popupElement,
popupAlign: dropdownAlign,
popupVisible: visible,
popupClassName: (0, _classnames.default)(dropdownClassName, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(dropdownPrefixCls, "-range"), range), (0, _defineProperty2.default)(_classNames, "".concat(dropdownPrefixCls, "-rtl"), direction === 'rtl'), _classNames)),
popupStyle: popupStyle,
getPopupContainer: getPopupContainer
}, children);
}
var _default = PickerTrigger;
exports.default = _default;