@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,18 +2,14 @@ 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 { getOffsetAndSize, getScrollOffset, getStyle, getAvailSize } from '@autobest-ui/utils';
18
14
  import { getTranslate, getLocationMethodByPlacement } from './utils';
19
15
  import * as alignUtil from './align';
@@ -21,62 +17,53 @@ import * as alignUtil from './align';
21
17
  * 获取popup元素接下来的位置信息
22
18
  * @returns {*}
23
19
  */
24
-
25
20
  export default function getPopupLocation(placement, rootEl, popupEl, initTranslateX, initTranslateY, rootToPopupSpacing, popupLimitSpacing, isTransformHorizontalDirection, hiddenArrow, isInsertNode) {
26
21
  // 判断body是否有隐藏, 用于判断按照哪种方式计算元素所在位置
27
22
  // 区别可参考getOffset的第二个参数ignoreScroll
28
23
  // 主要解决body hidden后,如果还是参考document进行定位,超出窗口后,会被隐藏
29
24
  var isBodyHidden = false;
30
-
31
25
  try {
32
26
  var bodyOverflowValue = getStyle(document.body, 'overflow');
33
27
  isBodyHidden = bodyOverflowValue === 'hidden';
34
28
  } catch (e) {}
35
-
36
29
  var parentNodeInfo = {
37
30
  left: 0,
38
31
  top: 0
39
- }; // 悬浮框插入到文档流中
40
-
32
+ };
33
+ // 悬浮框插入到文档流中
41
34
  if (isInsertNode) {
42
- var parentNode = rootEl.parentNode; // 判断父级元素是否定位,否则添加relative
43
-
35
+ var parentNode = rootEl.parentNode;
36
+ // 判断父级元素是否定位,否则添加relative
44
37
  if (getStyle(parentNode, 'position') === 'static') {
45
38
  parentNode.style.position = 'relative';
46
39
  }
47
-
48
40
  parentNodeInfo = getOffsetAndSize(parentNode);
49
41
  }
50
-
51
42
  var rootInfo = getOffsetAndSize(rootEl);
52
- var popInfo = getOffsetAndSize(popupEl); // 当前元素同级,形成兄弟节点时,需要设置样式隐藏
43
+ var popInfo = getOffsetAndSize(popupEl);
44
+ // 当前元素同级,形成兄弟节点时,需要设置样式隐藏
53
45
  // 并获取浏览器可用大小, scroll等信息,
54
46
  // 否则有可能会撑出当前UI,导致获取信息错误
55
-
56
47
  if (isInsertNode) {
57
48
  popupEl.style.display = 'none';
58
- } // 当body hidden时
49
+ }
50
+ // 当body hidden时
59
51
  // 1. 确定浏览器可用大小(窗口大小)
60
52
  // 2. 获取scroll信息,
61
53
  // 3. 改定位方式从document换成窗口定位,并智能判断方向,解决UI超出body导致隐藏的问题
62
-
63
-
64
54
  var availSize = getAvailSize(isBodyHidden);
65
55
  var scrollValueAtHidden = {
66
56
  left: 0,
67
57
  top: 0
68
58
  };
69
-
70
59
  if (isBodyHidden) {
71
60
  scrollValueAtHidden = getScrollOffset();
72
- } // 获取正确信息后,删除display样式
73
-
74
-
61
+ }
62
+ // 获取正确信息后,删除display样式
75
63
  if (isInsertNode) {
76
64
  popupEl.style.display = '';
77
- } // 获取位置的参数
78
-
79
-
65
+ }
66
+ // 获取位置的参数
80
67
  var params = {
81
68
  rootInfo: rootInfo,
82
69
  popInfo: popInfo,
@@ -86,68 +73,61 @@ export default function getPopupLocation(placement, rootEl, popupEl, initTransla
86
73
  translateX: initTranslateX,
87
74
  translateY: initTranslateY,
88
75
  isInsertNode: isInsertNode
89
- }; // 分两组:垂直与水平方向。
76
+ };
77
+ // 分两组:垂直与水平方向。
90
78
  // 判断方法名和是否为垂直方向
91
-
92
79
  var _a = getLocationMethodByPlacement({
93
- rootInfo: rootInfo,
94
- popInfo: popInfo,
95
- scrollInfo: scrollValueAtHidden,
96
- placement: placement,
97
- availSize: availSize,
98
- rootToPopupSpacing: rootToPopupSpacing
99
- }),
100
- methodStr = _a.methodStr,
101
- isVertical = _a.isVertical; // 拼装方法名
80
+ rootInfo: rootInfo,
81
+ popInfo: popInfo,
82
+ scrollInfo: scrollValueAtHidden,
83
+ placement: placement,
84
+ availSize: availSize,
85
+ rootToPopupSpacing: rootToPopupSpacing
86
+ }),
87
+ methodStr = _a.methodStr,
88
+ isVertical = _a.isVertical;
89
+ // 拼装方法名
102
90
  // eslint-disable-next-line import/namespace
103
-
104
-
105
- var currentMethod = alignUtil["get".concat(methodStr, "LocationInfo")]; // 执行方法
106
-
91
+ var currentMethod = alignUtil["get".concat(methodStr, "LocationInfo")];
92
+ // 执行方法
107
93
  var result = currentMethod(params);
108
-
109
94
  if (isVertical) {
110
95
  // 获取偏移量
111
96
  var _b = getTranslate({
112
- initTranslate: initTranslateX,
113
- popupLimitSpacing: popupLimitSpacing,
114
- currentValue: result.width,
115
- positionValue: isInsertNode ? parentNodeInfo.left + result.left : result.left,
116
- scrollValue: scrollValueAtHidden.left,
117
- availValue: availSize.width
118
- }),
119
- translateX = _b.translateValue,
120
- maxValue_1 = _b.maxValue; // 判断是否有偏移
121
-
122
-
97
+ initTranslate: initTranslateX,
98
+ popupLimitSpacing: popupLimitSpacing,
99
+ currentValue: result.width,
100
+ positionValue: isInsertNode ? parentNodeInfo.left + result.left : result.left,
101
+ scrollValue: scrollValueAtHidden.left,
102
+ availValue: availSize.width
103
+ }),
104
+ translateX = _b.translateValue,
105
+ maxValue_1 = _b.maxValue;
106
+ // 判断是否有偏移
123
107
  if (!translateX) {
124
108
  return result;
125
109
  }
126
-
127
110
  var translateResult_1 = currentMethod(__assign(__assign({}, params), {
128
111
  translateX: translateX
129
112
  }));
130
113
  translateResult_1.maxWidth = maxValue_1;
131
114
  return translateResult_1;
132
- } // 获取偏移量
133
-
134
-
115
+ }
116
+ // 获取偏移量
135
117
  var _c = getTranslate({
136
- initTranslate: initTranslateY,
137
- popupLimitSpacing: popupLimitSpacing,
138
- currentValue: result.height,
139
- positionValue: isInsertNode ? parentNodeInfo.top + result.top : result.top,
140
- scrollValue: scrollValueAtHidden.top,
141
- availValue: availSize.height
142
- }),
143
- translateY = _c.translateValue,
144
- maxValue = _c.maxValue; // 判断是否有偏移
145
-
146
-
118
+ initTranslate: initTranslateY,
119
+ popupLimitSpacing: popupLimitSpacing,
120
+ currentValue: result.height,
121
+ positionValue: isInsertNode ? parentNodeInfo.top + result.top : result.top,
122
+ scrollValue: scrollValueAtHidden.top,
123
+ availValue: availSize.height
124
+ }),
125
+ translateY = _c.translateValue,
126
+ maxValue = _c.maxValue;
127
+ // 判断是否有偏移
147
128
  if (!translateY) {
148
129
  return result;
149
130
  }
150
-
151
131
  var translateResult = currentMethod(__assign(__assign({}, params), {
152
132
  translateY: translateY
153
133
  }));