@sheinx/base 3.2.0-rc.3 → 3.2.0-rc.5

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 (219) hide show
  1. package/cjs/card/card-header.d.ts.map +1 -1
  2. package/cjs/card/card-header.js +23 -5
  3. package/cjs/card/card.d.ts.map +1 -1
  4. package/cjs/card/card.js +7 -3
  5. package/cjs/card/card.type.d.ts +1 -0
  6. package/cjs/card/card.type.d.ts.map +1 -1
  7. package/cjs/cascader/cascader.type.d.ts +1 -0
  8. package/cjs/cascader/cascader.type.d.ts.map +1 -1
  9. package/cjs/config/index.d.ts.map +1 -1
  10. package/cjs/config/index.js +3 -3
  11. package/cjs/form/form-field.type.d.ts +1 -1
  12. package/cjs/form/form-field.type.d.ts.map +1 -1
  13. package/cjs/grid/util.d.ts.map +1 -1
  14. package/cjs/grid/util.js +2 -6
  15. package/cjs/icons/config.d.ts +1 -0
  16. package/cjs/icons/config.d.ts.map +1 -1
  17. package/cjs/icons/config.js +2 -1
  18. package/cjs/input/input-group.d.ts.map +1 -1
  19. package/cjs/input/input-group.js +4 -2
  20. package/cjs/input/input-group.type.d.ts +10 -0
  21. package/cjs/input/input-group.type.d.ts.map +1 -1
  22. package/cjs/input/input-number.js +3 -2
  23. package/cjs/input/input.js +2 -2
  24. package/cjs/input/input.type.d.ts +5 -0
  25. package/cjs/input/input.type.d.ts.map +1 -1
  26. package/cjs/input/use-input-common.d.ts.map +1 -1
  27. package/cjs/input/use-input-common.js +1 -0
  28. package/cjs/menu/index.d.ts +2 -0
  29. package/cjs/menu/index.d.ts.map +1 -1
  30. package/cjs/menu/index.js +7 -0
  31. package/cjs/menu/item.d.ts.map +1 -1
  32. package/cjs/menu/item.js +91 -61
  33. package/cjs/menu/menu.d.ts.map +1 -1
  34. package/cjs/menu/menu.js +45 -22
  35. package/cjs/menu/menu.type.d.ts +25 -16
  36. package/cjs/menu/menu.type.d.ts.map +1 -1
  37. package/cjs/menu/search.d.ts +5 -0
  38. package/cjs/menu/search.d.ts.map +1 -0
  39. package/cjs/menu/search.js +53 -0
  40. package/cjs/menu/search.type.d.ts +33 -0
  41. package/cjs/menu/search.type.d.ts.map +1 -0
  42. package/cjs/menu/search.type.js +5 -0
  43. package/cjs/modal/modal-content.d.ts.map +1 -1
  44. package/cjs/modal/modal-content.js +5 -5
  45. package/cjs/modal/modal-func.d.ts +1 -1
  46. package/cjs/modal/modal-func.d.ts.map +1 -1
  47. package/cjs/modal/modal-func.js +1 -0
  48. package/cjs/modal/modal.d.ts.map +1 -1
  49. package/cjs/modal/modal.js +18 -3
  50. package/cjs/modal/modal.type.d.ts +1 -0
  51. package/cjs/modal/modal.type.d.ts.map +1 -1
  52. package/cjs/popover/confirm.d.ts.map +1 -1
  53. package/cjs/popover/confirm.js +4 -0
  54. package/cjs/popover/popover.d.ts.map +1 -1
  55. package/cjs/popover/popover.js +9 -5
  56. package/cjs/popover/popover.type.d.ts +18 -0
  57. package/cjs/popover/popover.type.d.ts.map +1 -1
  58. package/cjs/select/result-more.d.ts.map +1 -1
  59. package/cjs/select/result-more.js +0 -14
  60. package/cjs/select/result.d.ts.map +1 -1
  61. package/cjs/select/result.js +9 -7
  62. package/cjs/select/result.type.d.ts +1 -0
  63. package/cjs/select/result.type.d.ts.map +1 -1
  64. package/cjs/select/select.d.ts.map +1 -1
  65. package/cjs/select/select.js +1 -11
  66. package/cjs/select/select.type.d.ts +1 -0
  67. package/cjs/select/select.type.d.ts.map +1 -1
  68. package/cjs/sticky/sticky.d.ts.map +1 -1
  69. package/cjs/sticky/sticky.js +212 -90
  70. package/cjs/table/table.d.ts.map +1 -1
  71. package/cjs/table/table.js +34 -5
  72. package/cjs/table/tfoot.d.ts.map +1 -1
  73. package/cjs/table/tfoot.js +4 -1
  74. package/cjs/table/thead.js +1 -4
  75. package/cjs/table/tr.d.ts.map +1 -1
  76. package/cjs/table/tr.js +1 -1
  77. package/cjs/tag/tag.d.ts.map +1 -1
  78. package/cjs/tag/tag.js +5 -4
  79. package/cjs/textarea/textarea.d.ts.map +1 -1
  80. package/cjs/textarea/textarea.js +1 -0
  81. package/cjs/transfer/transfer-list.d.ts.map +1 -1
  82. package/cjs/transfer/transfer-list.js +7 -1
  83. package/cjs/transfer/transfer.js +1 -1
  84. package/cjs/tree/tree-content.d.ts.map +1 -1
  85. package/cjs/tree/tree-content.js +7 -5
  86. package/cjs/tree/tree-content.type.d.ts +1 -1
  87. package/cjs/tree/tree-content.type.d.ts.map +1 -1
  88. package/cjs/tree/tree-list.type.d.ts +1 -1
  89. package/cjs/tree/tree-list.type.d.ts.map +1 -1
  90. package/cjs/tree/tree-node.d.ts.map +1 -1
  91. package/cjs/tree/tree-node.js +5 -1
  92. package/cjs/tree/tree-node.type.d.ts +1 -1
  93. package/cjs/tree/tree-node.type.d.ts.map +1 -1
  94. package/cjs/tree/tree-root.type.d.ts +1 -1
  95. package/cjs/tree/tree-root.type.d.ts.map +1 -1
  96. package/cjs/tree/tree.d.ts.map +1 -1
  97. package/cjs/tree/tree.js +14 -0
  98. package/cjs/tree/tree.type.d.ts +1 -2
  99. package/cjs/tree/tree.type.d.ts.map +1 -1
  100. package/cjs/tree-select/tree-select.d.ts.map +1 -1
  101. package/cjs/tree-select/tree-select.js +3 -1
  102. package/cjs/tree-select/tree-select.type.d.ts +1 -0
  103. package/cjs/tree-select/tree-select.type.d.ts.map +1 -1
  104. package/cjs/virtual-scroll/scroll.d.ts +1 -0
  105. package/cjs/virtual-scroll/scroll.d.ts.map +1 -1
  106. package/cjs/virtual-scroll/scroll.js +3 -3
  107. package/cjs/virtual-scroll/virtual-scroll-list.d.ts.map +1 -1
  108. package/cjs/virtual-scroll/virtual-scroll-list.js +3 -0
  109. package/cjs/virtual-scroll/virtual-scroll-list.type.d.ts.map +1 -1
  110. package/esm/card/card-header.d.ts.map +1 -1
  111. package/esm/card/card-header.js +23 -5
  112. package/esm/card/card.d.ts.map +1 -1
  113. package/esm/card/card.js +9 -5
  114. package/esm/card/card.type.d.ts +1 -0
  115. package/esm/card/card.type.d.ts.map +1 -1
  116. package/esm/cascader/cascader.type.d.ts +1 -0
  117. package/esm/cascader/cascader.type.d.ts.map +1 -1
  118. package/esm/config/index.d.ts.map +1 -1
  119. package/esm/config/index.js +3 -3
  120. package/esm/form/form-field.type.d.ts +1 -1
  121. package/esm/form/form-field.type.d.ts.map +1 -1
  122. package/esm/grid/util.d.ts.map +1 -1
  123. package/esm/grid/util.js +2 -6
  124. package/esm/icons/config.d.ts +1 -0
  125. package/esm/icons/config.d.ts.map +1 -1
  126. package/esm/icons/config.js +2 -1
  127. package/esm/input/input-group.d.ts.map +1 -1
  128. package/esm/input/input-group.js +4 -2
  129. package/esm/input/input-group.type.d.ts +10 -0
  130. package/esm/input/input-group.type.d.ts.map +1 -1
  131. package/esm/input/input-number.js +3 -2
  132. package/esm/input/input.js +2 -2
  133. package/esm/input/input.type.d.ts +5 -0
  134. package/esm/input/input.type.d.ts.map +1 -1
  135. package/esm/input/use-input-common.d.ts.map +1 -1
  136. package/esm/input/use-input-common.js +1 -0
  137. package/esm/menu/index.d.ts +2 -0
  138. package/esm/menu/index.d.ts.map +1 -1
  139. package/esm/menu/index.js +2 -1
  140. package/esm/menu/item.d.ts.map +1 -1
  141. package/esm/menu/item.js +94 -63
  142. package/esm/menu/menu.d.ts.map +1 -1
  143. package/esm/menu/menu.js +46 -23
  144. package/esm/menu/menu.type.d.ts +25 -16
  145. package/esm/menu/menu.type.d.ts.map +1 -1
  146. package/esm/menu/search.d.ts +5 -0
  147. package/esm/menu/search.d.ts.map +1 -0
  148. package/esm/menu/search.js +46 -0
  149. package/esm/menu/search.type.d.ts +33 -0
  150. package/esm/menu/search.type.d.ts.map +1 -0
  151. package/esm/menu/search.type.js +1 -0
  152. package/esm/modal/modal-content.d.ts.map +1 -1
  153. package/esm/modal/modal-content.js +5 -5
  154. package/esm/modal/modal-func.d.ts +1 -1
  155. package/esm/modal/modal-func.d.ts.map +1 -1
  156. package/esm/modal/modal-func.js +1 -0
  157. package/esm/modal/modal.d.ts.map +1 -1
  158. package/esm/modal/modal.js +19 -4
  159. package/esm/modal/modal.type.d.ts +1 -0
  160. package/esm/modal/modal.type.d.ts.map +1 -1
  161. package/esm/popover/confirm.d.ts.map +1 -1
  162. package/esm/popover/confirm.js +4 -0
  163. package/esm/popover/popover.d.ts.map +1 -1
  164. package/esm/popover/popover.js +9 -5
  165. package/esm/popover/popover.type.d.ts +18 -0
  166. package/esm/popover/popover.type.d.ts.map +1 -1
  167. package/esm/select/result-more.d.ts.map +1 -1
  168. package/esm/select/result-more.js +1 -16
  169. package/esm/select/result.d.ts.map +1 -1
  170. package/esm/select/result.js +10 -8
  171. package/esm/select/result.type.d.ts +1 -0
  172. package/esm/select/result.type.d.ts.map +1 -1
  173. package/esm/select/select.d.ts.map +1 -1
  174. package/esm/select/select.js +1 -11
  175. package/esm/select/select.type.d.ts +1 -0
  176. package/esm/select/select.type.d.ts.map +1 -1
  177. package/esm/sticky/sticky.d.ts.map +1 -1
  178. package/esm/sticky/sticky.js +213 -91
  179. package/esm/table/table.d.ts.map +1 -1
  180. package/esm/table/table.js +34 -5
  181. package/esm/table/tfoot.d.ts.map +1 -1
  182. package/esm/table/tfoot.js +4 -1
  183. package/esm/table/thead.js +1 -4
  184. package/esm/table/tr.d.ts.map +1 -1
  185. package/esm/table/tr.js +1 -1
  186. package/esm/tag/tag.d.ts.map +1 -1
  187. package/esm/tag/tag.js +5 -4
  188. package/esm/textarea/textarea.d.ts.map +1 -1
  189. package/esm/textarea/textarea.js +1 -0
  190. package/esm/transfer/transfer-list.d.ts.map +1 -1
  191. package/esm/transfer/transfer-list.js +7 -1
  192. package/esm/transfer/transfer.js +1 -1
  193. package/esm/tree/tree-content.d.ts.map +1 -1
  194. package/esm/tree/tree-content.js +7 -5
  195. package/esm/tree/tree-content.type.d.ts +1 -1
  196. package/esm/tree/tree-content.type.d.ts.map +1 -1
  197. package/esm/tree/tree-list.type.d.ts +1 -1
  198. package/esm/tree/tree-list.type.d.ts.map +1 -1
  199. package/esm/tree/tree-node.d.ts.map +1 -1
  200. package/esm/tree/tree-node.js +5 -1
  201. package/esm/tree/tree-node.type.d.ts +1 -1
  202. package/esm/tree/tree-node.type.d.ts.map +1 -1
  203. package/esm/tree/tree-root.type.d.ts +1 -1
  204. package/esm/tree/tree-root.type.d.ts.map +1 -1
  205. package/esm/tree/tree.d.ts.map +1 -1
  206. package/esm/tree/tree.js +15 -1
  207. package/esm/tree/tree.type.d.ts +1 -2
  208. package/esm/tree/tree.type.d.ts.map +1 -1
  209. package/esm/tree-select/tree-select.d.ts.map +1 -1
  210. package/esm/tree-select/tree-select.js +3 -1
  211. package/esm/tree-select/tree-select.type.d.ts +1 -0
  212. package/esm/tree-select/tree-select.type.d.ts.map +1 -1
  213. package/esm/virtual-scroll/scroll.d.ts +1 -0
  214. package/esm/virtual-scroll/scroll.d.ts.map +1 -1
  215. package/esm/virtual-scroll/scroll.js +3 -3
  216. package/esm/virtual-scroll/virtual-scroll-list.d.ts.map +1 -1
  217. package/esm/virtual-scroll/virtual-scroll-list.js +3 -0
  218. package/esm/virtual-scroll/virtual-scroll-list.type.d.ts.map +1 -1
  219. package/package.json +3 -3
@@ -25,6 +25,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
25
25
  var cssSupport = _hooks.util.cssSupport;
26
26
  var supportSticky = cssSupport('position', 'sticky');
27
27
  var defaultZIndex = 900;
28
+ var events = ['scroll', 'pageshow', 'load', 'resize'];
28
29
 
29
30
  // const getFirstScrollParent = (el: HTMLElement) => {
30
31
  // let parent = el.parentNode as HTMLElement;
@@ -43,17 +44,19 @@ var defaultZIndex = 900;
43
44
  // };
44
45
 
45
46
  var Sticky = function Sticky(props) {
46
- var _props$style;
47
47
  var children = props.children,
48
48
  top = props.top,
49
49
  bottom = props.bottom;
50
- var css = props.css || props.target;
50
+ // 是否使用css sticky
51
+ var css = (props.css || props.target) && supportSticky;
52
+ var forceUpdate = (0, _hooks.useRender)();
51
53
  var _useRef = (0, _react.useRef)({
52
54
  target: null,
53
55
  div: null,
54
- observer: null,
56
+ position: '',
57
+ targetObserver: null,
55
58
  parentObserver: null,
56
- isTop: false
59
+ fixedObserver: null
57
60
  }),
58
61
  context = _useRef.current;
59
62
  var _useState = (0, _react.useState)({}),
@@ -68,12 +71,7 @@ var Sticky = function Sticky(props) {
68
71
  _useState6 = _slicedToArray(_useState5, 2),
69
72
  parentVisible = _useState6[0],
70
73
  setParentVisible = _useState6[1];
71
- var forceRender = (0, _hooks.useRender)();
72
74
  var elementRef = (0, _react.useRef)(null);
73
- var elementSize = (0, _hooks.useResize)({
74
- targetRef: elementRef,
75
- timer: 0
76
- });
77
75
  var getTarget = function getTarget() {
78
76
  var scrollContainer = props.scrollContainer;
79
77
  if (typeof scrollContainer === 'string') {
@@ -83,22 +81,19 @@ var Sticky = function Sticky(props) {
83
81
  if (scrollContainer && scrollContainer.nodeType === 1) {
84
82
  return scrollContainer;
85
83
  }
86
- return document.body;
84
+ return null;
87
85
  };
86
+
87
+ // window resize 时需要重新计算底部附着的位置
88
88
  var updateStyle = (0, _hooks.usePersistFn)(function () {
89
- if (context.div && !context.isTop && show) {
90
- var shouldFixed = context.target === document.body;
89
+ if (context.div && context.position === 'bottom' && show) {
91
90
  var scrollRect = context.target.getBoundingClientRect();
92
91
  var targetRect = elementRef.current.getBoundingClientRect();
93
92
  var targetLeft = targetRect.left;
94
- var width = targetRect.width,
95
- height = targetRect.height;
96
93
  if (typeof bottom === 'number') {
97
94
  var outRootRect = context.target.getBoundingClientRect();
98
95
  var _style = {
99
- position: shouldFixed ? 'fixed' : 'absolute',
100
- width: "".concat(width, "px"),
101
- height: "".concat(height, "px"),
96
+ position: 'absolute',
102
97
  top: "".concat(scrollRect.bottom - (props.bottom || 0) - outRootRect.top, "px"),
103
98
  left: "".concat(targetLeft - outRootRect.left, "px"),
104
99
  transform: 'translateY(-100%)'
@@ -107,30 +102,22 @@ var Sticky = function Sticky(props) {
107
102
  }
108
103
  }
109
104
  });
110
- var handlePosition = (0, _hooks.usePersistFn)(function (entries) {
105
+
106
+ // 有滚动容器时的定位
107
+ var handleTargetPosition = (0, _hooks.usePersistFn)(function (entries) {
111
108
  var entry = entries[0];
112
109
  var scrollRect = entry.rootBounds;
113
110
  var targetRect = entry.boundingClientRect;
114
- var shouldFixed = context.target === document.body;
115
111
  if (!entry.isIntersecting) {
116
112
  var targetLeft = targetRect.left;
117
- var outRootRect = shouldFixed ? {
118
- top: 0,
119
- bottom: 0,
120
- left: 0,
121
- right: 0
122
- } : context.div.getBoundingClientRect();
123
- var width = targetRect.width,
124
- height = targetRect.height;
113
+ var outRootRect = context.div.getBoundingClientRect();
125
114
  if (scrollRect && targetRect.bottom < scrollRect.bottom) {
126
115
  // top in
127
- context.isTop = true;
116
+ context.position = 'top';
128
117
  if (typeof top === 'number') {
129
118
  setShow(true);
130
119
  var _style2 = {
131
- position: shouldFixed ? 'fixed' : 'absolute',
132
- width: "".concat(width, "px"),
133
- height: "".concat(height, "px"),
120
+ position: 'absolute',
134
121
  top: "".concat(scrollRect.top - outRootRect.top, "px"),
135
122
  left: "".concat(targetLeft - outRootRect.left, "px")
136
123
  };
@@ -138,16 +125,13 @@ var Sticky = function Sticky(props) {
138
125
  }
139
126
  } else if (scrollRect) {
140
127
  // bottom in
141
- context.isTop = false;
128
+ context.position = 'bottom';
142
129
  if (typeof bottom === 'number') {
143
130
  setShow(true);
144
- var _outRootRect = context.target.getBoundingClientRect();
145
131
  var _style3 = {
146
- position: shouldFixed ? 'fixed' : 'absolute',
147
- width: "".concat(width, "px"),
148
- height: "".concat(height, "px"),
149
- top: "".concat(scrollRect.bottom - _outRootRect.top, "px"),
150
- left: "".concat(targetLeft - _outRootRect.left, "px"),
132
+ position: 'absolute',
133
+ top: "".concat(scrollRect.bottom - outRootRect.top, "px"),
134
+ left: "".concat(targetLeft - outRootRect.left, "px"),
151
135
  transform: 'translateY(-100%)'
152
136
  };
153
137
  setStyle(_style3);
@@ -156,8 +140,11 @@ var Sticky = function Sticky(props) {
156
140
  }
157
141
  if (entry.isIntersecting) {
158
142
  setShow(false);
143
+ context.position = '';
159
144
  }
160
145
  });
146
+
147
+ // 父元素是否可见
161
148
  var handleParentVisible = (0, _hooks.usePersistFn)(function (entries) {
162
149
  var entry = entries[0];
163
150
  if (entry.isIntersecting) {
@@ -166,35 +153,118 @@ var Sticky = function Sticky(props) {
166
153
  setParentVisible(false);
167
154
  }
168
155
  });
169
- var cleanEvents = function cleanEvents() {
170
- if (context.observer) {
171
- context.observer.disconnect();
172
- context.observer = null;
156
+ var setFixedStyle = (0, _hooks.usePersistFn)(function (s, m) {
157
+ var l = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
158
+ if (s !== show) {
159
+ setShow(s);
173
160
  }
174
- if (context.parentObserver) {
175
- context.parentObserver.disconnect();
176
- context.parentObserver = null;
161
+ if (s && m) {
162
+ var newStyle = _defineProperty(_defineProperty({
163
+ position: 'fixed'
164
+ }, m, m === 'top' ? top : bottom), "left", l);
165
+ if (!_hooks.util.shallowEqual(style, newStyle)) {
166
+ setStyle(newStyle);
167
+ }
168
+ }
169
+ });
170
+
171
+ // 无滚动容器的时候,body 滚动 resize 计算
172
+ var handleFixedPosition = (0, _hooks.usePersistFn)(function () {
173
+ if (css || context.target) return;
174
+ var element = elementRef.current;
175
+ if (!parentVisible) {
176
+ setFixedStyle(false);
177
+ return;
178
+ }
179
+ if (!element) return;
180
+ var selfRect = element.getBoundingClientRect();
181
+ if (selfRect === null) return;
182
+ // If the element is hidden, the width and height will be 0
183
+ if (selfRect && selfRect.width === 0 && selfRect.height === 0) return;
184
+ var scrollRect = document.body.getBoundingClientRect();
185
+ var top = props.top,
186
+ bottom = props.bottom;
187
+ if (top !== undefined && Math.ceil(selfRect.top) <= top) {
188
+ setFixedStyle(true, 'top', selfRect.left);
189
+ return;
190
+ } else if (bottom !== undefined && Math.ceil(selfRect.bottom) + bottom > scrollRect.bottom) {
191
+ setFixedStyle(true, 'bottom', selfRect.left);
192
+ return;
193
+ } else {
194
+ setFixedStyle(false);
195
+ }
196
+ });
197
+
198
+ // 无滚动容器时内滚场景触发
199
+ var handleFixedInter = (0, _hooks.usePersistFn)(function (entries) {
200
+ if (!parentVisible) {
201
+ setFixedStyle(false);
202
+ return;
203
+ }
204
+ var entry = entries[0];
205
+ var scrollRect = entry.rootBounds;
206
+ var targetRect = entry.boundingClientRect;
207
+ if (scrollRect && scrollRect.top === 0 && scrollRect.bottom === 0) {
208
+ return;
209
+ }
210
+ if (!entry.isIntersecting) {
211
+ var targetLeft = targetRect.left;
212
+ var outRootRect = document.body.getBoundingClientRect();
213
+ if (scrollRect && targetRect.bottom < scrollRect.bottom) {
214
+ // top in
215
+ if (typeof top === 'number') {
216
+ setFixedStyle(true, 'top', targetLeft - outRootRect.left);
217
+ }
218
+ } else if (scrollRect) {
219
+ // bottom in
220
+ if (typeof bottom === 'number') {
221
+ setFixedStyle(true, 'bottom', targetLeft - outRootRect.left);
222
+ }
223
+ }
224
+ }
225
+ if (entry.isIntersecting) {
226
+ setFixedStyle(false);
227
+ }
228
+ });
229
+ var elementSize = (0, _hooks.useResize)({
230
+ targetRef: elementRef,
231
+ timer: 10,
232
+ cb: handleFixedPosition
233
+ });
234
+ var cancelFixedObserver = function cancelFixedObserver() {
235
+ if (context.fixedObserver) {
236
+ context.fixedObserver.disconnect();
237
+ context.fixedObserver = null;
238
+ }
239
+ };
240
+ var createFixedObserver = function createFixedObserver() {
241
+ cancelFixedObserver();
242
+ context.fixedObserver = new IntersectionObserver(handleFixedInter, {
243
+ root: null,
244
+ rootMargin: "-".concat(top || 0, "px 0px -").concat(bottom || 0, "px 0px"),
245
+ threshold: 1.0
246
+ });
247
+ };
248
+ var cancelObserver = function cancelObserver() {
249
+ if (context.targetObserver) {
250
+ context.targetObserver.disconnect();
251
+ context.targetObserver = null;
177
252
  }
178
- window.removeEventListener('resize', updateStyle);
179
253
  };
180
254
  var createObserver = function createObserver() {
181
- var target = getTarget();
182
- if (!context.div && target !== document.body) {
255
+ if (!context.div) {
183
256
  context.div = document.createElement('div');
184
257
  context.div.style.position = 'relative';
185
258
  }
186
- if (target && target !== context.target) {
187
- forceRender();
188
- context.target = target;
189
- cleanEvents();
259
+ if (context.target) {
190
260
  if (context.div) {
191
261
  // append div
192
- if (target === document.body) {
193
- document.body.appendChild(context.div);
262
+ if (context.target === document.body) {
263
+ document.body.insertBefore(context.div, document.body.firstChild);
194
264
  } else {
195
- target.parentNode.insertBefore(context.div, target);
265
+ context.target.parentNode.insertBefore(context.div, context.target);
196
266
  }
197
- var _style4 = window.getComputedStyle(target);
267
+ var _style4 = window.getComputedStyle(context.target);
198
268
  if (_style4.position === 'absolute' || _style4.position === 'fixed') {
199
269
  context.div.style.position = _style4.position;
200
270
  context.div.style.top = _style4.top;
@@ -203,59 +273,109 @@ var Sticky = function Sticky(props) {
203
273
  context.div.style.bottom = _style4.bottom;
204
274
  }
205
275
  }
276
+ cancelFixedObserver();
206
277
  if (window.IntersectionObserver) {
207
- var observer = new IntersectionObserver(handlePosition, {
208
- root: target,
278
+ var observer = new IntersectionObserver(handleTargetPosition, {
279
+ root: context.target,
209
280
  rootMargin: "-".concat(top || 0, "px 0px -").concat(bottom || 0, "px 0px"),
210
281
  threshold: 1.0
211
282
  });
212
- context.observer = observer;
213
- context.parentObserver = new IntersectionObserver(handleParentVisible, {
214
- root: target,
215
- rootMargin: "-".concat(top || 0, "px 0px -").concat(bottom || 0, "px 0px"),
216
- threshold: 0
217
- });
283
+ context.targetObserver = observer;
218
284
  }
219
285
  }
220
286
  };
287
+ var cancelParentObserver = function cancelParentObserver() {
288
+ if (context.parentObserver) {
289
+ context.parentObserver.disconnect();
290
+ context.parentObserver = null;
291
+ }
292
+ };
293
+ var createParentObserver = function createParentObserver() {
294
+ if (!props.parent) return;
295
+ cancelParentObserver();
296
+ context.parentObserver = new IntersectionObserver(handleParentVisible, {
297
+ root: context.target,
298
+ rootMargin: "-".concat(top || 0, "px 0px -").concat(bottom || 0, "px 0px"),
299
+ threshold: 0
300
+ });
301
+ context.parentObserver.observe(props.parent);
302
+ };
303
+
304
+ // 存在滚动容器时的定位
305
+ var createTargetEvents = function createTargetEvents() {
306
+ createObserver();
307
+ window.addEventListener('resize', updateStyle);
308
+ };
309
+ var cancelTargetEvents = function cancelTargetEvents() {
310
+ cancelObserver();
311
+ window.removeEventListener('resize', updateStyle);
312
+ if (context.div) {
313
+ context.div.remove();
314
+ context.div = null;
315
+ }
316
+ };
317
+ var createFixedEvents = function createFixedEvents() {
318
+ createFixedObserver();
319
+ events.forEach(function (event) {
320
+ window.addEventListener(event, handleFixedPosition);
321
+ });
322
+ };
323
+ var cancelFixedEvents = function cancelFixedEvents() {
324
+ cancelFixedObserver();
325
+ events.forEach(function (event) {
326
+ window.removeEventListener(event, handleFixedPosition);
327
+ });
328
+ };
221
329
  var handleElementRef = function handleElementRef(el) {
222
330
  if (el) {
223
331
  elementRef.current = el;
224
- if (el && context.observer) {
225
- context.observer.observe(el);
332
+ if (context.targetObserver) {
333
+ if (!el) {
334
+ context.targetObserver.disconnect();
335
+ } else {
336
+ context.targetObserver.observe(el);
337
+ }
338
+ }
339
+ if (context.fixedObserver) {
340
+ if (!el) {
341
+ context.fixedObserver.disconnect();
342
+ } else {
343
+ context.fixedObserver.observe(el);
344
+ }
226
345
  }
227
346
  }
228
347
  };
229
- (0, _react.useEffect)(function () {
230
- if (!css) {
231
- createObserver();
232
- window.addEventListener('resize', updateStyle);
348
+ (0, _react.useLayoutEffect)(function () {
349
+ if (css) return;
350
+ var target = getTarget();
351
+ if (context.target !== target) {
352
+ context.target = target;
353
+ forceUpdate();
233
354
  }
234
- return function () {
235
- cleanEvents();
236
- if (context.div) {
237
- context.div.remove();
238
- context.div = null;
239
- }
240
- };
241
- }, [css]);
242
- (0, _react.useEffect)(function () {
243
- if (props.parent && context.parentObserver) {
355
+ if (context.target) {
356
+ createTargetEvents();
357
+ return cancelTargetEvents;
358
+ } else {
359
+ // fixed 布局
360
+ createFixedEvents();
361
+ return cancelFixedEvents;
362
+ }
363
+ }, [css, top, bottom]);
364
+ (0, _react.useLayoutEffect)(function () {
365
+ if (props.parent && !css) {
366
+ // createParentObserver 用到context.target
367
+ createParentObserver();
244
368
  context.parentObserver.observe(props.parent);
245
369
  }
246
- return function () {
247
- if (context.parentObserver) {
248
- context.parentObserver.disconnect();
249
- }
250
- };
251
- }, [props.parent]);
370
+ return cancelParentObserver;
371
+ }, [props.parent, css, context.target, top, bottom]);
252
372
 
253
373
  // 纯css方法 直接使用css
254
374
  // js方法
255
375
  // 1. 不指定滚动容器 基于document.body 使用fixed + js计算
256
376
  // 2. 指定滚动容器 在滚动容器上方插入一个dom占位 基于该dom渲染和定位
257
377
  // 3. 使用 intersectionObserver 来判断是否需要sticky
258
- if (css && supportSticky) {
378
+ if (css) {
259
379
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
260
380
  className: props.className,
261
381
  style: _objectSpread(_objectSpread({
@@ -279,12 +399,14 @@ var Sticky = function Sticky(props) {
279
399
  })
280
400
  }) : null;
281
401
  var isFixed = style.position === 'fixed';
402
+ var hideStyle = {
403
+ opacity: 0,
404
+ pointerEvents: 'none'
405
+ };
282
406
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
283
407
  children: [isFixed ? StickyEl : context.target && context.div && /*#__PURE__*/(0, _reactDom.createPortal)(StickyEl, context.div), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
284
408
  className: props.className,
285
- style: _objectSpread(_objectSpread({}, props.style), {}, {
286
- opacity: show && parentVisible ? 0 : (_props$style = props.style) === null || _props$style === void 0 ? void 0 : _props$style.opacity
287
- }),
409
+ style: _objectSpread(_objectSpread({}, props.style), show && parentVisible ? hideStyle : {}),
288
410
  ref: handleElementRef,
289
411
  children: children
290
412
  })]
@@ -1 +1 @@
1
- {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["table.tsx"],"names":[],"mappings":";AAsBA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;;AAoB1C,wBAgbE"}
1
+ {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["table.tsx"],"names":[],"mappings":";AAsBA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;;AAyB1C,wBAycE"}
@@ -24,14 +24,14 @@ var _excluded = ["data"];
24
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
25
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
26
26
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
27
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
28
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
29
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
27
30
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
28
31
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
29
32
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
30
33
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
31
34
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
32
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
33
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
34
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
35
35
  var emptyArr = [];
36
36
  var virtualScrollerStyle = {
37
37
  flex: 1,
@@ -40,6 +40,9 @@ var virtualScrollerStyle = {
40
40
  overflow: 'auto',
41
41
  width: '100%'
42
42
  };
43
+ var emptyStyle = _objectSpread(_objectSpread({}, virtualScrollerStyle), {}, {
44
+ height: 0
45
+ });
43
46
  var scrollWrapperStyle = {
44
47
  flex: 1,
45
48
  minHeight: 0,
@@ -210,6 +213,18 @@ var _default = exports.default = function _default(props) {
210
213
  e.preventDefault();
211
214
  scrollEl.scrollLeft = Math.min(Math.max(scrollLeft, 0), max);
212
215
  });
216
+ var handleBodyScroll = (0, _hooks.usePersistFn)(function (e) {
217
+ var target = e.currentTarget;
218
+ if (!target) return;
219
+ layoutFunc.checkFloat();
220
+ if (props.onScroll && typeof props.onScroll === 'function') {
221
+ var maxWidth = target.scrollWidth - target.clientWidth;
222
+ var maxHeight = target.scrollHeight - target.clientHeight;
223
+ var x = Math.min(target.scrollLeft / maxWidth, 1);
224
+ var y = Math.min(target.scrollTop / maxHeight, 1);
225
+ props.onScroll(x, y, target.scrollLeft);
226
+ }
227
+ });
213
228
  var handleVirtualScroll = (0, _hooks.usePersistFn)(function (info) {
214
229
  virtualInfo.handleScroll(info);
215
230
  layoutFunc.checkFloat();
@@ -228,7 +243,7 @@ var _default = exports.default = function _default(props) {
228
243
  });
229
244
  };
230
245
  var renderTable = function renderTable() {
231
- var _props$summary, _sticky$top;
246
+ var _props$summary, _sticky$top, _props$data3, _props$data4;
232
247
  var Group = /*#__PURE__*/(0, _jsxRuntime.jsx)(_colgroup.default, {
233
248
  colgroup: colgroup,
234
249
  columns: columns,
@@ -301,6 +316,20 @@ var _default = exports.default = function _default(props) {
301
316
  css: sticky === null || sticky === void 0 ? void 0 : sticky.css,
302
317
  parent: tableRef === null || tableRef === void 0 ? void 0 : tableRef.current
303
318
  };
319
+ if (!virtual && !isScrollY && !props.sticky && (_props$data3 = props.data) !== null && _props$data3 !== void 0 && _props$data3.length) {
320
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
321
+ ref: scrollRef,
322
+ className: tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.bodyWrapper,
323
+ onScroll: handleBodyScroll,
324
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("table", {
325
+ style: {
326
+ width: width
327
+ },
328
+ ref: tbodyRef,
329
+ children: [Group, !props.hideHeader && /*#__PURE__*/(0, _jsxRuntime.jsx)(_thead.default, _objectSpread({}, headCommonProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_tbody.default, _objectSpread({}, bodyCommonProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_tfoot.default, _objectSpread({}, footCommonProps))]
330
+ })
331
+ });
332
+ }
304
333
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
305
334
  children: [!props.hideHeader && /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapper, _objectSpread(_objectSpread({}, props.sticky ? stickyProps : {}), {}, {
306
335
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -319,7 +348,7 @@ var _default = exports.default = function _default(props) {
319
348
  })
320
349
  })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_scroll.default, {
321
350
  style: scrollWrapperStyle,
322
- scrollerStyle: virtualScrollerStyle,
351
+ scrollerStyle: (_props$data4 = props.data) !== null && _props$data4 !== void 0 && _props$data4.length ? virtualScrollerStyle : emptyStyle,
323
352
  wrapperRef: scrollRef,
324
353
  scrollWidth: width || 1,
325
354
  scrollHeight: virtual ? virtualInfo.scrollHeight : tbodyHeight,
@@ -1 +1 @@
1
- {"version":3,"file":"tfoot.d.ts","sourceRoot":"","sources":["tfoot.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAe,MAAM,cAAc,CAAC;gCAKhC,UAAU;AAAjC,wBAiGE"}
1
+ {"version":3,"file":"tfoot.d.ts","sourceRoot":"","sources":["tfoot.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAe,MAAM,cAAc,CAAC;gCAMhC,UAAU;AAAjC,wBAsGE"}
@@ -7,12 +7,14 @@ exports.default = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _classnames = _interopRequireDefault(require("classnames"));
9
9
  var _hooks = require("@sheinx/hooks");
10
+ var _config = require("../config");
10
11
  var _jsxRuntime = require("react/jsx-runtime");
11
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
13
  var isArray = _hooks.util.isArray;
13
14
  var _default = exports.default = function _default(props) {
14
15
  var _props$jssStyle, _props$jssStyle$table;
15
16
  var tableClasses = (_props$jssStyle = props.jssStyle) === null || _props$jssStyle === void 0 || (_props$jssStyle$table = _props$jssStyle.table) === null || _props$jssStyle$table === void 0 ? void 0 : _props$jssStyle$table.call(_props$jssStyle);
17
+ var config = (0, _config.useConfig)();
16
18
  var getFixedStyle = function getFixedStyle(fixed, index, colSpan) {
17
19
  var colgroup = props.colgroup;
18
20
  if (fixed === 'left') {
@@ -65,9 +67,10 @@ var _default = exports.default = function _default(props) {
65
67
  }
66
68
  }
67
69
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("td", {
70
+ dir: config.direction,
68
71
  colSpan: colSpan,
69
72
  style: getFixedStyle(fixed.fixed, index, colSpan),
70
- className: (0, _classnames.default)(fixed['fixed'] === 'left' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellFixedLeft), fixed['fixed'] === 'right' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellFixedRight), (fixed.lastFixed || fixed.firstFixed) && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellFixedLast), isLast && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellIgnoreBorder)),
73
+ className: (0, _classnames.default)(fixed['fixed'] === 'left' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellFixedLeft), fixed['fixed'] === 'right' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellFixedRight), fixed.firstFixed && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellFixedLeft), fixed.lastFixed && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellFixedRight), (fixed.lastFixed || fixed.firstFixed) && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellFixedLast), isLast && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellIgnoreBorder)),
71
74
  children: content
72
75
  }, index);
73
76
  };
@@ -169,10 +169,7 @@ var _default = exports.default = function _default(props) {
169
169
  style: fixedStyle,
170
170
  dir: config.direction,
171
171
  children: [showSelectAll && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
172
- style: {
173
- lineHeight: 1,
174
- verticalAlign: 'middle'
175
- },
172
+ className: tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.iconWrapper,
176
173
  children: props.radio ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)(_checkbox.default, {
177
174
  disabled: props.disabled === true,
178
175
  checked: props.datum.getCheckedStatus(props.treeCheckAll ? props.treeColumnsName : undefined),
@@ -1 +1 @@
1
- {"version":3,"file":"tr.d.ts","sourceRoot":"","sources":["tr.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAKvD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAG7D,UAAU,OACR,SAAQ,IAAI,CACV,UAAU,EACR,UAAU,GACV,cAAc,GACd,OAAO,GACP,UAAU,GACV,iBAAiB,GACjB,iBAAiB,GACjB,aAAa,GACb,cAAc,GACd,YAAY,GACZ,aAAa,GACb,SAAS,GACT,OAAO,GACP,YAAY,GACZ,cAAc,GACd,WAAW,GACX,iBAAiB,GACjB,YAAY,GACZ,cAAc,CACjB;IACD,GAAG,EAAE;QACH,IAAI,EAAE,GAAG,EAAE,CAAC;QACZ,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACjB,EAAE,CAAC;IACJ,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;IACjC,OAAO,EAAE,GAAG,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,UAAU,CAAC,eAAe,CAAC,GAAG,SAAS,CAAC;IACnD,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB,EAAE,CAAC,GAAG,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,WAAW,EAAE,iBAAiB,CAAC,aAAa,CAAC,CAAC;IAC9C,eAAe,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACtD,UAAU,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC;IAC5C,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,EAAE,UAAW,OAAO,gBAyRzB,CAAC;AAEF,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"tr.d.ts","sourceRoot":"","sources":["tr.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAKvD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAG7D,UAAU,OACR,SAAQ,IAAI,CACV,UAAU,EACR,UAAU,GACV,cAAc,GACd,OAAO,GACP,UAAU,GACV,iBAAiB,GACjB,iBAAiB,GACjB,aAAa,GACb,cAAc,GACd,YAAY,GACZ,aAAa,GACb,SAAS,GACT,OAAO,GACP,YAAY,GACZ,cAAc,GACd,WAAW,GACX,iBAAiB,GACjB,YAAY,GACZ,cAAc,CACjB;IACD,GAAG,EAAE;QACH,IAAI,EAAE,GAAG,EAAE,CAAC;QACZ,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACjB,EAAE,CAAC;IACJ,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;IACjC,OAAO,EAAE,GAAG,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,UAAU,CAAC,eAAe,CAAC,GAAG,SAAS,CAAC;IACnD,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB,EAAE,CAAC,GAAG,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,WAAW,EAAE,iBAAiB,CAAC,aAAa,CAAC,CAAC;IAC9C,eAAe,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACtD,UAAU,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC;IAC5C,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,EAAE,UAAW,OAAO,gBAwRzB,CAAC;AAEF,eAAe,EAAE,CAAC"}
package/cjs/table/tr.js CHANGED
@@ -51,7 +51,7 @@ var Tr = function Tr(props) {
51
51
  transform: "translate3d(".concat(0 - props.fixRightNum, "px, 0, 0)")
52
52
  };
53
53
  }
54
- var right = props.colgroup.slice(index + 1 + colSpan).reduce(function (a, b) {
54
+ var right = props.colgroup.slice(index + colSpan).reduce(function (a, b) {
55
55
  return (a || 0) + (b || 0);
56
56
  }, 0);
57
57
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["tag.tsx"],"names":[],"mappings":";AACA,OAAO,EAAc,QAAQ,EAAE,MAAM,YAAY,CAAC;AAOlD,QAAA,MAAM,GAAG;YAAW,QAAQ;;CAgI3B,CAAC;AAIF,eAAe,GAAG,CAAC"}
1
+ {"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["tag.tsx"],"names":[],"mappings":";AACA,OAAO,EAAc,QAAQ,EAAE,MAAM,YAAY,CAAC;AAQlD,QAAA,MAAM,GAAG;YAAW,QAAQ;;CAgI3B,CAAC;AAIF,eAAe,GAAG,CAAC"}
package/cjs/tag/tag.js CHANGED
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _classnames = _interopRequireDefault(require("classnames"));
9
9
  var _useTag2 = _interopRequireDefault(require("./use-tag"));
10
+ var _hooks = require("@sheinx/hooks");
10
11
  var _tagInput = _interopRequireDefault(require("./tag-input"));
11
12
  var _jsxRuntime = require("react/jsx-runtime");
12
13
  var _excluded = ["jssStyle", "className", "type", "color", "size", "disabled", "mode", "shape", "children", "onClick", "onClose", "style", "backgroundColor", "inlineStyle", "onKeyUp", "onCompleted", "onEnterPress", "closable"];
@@ -79,15 +80,15 @@ var Tag = function Tag(props) {
79
80
  if (onClose) {
80
81
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
81
82
  className: (0, _classnames.default)(tagStyle.wrapper, inlineStyle && tagStyle.inline),
82
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
83
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
83
84
  className: tagStyle.container,
84
- children: children
85
+ children: _hooks.util.wrapSpan(children)
85
86
  })
86
87
  });
87
88
  }
88
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
89
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
89
90
  className: (0, _classnames.default)(tagStyle.wrapper, inlineStyle && tagStyle.inline),
90
- children: children
91
+ children: _hooks.util.wrapSpan(children)
91
92
  });
92
93
  };
93
94
  var renderInput = function renderInput() {
@@ -1 +1 @@
1
- {"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAG/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;;AA8LhD,wBAAoC"}
1
+ {"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAG/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;;AA+LhD,wBAAoC"}
@@ -139,6 +139,7 @@ var Textarea = function Textarea(props0) {
139
139
  if (!res) return null;
140
140
  var isError = res instanceof Error;
141
141
  var text = isError ? res.message : res;
142
+ if (!isError && !focused) return null;
142
143
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
143
144
  style: {
144
145
  minWidth: 'auto'
@@ -1 +1 @@
1
- {"version":3,"file":"transfer-list.d.ts","sourceRoot":"","sources":["transfer-list.tsx"],"names":[],"mappings":";AACA,OAAO,EAAQ,YAAY,EAAE,MAAM,eAAe,CAAC;AAGnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AASzD,QAAA,MAAM,YAAY,oGAgMjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"transfer-list.d.ts","sourceRoot":"","sources":["transfer-list.tsx"],"names":[],"mappings":";AACA,OAAO,EAAQ,YAAY,EAAE,MAAM,eAAe,CAAC;AAGnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AASzD,QAAA,MAAM,YAAY,oGAoMjB,CAAC;AAEF,eAAe,YAAY,CAAC"}