1 | "use strict";
|
2 |
|
3 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4 |
|
5 | Object.defineProperty(exports, "__esModule", {
|
6 | value: true
|
7 | });
|
8 | exports.getAlignFromPlacement = getAlignFromPlacement;
|
9 | exports.getAlignPopupClassName = getAlignPopupClassName;
|
10 |
|
11 | var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
12 |
|
13 | function isPointsEq(a1, a2, isAlignPoint) {
|
14 | if (isAlignPoint) {
|
15 | return a1[0] === a2[0];
|
16 | }
|
17 |
|
18 | return a1[0] === a2[0] && a1[1] === a2[1];
|
19 | }
|
20 |
|
21 | function getAlignFromPlacement(builtinPlacements, placementStr, align) {
|
22 | var baseAlign = builtinPlacements[placementStr] || {};
|
23 | return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, baseAlign), align);
|
24 | }
|
25 |
|
26 | function getAlignPopupClassName(builtinPlacements, prefixCls, align, isAlignPoint) {
|
27 | var points = align.points;
|
28 | var placements = Object.keys(builtinPlacements);
|
29 |
|
30 | for (var i = 0; i < placements.length; i += 1) {
|
31 | var placement = placements[i];
|
32 |
|
33 | if (isPointsEq(builtinPlacements[placement].points, points, isAlignPoint)) {
|
34 | return "".concat(prefixCls, "-placement-").concat(placement);
|
35 | }
|
36 | }
|
37 |
|
38 | return '';
|
39 | } |
\ | No newline at end of file |