@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.
Files changed (141) 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 +2 -2
  22. package/esm/index.js +1 -1
  23. package/esm/input-number/ControlArrow.js +0 -2
  24. package/esm/input-number/constants.js +2 -2
  25. package/esm/input-number/index.js +26 -106
  26. package/esm/lazy-image/index.js +10 -55
  27. package/esm/link-list/index.js +11 -35
  28. package/esm/loading/index.js +15 -42
  29. package/esm/loading-container/index.js +3 -6
  30. package/esm/loading-icon/index.js +0 -2
  31. package/esm/mask/index.js +6 -9
  32. package/esm/message/index.d.ts +44 -7
  33. package/esm/message/index.js +96 -111
  34. package/esm/message/renderMessage.d.ts +17 -0
  35. package/esm/message/renderMessage.js +137 -0
  36. package/esm/message/style/index.css +1 -1
  37. package/esm/modal/Title.js +5 -12
  38. package/esm/modal/getPopupLocation.js +5 -7
  39. package/esm/modal/index.js +44 -125
  40. package/esm/move/index.js +32 -132
  41. package/esm/move/range.js +6 -12
  42. package/esm/move/utils.js +3 -10
  43. package/esm/popover/index.js +9 -28
  44. package/esm/portal/index.js +1 -22
  45. package/esm/script/index.js +19 -59
  46. package/esm/select/index.js +28 -106
  47. package/esm/show-more/index.js +40 -103
  48. package/esm/skeleton/Item.js +1 -3
  49. package/esm/skeleton/index.js +5 -11
  50. package/esm/style.css +1 -1
  51. package/esm/table/body/BodyRow.js +11 -28
  52. package/esm/table/body/CheckIcon.js +10 -18
  53. package/esm/table/body/index.js +8 -12
  54. package/esm/table/header/CheckIcon.js +3 -11
  55. package/esm/table/header/HeaderCell.js +12 -33
  56. package/esm/table/header/HeaderRow.js +6 -17
  57. package/esm/table/index.js +30 -100
  58. package/esm/tabs/index.js +35 -118
  59. package/esm/tooltip/index.js +0 -4
  60. package/esm/trigger/align.js +6 -6
  61. package/esm/trigger/bottomAlign.js +33 -45
  62. package/esm/trigger/constants.js +0 -1
  63. package/esm/trigger/getPopupLocation.js +48 -68
  64. package/esm/trigger/index.js +52 -187
  65. package/esm/trigger/leftAlign.js +33 -47
  66. package/esm/trigger/ref.js +2 -7
  67. package/esm/trigger/rightAlign.js +33 -45
  68. package/esm/trigger/topAlign.js +33 -45
  69. package/esm/trigger/utils.js +28 -45
  70. package/lib/accordion/Item.js +6 -27
  71. package/lib/accordion/index.js +8 -41
  72. package/lib/affix/PortalAffix.js +7 -17
  73. package/lib/affix/index.js +30 -75
  74. package/lib/carousel/index.js +45 -146
  75. package/lib/checkbox/index.js +12 -41
  76. package/lib/collapse/index.js +11 -53
  77. package/lib/confirm/index.d.ts +8 -0
  78. package/lib/confirm/index.js +23 -38
  79. package/lib/date-picker/DateEnum.js +0 -3
  80. package/lib/date-picker/calendar/Day.js +62 -87
  81. package/lib/date-picker/calendar/MonthYear.js +20 -62
  82. package/lib/date-picker/calendar/grid/index.js +7 -16
  83. package/lib/date-picker/calendar/index.js +4 -37
  84. package/lib/date-picker/index.js +9 -58
  85. package/lib/date-picker/utils.js +6 -26
  86. package/lib/drawer/Child.js +10 -25
  87. package/lib/drawer/index.js +22 -78
  88. package/lib/ellipsis/index.js +9 -23
  89. package/lib/guide/index.js +25 -71
  90. package/lib/index.d.ts +2 -2
  91. package/lib/index.js +12 -32
  92. package/lib/input-number/ControlArrow.js +0 -4
  93. package/lib/input-number/constants.js +2 -2
  94. package/lib/input-number/index.js +26 -114
  95. package/lib/lazy-image/index.js +10 -58
  96. package/lib/link-list/index.js +11 -40
  97. package/lib/loading/index.js +13 -48
  98. package/lib/loading-bar/index.js +0 -5
  99. package/lib/loading-container/index.js +3 -11
  100. package/lib/loading-icon/index.js +0 -7
  101. package/lib/mask/index.js +6 -17
  102. package/lib/message/index.d.ts +44 -7
  103. package/lib/message/index.js +97 -120
  104. package/lib/message/renderMessage.d.ts +17 -0
  105. package/lib/message/renderMessage.js +144 -0
  106. package/lib/message/style/index.css +1 -1
  107. package/lib/modal/Affix.js +0 -4
  108. package/lib/modal/Title.js +5 -15
  109. package/lib/modal/getPopupLocation.js +5 -9
  110. package/lib/modal/index.js +44 -135
  111. package/lib/move/index.js +32 -144
  112. package/lib/move/range.js +6 -14
  113. package/lib/move/utils.js +3 -12
  114. package/lib/popover/index.js +9 -33
  115. package/lib/portal/index.js +1 -25
  116. package/lib/script/index.js +19 -61
  117. package/lib/select/index.js +28 -113
  118. package/lib/show-more/index.js +40 -110
  119. package/lib/skeleton/Item.js +1 -8
  120. package/lib/skeleton/index.js +5 -16
  121. package/lib/style.css +1 -1
  122. package/lib/table/body/BodyRow.js +11 -33
  123. package/lib/table/body/CheckIcon.js +10 -22
  124. package/lib/table/body/index.js +8 -17
  125. package/lib/table/header/CheckIcon.js +3 -15
  126. package/lib/table/header/HeaderCell.js +12 -37
  127. package/lib/table/header/HeaderRow.js +6 -22
  128. package/lib/table/index.js +30 -107
  129. package/lib/tabs/index.js +35 -122
  130. package/lib/tooltip/index.js +0 -9
  131. package/lib/trigger/align.js +0 -4
  132. package/lib/trigger/bottomAlign.js +33 -48
  133. package/lib/trigger/constants.js +0 -2
  134. package/lib/trigger/getPopupLocation.js +48 -74
  135. package/lib/trigger/index.js +52 -198
  136. package/lib/trigger/leftAlign.js +33 -50
  137. package/lib/trigger/ref.js +2 -12
  138. package/lib/trigger/rightAlign.js +33 -48
  139. package/lib/trigger/topAlign.js +33 -48
  140. package/lib/trigger/utils.js +28 -53
  141. package/package.json +7 -3
@@ -1,38 +1,27 @@
1
1
  "use strict";
2
2
 
3
3
  var _typeof = require("@babel/runtime/helpers/typeof");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = getPopupLocation;
9
-
10
8
  var _utils = require("@autobest-ui/utils");
11
-
12
9
  var _utils2 = require("./utils");
13
-
14
10
  var alignUtil = _interopRequireWildcard(require("./align"));
15
-
16
11
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
-
18
12
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
-
20
13
  var __assign = void 0 && (void 0).__assign || function () {
21
14
  __assign = Object.assign || function (t) {
22
15
  for (var s, i = 1, n = arguments.length; i < n; i++) {
23
16
  s = arguments[i];
24
-
25
17
  for (var p in s) {
26
18
  if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
27
19
  }
28
20
  }
29
-
30
21
  return t;
31
22
  };
32
-
33
23
  return __assign.apply(this, arguments);
34
24
  };
35
-
36
25
  /**
37
26
  * 获取popup元素接下来的位置信息
38
27
  * @returns {*}
@@ -42,56 +31,48 @@ function getPopupLocation(placement, rootEl, popupEl, initTranslateX, initTransl
42
31
  // 区别可参考getOffset的第二个参数ignoreScroll
43
32
  // 主要解决body hidden后,如果还是参考document进行定位,超出窗口后,会被隐藏
44
33
  var isBodyHidden = false;
45
-
46
34
  try {
47
35
  var bodyOverflowValue = (0, _utils.getStyle)(document.body, 'overflow');
48
36
  isBodyHidden = bodyOverflowValue === 'hidden';
49
37
  } catch (e) {}
50
-
51
38
  var parentNodeInfo = {
52
39
  left: 0,
53
40
  top: 0
54
- }; // 悬浮框插入到文档流中
55
-
41
+ };
42
+ // 悬浮框插入到文档流中
56
43
  if (isInsertNode) {
57
- var parentNode = rootEl.parentNode; // 判断父级元素是否定位,否则添加relative
58
-
44
+ var parentNode = rootEl.parentNode;
45
+ // 判断父级元素是否定位,否则添加relative
59
46
  if ((0, _utils.getStyle)(parentNode, 'position') === 'static') {
60
47
  parentNode.style.position = 'relative';
61
48
  }
62
-
63
49
  parentNodeInfo = (0, _utils.getOffsetAndSize)(parentNode);
64
50
  }
65
-
66
51
  var rootInfo = (0, _utils.getOffsetAndSize)(rootEl);
67
- var popInfo = (0, _utils.getOffsetAndSize)(popupEl); // 当前元素同级,形成兄弟节点时,需要设置样式隐藏
52
+ var popInfo = (0, _utils.getOffsetAndSize)(popupEl);
53
+ // 当前元素同级,形成兄弟节点时,需要设置样式隐藏
68
54
  // 并获取浏览器可用大小, scroll等信息,
69
55
  // 否则有可能会撑出当前UI,导致获取信息错误
70
-
71
56
  if (isInsertNode) {
72
57
  popupEl.style.display = 'none';
73
- } // 当body hidden时
58
+ }
59
+ // 当body hidden时
74
60
  // 1. 确定浏览器可用大小(窗口大小)
75
61
  // 2. 获取scroll信息,
76
62
  // 3. 改定位方式从document换成窗口定位,并智能判断方向,解决UI超出body导致隐藏的问题
77
-
78
-
79
63
  var availSize = (0, _utils.getAvailSize)(isBodyHidden);
80
64
  var scrollValueAtHidden = {
81
65
  left: 0,
82
66
  top: 0
83
67
  };
84
-
85
68
  if (isBodyHidden) {
86
69
  scrollValueAtHidden = (0, _utils.getScrollOffset)();
87
- } // 获取正确信息后,删除display样式
88
-
89
-
70
+ }
71
+ // 获取正确信息后,删除display样式
90
72
  if (isInsertNode) {
91
73
  popupEl.style.display = '';
92
- } // 获取位置的参数
93
-
94
-
74
+ }
75
+ // 获取位置的参数
95
76
  var params = {
96
77
  rootInfo: rootInfo,
97
78
  popInfo: popInfo,
@@ -101,68 +82,61 @@ function getPopupLocation(placement, rootEl, popupEl, initTranslateX, initTransl
101
82
  translateX: initTranslateX,
102
83
  translateY: initTranslateY,
103
84
  isInsertNode: isInsertNode
104
- }; // 分两组:垂直与水平方向。
85
+ };
86
+ // 分两组:垂直与水平方向。
105
87
  // 判断方法名和是否为垂直方向
106
-
107
88
  var _a = (0, _utils2.getLocationMethodByPlacement)({
108
- rootInfo: rootInfo,
109
- popInfo: popInfo,
110
- scrollInfo: scrollValueAtHidden,
111
- placement: placement,
112
- availSize: availSize,
113
- rootToPopupSpacing: rootToPopupSpacing
114
- }),
115
- methodStr = _a.methodStr,
116
- isVertical = _a.isVertical; // 拼装方法名
89
+ rootInfo: rootInfo,
90
+ popInfo: popInfo,
91
+ scrollInfo: scrollValueAtHidden,
92
+ placement: placement,
93
+ availSize: availSize,
94
+ rootToPopupSpacing: rootToPopupSpacing
95
+ }),
96
+ methodStr = _a.methodStr,
97
+ isVertical = _a.isVertical;
98
+ // 拼装方法名
117
99
  // eslint-disable-next-line import/namespace
118
-
119
-
120
- var currentMethod = alignUtil["get".concat(methodStr, "LocationInfo")]; // 执行方法
121
-
100
+ var currentMethod = alignUtil["get".concat(methodStr, "LocationInfo")];
101
+ // 执行方法
122
102
  var result = currentMethod(params);
123
-
124
103
  if (isVertical) {
125
104
  // 获取偏移量
126
105
  var _b = (0, _utils2.getTranslate)({
127
- initTranslate: initTranslateX,
128
- popupLimitSpacing: popupLimitSpacing,
129
- currentValue: result.width,
130
- positionValue: isInsertNode ? parentNodeInfo.left + result.left : result.left,
131
- scrollValue: scrollValueAtHidden.left,
132
- availValue: availSize.width
133
- }),
134
- translateX = _b.translateValue,
135
- maxValue_1 = _b.maxValue; // 判断是否有偏移
136
-
137
-
106
+ initTranslate: initTranslateX,
107
+ popupLimitSpacing: popupLimitSpacing,
108
+ currentValue: result.width,
109
+ positionValue: isInsertNode ? parentNodeInfo.left + result.left : result.left,
110
+ scrollValue: scrollValueAtHidden.left,
111
+ availValue: availSize.width
112
+ }),
113
+ translateX = _b.translateValue,
114
+ maxValue_1 = _b.maxValue;
115
+ // 判断是否有偏移
138
116
  if (!translateX) {
139
117
  return result;
140
118
  }
141
-
142
119
  var translateResult_1 = currentMethod(__assign(__assign({}, params), {
143
120
  translateX: translateX
144
121
  }));
145
122
  translateResult_1.maxWidth = maxValue_1;
146
123
  return translateResult_1;
147
- } // 获取偏移量
148
-
149
-
124
+ }
125
+ // 获取偏移量
150
126
  var _c = (0, _utils2.getTranslate)({
151
- initTranslate: initTranslateY,
152
- popupLimitSpacing: popupLimitSpacing,
153
- currentValue: result.height,
154
- positionValue: isInsertNode ? parentNodeInfo.top + result.top : result.top,
155
- scrollValue: scrollValueAtHidden.top,
156
- availValue: availSize.height
157
- }),
158
- translateY = _c.translateValue,
159
- maxValue = _c.maxValue; // 判断是否有偏移
160
-
161
-
127
+ initTranslate: initTranslateY,
128
+ popupLimitSpacing: popupLimitSpacing,
129
+ currentValue: result.height,
130
+ positionValue: isInsertNode ? parentNodeInfo.top + result.top : result.top,
131
+ scrollValue: scrollValueAtHidden.top,
132
+ availValue: availSize.height
133
+ }),
134
+ translateY = _c.translateValue,
135
+ maxValue = _c.maxValue;
136
+ // 判断是否有偏移
162
137
  if (!translateY) {
163
138
  return result;
164
139
  }
165
-
166
140
  var translateResult = currentMethod(__assign(__assign({}, params), {
167
141
  translateY: translateY
168
142
  }));