@autobest-ui/components 2.3.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/accordion/Item.js +6 -23
- package/esm/accordion/index.js +8 -36
- package/esm/affix/PortalAffix.js +7 -11
- package/esm/affix/index.js +30 -70
- package/esm/carousel/index.js +45 -141
- package/esm/checkbox/index.js +12 -37
- package/esm/collapse/index.js +11 -49
- package/esm/confirm/index.d.ts +8 -0
- package/esm/confirm/index.js +23 -31
- package/esm/date-picker/DateEnum.js +0 -3
- package/esm/date-picker/calendar/Day.js +62 -78
- package/esm/date-picker/calendar/MonthYear.js +20 -53
- package/esm/date-picker/calendar/grid/index.js +7 -12
- package/esm/date-picker/calendar/index.js +4 -31
- package/esm/date-picker/index.js +11 -51
- package/esm/date-picker/utils.js +6 -11
- package/esm/drawer/Child.js +10 -20
- package/esm/drawer/index.js +22 -71
- package/esm/ellipsis/index.js +9 -17
- package/esm/guide/index.js +25 -63
- package/esm/index.d.ts +2 -2
- package/esm/index.js +1 -1
- package/esm/input-number/ControlArrow.js +0 -2
- package/esm/input-number/constants.js +2 -2
- package/esm/input-number/index.js +26 -106
- package/esm/lazy-image/index.js +10 -55
- package/esm/link-list/index.js +11 -35
- package/esm/loading/index.js +15 -42
- package/esm/loading-container/index.js +3 -6
- package/esm/loading-icon/index.js +0 -2
- package/esm/mask/index.js +6 -9
- package/esm/message/index.d.ts +44 -7
- package/esm/message/index.js +96 -111
- package/esm/message/renderMessage.d.ts +17 -0
- package/esm/message/renderMessage.js +137 -0
- package/esm/message/style/index.css +1 -1
- package/esm/modal/Title.js +5 -12
- package/esm/modal/getPopupLocation.js +5 -7
- package/esm/modal/index.js +44 -125
- package/esm/move/index.js +32 -132
- package/esm/move/range.js +6 -12
- package/esm/move/utils.js +3 -10
- package/esm/popover/index.js +9 -28
- package/esm/portal/index.js +1 -22
- package/esm/script/index.js +19 -59
- package/esm/select/index.js +28 -106
- package/esm/show-more/index.js +40 -103
- package/esm/skeleton/Item.js +1 -3
- package/esm/skeleton/index.js +5 -11
- package/esm/style.css +1 -1
- package/esm/table/body/BodyRow.js +11 -28
- package/esm/table/body/CheckIcon.js +10 -18
- package/esm/table/body/index.js +8 -12
- package/esm/table/header/CheckIcon.js +3 -11
- package/esm/table/header/HeaderCell.js +12 -33
- package/esm/table/header/HeaderRow.js +6 -17
- package/esm/table/index.js +30 -100
- package/esm/tabs/index.js +35 -118
- package/esm/tooltip/index.js +0 -4
- package/esm/trigger/align.js +6 -6
- package/esm/trigger/bottomAlign.js +33 -45
- package/esm/trigger/constants.js +0 -1
- package/esm/trigger/getPopupLocation.js +48 -68
- package/esm/trigger/index.js +52 -187
- package/esm/trigger/leftAlign.js +33 -47
- package/esm/trigger/ref.js +2 -7
- package/esm/trigger/rightAlign.js +33 -45
- package/esm/trigger/topAlign.js +33 -45
- package/esm/trigger/utils.js +28 -45
- package/lib/accordion/Item.js +6 -27
- package/lib/accordion/index.js +8 -41
- package/lib/affix/PortalAffix.js +7 -17
- package/lib/affix/index.js +30 -75
- package/lib/carousel/index.js +45 -146
- package/lib/checkbox/index.js +12 -41
- package/lib/collapse/index.js +11 -53
- package/lib/confirm/index.d.ts +8 -0
- package/lib/confirm/index.js +23 -38
- package/lib/date-picker/DateEnum.js +0 -3
- package/lib/date-picker/calendar/Day.js +62 -87
- package/lib/date-picker/calendar/MonthYear.js +20 -62
- package/lib/date-picker/calendar/grid/index.js +7 -16
- package/lib/date-picker/calendar/index.js +4 -37
- package/lib/date-picker/index.js +9 -58
- package/lib/date-picker/utils.js +6 -26
- package/lib/drawer/Child.js +10 -25
- package/lib/drawer/index.js +22 -78
- package/lib/ellipsis/index.js +9 -23
- package/lib/guide/index.js +25 -71
- package/lib/index.d.ts +2 -2
- package/lib/index.js +12 -32
- package/lib/input-number/ControlArrow.js +0 -4
- package/lib/input-number/constants.js +2 -2
- package/lib/input-number/index.js +26 -114
- package/lib/lazy-image/index.js +10 -58
- package/lib/link-list/index.js +11 -40
- package/lib/loading/index.js +13 -48
- package/lib/loading-bar/index.js +0 -5
- package/lib/loading-container/index.js +3 -11
- package/lib/loading-icon/index.js +0 -7
- package/lib/mask/index.js +6 -17
- package/lib/message/index.d.ts +44 -7
- package/lib/message/index.js +97 -120
- package/lib/message/renderMessage.d.ts +17 -0
- package/lib/message/renderMessage.js +144 -0
- package/lib/message/style/index.css +1 -1
- package/lib/modal/Affix.js +0 -4
- package/lib/modal/Title.js +5 -15
- package/lib/modal/getPopupLocation.js +5 -9
- package/lib/modal/index.js +44 -135
- package/lib/move/index.js +32 -144
- package/lib/move/range.js +6 -14
- package/lib/move/utils.js +3 -12
- package/lib/popover/index.js +9 -33
- package/lib/portal/index.js +1 -25
- package/lib/script/index.js +19 -61
- package/lib/select/index.js +28 -113
- package/lib/show-more/index.js +40 -110
- package/lib/skeleton/Item.js +1 -8
- package/lib/skeleton/index.js +5 -16
- package/lib/style.css +1 -1
- package/lib/table/body/BodyRow.js +11 -33
- package/lib/table/body/CheckIcon.js +10 -22
- package/lib/table/body/index.js +8 -17
- package/lib/table/header/CheckIcon.js +3 -15
- package/lib/table/header/HeaderCell.js +12 -37
- package/lib/table/header/HeaderRow.js +6 -22
- package/lib/table/index.js +30 -107
- package/lib/tabs/index.js +35 -122
- package/lib/tooltip/index.js +0 -9
- package/lib/trigger/align.js +0 -4
- package/lib/trigger/bottomAlign.js +33 -48
- package/lib/trigger/constants.js +0 -2
- package/lib/trigger/getPopupLocation.js +48 -74
- package/lib/trigger/index.js +52 -198
- package/lib/trigger/leftAlign.js +33 -50
- package/lib/trigger/ref.js +2 -12
- package/lib/trigger/rightAlign.js +33 -48
- package/lib/trigger/topAlign.js +33 -48
- package/lib/trigger/utils.js +28 -53
- package/package.json +7 -3
package/esm/trigger/leftAlign.js
CHANGED
|
@@ -2,28 +2,23 @@ var __assign = this && this.__assign || function () {
|
|
|
2
2
|
__assign = Object.assign || function (t) {
|
|
3
3
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
4
|
s = arguments[i];
|
|
5
|
-
|
|
6
5
|
for (var p in s) {
|
|
7
6
|
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
8
7
|
}
|
|
9
8
|
}
|
|
10
|
-
|
|
11
9
|
return t;
|
|
12
10
|
};
|
|
13
|
-
|
|
14
11
|
return __assign.apply(this, arguments);
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
import { getArrowTop, getAvailPosition } from './utils';
|
|
18
|
-
|
|
19
14
|
function getLeftCommon(_a) {
|
|
20
15
|
var left = _a.left,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
rootInfo = _a.rootInfo,
|
|
17
|
+
popInfo = _a.popInfo,
|
|
18
|
+
arrowTop = _a.arrowTop,
|
|
19
|
+
hiddenArrow = _a.hiddenArrow,
|
|
20
|
+
rootToPopupSpacing = _a.rootToPopupSpacing,
|
|
21
|
+
isTransformHorizontalDirection = _a.isTransformHorizontalDirection;
|
|
27
22
|
return {
|
|
28
23
|
rootWidth: rootInfo.width,
|
|
29
24
|
width: popInfo.width,
|
|
@@ -38,23 +33,19 @@ function getLeftCommon(_a) {
|
|
|
38
33
|
};
|
|
39
34
|
}
|
|
40
35
|
/* 具体方位 */
|
|
41
|
-
|
|
42
|
-
|
|
43
36
|
export function getLeftLocationInfo(_a) {
|
|
44
37
|
var rootInfo = _a.rootInfo,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
38
|
+
popInfo = _a.popInfo,
|
|
39
|
+
_b = _a.translateY,
|
|
40
|
+
translateY = _b === void 0 ? 0 : _b,
|
|
41
|
+
rootToPopupSpacing = _a.rootToPopupSpacing,
|
|
42
|
+
isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
|
|
43
|
+
hiddenArrow = _a.hiddenArrow,
|
|
44
|
+
isInsertNode = _a.isInsertNode;
|
|
52
45
|
var arrowTop = getArrowTop(popInfo.height / 2 - translateY, popInfo.height);
|
|
53
|
-
|
|
54
46
|
var _c = getAvailPosition(rootInfo, isInsertNode),
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
left = _c.left,
|
|
48
|
+
top = _c.top;
|
|
58
49
|
return __assign(__assign({}, getLeftCommon({
|
|
59
50
|
left: left,
|
|
60
51
|
rootInfo: rootInfo,
|
|
@@ -68,22 +59,19 @@ export function getLeftLocationInfo(_a) {
|
|
|
68
59
|
});
|
|
69
60
|
}
|
|
70
61
|
/* 其他方位 */
|
|
71
|
-
|
|
72
62
|
export function getLeftTopLocationInfo(_a) {
|
|
73
63
|
var rootInfo = _a.rootInfo,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
64
|
+
popInfo = _a.popInfo,
|
|
65
|
+
_b = _a.translateY,
|
|
66
|
+
translateY = _b === void 0 ? 0 : _b,
|
|
67
|
+
rootToPopupSpacing = _a.rootToPopupSpacing,
|
|
68
|
+
isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
|
|
69
|
+
hiddenArrow = _a.hiddenArrow,
|
|
70
|
+
isInsertNode = _a.isInsertNode;
|
|
81
71
|
var arrowTop = getArrowTop(rootInfo.height / 2 - translateY, popInfo.height);
|
|
82
|
-
|
|
83
72
|
var _c = getAvailPosition(rootInfo, isInsertNode),
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
73
|
+
left = _c.left,
|
|
74
|
+
top = _c.top;
|
|
87
75
|
return __assign(__assign({}, getLeftCommon({
|
|
88
76
|
left: left,
|
|
89
77
|
rootInfo: rootInfo,
|
|
@@ -98,19 +86,17 @@ export function getLeftTopLocationInfo(_a) {
|
|
|
98
86
|
}
|
|
99
87
|
export function getLeftBottomLocationInfo(_a) {
|
|
100
88
|
var rootInfo = _a.rootInfo,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
89
|
+
popInfo = _a.popInfo,
|
|
90
|
+
_b = _a.translateY,
|
|
91
|
+
translateY = _b === void 0 ? 0 : _b,
|
|
92
|
+
rootToPopupSpacing = _a.rootToPopupSpacing,
|
|
93
|
+
isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
|
|
94
|
+
hiddenArrow = _a.hiddenArrow,
|
|
95
|
+
isInsertNode = _a.isInsertNode;
|
|
108
96
|
var arrowTop = getArrowTop(popInfo.height - rootInfo.height / 2 - translateY, popInfo.height);
|
|
109
|
-
|
|
110
97
|
var _c = getAvailPosition(rootInfo, isInsertNode),
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
98
|
+
left = _c.left,
|
|
99
|
+
top = _c.top;
|
|
114
100
|
return __assign(__assign({}, getLeftCommon({
|
|
115
101
|
left: left,
|
|
116
102
|
rootInfo: rootInfo,
|
package/esm/trigger/ref.js
CHANGED
|
@@ -9,14 +9,11 @@ export function fillRef(ref, node) {
|
|
|
9
9
|
/**
|
|
10
10
|
* Merge refs into one ref function to support ref passing.
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
12
|
export function composeRef() {
|
|
14
13
|
var refs = [];
|
|
15
|
-
|
|
16
14
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
17
15
|
refs[_i] = arguments[_i];
|
|
18
16
|
}
|
|
19
|
-
|
|
20
17
|
return function (node) {
|
|
21
18
|
refs.forEach(function (ref) {
|
|
22
19
|
fillRef(ref, node);
|
|
@@ -27,12 +24,10 @@ export function supportRef(nodeOrComponent) {
|
|
|
27
24
|
// Function component node
|
|
28
25
|
if (nodeOrComponent.type && nodeOrComponent.type.prototype && !nodeOrComponent.type.prototype.render) {
|
|
29
26
|
return false;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
}
|
|
28
|
+
// Class component
|
|
33
29
|
if (typeof nodeOrComponent === 'function' && nodeOrComponent.prototype && !nodeOrComponent.prototype.render) {
|
|
34
30
|
return false;
|
|
35
31
|
}
|
|
36
|
-
|
|
37
32
|
return true;
|
|
38
33
|
}
|
|
@@ -2,28 +2,23 @@ var __assign = this && this.__assign || function () {
|
|
|
2
2
|
__assign = Object.assign || function (t) {
|
|
3
3
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
4
|
s = arguments[i];
|
|
5
|
-
|
|
6
5
|
for (var p in s) {
|
|
7
6
|
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
8
7
|
}
|
|
9
8
|
}
|
|
10
|
-
|
|
11
9
|
return t;
|
|
12
10
|
};
|
|
13
|
-
|
|
14
11
|
return __assign.apply(this, arguments);
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
import { getArrowTop, getAvailPosition } from './utils';
|
|
18
|
-
|
|
19
14
|
function getRightCommon(_a) {
|
|
20
15
|
var left = _a.left,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
rootInfo = _a.rootInfo,
|
|
17
|
+
popInfo = _a.popInfo,
|
|
18
|
+
arrowTop = _a.arrowTop,
|
|
19
|
+
hiddenArrow = _a.hiddenArrow,
|
|
20
|
+
rootToPopupSpacing = _a.rootToPopupSpacing,
|
|
21
|
+
isTransformHorizontalDirection = _a.isTransformHorizontalDirection;
|
|
27
22
|
return {
|
|
28
23
|
rootWidth: rootInfo.width,
|
|
29
24
|
width: popInfo.width,
|
|
@@ -37,22 +32,19 @@ function getRightCommon(_a) {
|
|
|
37
32
|
transformOrigin: isTransformHorizontalDirection ? 'left center' : "left ".concat(arrowTop, "px")
|
|
38
33
|
};
|
|
39
34
|
}
|
|
40
|
-
|
|
41
35
|
export function getRightLocationInfo(_a) {
|
|
42
36
|
var rootInfo = _a.rootInfo,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
37
|
+
popInfo = _a.popInfo,
|
|
38
|
+
_b = _a.translateY,
|
|
39
|
+
translateY = _b === void 0 ? 0 : _b,
|
|
40
|
+
rootToPopupSpacing = _a.rootToPopupSpacing,
|
|
41
|
+
isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
|
|
42
|
+
hiddenArrow = _a.hiddenArrow,
|
|
43
|
+
isInsertNode = _a.isInsertNode;
|
|
50
44
|
var arrowTop = getArrowTop(popInfo.height / 2 - translateY, popInfo.height);
|
|
51
|
-
|
|
52
45
|
var _c = getAvailPosition(rootInfo, isInsertNode),
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
46
|
+
left = _c.left,
|
|
47
|
+
top = _c.top;
|
|
56
48
|
return __assign(__assign({}, getRightCommon({
|
|
57
49
|
left: left,
|
|
58
50
|
rootInfo: rootInfo,
|
|
@@ -67,19 +59,17 @@ export function getRightLocationInfo(_a) {
|
|
|
67
59
|
}
|
|
68
60
|
export function getRightTopLocationInfo(_a) {
|
|
69
61
|
var rootInfo = _a.rootInfo,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
62
|
+
popInfo = _a.popInfo,
|
|
63
|
+
_b = _a.translateY,
|
|
64
|
+
translateY = _b === void 0 ? 0 : _b,
|
|
65
|
+
rootToPopupSpacing = _a.rootToPopupSpacing,
|
|
66
|
+
isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
|
|
67
|
+
hiddenArrow = _a.hiddenArrow,
|
|
68
|
+
isInsertNode = _a.isInsertNode;
|
|
77
69
|
var arrowTop = getArrowTop(rootInfo.height / 2 - translateY, popInfo.height);
|
|
78
|
-
|
|
79
70
|
var _c = getAvailPosition(rootInfo, isInsertNode),
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
71
|
+
left = _c.left,
|
|
72
|
+
top = _c.top;
|
|
83
73
|
return __assign(__assign({}, getRightCommon({
|
|
84
74
|
left: left,
|
|
85
75
|
rootInfo: rootInfo,
|
|
@@ -94,19 +84,17 @@ export function getRightTopLocationInfo(_a) {
|
|
|
94
84
|
}
|
|
95
85
|
export function getRightBottomLocationInfo(_a) {
|
|
96
86
|
var rootInfo = _a.rootInfo,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
87
|
+
popInfo = _a.popInfo,
|
|
88
|
+
_b = _a.translateY,
|
|
89
|
+
translateY = _b === void 0 ? 0 : _b,
|
|
90
|
+
rootToPopupSpacing = _a.rootToPopupSpacing,
|
|
91
|
+
isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
|
|
92
|
+
hiddenArrow = _a.hiddenArrow,
|
|
93
|
+
isInsertNode = _a.isInsertNode;
|
|
104
94
|
var arrowTop = getArrowTop(popInfo.height - rootInfo.height / 2 - translateY, popInfo.height);
|
|
105
|
-
|
|
106
95
|
var _c = getAvailPosition(rootInfo, isInsertNode),
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
96
|
+
left = _c.left,
|
|
97
|
+
top = _c.top;
|
|
110
98
|
return __assign(__assign({}, getRightCommon({
|
|
111
99
|
left: left,
|
|
112
100
|
rootInfo: rootInfo,
|
package/esm/trigger/topAlign.js
CHANGED
|
@@ -2,28 +2,23 @@ var __assign = this && this.__assign || function () {
|
|
|
2
2
|
__assign = Object.assign || function (t) {
|
|
3
3
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
4
|
s = arguments[i];
|
|
5
|
-
|
|
6
5
|
for (var p in s) {
|
|
7
6
|
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
8
7
|
}
|
|
9
8
|
}
|
|
10
|
-
|
|
11
9
|
return t;
|
|
12
10
|
};
|
|
13
|
-
|
|
14
11
|
return __assign.apply(this, arguments);
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
import { getArrowLeft, getAvailPosition } from './utils';
|
|
18
|
-
|
|
19
14
|
function getTopCommon(_a) {
|
|
20
15
|
var top = _a.top,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
rootInfo = _a.rootInfo,
|
|
17
|
+
popInfo = _a.popInfo,
|
|
18
|
+
arrowLeft = _a.arrowLeft,
|
|
19
|
+
hiddenArrow = _a.hiddenArrow,
|
|
20
|
+
rootToPopupSpacing = _a.rootToPopupSpacing,
|
|
21
|
+
isTransformHorizontalDirection = _a.isTransformHorizontalDirection;
|
|
27
22
|
return {
|
|
28
23
|
rootWidth: rootInfo.width,
|
|
29
24
|
width: popInfo.width,
|
|
@@ -37,22 +32,19 @@ function getTopCommon(_a) {
|
|
|
37
32
|
transformOrigin: isTransformHorizontalDirection ? 'center bottom' : "".concat(arrowLeft, "px bottom")
|
|
38
33
|
};
|
|
39
34
|
}
|
|
40
|
-
|
|
41
35
|
export function getTopLocationInfo(_a) {
|
|
42
36
|
var rootInfo = _a.rootInfo,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
37
|
+
popInfo = _a.popInfo,
|
|
38
|
+
_b = _a.translateX,
|
|
39
|
+
translateX = _b === void 0 ? 0 : _b,
|
|
40
|
+
rootToPopupSpacing = _a.rootToPopupSpacing,
|
|
41
|
+
isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
|
|
42
|
+
hiddenArrow = _a.hiddenArrow,
|
|
43
|
+
isInsertNode = _a.isInsertNode;
|
|
50
44
|
var arrowLeft = getArrowLeft(popInfo.width / 2 - translateX, popInfo.width);
|
|
51
|
-
|
|
52
45
|
var _c = getAvailPosition(rootInfo, isInsertNode),
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
46
|
+
left = _c.left,
|
|
47
|
+
top = _c.top;
|
|
56
48
|
return __assign(__assign({}, getTopCommon({
|
|
57
49
|
top: top,
|
|
58
50
|
rootInfo: rootInfo,
|
|
@@ -67,19 +59,17 @@ export function getTopLocationInfo(_a) {
|
|
|
67
59
|
}
|
|
68
60
|
export function getTopLeftLocationInfo(_a) {
|
|
69
61
|
var rootInfo = _a.rootInfo,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
62
|
+
popInfo = _a.popInfo,
|
|
63
|
+
_b = _a.translateX,
|
|
64
|
+
translateX = _b === void 0 ? 0 : _b,
|
|
65
|
+
rootToPopupSpacing = _a.rootToPopupSpacing,
|
|
66
|
+
isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
|
|
67
|
+
hiddenArrow = _a.hiddenArrow,
|
|
68
|
+
isInsertNode = _a.isInsertNode;
|
|
77
69
|
var arrowLeft = getArrowLeft(rootInfo.width / 2 - translateX, popInfo.width);
|
|
78
|
-
|
|
79
70
|
var _c = getAvailPosition(rootInfo, isInsertNode),
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
71
|
+
left = _c.left,
|
|
72
|
+
top = _c.top;
|
|
83
73
|
return __assign(__assign({}, getTopCommon({
|
|
84
74
|
top: top,
|
|
85
75
|
rootInfo: rootInfo,
|
|
@@ -94,19 +84,17 @@ export function getTopLeftLocationInfo(_a) {
|
|
|
94
84
|
}
|
|
95
85
|
export function getTopRightLocationInfo(_a) {
|
|
96
86
|
var rootInfo = _a.rootInfo,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
87
|
+
popInfo = _a.popInfo,
|
|
88
|
+
_b = _a.translateX,
|
|
89
|
+
translateX = _b === void 0 ? 0 : _b,
|
|
90
|
+
rootToPopupSpacing = _a.rootToPopupSpacing,
|
|
91
|
+
isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
|
|
92
|
+
hiddenArrow = _a.hiddenArrow,
|
|
93
|
+
isInsertNode = _a.isInsertNode;
|
|
104
94
|
var arrowLeft = getArrowLeft(popInfo.width - rootInfo.width / 2 - translateX, popInfo.width);
|
|
105
|
-
|
|
106
95
|
var _c = getAvailPosition(rootInfo, isInsertNode),
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
96
|
+
left = _c.left,
|
|
97
|
+
top = _c.top;
|
|
110
98
|
return __assign(__assign({}, getTopCommon({
|
|
111
99
|
top: top,
|
|
112
100
|
rootInfo: rootInfo,
|
package/esm/trigger/utils.js
CHANGED
|
@@ -5,16 +5,13 @@ var ArrowLimit = 8;
|
|
|
5
5
|
* @param value
|
|
6
6
|
* @param popWidth
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
8
|
export function getArrowLeft(value, popWidth) {
|
|
10
9
|
if (value < 0) {
|
|
11
10
|
return 0;
|
|
12
11
|
}
|
|
13
|
-
|
|
14
12
|
if (value > popWidth - ArrowLimit) {
|
|
15
13
|
return popWidth - ArrowLimit;
|
|
16
14
|
}
|
|
17
|
-
|
|
18
15
|
return value;
|
|
19
16
|
}
|
|
20
17
|
/**
|
|
@@ -22,16 +19,13 @@ export function getArrowLeft(value, popWidth) {
|
|
|
22
19
|
* @param value
|
|
23
20
|
* @param popHeight
|
|
24
21
|
*/
|
|
25
|
-
|
|
26
22
|
export function getArrowTop(value, popHeight) {
|
|
27
23
|
if (value < 0) {
|
|
28
24
|
return 0;
|
|
29
25
|
}
|
|
30
|
-
|
|
31
26
|
if (value > popHeight - ArrowLimit) {
|
|
32
27
|
return popHeight - ArrowLimit;
|
|
33
28
|
}
|
|
34
|
-
|
|
35
29
|
return value;
|
|
36
30
|
}
|
|
37
31
|
export function getAvailPosition(rootInfo, isInsertNode) {
|
|
@@ -49,16 +43,15 @@ export function getAvailPosition(rootInfo, isInsertNode) {
|
|
|
49
43
|
* @param scrollValue 滚动信息
|
|
50
44
|
* @param availValue 浏览器可用大小
|
|
51
45
|
*/
|
|
52
|
-
|
|
53
46
|
export function getTranslate(_a) {
|
|
54
47
|
var initTranslate = _a.initTranslate,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
var limit = initTranslate ? 0 : popupLimitSpacing;
|
|
61
|
-
|
|
48
|
+
popupLimitSpacing = _a.popupLimitSpacing,
|
|
49
|
+
currentValue = _a.currentValue,
|
|
50
|
+
positionValue = _a.positionValue,
|
|
51
|
+
scrollValue = _a.scrollValue,
|
|
52
|
+
availValue = _a.availValue;
|
|
53
|
+
var limit = initTranslate ? 0 : popupLimitSpacing;
|
|
54
|
+
// 小于设备大小
|
|
62
55
|
if (currentValue < availValue - limit * 2) {
|
|
63
56
|
if (positionValue - scrollValue < limit) {
|
|
64
57
|
return {
|
|
@@ -66,7 +59,6 @@ export function getTranslate(_a) {
|
|
|
66
59
|
maxValue: null
|
|
67
60
|
};
|
|
68
61
|
}
|
|
69
|
-
|
|
70
62
|
if (positionValue - scrollValue + currentValue + limit > availValue) {
|
|
71
63
|
return {
|
|
72
64
|
translateValue: availValue - (positionValue + currentValue + limit) + scrollValue,
|
|
@@ -81,7 +73,6 @@ export function getTranslate(_a) {
|
|
|
81
73
|
maxValue: maxValue
|
|
82
74
|
};
|
|
83
75
|
}
|
|
84
|
-
|
|
85
76
|
return {
|
|
86
77
|
translateValue: initTranslate,
|
|
87
78
|
maxValue: null
|
|
@@ -95,20 +86,18 @@ export function getTranslate(_a) {
|
|
|
95
86
|
* @param useHeight
|
|
96
87
|
* @param placement
|
|
97
88
|
*/
|
|
98
|
-
|
|
99
89
|
export function isTopMoreThanBottom(_a) {
|
|
100
90
|
var rootInfo = _a.rootInfo,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
91
|
+
availHeight = _a.availHeight,
|
|
92
|
+
scrollTop = _a.scrollTop,
|
|
93
|
+
useHeight = _a.useHeight,
|
|
94
|
+
placement = _a.placement;
|
|
105
95
|
var topDistance = rootInfo.top - scrollTop;
|
|
106
|
-
var bottomDistance = availHeight - rootInfo.top + scrollTop - rootInfo.height;
|
|
107
|
-
|
|
96
|
+
var bottomDistance = availHeight - rootInfo.top + scrollTop - rootInfo.height;
|
|
97
|
+
// 当都满足要求时,优先使用给定的位置
|
|
108
98
|
if (topDistance > useHeight && bottomDistance > useHeight) {
|
|
109
99
|
return placement === LocationType.Top.value || placement === LocationType.TopLeft.value || placement === LocationType.TopRight.value;
|
|
110
100
|
}
|
|
111
|
-
|
|
112
101
|
return topDistance > bottomDistance;
|
|
113
102
|
}
|
|
114
103
|
/**
|
|
@@ -119,20 +108,18 @@ export function isTopMoreThanBottom(_a) {
|
|
|
119
108
|
* @param useWidth
|
|
120
109
|
* @param placement
|
|
121
110
|
*/
|
|
122
|
-
|
|
123
111
|
export function isLeftMoreThanRight(_a) {
|
|
124
112
|
var rootInfo = _a.rootInfo,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
113
|
+
availWidth = _a.availWidth,
|
|
114
|
+
scrollLeft = _a.scrollLeft,
|
|
115
|
+
useWidth = _a.useWidth,
|
|
116
|
+
placement = _a.placement;
|
|
129
117
|
var leftDistance = rootInfo.left - scrollLeft;
|
|
130
|
-
var rightDistance = availWidth - rootInfo.left + scrollLeft - rootInfo.width;
|
|
131
|
-
|
|
118
|
+
var rightDistance = availWidth - rootInfo.left + scrollLeft - rootInfo.width;
|
|
119
|
+
// 当都满足要求时,优先使用给定的位置
|
|
132
120
|
if (leftDistance > useWidth && rightDistance > useWidth) {
|
|
133
121
|
return placement === LocationType.Left.value || placement === LocationType.LeftTop.value || placement === LocationType.LeftBottom.value;
|
|
134
122
|
}
|
|
135
|
-
|
|
136
123
|
return leftDistance > rightDistance;
|
|
137
124
|
}
|
|
138
125
|
/**
|
|
@@ -145,19 +132,16 @@ export function isLeftMoreThanRight(_a) {
|
|
|
145
132
|
* @param availSize
|
|
146
133
|
* @param rootToPopupSpacing
|
|
147
134
|
*/
|
|
148
|
-
|
|
149
135
|
export function getLocationMethodByPlacement(_a) {
|
|
150
136
|
var rootInfo = _a.rootInfo,
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
137
|
+
popInfo = _a.popInfo,
|
|
138
|
+
scrollInfo = _a.scrollInfo,
|
|
139
|
+
placement = _a.placement,
|
|
140
|
+
availSize = _a.availSize,
|
|
141
|
+
rootToPopupSpacing = _a.rootToPopupSpacing;
|
|
157
142
|
var _b = getLocationInfo(placement),
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
143
|
+
isVertical = _b.isVertical,
|
|
144
|
+
splitArr = _b.splitArr;
|
|
161
145
|
if (isVertical) {
|
|
162
146
|
var useTopLocation = isTopMoreThanBottom({
|
|
163
147
|
rootInfo: rootInfo,
|
|
@@ -170,9 +154,8 @@ export function getLocationMethodByPlacement(_a) {
|
|
|
170
154
|
methodStr: useTopLocation ? "Top".concat(splitArr[1]) : "Bottom".concat(splitArr[1]),
|
|
171
155
|
isVertical: true
|
|
172
156
|
};
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
|
|
157
|
+
}
|
|
158
|
+
// 判断悬浮框最终位置
|
|
176
159
|
var useLeftLocation = isLeftMoreThanRight({
|
|
177
160
|
rootInfo: rootInfo,
|
|
178
161
|
placement: placement,
|
package/lib/accordion/Item.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _collapse = _interopRequireDefault(require("../collapse"));
|
|
13
|
-
|
|
14
10
|
var __extends = void 0 && (void 0).__extends || function () {
|
|
15
11
|
var _extendStatics = function extendStatics(d, b) {
|
|
16
12
|
_extendStatics = Object.setPrototypeOf || {
|
|
@@ -22,64 +18,47 @@ var __extends = void 0 && (void 0).__extends || function () {
|
|
|
22
18
|
if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
|
23
19
|
}
|
|
24
20
|
};
|
|
25
|
-
|
|
26
21
|
return _extendStatics(d, b);
|
|
27
22
|
};
|
|
28
|
-
|
|
29
23
|
return function (d, b) {
|
|
30
24
|
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
31
|
-
|
|
32
25
|
_extendStatics(d, b);
|
|
33
|
-
|
|
34
26
|
function __() {
|
|
35
27
|
this.constructor = d;
|
|
36
28
|
}
|
|
37
|
-
|
|
38
29
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
39
30
|
};
|
|
40
31
|
}();
|
|
41
|
-
|
|
42
|
-
var AccordionItem =
|
|
43
|
-
/** @class */
|
|
44
|
-
function (_super) {
|
|
32
|
+
var AccordionItem = /** @class */function (_super) {
|
|
45
33
|
__extends(AccordionItem, _super);
|
|
46
|
-
|
|
47
34
|
function AccordionItem() {
|
|
48
35
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
49
|
-
|
|
50
36
|
_this.getTitle = function () {
|
|
51
37
|
var _a = _this.props,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
38
|
+
title = _a.title,
|
|
39
|
+
onTitleClick = _a.onTitleClick;
|
|
55
40
|
if (!title) {
|
|
56
41
|
return null;
|
|
57
42
|
}
|
|
58
|
-
|
|
59
43
|
var child = _react.default.Children.only(title);
|
|
60
|
-
|
|
61
44
|
return /*#__PURE__*/_react.default.cloneElement(child, {
|
|
62
45
|
onClick: onTitleClick
|
|
63
46
|
});
|
|
64
47
|
};
|
|
65
|
-
|
|
66
48
|
return _this;
|
|
67
49
|
}
|
|
68
|
-
|
|
69
50
|
AccordionItem.prototype.render = function () {
|
|
70
51
|
var _a = this.props,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
52
|
+
appear = _a.appear,
|
|
53
|
+
children = _a.children,
|
|
54
|
+
visible = _a.visible;
|
|
74
55
|
return /*#__PURE__*/_react.default.createElement("li", null, /*#__PURE__*/_react.default.createElement(_collapse.default, {
|
|
75
56
|
title: this.getTitle(),
|
|
76
57
|
visible: visible,
|
|
77
58
|
appear: appear
|
|
78
59
|
}, children));
|
|
79
60
|
};
|
|
80
|
-
|
|
81
61
|
return AccordionItem;
|
|
82
62
|
}(_react.default.Component);
|
|
83
|
-
|
|
84
63
|
var _default = AccordionItem;
|
|
85
64
|
exports.default = _default;
|