@sheinx/base 3.8.9 → 3.8.10-beta.10

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 (43) hide show
  1. package/cjs/cascader/node.d.ts.map +1 -1
  2. package/cjs/cascader/node.js +2 -0
  3. package/cjs/date-picker/day.js +3 -3
  4. package/cjs/date-picker/month.js +2 -2
  5. package/cjs/date-picker/quarter.js +2 -2
  6. package/cjs/date-picker/year.js +2 -2
  7. package/cjs/descriptions/descriptions.d.ts.map +1 -1
  8. package/cjs/descriptions/descriptions.js +7 -2
  9. package/cjs/list/list.d.ts.map +1 -1
  10. package/cjs/list/list.js +2 -1
  11. package/cjs/select/list.d.ts +2 -0
  12. package/cjs/select/list.d.ts.map +1 -1
  13. package/cjs/select/list.js +5 -4
  14. package/cjs/select/result.js +1 -1
  15. package/cjs/select/select.js +4 -5
  16. package/cjs/table/thead.js +1 -1
  17. package/cjs/virtual-scroll/scroll.d.ts +1 -0
  18. package/cjs/virtual-scroll/scroll.d.ts.map +1 -1
  19. package/cjs/virtual-scroll/scroll.js +6 -2
  20. package/cjs/virtual-scroll/virtual-scroll-list.d.ts.map +1 -1
  21. package/cjs/virtual-scroll/virtual-scroll-list.js +1 -0
  22. package/esm/cascader/node.d.ts.map +1 -1
  23. package/esm/cascader/node.js +2 -0
  24. package/esm/date-picker/day.js +3 -3
  25. package/esm/date-picker/month.js +2 -2
  26. package/esm/date-picker/quarter.js +2 -2
  27. package/esm/date-picker/year.js +2 -2
  28. package/esm/descriptions/descriptions.d.ts.map +1 -1
  29. package/esm/descriptions/descriptions.js +8 -3
  30. package/esm/list/list.d.ts.map +1 -1
  31. package/esm/list/list.js +2 -1
  32. package/esm/select/list.d.ts +2 -0
  33. package/esm/select/list.d.ts.map +1 -1
  34. package/esm/select/list.js +4 -3
  35. package/esm/select/result.js +1 -1
  36. package/esm/select/select.js +4 -5
  37. package/esm/table/thead.js +1 -1
  38. package/esm/virtual-scroll/scroll.d.ts +1 -0
  39. package/esm/virtual-scroll/scroll.d.ts.map +1 -1
  40. package/esm/virtual-scroll/scroll.js +6 -2
  41. package/esm/virtual-scroll/virtual-scroll-list.d.ts.map +1 -1
  42. package/esm/virtual-scroll/virtual-scroll-list.js +1 -0
  43. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["node.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAuB,MAAM,eAAe,CAAC;AAElE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAQhD,QAAA,MAAM,YAAY,gIAqJjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["node.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAuB,MAAM,eAAe,CAAC;AAElE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAQhD,QAAA,MAAM,YAAY,gIAuJjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -103,6 +103,8 @@ var CascaderNode = function CascaderNode(props) {
103
103
  handleSelect(e);
104
104
  };
105
105
  hasHandleSelectRef.current = true;
106
+ } else {
107
+ hasHandleSelectRef.current = false;
106
108
  }
107
109
  return events;
108
110
  };
@@ -34,8 +34,8 @@ var Day = function Day(props) {
34
34
  props.onChange(date, noClose || props.type === 'datetime');
35
35
  props.setTarget(undefined);
36
36
  });
37
- var setCurrent = (0, _hooks.usePersistFn)(function (date) {
38
- props.setCurrent(date, areaType);
37
+ var setCurrent = (0, _hooks.usePersistFn)(function (date, type) {
38
+ props.setCurrent(date, type || areaType);
39
39
  });
40
40
  var _useDatePick = (0, _hooks.useDatePick)({
41
41
  current: props.current,
@@ -67,7 +67,7 @@ var Day = function Day(props) {
67
67
  props.setCurrent(new Date(), areaType);
68
68
  props.onChange(new Date(), props.needConfirm || props.type === 'datetime');
69
69
  setTimeout(function () {
70
- if (props.closeByConfirm && !props.range) props.closeByConfirm();
70
+ if (props.needConfirm && props.closeByConfirm && !props.range) props.closeByConfirm();
71
71
  }, 0);
72
72
  };
73
73
  var renderDay = function renderDay(item, index) {
@@ -23,8 +23,8 @@ var Month = function Month(props) {
23
23
  var changeMode = (0, _hooks.usePersistFn)(function () {
24
24
  props.setMode('day');
25
25
  });
26
- var setCurrent = (0, _hooks.usePersistFn)(function (date) {
27
- props.setCurrent(date, 'month');
26
+ var setCurrent = (0, _hooks.usePersistFn)(function (date, type) {
27
+ props.setCurrent(date, type || 'month');
28
28
  });
29
29
  var _useMonthPick = (0, _hooks.useMonthPick)({
30
30
  current: props.current,
@@ -18,8 +18,8 @@ var Quarter = function Quarter(props) {
18
18
  var jssStyle = props.jssStyle;
19
19
  var config = (0, _config.useConfig)();
20
20
  var styles = jssStyle === null || jssStyle === void 0 || (_jssStyle$datePicker = jssStyle.datePicker) === null || _jssStyle$datePicker === void 0 ? void 0 : _jssStyle$datePicker.call(jssStyle);
21
- var setCurrent = (0, _hooks.usePersistFn)(function (date) {
22
- props.setCurrent(date, 'quarter');
21
+ var setCurrent = (0, _hooks.usePersistFn)(function (date, type) {
22
+ props.setCurrent(date, type || 'quarter');
23
23
  });
24
24
  var _useQuarterPick = (0, _hooks.useQuarterPick)({
25
25
  current: props.current,
@@ -22,8 +22,8 @@ var Year = function Year(props) {
22
22
  var changeMode = (0, _hooks.usePersistFn)(function () {
23
23
  props.setMode('month');
24
24
  });
25
- var setCurrent = (0, _hooks.usePersistFn)(function (date) {
26
- props.setCurrent(date, 'year');
25
+ var setCurrent = (0, _hooks.usePersistFn)(function (date, type) {
26
+ props.setCurrent(date, type || 'year');
27
27
  });
28
28
  var _useYearPick = (0, _hooks.useYearPick)({
29
29
  current: props.current,
@@ -1 +1 @@
1
- {"version":3,"file":"descriptions.d.ts","sourceRoot":"","sources":["descriptions.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAuB,MAAM,qBAAqB,CAAC;AAGlF,QAAA,MAAM,YAAY,UAAW,iBAAiB,4CAyI7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"descriptions.d.ts","sourceRoot":"","sources":["descriptions.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAuB,MAAM,qBAAqB,CAAC;AAGlF,QAAA,MAAM,YAAY,UAAW,iBAAiB,4CA8I7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -18,7 +18,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
18
18
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
19
19
  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); }
20
20
  var Descriptions = function Descriptions(props) {
21
- var _jssStyleProps$descri, _renderItem$;
21
+ var _jssStyleProps$descri;
22
22
  var className = props.className,
23
23
  jssStyleProps = props.jssStyle,
24
24
  style = props.style,
@@ -46,6 +46,11 @@ var Descriptions = function Descriptions(props) {
46
46
  labelStyle: labelStyle
47
47
  }),
48
48
  renderItem = _useDescriptions.renderItem;
49
+ var longestItem = (0, _react.useMemo)(function () {
50
+ return renderItem.reduce(function (prev, curr) {
51
+ return prev.length >= curr.length ? prev : curr;
52
+ }, []);
53
+ }, [renderItem]);
49
54
  var jssStyle = (jssStyleProps === null || jssStyleProps === void 0 || (_jssStyleProps$descri = jssStyleProps.descriptions) === null || _jssStyleProps$descri === void 0 ? void 0 : _jssStyleProps$descri.call(jssStyleProps)) || {};
50
55
  var Header = function Header() {
51
56
  if (!title && !extra) return null;
@@ -142,7 +147,7 @@ var Descriptions = function Descriptions(props) {
142
147
  cellPadding: 0,
143
148
  cellSpacing: 0,
144
149
  children: [layout === 'inlineHorizontal' && typeof column === 'number' && column > 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)("colgroup", {
145
- children: (_renderItem$ = renderItem[0]) === null || _renderItem$ === void 0 ? void 0 : _renderItem$.map(function (_, index, arr) {
150
+ children: longestItem === null || longestItem === void 0 ? void 0 : longestItem.map(function (_, index, arr) {
146
151
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("col", {
147
152
  style: {
148
153
  width: "".concat(1 / arr.length * 100, "%")
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["list.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AASxC,QAAA,MAAM,IAAI,+GAiQT,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["list.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AASxC,QAAA,MAAM,IAAI,+GAkQT,CAAC;AAEF,eAAe,IAAI,CAAC"}
package/cjs/list/list.js CHANGED
@@ -225,7 +225,8 @@ var List = function List(props) {
225
225
  minWidth: 0,
226
226
  overflow: 'auto'
227
227
  },
228
- dynamicVirtual: props.dynamicHeight
228
+ dynamicVirtual: props.dynamicHeight,
229
+ keepScrollTop: !!props.scrollLoading
229
230
  }), renderFooter()]
230
231
  });
231
232
  }
@@ -1,4 +1,6 @@
1
+ import React from 'react';
1
2
  import { BaseListProps } from './select.type';
3
+ export declare const defaultRenderItem: <DataItem>(d: DataItem) => React.ReactNode;
2
4
  declare const List: <DataItem, Value>(props: BaseListProps<DataItem, Value>) => import("react/jsx-runtime").JSX.Element;
3
5
  export default List;
4
6
  //# sourceMappingURL=list.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["list.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAiB,aAAa,EAAE,MAAM,eAAe,CAAC;AAK7D,QAAA,MAAM,IAAI,qGAoNT,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAG3D,OAAO,EAAiB,aAAa,EAAE,MAAM,eAAe,CAAC;AAK7D,eAAO,MAAM,iBAAiB,4CAA8D,CAAC;AAC7F,QAAA,MAAM,IAAI,qGAoNT,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.defaultRenderItem = exports.default = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _classnames = _interopRequireDefault(require("classnames"));
9
9
  var _hooks = require("@sheinx/hooks");
@@ -26,6 +26,9 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
26
26
  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; }
27
27
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
28
28
  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); }
29
+ var defaultRenderItem = exports.defaultRenderItem = function defaultRenderItem(d) {
30
+ return d;
31
+ };
29
32
  var List = function List(props) {
30
33
  var _jssStyle$select;
31
34
  var jssStyle = props.jssStyle,
@@ -45,9 +48,7 @@ var List = function List(props) {
45
48
  optionListRef = props.optionListRef,
46
49
  isAnimationFinish = props.isAnimationFinish,
47
50
  _props$renderItem = props.renderItem,
48
- renderItemProp = _props$renderItem === void 0 ? function (d) {
49
- return d;
50
- } : _props$renderItem,
51
+ renderItemProp = _props$renderItem === void 0 ? defaultRenderItem : _props$renderItem,
51
52
  closePop = props.closePop,
52
53
  onControlTypeChange = props.onControlTypeChange,
53
54
  onOptionClick = props.onOptionClick;
@@ -188,7 +188,7 @@ var Result = function Result(props) {
188
188
  handleResultItemClick(e, item);
189
189
  };
190
190
  var content = renderResultContent(item, index, nodes);
191
- if (!content) return null;
191
+ if (!content && content !== 0) return null;
192
192
  if (renderResultContentProp) {
193
193
  // cascader 不渲染tag
194
194
  return renderResultContentProp(_objectSpread({
@@ -13,7 +13,7 @@ var _useInnerTitle = _interopRequireDefault(require("../common/use-inner-title")
13
13
  var _animationList = _interopRequireDefault(require("../animation-list"));
14
14
  var _spin = _interopRequireDefault(require("../spin"));
15
15
  var _result = _interopRequireDefault(require("./result"));
16
- var _list = _interopRequireDefault(require("./list"));
16
+ var _list = _interopRequireWildcard(require("./list"));
17
17
  var _listTree = _interopRequireDefault(require("./list-tree"));
18
18
  var _icons = _interopRequireDefault(require("../icons"));
19
19
  var _listColumns = _interopRequireDefault(require("./list-columns"));
@@ -101,9 +101,7 @@ function Select(props0) {
101
101
  autoAdapt = props.autoAdapt,
102
102
  groupBy = props.groupBy,
103
103
  _props$renderItem = props.renderItem,
104
- renderItemProp = _props$renderItem === void 0 ? function (d) {
105
- return d;
106
- } : _props$renderItem,
104
+ renderItemProp = _props$renderItem === void 0 ? _list.defaultRenderItem : _props$renderItem,
107
105
  renderResultProp = props.renderResult,
108
106
  renderUnmatched = props.renderUnmatched,
109
107
  resultClassName = props.resultClassName,
@@ -324,7 +322,8 @@ function Select(props0) {
324
322
  });
325
323
  var rootClass = (0, _classnames.default)(className, styles === null || styles === void 0 ? void 0 : styles.rootClass, styles === null || styles === void 0 ? void 0 : styles.wrapper, isEmpty && styles.wrapperEmpty, open && (styles === null || styles === void 0 ? void 0 : styles.wrapperOpen), open && trigger === 'hover' && (styles === null || styles === void 0 ? void 0 : styles.triggerHover), disabled === true && (styles === null || styles === void 0 ? void 0 : styles.wrapperDisabled), disabled !== true && focused && (styles === null || styles === void 0 ? void 0 : styles.wrapperFocus), innerTitle && (styles === null || styles === void 0 ? void 0 : styles.wrapperInnerTitle), size === 'small' && (styles === null || styles === void 0 ? void 0 : styles.wrapperSmall), size === 'large' && (styles === null || styles === void 0 ? void 0 : styles.wrapperLarge), (!!props.error || props.status === 'error') && (styles === null || styles === void 0 ? void 0 : styles.wrapperError), clearable && (styles === null || styles === void 0 ? void 0 : styles.clearable), !border && (styles === null || styles === void 0 ? void 0 : styles.wrapperNoBorder), !!underline && (styles === null || styles === void 0 ? void 0 : styles.wrapperUnderline), _defineProperty({}, styles === null || styles === void 0 ? void 0 : styles.multiple, multiple));
326
324
  var getRenderItem = function getRenderItem(data, index) {
327
- return typeof renderItemProp === 'function' ? renderItemProp(data, index) : (data === null || data === void 0 ? void 0 : data[renderItemProp]) || '';
325
+ var _data$renderItemProp;
326
+ return typeof renderItemProp === 'function' ? renderItemProp(data, index) : (_data$renderItemProp = data === null || data === void 0 ? void 0 : data[renderItemProp]) !== null && _data$renderItemProp !== void 0 ? _data$renderItemProp : '';
328
327
  };
329
328
  var renderItem = getRenderItem;
330
329
  var handleFocus = (0, _hooks.usePersistFn)(function (e) {
@@ -195,7 +195,7 @@ var _default = exports.default = function _default(props) {
195
195
  var fixedStyle = getFixedStyle(col.fixed, col.index, level);
196
196
  var cellClassName = (0, _classnames.default)(colTemp.className, colTemp.type === 'checkbox' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellCheckbox), col.fixed === 'left' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellFixedLeft), col.fixed === 'right' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellFixedRight), colTemp.align === 'center' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellAlignCenter), colTemp.align === 'right' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellAlignRight), colTemp.align !== 'right' && colTemp.align !== 'center' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellAlignLeft), (col.lastFixed || col.firstFixed) && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellFixedLast), isLast && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellIgnoreBorder), colTemp.sorter && props.cellSortable && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellSortable));
197
197
  var isExpand = colTemp.type === 'expand' || colTemp.type === 'row-expand';
198
- if (colTemp.title || isExpand) {
198
+ if (colTemp.title !== undefined || isExpand) {
199
199
  var sorter = renderSort(colTemp);
200
200
  var filter = renderFilter(colTemp, columnIndex);
201
201
  trs[level].push( /*#__PURE__*/(0, _jsxRuntime.jsx)("th", {
@@ -4,6 +4,7 @@ interface scrollProps {
4
4
  scrollWidth: number | string;
5
5
  height?: number | string;
6
6
  children: React.ReactNode;
7
+ keepScrollTop?: boolean;
7
8
  wrapperRef?: React.RefObject<HTMLDivElement>;
8
9
  onScroll?: (info: {
9
10
  scrollLeft: number;
@@ -1 +1 @@
1
- {"version":3,"file":"scroll.d.ts","sourceRoot":"","sources":["scroll.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAI/C,UAAU,WAAW;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC7C,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,QAAQ,EAAE,OAAO,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;KACf,KAAK,IAAI,CAAC;IACX,gBAAgB,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACpC,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACpC,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,QAAA,MAAM,MAAM,UAAW,WAAW,4CA+HjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"scroll.d.ts","sourceRoot":"","sources":["scroll.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAI/C,UAAU,WAAW;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC7C,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,QAAQ,EAAE,OAAO,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;KACf,KAAK,IAAI,CAAC;IACX,gBAAgB,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACpC,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACpC,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,QAAA,MAAM,MAAM,UAAW,WAAW,4CAiIjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -30,7 +30,9 @@ var Scroll = function Scroll(props) {
30
30
  _props$scrollWidth = props.scrollWidth,
31
31
  scrollWidth = _props$scrollWidth === void 0 ? 0 : _props$scrollWidth,
32
32
  _props$defaultHeight = props.defaultHeight,
33
- defaultHeight = _props$defaultHeight === void 0 ? 0 : _props$defaultHeight;
33
+ defaultHeight = _props$defaultHeight === void 0 ? 0 : _props$defaultHeight,
34
+ _props$keepScrollTop = props.keepScrollTop,
35
+ keepScrollTop = _props$keepScrollTop === void 0 ? false : _props$keepScrollTop;
34
36
  var _useResize = (0, _hooks.useResize)({
35
37
  targetRef: containerRef,
36
38
  timer: 100
@@ -55,7 +57,9 @@ var Scroll = function Scroll(props) {
55
57
 
56
58
  // 当滚动容器的高度为 0 时,paddingTop 为 0,避免滚动条抖动现象
57
59
  var paddingTop = (0, _react.useMemo)(function () {
58
- return height === 0 ? 0 : Math.max(0, Math.floor(scrollHeight - height));
60
+ var maxHeight = Math.max(0, scrollHeight - height);
61
+ if (keepScrollTop) return maxHeight;
62
+ return height === 0 ? 0 : maxHeight;
59
63
  }, [scrollHeight, height]);
60
64
  var placeStyle = {
61
65
  paddingTop: paddingTop,
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-scroll-list.d.ts","sourceRoot":"","sources":["virtual-scroll-list.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,QAAA,MAAM,WAAW,0FAwQhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"virtual-scroll-list.d.ts","sourceRoot":"","sources":["virtual-scroll-list.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,QAAA,MAAM,WAAW,0FAyQhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -208,6 +208,7 @@ var VirtualList = function VirtualList(props) {
208
208
  wrapperRef: wrapperRef,
209
209
  onScroll: handleScroll,
210
210
  onMouseMove: handleMouseMove,
211
+ keepScrollTop: keepScrollTop,
211
212
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Tag, {
212
213
  className: tagClassName,
213
214
  style: innerStyle,
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["node.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAuB,MAAM,eAAe,CAAC;AAElE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAQhD,QAAA,MAAM,YAAY,gIAqJjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["node.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAuB,MAAM,eAAe,CAAC;AAElE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAQhD,QAAA,MAAM,YAAY,gIAuJjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -97,6 +97,8 @@ var CascaderNode = function CascaderNode(props) {
97
97
  handleSelect(e);
98
98
  };
99
99
  hasHandleSelectRef.current = true;
100
+ } else {
101
+ hasHandleSelectRef.current = false;
100
102
  }
101
103
  return events;
102
104
  };
@@ -29,8 +29,8 @@ var Day = function Day(props) {
29
29
  props.onChange(date, noClose || props.type === 'datetime');
30
30
  props.setTarget(undefined);
31
31
  });
32
- var setCurrent = usePersistFn(function (date) {
33
- props.setCurrent(date, areaType);
32
+ var setCurrent = usePersistFn(function (date, type) {
33
+ props.setCurrent(date, type || areaType);
34
34
  });
35
35
  var _useDatePick = useDatePick({
36
36
  current: props.current,
@@ -62,7 +62,7 @@ var Day = function Day(props) {
62
62
  props.setCurrent(new Date(), areaType);
63
63
  props.onChange(new Date(), props.needConfirm || props.type === 'datetime');
64
64
  setTimeout(function () {
65
- if (props.closeByConfirm && !props.range) props.closeByConfirm();
65
+ if (props.needConfirm && props.closeByConfirm && !props.range) props.closeByConfirm();
66
66
  }, 0);
67
67
  };
68
68
  var renderDay = function renderDay(item, index) {
@@ -17,8 +17,8 @@ var Month = function Month(props) {
17
17
  var changeMode = usePersistFn(function () {
18
18
  props.setMode('day');
19
19
  });
20
- var setCurrent = usePersistFn(function (date) {
21
- props.setCurrent(date, 'month');
20
+ var setCurrent = usePersistFn(function (date, type) {
21
+ props.setCurrent(date, type || 'month');
22
22
  });
23
23
  var _useMonthPick = useMonthPick({
24
24
  current: props.current,
@@ -12,8 +12,8 @@ var Quarter = function Quarter(props) {
12
12
  var jssStyle = props.jssStyle;
13
13
  var config = useConfig();
14
14
  var styles = jssStyle === null || jssStyle === void 0 || (_jssStyle$datePicker = jssStyle.datePicker) === null || _jssStyle$datePicker === void 0 ? void 0 : _jssStyle$datePicker.call(jssStyle);
15
- var setCurrent = usePersistFn(function (date) {
16
- props.setCurrent(date, 'quarter');
15
+ var setCurrent = usePersistFn(function (date, type) {
16
+ props.setCurrent(date, type || 'quarter');
17
17
  });
18
18
  var _useQuarterPick = useQuarterPick({
19
19
  current: props.current,
@@ -16,8 +16,8 @@ var Year = function Year(props) {
16
16
  var changeMode = usePersistFn(function () {
17
17
  props.setMode('month');
18
18
  });
19
- var setCurrent = usePersistFn(function (date) {
20
- props.setCurrent(date, 'year');
19
+ var setCurrent = usePersistFn(function (date, type) {
20
+ props.setCurrent(date, type || 'year');
21
21
  });
22
22
  var _useYearPick = useYearPick({
23
23
  current: props.current,
@@ -1 +1 @@
1
- {"version":3,"file":"descriptions.d.ts","sourceRoot":"","sources":["descriptions.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAuB,MAAM,qBAAqB,CAAC;AAGlF,QAAA,MAAM,YAAY,UAAW,iBAAiB,4CAyI7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"descriptions.d.ts","sourceRoot":"","sources":["descriptions.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAuB,MAAM,qBAAqB,CAAC;AAGlF,QAAA,MAAM,YAAY,UAAW,iBAAiB,4CA8I7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -4,13 +4,13 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  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; }
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
6
  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); }
7
- import React, { Fragment } from 'react';
7
+ import React, { Fragment, useMemo } from 'react';
8
8
  import classNames from 'classnames';
9
9
  import { useDescriptions, usePersistFn } from '@sheinx/hooks';
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
12
12
  var Descriptions = function Descriptions(props) {
13
- var _jssStyleProps$descri, _renderItem$;
13
+ var _jssStyleProps$descri;
14
14
  var className = props.className,
15
15
  jssStyleProps = props.jssStyle,
16
16
  style = props.style,
@@ -38,6 +38,11 @@ var Descriptions = function Descriptions(props) {
38
38
  labelStyle: labelStyle
39
39
  }),
40
40
  renderItem = _useDescriptions.renderItem;
41
+ var longestItem = useMemo(function () {
42
+ return renderItem.reduce(function (prev, curr) {
43
+ return prev.length >= curr.length ? prev : curr;
44
+ }, []);
45
+ }, [renderItem]);
41
46
  var jssStyle = (jssStyleProps === null || jssStyleProps === void 0 || (_jssStyleProps$descri = jssStyleProps.descriptions) === null || _jssStyleProps$descri === void 0 ? void 0 : _jssStyleProps$descri.call(jssStyleProps)) || {};
42
47
  var Header = function Header() {
43
48
  if (!title && !extra) return null;
@@ -134,7 +139,7 @@ var Descriptions = function Descriptions(props) {
134
139
  cellPadding: 0,
135
140
  cellSpacing: 0,
136
141
  children: [layout === 'inlineHorizontal' && typeof column === 'number' && column > 1 && /*#__PURE__*/_jsx("colgroup", {
137
- children: (_renderItem$ = renderItem[0]) === null || _renderItem$ === void 0 ? void 0 : _renderItem$.map(function (_, index, arr) {
142
+ children: longestItem === null || longestItem === void 0 ? void 0 : longestItem.map(function (_, index, arr) {
138
143
  return /*#__PURE__*/_jsx("col", {
139
144
  style: {
140
145
  width: "".concat(1 / arr.length * 100, "%")
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["list.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AASxC,QAAA,MAAM,IAAI,+GAiQT,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["list.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AASxC,QAAA,MAAM,IAAI,+GAkQT,CAAC;AAEF,eAAe,IAAI,CAAC"}
package/esm/list/list.js CHANGED
@@ -219,7 +219,8 @@ var List = function List(props) {
219
219
  minWidth: 0,
220
220
  overflow: 'auto'
221
221
  },
222
- dynamicVirtual: props.dynamicHeight
222
+ dynamicVirtual: props.dynamicHeight,
223
+ keepScrollTop: !!props.scrollLoading
223
224
  }), renderFooter()]
224
225
  });
225
226
  }
@@ -1,4 +1,6 @@
1
+ import React from 'react';
1
2
  import { BaseListProps } from './select.type';
3
+ export declare const defaultRenderItem: <DataItem>(d: DataItem) => React.ReactNode;
2
4
  declare const List: <DataItem, Value>(props: BaseListProps<DataItem, Value>) => import("react/jsx-runtime").JSX.Element;
3
5
  export default List;
4
6
  //# sourceMappingURL=list.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["list.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAiB,aAAa,EAAE,MAAM,eAAe,CAAC;AAK7D,QAAA,MAAM,IAAI,qGAoNT,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAG3D,OAAO,EAAiB,aAAa,EAAE,MAAM,eAAe,CAAC;AAK7D,eAAO,MAAM,iBAAiB,4CAA8D,CAAC;AAC7F,QAAA,MAAM,IAAI,qGAoNT,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -17,6 +17,9 @@ import { usePersistFn } from '@sheinx/hooks';
17
17
  import { VirtualScrollList } from "../virtual-scroll";
18
18
  import ListOption from "./list-option";
19
19
  import { jsx as _jsx } from "react/jsx-runtime";
20
+ export var defaultRenderItem = function defaultRenderItem(d) {
21
+ return d;
22
+ };
20
23
  var List = function List(props) {
21
24
  var _jssStyle$select;
22
25
  var jssStyle = props.jssStyle,
@@ -36,9 +39,7 @@ var List = function List(props) {
36
39
  optionListRef = props.optionListRef,
37
40
  isAnimationFinish = props.isAnimationFinish,
38
41
  _props$renderItem = props.renderItem,
39
- renderItemProp = _props$renderItem === void 0 ? function (d) {
40
- return d;
41
- } : _props$renderItem,
42
+ renderItemProp = _props$renderItem === void 0 ? defaultRenderItem : _props$renderItem,
42
43
  closePop = props.closePop,
43
44
  onControlTypeChange = props.onControlTypeChange,
44
45
  onOptionClick = props.onOptionClick;
@@ -180,7 +180,7 @@ var Result = function Result(props) {
180
180
  handleResultItemClick(e, item);
181
181
  };
182
182
  var content = renderResultContent(item, index, nodes);
183
- if (!content) return null;
183
+ if (!content && content !== 0) return null;
184
184
  if (renderResultContentProp) {
185
185
  // cascader 不渲染tag
186
186
  return renderResultContentProp(_objectSpread({
@@ -22,7 +22,7 @@ import useInnerTitle from "../common/use-inner-title";
22
22
  import AnimationList from "../animation-list";
23
23
  import Spin from "../spin";
24
24
  import Result from "./result";
25
- import List from "./list";
25
+ import List, { defaultRenderItem } from "./list";
26
26
  import TreeList from "./list-tree";
27
27
  import Icons from "../icons";
28
28
  import ColumnsList from "./list-columns";
@@ -94,9 +94,7 @@ function Select(props0) {
94
94
  autoAdapt = props.autoAdapt,
95
95
  groupBy = props.groupBy,
96
96
  _props$renderItem = props.renderItem,
97
- renderItemProp = _props$renderItem === void 0 ? function (d) {
98
- return d;
99
- } : _props$renderItem,
97
+ renderItemProp = _props$renderItem === void 0 ? defaultRenderItem : _props$renderItem,
100
98
  renderResultProp = props.renderResult,
101
99
  renderUnmatched = props.renderUnmatched,
102
100
  resultClassName = props.resultClassName,
@@ -317,7 +315,8 @@ function Select(props0) {
317
315
  });
318
316
  var rootClass = classNames(className, styles === null || styles === void 0 ? void 0 : styles.rootClass, styles === null || styles === void 0 ? void 0 : styles.wrapper, isEmpty && styles.wrapperEmpty, open && (styles === null || styles === void 0 ? void 0 : styles.wrapperOpen), open && trigger === 'hover' && (styles === null || styles === void 0 ? void 0 : styles.triggerHover), disabled === true && (styles === null || styles === void 0 ? void 0 : styles.wrapperDisabled), disabled !== true && focused && (styles === null || styles === void 0 ? void 0 : styles.wrapperFocus), innerTitle && (styles === null || styles === void 0 ? void 0 : styles.wrapperInnerTitle), size === 'small' && (styles === null || styles === void 0 ? void 0 : styles.wrapperSmall), size === 'large' && (styles === null || styles === void 0 ? void 0 : styles.wrapperLarge), (!!props.error || props.status === 'error') && (styles === null || styles === void 0 ? void 0 : styles.wrapperError), clearable && (styles === null || styles === void 0 ? void 0 : styles.clearable), !border && (styles === null || styles === void 0 ? void 0 : styles.wrapperNoBorder), !!underline && (styles === null || styles === void 0 ? void 0 : styles.wrapperUnderline), _defineProperty({}, styles === null || styles === void 0 ? void 0 : styles.multiple, multiple));
319
317
  var getRenderItem = function getRenderItem(data, index) {
320
- return typeof renderItemProp === 'function' ? renderItemProp(data, index) : (data === null || data === void 0 ? void 0 : data[renderItemProp]) || '';
318
+ var _data$renderItemProp;
319
+ return typeof renderItemProp === 'function' ? renderItemProp(data, index) : (_data$renderItemProp = data === null || data === void 0 ? void 0 : data[renderItemProp]) !== null && _data$renderItemProp !== void 0 ? _data$renderItemProp : '';
321
320
  };
322
321
  var renderItem = getRenderItem;
323
322
  var handleFocus = usePersistFn(function (e) {
@@ -188,7 +188,7 @@ export default (function (props) {
188
188
  var fixedStyle = getFixedStyle(col.fixed, col.index, level);
189
189
  var cellClassName = classNames(colTemp.className, colTemp.type === 'checkbox' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellCheckbox), col.fixed === 'left' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellFixedLeft), col.fixed === 'right' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellFixedRight), colTemp.align === 'center' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellAlignCenter), colTemp.align === 'right' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellAlignRight), colTemp.align !== 'right' && colTemp.align !== 'center' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellAlignLeft), (col.lastFixed || col.firstFixed) && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellFixedLast), isLast && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellIgnoreBorder), colTemp.sorter && props.cellSortable && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellSortable));
190
190
  var isExpand = colTemp.type === 'expand' || colTemp.type === 'row-expand';
191
- if (colTemp.title || isExpand) {
191
+ if (colTemp.title !== undefined || isExpand) {
192
192
  var sorter = renderSort(colTemp);
193
193
  var filter = renderFilter(colTemp, columnIndex);
194
194
  trs[level].push( /*#__PURE__*/_jsx("th", {
@@ -4,6 +4,7 @@ interface scrollProps {
4
4
  scrollWidth: number | string;
5
5
  height?: number | string;
6
6
  children: React.ReactNode;
7
+ keepScrollTop?: boolean;
7
8
  wrapperRef?: React.RefObject<HTMLDivElement>;
8
9
  onScroll?: (info: {
9
10
  scrollLeft: number;
@@ -1 +1 @@
1
- {"version":3,"file":"scroll.d.ts","sourceRoot":"","sources":["scroll.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAI/C,UAAU,WAAW;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC7C,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,QAAQ,EAAE,OAAO,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;KACf,KAAK,IAAI,CAAC;IACX,gBAAgB,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACpC,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACpC,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,QAAA,MAAM,MAAM,UAAW,WAAW,4CA+HjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"scroll.d.ts","sourceRoot":"","sources":["scroll.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAI/C,UAAU,WAAW;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC7C,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,QAAQ,EAAE,OAAO,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;KACf,KAAK,IAAI,CAAC;IACX,gBAAgB,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACpC,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACpC,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,QAAA,MAAM,MAAM,UAAW,WAAW,4CAiIjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -23,7 +23,9 @@ var Scroll = function Scroll(props) {
23
23
  _props$scrollWidth = props.scrollWidth,
24
24
  scrollWidth = _props$scrollWidth === void 0 ? 0 : _props$scrollWidth,
25
25
  _props$defaultHeight = props.defaultHeight,
26
- defaultHeight = _props$defaultHeight === void 0 ? 0 : _props$defaultHeight;
26
+ defaultHeight = _props$defaultHeight === void 0 ? 0 : _props$defaultHeight,
27
+ _props$keepScrollTop = props.keepScrollTop,
28
+ keepScrollTop = _props$keepScrollTop === void 0 ? false : _props$keepScrollTop;
27
29
  var _useResize = useResize({
28
30
  targetRef: containerRef,
29
31
  timer: 100
@@ -48,7 +50,9 @@ var Scroll = function Scroll(props) {
48
50
 
49
51
  // 当滚动容器的高度为 0 时,paddingTop 为 0,避免滚动条抖动现象
50
52
  var paddingTop = useMemo(function () {
51
- return height === 0 ? 0 : Math.max(0, Math.floor(scrollHeight - height));
53
+ var maxHeight = Math.max(0, scrollHeight - height);
54
+ if (keepScrollTop) return maxHeight;
55
+ return height === 0 ? 0 : maxHeight;
52
56
  }, [scrollHeight, height]);
53
57
  var placeStyle = {
54
58
  paddingTop: paddingTop,
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-scroll-list.d.ts","sourceRoot":"","sources":["virtual-scroll-list.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,QAAA,MAAM,WAAW,0FAwQhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"virtual-scroll-list.d.ts","sourceRoot":"","sources":["virtual-scroll-list.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,QAAA,MAAM,WAAW,0FAyQhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -199,6 +199,7 @@ var VirtualList = function VirtualList(props) {
199
199
  wrapperRef: wrapperRef,
200
200
  onScroll: handleScroll,
201
201
  onMouseMove: handleMouseMove,
202
+ keepScrollTop: keepScrollTop,
202
203
  children: /*#__PURE__*/_jsx(Tag, {
203
204
  className: tagClassName,
204
205
  style: innerStyle,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheinx/base",
3
- "version": "3.8.9",
3
+ "version": "3.8.10-beta.10",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -10,7 +10,7 @@
10
10
  "module": "./esm/index.js",
11
11
  "typings": "./cjs/index.d.ts",
12
12
  "dependencies": {
13
- "@sheinx/hooks": "3.8.9",
13
+ "@sheinx/hooks": "3.8.10-beta.10",
14
14
  "immer": "^10.0.0",
15
15
  "classnames": "^2.0.0",
16
16
  "@shined/reactive": "^0.1.3-alpha.0"