@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
@@ -6,33 +6,27 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getLeftBottomLocationInfo = getLeftBottomLocationInfo;
7
7
  exports.getLeftLocationInfo = getLeftLocationInfo;
8
8
  exports.getLeftTopLocationInfo = getLeftTopLocationInfo;
9
-
10
9
  var _utils = require("./utils");
11
-
12
10
  var __assign = void 0 && (void 0).__assign || function () {
13
11
  __assign = Object.assign || function (t) {
14
12
  for (var s, i = 1, n = arguments.length; i < n; i++) {
15
13
  s = arguments[i];
16
-
17
14
  for (var p in s) {
18
15
  if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
19
16
  }
20
17
  }
21
-
22
18
  return t;
23
19
  };
24
-
25
20
  return __assign.apply(this, arguments);
26
21
  };
27
-
28
22
  function getLeftCommon(_a) {
29
23
  var left = _a.left,
30
- rootInfo = _a.rootInfo,
31
- popInfo = _a.popInfo,
32
- arrowTop = _a.arrowTop,
33
- hiddenArrow = _a.hiddenArrow,
34
- rootToPopupSpacing = _a.rootToPopupSpacing,
35
- isTransformHorizontalDirection = _a.isTransformHorizontalDirection;
24
+ rootInfo = _a.rootInfo,
25
+ popInfo = _a.popInfo,
26
+ arrowTop = _a.arrowTop,
27
+ hiddenArrow = _a.hiddenArrow,
28
+ rootToPopupSpacing = _a.rootToPopupSpacing,
29
+ isTransformHorizontalDirection = _a.isTransformHorizontalDirection;
36
30
  return {
37
31
  rootWidth: rootInfo.width,
38
32
  width: popInfo.width,
@@ -47,23 +41,19 @@ function getLeftCommon(_a) {
47
41
  };
48
42
  }
49
43
  /* 具体方位 */
50
-
51
-
52
44
  function getLeftLocationInfo(_a) {
53
45
  var rootInfo = _a.rootInfo,
54
- popInfo = _a.popInfo,
55
- _b = _a.translateY,
56
- translateY = _b === void 0 ? 0 : _b,
57
- rootToPopupSpacing = _a.rootToPopupSpacing,
58
- isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
59
- hiddenArrow = _a.hiddenArrow,
60
- isInsertNode = _a.isInsertNode;
46
+ popInfo = _a.popInfo,
47
+ _b = _a.translateY,
48
+ translateY = _b === void 0 ? 0 : _b,
49
+ rootToPopupSpacing = _a.rootToPopupSpacing,
50
+ isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
51
+ hiddenArrow = _a.hiddenArrow,
52
+ isInsertNode = _a.isInsertNode;
61
53
  var arrowTop = (0, _utils.getArrowTop)(popInfo.height / 2 - translateY, popInfo.height);
62
-
63
54
  var _c = (0, _utils.getAvailPosition)(rootInfo, isInsertNode),
64
- left = _c.left,
65
- top = _c.top;
66
-
55
+ left = _c.left,
56
+ top = _c.top;
67
57
  return __assign(__assign({}, getLeftCommon({
68
58
  left: left,
69
59
  rootInfo: rootInfo,
@@ -77,23 +67,19 @@ function getLeftLocationInfo(_a) {
77
67
  });
78
68
  }
79
69
  /* 其他方位 */
80
-
81
-
82
70
  function getLeftTopLocationInfo(_a) {
83
71
  var rootInfo = _a.rootInfo,
84
- popInfo = _a.popInfo,
85
- _b = _a.translateY,
86
- translateY = _b === void 0 ? 0 : _b,
87
- rootToPopupSpacing = _a.rootToPopupSpacing,
88
- isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
89
- hiddenArrow = _a.hiddenArrow,
90
- isInsertNode = _a.isInsertNode;
72
+ popInfo = _a.popInfo,
73
+ _b = _a.translateY,
74
+ translateY = _b === void 0 ? 0 : _b,
75
+ rootToPopupSpacing = _a.rootToPopupSpacing,
76
+ isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
77
+ hiddenArrow = _a.hiddenArrow,
78
+ isInsertNode = _a.isInsertNode;
91
79
  var arrowTop = (0, _utils.getArrowTop)(rootInfo.height / 2 - translateY, popInfo.height);
92
-
93
80
  var _c = (0, _utils.getAvailPosition)(rootInfo, isInsertNode),
94
- left = _c.left,
95
- top = _c.top;
96
-
81
+ left = _c.left,
82
+ top = _c.top;
97
83
  return __assign(__assign({}, getLeftCommon({
98
84
  left: left,
99
85
  rootInfo: rootInfo,
@@ -106,22 +92,19 @@ function getLeftTopLocationInfo(_a) {
106
92
  top: top + translateY
107
93
  });
108
94
  }
109
-
110
95
  function getLeftBottomLocationInfo(_a) {
111
96
  var rootInfo = _a.rootInfo,
112
- popInfo = _a.popInfo,
113
- _b = _a.translateY,
114
- translateY = _b === void 0 ? 0 : _b,
115
- rootToPopupSpacing = _a.rootToPopupSpacing,
116
- isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
117
- hiddenArrow = _a.hiddenArrow,
118
- isInsertNode = _a.isInsertNode;
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;
119
104
  var arrowTop = (0, _utils.getArrowTop)(popInfo.height - rootInfo.height / 2 - translateY, popInfo.height);
120
-
121
105
  var _c = (0, _utils.getAvailPosition)(rootInfo, isInsertNode),
122
- left = _c.left,
123
- top = _c.top;
124
-
106
+ left = _c.left,
107
+ top = _c.top;
125
108
  return __assign(__assign({}, getLeftCommon({
126
109
  left: left,
127
110
  rootInfo: rootInfo,
@@ -1,16 +1,13 @@
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.composeRef = composeRef;
9
8
  exports.fillRef = fillRef;
10
9
  exports.supportRef = supportRef;
11
-
12
10
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
13
-
14
11
  function fillRef(ref, node) {
15
12
  if (typeof ref === 'function') {
16
13
  ref(node);
@@ -21,32 +18,25 @@ function fillRef(ref, node) {
21
18
  /**
22
19
  * Merge refs into one ref function to support ref passing.
23
20
  */
24
-
25
-
26
21
  function composeRef() {
27
22
  var refs = [];
28
-
29
23
  for (var _i = 0; _i < arguments.length; _i++) {
30
24
  refs[_i] = arguments[_i];
31
25
  }
32
-
33
26
  return function (node) {
34
27
  refs.forEach(function (ref) {
35
28
  fillRef(ref, node);
36
29
  });
37
30
  };
38
31
  }
39
-
40
32
  function supportRef(nodeOrComponent) {
41
33
  // Function component node
42
34
  if (nodeOrComponent.type && nodeOrComponent.type.prototype && !nodeOrComponent.type.prototype.render) {
43
35
  return false;
44
- } // Class component
45
-
46
-
36
+ }
37
+ // Class component
47
38
  if (typeof nodeOrComponent === 'function' && nodeOrComponent.prototype && !nodeOrComponent.prototype.render) {
48
39
  return false;
49
40
  }
50
-
51
41
  return true;
52
42
  }
@@ -6,33 +6,27 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getRightBottomLocationInfo = getRightBottomLocationInfo;
7
7
  exports.getRightLocationInfo = getRightLocationInfo;
8
8
  exports.getRightTopLocationInfo = getRightTopLocationInfo;
9
-
10
9
  var _utils = require("./utils");
11
-
12
10
  var __assign = void 0 && (void 0).__assign || function () {
13
11
  __assign = Object.assign || function (t) {
14
12
  for (var s, i = 1, n = arguments.length; i < n; i++) {
15
13
  s = arguments[i];
16
-
17
14
  for (var p in s) {
18
15
  if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
19
16
  }
20
17
  }
21
-
22
18
  return t;
23
19
  };
24
-
25
20
  return __assign.apply(this, arguments);
26
21
  };
27
-
28
22
  function getRightCommon(_a) {
29
23
  var left = _a.left,
30
- rootInfo = _a.rootInfo,
31
- popInfo = _a.popInfo,
32
- arrowTop = _a.arrowTop,
33
- hiddenArrow = _a.hiddenArrow,
34
- rootToPopupSpacing = _a.rootToPopupSpacing,
35
- isTransformHorizontalDirection = _a.isTransformHorizontalDirection;
24
+ rootInfo = _a.rootInfo,
25
+ popInfo = _a.popInfo,
26
+ arrowTop = _a.arrowTop,
27
+ hiddenArrow = _a.hiddenArrow,
28
+ rootToPopupSpacing = _a.rootToPopupSpacing,
29
+ isTransformHorizontalDirection = _a.isTransformHorizontalDirection;
36
30
  return {
37
31
  rootWidth: rootInfo.width,
38
32
  width: popInfo.width,
@@ -46,22 +40,19 @@ function getRightCommon(_a) {
46
40
  transformOrigin: isTransformHorizontalDirection ? 'left center' : "left ".concat(arrowTop, "px")
47
41
  };
48
42
  }
49
-
50
43
  function getRightLocationInfo(_a) {
51
44
  var rootInfo = _a.rootInfo,
52
- popInfo = _a.popInfo,
53
- _b = _a.translateY,
54
- translateY = _b === void 0 ? 0 : _b,
55
- rootToPopupSpacing = _a.rootToPopupSpacing,
56
- isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
57
- hiddenArrow = _a.hiddenArrow,
58
- isInsertNode = _a.isInsertNode;
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;
59
52
  var arrowTop = (0, _utils.getArrowTop)(popInfo.height / 2 - translateY, popInfo.height);
60
-
61
53
  var _c = (0, _utils.getAvailPosition)(rootInfo, isInsertNode),
62
- left = _c.left,
63
- top = _c.top;
64
-
54
+ left = _c.left,
55
+ top = _c.top;
65
56
  return __assign(__assign({}, getRightCommon({
66
57
  left: left,
67
58
  rootInfo: rootInfo,
@@ -74,22 +65,19 @@ function getRightLocationInfo(_a) {
74
65
  top: top - (popInfo.height / 2 - rootInfo.height / 2) + translateY
75
66
  });
76
67
  }
77
-
78
68
  function getRightTopLocationInfo(_a) {
79
69
  var rootInfo = _a.rootInfo,
80
- popInfo = _a.popInfo,
81
- _b = _a.translateY,
82
- translateY = _b === void 0 ? 0 : _b,
83
- rootToPopupSpacing = _a.rootToPopupSpacing,
84
- isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
85
- hiddenArrow = _a.hiddenArrow,
86
- isInsertNode = _a.isInsertNode;
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;
87
77
  var arrowTop = (0, _utils.getArrowTop)(rootInfo.height / 2 - translateY, popInfo.height);
88
-
89
78
  var _c = (0, _utils.getAvailPosition)(rootInfo, isInsertNode),
90
- left = _c.left,
91
- top = _c.top;
92
-
79
+ left = _c.left,
80
+ top = _c.top;
93
81
  return __assign(__assign({}, getRightCommon({
94
82
  left: left,
95
83
  rootInfo: rootInfo,
@@ -102,22 +90,19 @@ function getRightTopLocationInfo(_a) {
102
90
  top: top + translateY
103
91
  });
104
92
  }
105
-
106
93
  function getRightBottomLocationInfo(_a) {
107
94
  var rootInfo = _a.rootInfo,
108
- popInfo = _a.popInfo,
109
- _b = _a.translateY,
110
- translateY = _b === void 0 ? 0 : _b,
111
- rootToPopupSpacing = _a.rootToPopupSpacing,
112
- isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
113
- hiddenArrow = _a.hiddenArrow,
114
- isInsertNode = _a.isInsertNode;
95
+ popInfo = _a.popInfo,
96
+ _b = _a.translateY,
97
+ translateY = _b === void 0 ? 0 : _b,
98
+ rootToPopupSpacing = _a.rootToPopupSpacing,
99
+ isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
100
+ hiddenArrow = _a.hiddenArrow,
101
+ isInsertNode = _a.isInsertNode;
115
102
  var arrowTop = (0, _utils.getArrowTop)(popInfo.height - rootInfo.height / 2 - translateY, popInfo.height);
116
-
117
103
  var _c = (0, _utils.getAvailPosition)(rootInfo, isInsertNode),
118
- left = _c.left,
119
- top = _c.top;
120
-
104
+ left = _c.left,
105
+ top = _c.top;
121
106
  return __assign(__assign({}, getRightCommon({
122
107
  left: left,
123
108
  rootInfo: rootInfo,
@@ -6,33 +6,27 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getTopLeftLocationInfo = getTopLeftLocationInfo;
7
7
  exports.getTopLocationInfo = getTopLocationInfo;
8
8
  exports.getTopRightLocationInfo = getTopRightLocationInfo;
9
-
10
9
  var _utils = require("./utils");
11
-
12
10
  var __assign = void 0 && (void 0).__assign || function () {
13
11
  __assign = Object.assign || function (t) {
14
12
  for (var s, i = 1, n = arguments.length; i < n; i++) {
15
13
  s = arguments[i];
16
-
17
14
  for (var p in s) {
18
15
  if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
19
16
  }
20
17
  }
21
-
22
18
  return t;
23
19
  };
24
-
25
20
  return __assign.apply(this, arguments);
26
21
  };
27
-
28
22
  function getTopCommon(_a) {
29
23
  var top = _a.top,
30
- rootInfo = _a.rootInfo,
31
- popInfo = _a.popInfo,
32
- arrowLeft = _a.arrowLeft,
33
- hiddenArrow = _a.hiddenArrow,
34
- rootToPopupSpacing = _a.rootToPopupSpacing,
35
- isTransformHorizontalDirection = _a.isTransformHorizontalDirection;
24
+ rootInfo = _a.rootInfo,
25
+ popInfo = _a.popInfo,
26
+ arrowLeft = _a.arrowLeft,
27
+ hiddenArrow = _a.hiddenArrow,
28
+ rootToPopupSpacing = _a.rootToPopupSpacing,
29
+ isTransformHorizontalDirection = _a.isTransformHorizontalDirection;
36
30
  return {
37
31
  rootWidth: rootInfo.width,
38
32
  width: popInfo.width,
@@ -46,22 +40,19 @@ function getTopCommon(_a) {
46
40
  transformOrigin: isTransformHorizontalDirection ? 'center bottom' : "".concat(arrowLeft, "px bottom")
47
41
  };
48
42
  }
49
-
50
43
  function getTopLocationInfo(_a) {
51
44
  var rootInfo = _a.rootInfo,
52
- popInfo = _a.popInfo,
53
- _b = _a.translateX,
54
- translateX = _b === void 0 ? 0 : _b,
55
- rootToPopupSpacing = _a.rootToPopupSpacing,
56
- isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
57
- hiddenArrow = _a.hiddenArrow,
58
- isInsertNode = _a.isInsertNode;
45
+ popInfo = _a.popInfo,
46
+ _b = _a.translateX,
47
+ translateX = _b === void 0 ? 0 : _b,
48
+ rootToPopupSpacing = _a.rootToPopupSpacing,
49
+ isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
50
+ hiddenArrow = _a.hiddenArrow,
51
+ isInsertNode = _a.isInsertNode;
59
52
  var arrowLeft = (0, _utils.getArrowLeft)(popInfo.width / 2 - translateX, popInfo.width);
60
-
61
53
  var _c = (0, _utils.getAvailPosition)(rootInfo, isInsertNode),
62
- left = _c.left,
63
- top = _c.top;
64
-
54
+ left = _c.left,
55
+ top = _c.top;
65
56
  return __assign(__assign({}, getTopCommon({
66
57
  top: top,
67
58
  rootInfo: rootInfo,
@@ -74,22 +65,19 @@ function getTopLocationInfo(_a) {
74
65
  left: left + rootInfo.width / 2 - popInfo.width / 2 + translateX
75
66
  });
76
67
  }
77
-
78
68
  function getTopLeftLocationInfo(_a) {
79
69
  var rootInfo = _a.rootInfo,
80
- popInfo = _a.popInfo,
81
- _b = _a.translateX,
82
- translateX = _b === void 0 ? 0 : _b,
83
- rootToPopupSpacing = _a.rootToPopupSpacing,
84
- isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
85
- hiddenArrow = _a.hiddenArrow,
86
- isInsertNode = _a.isInsertNode;
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;
87
77
  var arrowLeft = (0, _utils.getArrowLeft)(rootInfo.width / 2 - translateX, popInfo.width);
88
-
89
78
  var _c = (0, _utils.getAvailPosition)(rootInfo, isInsertNode),
90
- left = _c.left,
91
- top = _c.top;
92
-
79
+ left = _c.left,
80
+ top = _c.top;
93
81
  return __assign(__assign({}, getTopCommon({
94
82
  top: top,
95
83
  rootInfo: rootInfo,
@@ -102,22 +90,19 @@ function getTopLeftLocationInfo(_a) {
102
90
  left: left + translateX
103
91
  });
104
92
  }
105
-
106
93
  function getTopRightLocationInfo(_a) {
107
94
  var rootInfo = _a.rootInfo,
108
- popInfo = _a.popInfo,
109
- _b = _a.translateX,
110
- translateX = _b === void 0 ? 0 : _b,
111
- rootToPopupSpacing = _a.rootToPopupSpacing,
112
- isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
113
- hiddenArrow = _a.hiddenArrow,
114
- isInsertNode = _a.isInsertNode;
95
+ popInfo = _a.popInfo,
96
+ _b = _a.translateX,
97
+ translateX = _b === void 0 ? 0 : _b,
98
+ rootToPopupSpacing = _a.rootToPopupSpacing,
99
+ isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
100
+ hiddenArrow = _a.hiddenArrow,
101
+ isInsertNode = _a.isInsertNode;
115
102
  var arrowLeft = (0, _utils.getArrowLeft)(popInfo.width - rootInfo.width / 2 - translateX, popInfo.width);
116
-
117
103
  var _c = (0, _utils.getAvailPosition)(rootInfo, isInsertNode),
118
- left = _c.left,
119
- top = _c.top;
120
-
104
+ left = _c.left,
105
+ top = _c.top;
121
106
  return __assign(__assign({}, getTopCommon({
122
107
  top: top,
123
108
  rootInfo: rootInfo,
@@ -10,25 +10,20 @@ exports.getLocationMethodByPlacement = getLocationMethodByPlacement;
10
10
  exports.getTranslate = getTranslate;
11
11
  exports.isLeftMoreThanRight = isLeftMoreThanRight;
12
12
  exports.isTopMoreThanBottom = isTopMoreThanBottom;
13
-
14
13
  var _constants = require("./constants");
15
-
16
14
  var ArrowLimit = 8;
17
15
  /**
18
16
  * 获取悬浮框箭头left位置,处理临界点
19
17
  * @param value
20
18
  * @param popWidth
21
19
  */
22
-
23
20
  function getArrowLeft(value, popWidth) {
24
21
  if (value < 0) {
25
22
  return 0;
26
23
  }
27
-
28
24
  if (value > popWidth - ArrowLimit) {
29
25
  return popWidth - ArrowLimit;
30
26
  }
31
-
32
27
  return value;
33
28
  }
34
29
  /**
@@ -36,20 +31,15 @@ function getArrowLeft(value, popWidth) {
36
31
  * @param value
37
32
  * @param popHeight
38
33
  */
39
-
40
-
41
34
  function getArrowTop(value, popHeight) {
42
35
  if (value < 0) {
43
36
  return 0;
44
37
  }
45
-
46
38
  if (value > popHeight - ArrowLimit) {
47
39
  return popHeight - ArrowLimit;
48
40
  }
49
-
50
41
  return value;
51
42
  }
52
-
53
43
  function getAvailPosition(rootInfo, isInsertNode) {
54
44
  return isInsertNode ? {
55
45
  left: rootInfo.offsetLeft,
@@ -65,17 +55,15 @@ function getAvailPosition(rootInfo, isInsertNode) {
65
55
  * @param scrollValue 滚动信息
66
56
  * @param availValue 浏览器可用大小
67
57
  */
68
-
69
-
70
58
  function getTranslate(_a) {
71
59
  var initTranslate = _a.initTranslate,
72
- popupLimitSpacing = _a.popupLimitSpacing,
73
- currentValue = _a.currentValue,
74
- positionValue = _a.positionValue,
75
- scrollValue = _a.scrollValue,
76
- availValue = _a.availValue;
77
- var limit = initTranslate ? 0 : popupLimitSpacing; // 小于设备大小
78
-
60
+ popupLimitSpacing = _a.popupLimitSpacing,
61
+ currentValue = _a.currentValue,
62
+ positionValue = _a.positionValue,
63
+ scrollValue = _a.scrollValue,
64
+ availValue = _a.availValue;
65
+ var limit = initTranslate ? 0 : popupLimitSpacing;
66
+ // 小于设备大小
79
67
  if (currentValue < availValue - limit * 2) {
80
68
  if (positionValue - scrollValue < limit) {
81
69
  return {
@@ -83,7 +71,6 @@ function getTranslate(_a) {
83
71
  maxValue: null
84
72
  };
85
73
  }
86
-
87
74
  if (positionValue - scrollValue + currentValue + limit > availValue) {
88
75
  return {
89
76
  translateValue: availValue - (positionValue + currentValue + limit) + scrollValue,
@@ -98,7 +85,6 @@ function getTranslate(_a) {
98
85
  maxValue: maxValue
99
86
  };
100
87
  }
101
-
102
88
  return {
103
89
  translateValue: initTranslate,
104
90
  maxValue: null
@@ -112,21 +98,18 @@ function getTranslate(_a) {
112
98
  * @param useHeight
113
99
  * @param placement
114
100
  */
115
-
116
-
117
101
  function isTopMoreThanBottom(_a) {
118
102
  var rootInfo = _a.rootInfo,
119
- availHeight = _a.availHeight,
120
- scrollTop = _a.scrollTop,
121
- useHeight = _a.useHeight,
122
- placement = _a.placement;
103
+ availHeight = _a.availHeight,
104
+ scrollTop = _a.scrollTop,
105
+ useHeight = _a.useHeight,
106
+ placement = _a.placement;
123
107
  var topDistance = rootInfo.top - scrollTop;
124
- var bottomDistance = availHeight - rootInfo.top + scrollTop - rootInfo.height; // 当都满足要求时,优先使用给定的位置
125
-
108
+ var bottomDistance = availHeight - rootInfo.top + scrollTop - rootInfo.height;
109
+ // 当都满足要求时,优先使用给定的位置
126
110
  if (topDistance > useHeight && bottomDistance > useHeight) {
127
111
  return placement === _constants.LocationType.Top.value || placement === _constants.LocationType.TopLeft.value || placement === _constants.LocationType.TopRight.value;
128
112
  }
129
-
130
113
  return topDistance > bottomDistance;
131
114
  }
132
115
  /**
@@ -137,21 +120,18 @@ function isTopMoreThanBottom(_a) {
137
120
  * @param useWidth
138
121
  * @param placement
139
122
  */
140
-
141
-
142
123
  function isLeftMoreThanRight(_a) {
143
124
  var rootInfo = _a.rootInfo,
144
- availWidth = _a.availWidth,
145
- scrollLeft = _a.scrollLeft,
146
- useWidth = _a.useWidth,
147
- placement = _a.placement;
125
+ availWidth = _a.availWidth,
126
+ scrollLeft = _a.scrollLeft,
127
+ useWidth = _a.useWidth,
128
+ placement = _a.placement;
148
129
  var leftDistance = rootInfo.left - scrollLeft;
149
- var rightDistance = availWidth - rootInfo.left + scrollLeft - rootInfo.width; // 当都满足要求时,优先使用给定的位置
150
-
130
+ var rightDistance = availWidth - rootInfo.left + scrollLeft - rootInfo.width;
131
+ // 当都满足要求时,优先使用给定的位置
151
132
  if (leftDistance > useWidth && rightDistance > useWidth) {
152
133
  return placement === _constants.LocationType.Left.value || placement === _constants.LocationType.LeftTop.value || placement === _constants.LocationType.LeftBottom.value;
153
134
  }
154
-
155
135
  return leftDistance > rightDistance;
156
136
  }
157
137
  /**
@@ -164,20 +144,16 @@ function isLeftMoreThanRight(_a) {
164
144
  * @param availSize
165
145
  * @param rootToPopupSpacing
166
146
  */
167
-
168
-
169
147
  function getLocationMethodByPlacement(_a) {
170
148
  var rootInfo = _a.rootInfo,
171
- popInfo = _a.popInfo,
172
- scrollInfo = _a.scrollInfo,
173
- placement = _a.placement,
174
- availSize = _a.availSize,
175
- rootToPopupSpacing = _a.rootToPopupSpacing;
176
-
149
+ popInfo = _a.popInfo,
150
+ scrollInfo = _a.scrollInfo,
151
+ placement = _a.placement,
152
+ availSize = _a.availSize,
153
+ rootToPopupSpacing = _a.rootToPopupSpacing;
177
154
  var _b = (0, _constants.getLocationInfo)(placement),
178
- isVertical = _b.isVertical,
179
- splitArr = _b.splitArr;
180
-
155
+ isVertical = _b.isVertical,
156
+ splitArr = _b.splitArr;
181
157
  if (isVertical) {
182
158
  var useTopLocation = isTopMoreThanBottom({
183
159
  rootInfo: rootInfo,
@@ -190,9 +166,8 @@ function getLocationMethodByPlacement(_a) {
190
166
  methodStr: useTopLocation ? "Top".concat(splitArr[1]) : "Bottom".concat(splitArr[1]),
191
167
  isVertical: true
192
168
  };
193
- } // 判断悬浮框最终位置
194
-
195
-
169
+ }
170
+ // 判断悬浮框最终位置
196
171
  var useLeftLocation = isLeftMoreThanRight({
197
172
  rootInfo: rootInfo,
198
173
  placement: placement,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobest-ui/components",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "private": false,
5
5
  "description": "components common ui for React",
6
6
  "main": "lib/index.js",
@@ -39,6 +39,10 @@
39
39
  "ie 11"
40
40
  ]
41
41
  },
42
+ "publishConfig": {
43
+ "registry": "https://registry.npmjs.org/",
44
+ "access": "public"
45
+ },
42
46
  "homepage": "https://autobest.visualstudio.com/AutoBestChina/_git/AutobestFrontendCommon#readme",
43
47
  "peerDependencies": {
44
48
  "intersection-observer": ">=0.12.0",
@@ -46,7 +50,7 @@
46
50
  "react-transition-group": ">=4.2.2"
47
51
  },
48
52
  "dependencies": {
49
- "@autobest-ui/utils": "^2.0.3"
53
+ "@autobest-ui/utils": "^2.1.0"
50
54
  },
51
- "gitHead": "ef2e322eb17bfac857e9f2a773990a3951d51c4f"
55
+ "gitHead": "56e873adb2a68d99dcd56f83cb68f5d4b5d618d6"
52
56
  }