@autobest-ui/components 2.3.0 → 2.4.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.
Files changed (140) hide show
  1. package/esm/accordion/Item.js +6 -23
  2. package/esm/accordion/index.js +8 -36
  3. package/esm/affix/PortalAffix.js +7 -11
  4. package/esm/affix/index.js +30 -70
  5. package/esm/carousel/index.js +45 -141
  6. package/esm/checkbox/index.js +12 -37
  7. package/esm/collapse/index.js +11 -49
  8. package/esm/confirm/index.d.ts +8 -0
  9. package/esm/confirm/index.js +23 -31
  10. package/esm/date-picker/DateEnum.js +0 -3
  11. package/esm/date-picker/calendar/Day.js +62 -78
  12. package/esm/date-picker/calendar/MonthYear.js +20 -53
  13. package/esm/date-picker/calendar/grid/index.js +7 -12
  14. package/esm/date-picker/calendar/index.js +4 -31
  15. package/esm/date-picker/index.js +11 -51
  16. package/esm/date-picker/utils.js +6 -11
  17. package/esm/drawer/Child.js +10 -20
  18. package/esm/drawer/index.js +22 -71
  19. package/esm/ellipsis/index.js +9 -17
  20. package/esm/guide/index.js +25 -63
  21. package/esm/index.d.ts +1 -1
  22. package/esm/input-number/ControlArrow.js +0 -2
  23. package/esm/input-number/constants.js +2 -2
  24. package/esm/input-number/index.js +26 -106
  25. package/esm/lazy-image/index.js +10 -55
  26. package/esm/link-list/index.js +11 -35
  27. package/esm/loading/index.js +15 -42
  28. package/esm/loading-container/index.js +3 -6
  29. package/esm/loading-icon/index.js +0 -2
  30. package/esm/mask/index.js +6 -9
  31. package/esm/message/index.d.ts +17 -6
  32. package/esm/message/index.js +68 -96
  33. package/esm/message/renderMessage.d.ts +17 -0
  34. package/esm/message/renderMessage.js +137 -0
  35. package/esm/message/style/index.css +1 -1
  36. package/esm/modal/Title.js +5 -12
  37. package/esm/modal/getPopupLocation.js +5 -7
  38. package/esm/modal/index.js +44 -125
  39. package/esm/move/index.js +32 -132
  40. package/esm/move/range.js +6 -12
  41. package/esm/move/utils.js +3 -10
  42. package/esm/popover/index.js +9 -28
  43. package/esm/portal/index.js +1 -22
  44. package/esm/script/index.js +19 -59
  45. package/esm/select/index.js +28 -106
  46. package/esm/show-more/index.js +40 -103
  47. package/esm/skeleton/Item.js +1 -3
  48. package/esm/skeleton/index.js +5 -11
  49. package/esm/style.css +1 -1
  50. package/esm/table/body/BodyRow.js +11 -28
  51. package/esm/table/body/CheckIcon.js +10 -18
  52. package/esm/table/body/index.js +8 -12
  53. package/esm/table/header/CheckIcon.js +3 -11
  54. package/esm/table/header/HeaderCell.js +12 -33
  55. package/esm/table/header/HeaderRow.js +6 -17
  56. package/esm/table/index.js +30 -100
  57. package/esm/tabs/index.js +35 -118
  58. package/esm/tooltip/index.js +0 -4
  59. package/esm/trigger/align.js +6 -6
  60. package/esm/trigger/bottomAlign.js +33 -45
  61. package/esm/trigger/constants.js +0 -1
  62. package/esm/trigger/getPopupLocation.js +48 -68
  63. package/esm/trigger/index.js +52 -187
  64. package/esm/trigger/leftAlign.js +33 -47
  65. package/esm/trigger/ref.js +2 -7
  66. package/esm/trigger/rightAlign.js +33 -45
  67. package/esm/trigger/topAlign.js +33 -45
  68. package/esm/trigger/utils.js +28 -45
  69. package/lib/accordion/Item.js +6 -27
  70. package/lib/accordion/index.js +8 -41
  71. package/lib/affix/PortalAffix.js +7 -17
  72. package/lib/affix/index.js +30 -75
  73. package/lib/carousel/index.js +45 -146
  74. package/lib/checkbox/index.js +12 -41
  75. package/lib/collapse/index.js +11 -53
  76. package/lib/confirm/index.d.ts +8 -0
  77. package/lib/confirm/index.js +23 -38
  78. package/lib/date-picker/DateEnum.js +0 -3
  79. package/lib/date-picker/calendar/Day.js +62 -87
  80. package/lib/date-picker/calendar/MonthYear.js +20 -62
  81. package/lib/date-picker/calendar/grid/index.js +7 -16
  82. package/lib/date-picker/calendar/index.js +4 -37
  83. package/lib/date-picker/index.js +9 -58
  84. package/lib/date-picker/utils.js +6 -26
  85. package/lib/drawer/Child.js +10 -25
  86. package/lib/drawer/index.js +22 -78
  87. package/lib/ellipsis/index.js +9 -23
  88. package/lib/guide/index.js +25 -71
  89. package/lib/index.d.ts +1 -1
  90. package/lib/index.js +0 -29
  91. package/lib/input-number/ControlArrow.js +0 -4
  92. package/lib/input-number/constants.js +2 -2
  93. package/lib/input-number/index.js +26 -114
  94. package/lib/lazy-image/index.js +10 -58
  95. package/lib/link-list/index.js +11 -40
  96. package/lib/loading/index.js +13 -48
  97. package/lib/loading-bar/index.js +0 -5
  98. package/lib/loading-container/index.js +3 -11
  99. package/lib/loading-icon/index.js +0 -7
  100. package/lib/mask/index.js +6 -17
  101. package/lib/message/index.d.ts +17 -6
  102. package/lib/message/index.js +67 -104
  103. package/lib/message/renderMessage.d.ts +17 -0
  104. package/lib/message/renderMessage.js +144 -0
  105. package/lib/message/style/index.css +1 -1
  106. package/lib/modal/Affix.js +0 -4
  107. package/lib/modal/Title.js +5 -15
  108. package/lib/modal/getPopupLocation.js +5 -9
  109. package/lib/modal/index.js +44 -135
  110. package/lib/move/index.js +32 -144
  111. package/lib/move/range.js +6 -14
  112. package/lib/move/utils.js +3 -12
  113. package/lib/popover/index.js +9 -33
  114. package/lib/portal/index.js +1 -25
  115. package/lib/script/index.js +19 -61
  116. package/lib/select/index.js +28 -113
  117. package/lib/show-more/index.js +40 -110
  118. package/lib/skeleton/Item.js +1 -8
  119. package/lib/skeleton/index.js +5 -16
  120. package/lib/style.css +1 -1
  121. package/lib/table/body/BodyRow.js +11 -33
  122. package/lib/table/body/CheckIcon.js +10 -22
  123. package/lib/table/body/index.js +8 -17
  124. package/lib/table/header/CheckIcon.js +3 -15
  125. package/lib/table/header/HeaderCell.js +12 -37
  126. package/lib/table/header/HeaderRow.js +6 -22
  127. package/lib/table/index.js +30 -107
  128. package/lib/tabs/index.js +35 -122
  129. package/lib/tooltip/index.js +0 -9
  130. package/lib/trigger/align.js +0 -4
  131. package/lib/trigger/bottomAlign.js +33 -48
  132. package/lib/trigger/constants.js +0 -2
  133. package/lib/trigger/getPopupLocation.js +48 -74
  134. package/lib/trigger/index.js +52 -198
  135. package/lib/trigger/leftAlign.js +33 -50
  136. package/lib/trigger/ref.js +2 -12
  137. package/lib/trigger/rightAlign.js +33 -48
  138. package/lib/trigger/topAlign.js +33 -48
  139. package/lib/trigger/utils.js +28 -53
  140. package/package.json +7 -3
@@ -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
- rootInfo = _a.rootInfo,
22
- popInfo = _a.popInfo,
23
- arrowTop = _a.arrowTop,
24
- hiddenArrow = _a.hiddenArrow,
25
- rootToPopupSpacing = _a.rootToPopupSpacing,
26
- isTransformHorizontalDirection = _a.isTransformHorizontalDirection;
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
- popInfo = _a.popInfo,
46
- _b = _a.translateY,
47
- translateY = _b === void 0 ? 0 : _b,
48
- rootToPopupSpacing = _a.rootToPopupSpacing,
49
- isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
50
- hiddenArrow = _a.hiddenArrow,
51
- isInsertNode = _a.isInsertNode;
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
- left = _c.left,
56
- top = _c.top;
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
- popInfo = _a.popInfo,
75
- _b = _a.translateY,
76
- translateY = _b === void 0 ? 0 : _b,
77
- rootToPopupSpacing = _a.rootToPopupSpacing,
78
- isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
79
- hiddenArrow = _a.hiddenArrow,
80
- isInsertNode = _a.isInsertNode;
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
- left = _c.left,
85
- top = _c.top;
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
- popInfo = _a.popInfo,
102
- _b = _a.translateY,
103
- translateY = _b === void 0 ? 0 : _b,
104
- rootToPopupSpacing = _a.rootToPopupSpacing,
105
- isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
106
- hiddenArrow = _a.hiddenArrow,
107
- isInsertNode = _a.isInsertNode;
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
- left = _c.left,
112
- top = _c.top;
113
-
98
+ left = _c.left,
99
+ top = _c.top;
114
100
  return __assign(__assign({}, getLeftCommon({
115
101
  left: left,
116
102
  rootInfo: rootInfo,
@@ -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
- } // Class component
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
- rootInfo = _a.rootInfo,
22
- popInfo = _a.popInfo,
23
- arrowTop = _a.arrowTop,
24
- hiddenArrow = _a.hiddenArrow,
25
- rootToPopupSpacing = _a.rootToPopupSpacing,
26
- isTransformHorizontalDirection = _a.isTransformHorizontalDirection;
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
- popInfo = _a.popInfo,
44
- _b = _a.translateY,
45
- translateY = _b === void 0 ? 0 : _b,
46
- rootToPopupSpacing = _a.rootToPopupSpacing,
47
- isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
48
- hiddenArrow = _a.hiddenArrow,
49
- isInsertNode = _a.isInsertNode;
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
- left = _c.left,
54
- top = _c.top;
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
- popInfo = _a.popInfo,
71
- _b = _a.translateY,
72
- translateY = _b === void 0 ? 0 : _b,
73
- rootToPopupSpacing = _a.rootToPopupSpacing,
74
- isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
75
- hiddenArrow = _a.hiddenArrow,
76
- isInsertNode = _a.isInsertNode;
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
- left = _c.left,
81
- top = _c.top;
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
- popInfo = _a.popInfo,
98
- _b = _a.translateY,
99
- translateY = _b === void 0 ? 0 : _b,
100
- rootToPopupSpacing = _a.rootToPopupSpacing,
101
- isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
102
- hiddenArrow = _a.hiddenArrow,
103
- isInsertNode = _a.isInsertNode;
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
- left = _c.left,
108
- top = _c.top;
109
-
96
+ left = _c.left,
97
+ top = _c.top;
110
98
  return __assign(__assign({}, getRightCommon({
111
99
  left: left,
112
100
  rootInfo: rootInfo,
@@ -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
- rootInfo = _a.rootInfo,
22
- popInfo = _a.popInfo,
23
- arrowLeft = _a.arrowLeft,
24
- hiddenArrow = _a.hiddenArrow,
25
- rootToPopupSpacing = _a.rootToPopupSpacing,
26
- isTransformHorizontalDirection = _a.isTransformHorizontalDirection;
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
- popInfo = _a.popInfo,
44
- _b = _a.translateX,
45
- translateX = _b === void 0 ? 0 : _b,
46
- rootToPopupSpacing = _a.rootToPopupSpacing,
47
- isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
48
- hiddenArrow = _a.hiddenArrow,
49
- isInsertNode = _a.isInsertNode;
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
- left = _c.left,
54
- top = _c.top;
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
- popInfo = _a.popInfo,
71
- _b = _a.translateX,
72
- translateX = _b === void 0 ? 0 : _b,
73
- rootToPopupSpacing = _a.rootToPopupSpacing,
74
- isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
75
- hiddenArrow = _a.hiddenArrow,
76
- isInsertNode = _a.isInsertNode;
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
- left = _c.left,
81
- top = _c.top;
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
- popInfo = _a.popInfo,
98
- _b = _a.translateX,
99
- translateX = _b === void 0 ? 0 : _b,
100
- rootToPopupSpacing = _a.rootToPopupSpacing,
101
- isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
102
- hiddenArrow = _a.hiddenArrow,
103
- isInsertNode = _a.isInsertNode;
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
- left = _c.left,
108
- top = _c.top;
109
-
96
+ left = _c.left,
97
+ top = _c.top;
110
98
  return __assign(__assign({}, getTopCommon({
111
99
  top: top,
112
100
  rootInfo: rootInfo,
@@ -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
- popupLimitSpacing = _a.popupLimitSpacing,
56
- currentValue = _a.currentValue,
57
- positionValue = _a.positionValue,
58
- scrollValue = _a.scrollValue,
59
- availValue = _a.availValue;
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
- availHeight = _a.availHeight,
102
- scrollTop = _a.scrollTop,
103
- useHeight = _a.useHeight,
104
- placement = _a.placement;
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
- availWidth = _a.availWidth,
126
- scrollLeft = _a.scrollLeft,
127
- useWidth = _a.useWidth,
128
- placement = _a.placement;
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
- popInfo = _a.popInfo,
152
- scrollInfo = _a.scrollInfo,
153
- placement = _a.placement,
154
- availSize = _a.availSize,
155
- rootToPopupSpacing = _a.rootToPopupSpacing;
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
- isVertical = _b.isVertical,
159
- splitArr = _b.splitArr;
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,
@@ -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
- title = _a.title,
53
- onTitleClick = _a.onTitleClick;
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
- appear = _a.appear,
72
- children = _a.children,
73
- visible = _a.visible;
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;