shineout 3.7.8-beta.5 → 3.7.8-beta.7

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.
package/cjs/index.js CHANGED
@@ -522,5 +522,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
522
522
  // 此文件由脚本自动生成,请勿直接修改。
523
523
  // This file was generated automatically by a script. Please do not modify it directly.
524
524
  var _default = exports.default = {
525
- version: '3.7.8-beta.5'
525
+ version: '3.7.8-beta.7'
526
526
  };
package/dist/shineout.js CHANGED
@@ -12234,7 +12234,7 @@ var handleStyle = function handleStyle(style) {
12234
12234
  };
12235
12235
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12236
12236
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12237
- /* harmony default export */ var version = ('3.7.8-beta.5');
12237
+ /* harmony default export */ var version = ('3.7.8-beta.7');
12238
12238
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12239
12239
 
12240
12240
 
@@ -39572,8 +39572,8 @@ var useTree = function useTree(props) {
39572
39572
  var _context$value;
39573
39573
  if (mode !== MODE.MODE_0) return;
39574
39574
  (_context$value = context.value) === null || _context$value === void 0 || _context$value.forEach(function (id) {
39575
- var _ref3 = context.pathMap.get(id),
39576
- children = _ref3.children;
39575
+ var node = context.pathMap.get(id);
39576
+ var children = node === null || node === void 0 ? void 0 : node.children;
39577
39577
  if (children && children.length) {
39578
39578
  var noCheckedChildren = children.filter(function (cid) {
39579
39579
  var _context$value2;
@@ -40058,7 +40058,8 @@ var VirtualList = function VirtualList(props) {
40058
40058
  preIndex: null,
40059
40059
  topTimer: null,
40060
40060
  rateTimer: null,
40061
- shouldUpdateHeight: true
40061
+ shouldUpdateHeight: true,
40062
+ prevWrapperRefHeight: 0
40062
40063
  }),
40063
40064
  context = _useRef.current;
40064
40065
  var getContentHeight = function getContentHeight(index) {
@@ -40218,11 +40219,14 @@ var VirtualList = function VirtualList(props) {
40218
40219
  context.preIndex = startIndex;
40219
40220
  }, [startIndex]);
40220
40221
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function () {
40221
- if (keepScrollHeight) return;
40222
+ var _wrapperRef$current2;
40223
+ var currentWrapperRefHeight = ((_wrapperRef$current2 = wrapperRef.current) === null || _wrapperRef$current2 === void 0 ? void 0 : _wrapperRef$current2.clientHeight) || 0;
40224
+ if (keepScrollHeight && currentWrapperRefHeight === context.prevWrapperRefHeight) return;
40222
40225
  if (keepScrollTop) return;
40223
40226
  // 数据变化的时候清空掉 preIndex, 如果之前有缓存的index, setRowHeight 会有问题
40224
40227
  setTop(0);
40225
40228
  setStartIndex(0);
40229
+ context.prevWrapperRefHeight = currentWrapperRefHeight;
40226
40230
  return function () {
40227
40231
  context.preIndex = null;
40228
40232
  };
@@ -41392,25 +41396,44 @@ function getResetMore(onFilter, container, doms) {
41392
41396
  var hideMargin = parsePxToNumber(hideElStyle.marginLeft) + parsePxToNumber(hideElStyle.marginRight);
41393
41397
  var num = 0;
41394
41398
  var sumWidth = 0;
41395
- for (var i = 0; i < doms.length; i++) {
41396
- var _item2 = doms[i];
41397
- var itemStyle = getComputedStyle(_item2);
41398
- var itemWidth = _item2.offsetWidth + parsePxToNumber(itemStyle.marginLeft) + parsePxToNumber(itemStyle.marginRight);
41399
- sumWidth += itemWidth;
41400
- var moreWidth = 0;
41401
- var resetNum = items.length - 1 - i;
41402
- if (resetNum > 0) {
41403
- var reset = "+".concat(resetNum);
41404
- hideEl.childNodes[0].innerText = reset;
41405
- moreWidth = hideEl.offsetWidth + hideMargin;
41406
- }
41407
- if (sumWidth > contentWidth - moreWidth) {
41408
- num = i;
41409
- break;
41410
- }
41399
+ var itemWidthArr = items.map(function (item) {
41400
+ var itemStyle = getComputedStyle(item);
41401
+ var itemLen = item.offsetWidth + parsePxToNumber(itemStyle.marginLeft) + parsePxToNumber(itemStyle.marginRight);
41402
+ sumWidth += itemLen;
41403
+ return itemLen;
41404
+ });
41405
+ if (sumWidth <= contentWidth) {
41411
41406
  num = -1;
41407
+ } else {
41408
+ var len = 0;
41409
+ for (var i = 0; i < itemWidthArr.length; i++) {
41410
+ var itemLen = itemWidthArr[i];
41411
+ // number length
41412
+ var resetNum = items.length - 1 - i;
41413
+ var moreWidth = void 0;
41414
+ if (resetNum <= 0) {
41415
+ moreWidth = 0;
41416
+ } else {
41417
+ var reset = "+".concat(resetNum);
41418
+ hideEl.childNodes[0].innerText = reset;
41419
+ // (+num) width
41420
+ moreWidth = hideEl.offsetWidth + hideMargin;
41421
+ }
41422
+ len += itemLen;
41423
+ if (len > contentWidth - moreWidth) {
41424
+ break;
41425
+ }
41426
+ num += 1;
41427
+ if (i === items.length - 1) {
41428
+ // not show more
41429
+ num = -1;
41430
+ }
41431
+ }
41432
+ }
41433
+ // at least show one
41434
+ if (num === 0 && itemWidthArr[0]) {
41435
+ num = 1;
41412
41436
  }
41413
- ;
41414
41437
  return num;
41415
41438
  }
41416
41439
  var More = function More(props) {
@@ -71835,7 +71858,7 @@ var upload_interface = __webpack_require__(8821);
71835
71858
 
71836
71859
 
71837
71860
  /* harmony default export */ var src_0 = ({
71838
- version: '3.7.8-beta.5'
71861
+ version: '3.7.8-beta.7'
71839
71862
  });
71840
71863
  }();
71841
71864
  /******/ return __webpack_exports__;