shineout 3.8.0-beta.18 → 3.8.0-beta.19

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.8.0-beta.18'
525
+ version: '3.8.0-beta.19'
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.8.0-beta.18');
12237
+ /* harmony default export */ var version = ('3.8.0-beta.19');
12238
12238
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12239
12239
 
12240
12240
 
@@ -24084,7 +24084,6 @@ var selectStyle = objectSpread2_default()(objectSpread2_default()({
24084
24084
  height: 32,
24085
24085
  padding: "".concat(src.selectHeaderPaddingY, " ").concat(src.selectHeaderPaddingX),
24086
24086
  borderBottom: "1px solid ".concat(src.selectHeaderBorderColor),
24087
- marginBottom: 4,
24088
24087
  '& $columnsCheckbox': {
24089
24088
  marginRight: 0,
24090
24089
  marginLeft: 4,
@@ -31203,6 +31202,23 @@ var getCurrentCSSZoom = function getCurrentCSSZoom() {
31203
31202
  // height: rect.height * zoomRatio,
31204
31203
  // }
31205
31204
  // }
31205
+
31206
+ var getScrollPosition = function getScrollPosition(element) {
31207
+ if (!element) return {
31208
+ scrollTop: 0,
31209
+ scrollLeft: 0
31210
+ };
31211
+ if (element === document.documentElement || element === document.body) {
31212
+ return {
31213
+ scrollTop: document.documentElement.scrollTop || document.body.scrollTop,
31214
+ scrollLeft: document.documentElement.scrollLeft || document.body.scrollLeft
31215
+ };
31216
+ }
31217
+ return {
31218
+ scrollTop: element.scrollTop,
31219
+ scrollLeft: element.scrollLeft
31220
+ };
31221
+ };
31206
31222
  ;// CONCATENATED MODULE: ../hooks/src/common/use-position-style/index.ts
31207
31223
 
31208
31224
 
@@ -31459,17 +31475,18 @@ var usePositionStyle = function usePositionStyle(config) {
31459
31475
  };
31460
31476
  };
31461
31477
  var getAbsoluteStyle = function getAbsoluteStyle(position) {
31462
- var _scrollElRef$current, _scrollElRef$current2, _scrollElRef$current3;
31478
+ var _scrollElRef$current;
31463
31479
  if (!parentElRef.current) return {
31464
31480
  style: hideStyle
31465
31481
  };
31466
31482
  var rect = context.parentRect;
31467
31483
  var needCheck = !show || !shallow_equal(context.prevParentPosition, parentElNewPosition);
31468
- var scrollTop = (scrollElRef === null || scrollElRef === void 0 || (_scrollElRef$current = scrollElRef.current) === null || _scrollElRef$current === void 0 ? void 0 : _scrollElRef$current.scrollTop) || 0;
31469
- var scrollLeft = (scrollElRef === null || scrollElRef === void 0 || (_scrollElRef$current2 = scrollElRef.current) === null || _scrollElRef$current2 === void 0 ? void 0 : _scrollElRef$current2.scrollLeft) || 0;
31470
- if (needCheck && scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current && (_scrollElRef$current3 = scrollElRef.current) !== null && _scrollElRef$current3 !== void 0 && _scrollElRef$current3.contains(parentElRef.current)) {
31471
- var _scrollElRef$current4;
31472
- var visibleRect = ((_scrollElRef$current4 = scrollElRef.current) === null || _scrollElRef$current4 === void 0 ? void 0 : _scrollElRef$current4.getBoundingClientRect()) || {};
31484
+ var _getScrollPosition = getScrollPosition(scrollElRef === null || scrollElRef === void 0 ? void 0 : scrollElRef.current),
31485
+ scrollTop = _getScrollPosition.scrollTop,
31486
+ scrollLeft = _getScrollPosition.scrollLeft;
31487
+ if (needCheck && scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current && (_scrollElRef$current = scrollElRef.current) !== null && _scrollElRef$current !== void 0 && _scrollElRef$current.contains(parentElRef.current)) {
31488
+ var _scrollElRef$current2;
31489
+ var visibleRect = ((_scrollElRef$current2 = scrollElRef.current) === null || _scrollElRef$current2 === void 0 ? void 0 : _scrollElRef$current2.getBoundingClientRect()) || {};
31473
31490
  if (rect.bottom < visibleRect.top || rect.top > visibleRect.bottom + scrollTop || rect.right < visibleRect.left || rect.left > visibleRect.right + scrollLeft) {
31474
31491
  return {
31475
31492
  style: hideStyle
@@ -31543,7 +31560,9 @@ var usePositionStyle = function usePositionStyle(config) {
31543
31560
  }
31544
31561
 
31545
31562
  // 当父元素的滚动容器滚动时,判断是否需要更新弹出层位置,包括是否隐藏弹出层(通过hideStyle隐藏,不是show状态)
31546
- context.prevParentPosition = parentElNewPosition;
31563
+ if (show) {
31564
+ context.prevParentPosition = parentElNewPosition;
31565
+ }
31547
31566
  });
31548
31567
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(updateStyle, [show, position, absolute, updateKey, fixedWidth, parentElNewPosition, popupElSize]);
31549
31568
  return {
@@ -39739,8 +39758,8 @@ var useTree = function useTree(props) {
39739
39758
  var _context$value;
39740
39759
  if (mode !== MODE.MODE_0) return;
39741
39760
  (_context$value = context.value) === null || _context$value === void 0 || _context$value.forEach(function (id) {
39742
- var _ref3 = context.pathMap.get(id),
39743
- children = _ref3.children;
39761
+ var node = context.pathMap.get(id);
39762
+ var children = node === null || node === void 0 ? void 0 : node.children;
39744
39763
  if (children && children.length) {
39745
39764
  var noCheckedChildren = children.filter(function (cid) {
39746
39765
  var _context$value2;
@@ -40225,7 +40244,8 @@ var VirtualList = function VirtualList(props) {
40225
40244
  preIndex: null,
40226
40245
  topTimer: null,
40227
40246
  rateTimer: null,
40228
- shouldUpdateHeight: true
40247
+ shouldUpdateHeight: true,
40248
+ prevWrapperRefHeight: 0
40229
40249
  }),
40230
40250
  context = _useRef.current;
40231
40251
  var getContentHeight = function getContentHeight(index) {
@@ -40385,11 +40405,14 @@ var VirtualList = function VirtualList(props) {
40385
40405
  context.preIndex = startIndex;
40386
40406
  }, [startIndex]);
40387
40407
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function () {
40388
- if (keepScrollHeight) return;
40408
+ var _wrapperRef$current2;
40409
+ var currentWrapperRefHeight = ((_wrapperRef$current2 = wrapperRef.current) === null || _wrapperRef$current2 === void 0 ? void 0 : _wrapperRef$current2.clientHeight) || 0;
40410
+ if (keepScrollHeight && currentWrapperRefHeight === context.prevWrapperRefHeight) return;
40389
40411
  if (keepScrollTop) return;
40390
40412
  // 数据变化的时候清空掉 preIndex, 如果之前有缓存的index, setRowHeight 会有问题
40391
40413
  setTop(0);
40392
40414
  setStartIndex(0);
40415
+ context.prevWrapperRefHeight = currentWrapperRefHeight;
40393
40416
  return function () {
40394
40417
  context.preIndex = null;
40395
40418
  };
@@ -41559,25 +41582,44 @@ function getResetMore(onFilter, container, doms) {
41559
41582
  var hideMargin = parsePxToNumber(hideElStyle.marginLeft) + parsePxToNumber(hideElStyle.marginRight);
41560
41583
  var num = 0;
41561
41584
  var sumWidth = 0;
41562
- for (var i = 0; i < doms.length; i++) {
41563
- var _item2 = doms[i];
41564
- var itemStyle = getComputedStyle(_item2);
41565
- var itemWidth = _item2.offsetWidth + parsePxToNumber(itemStyle.marginLeft) + parsePxToNumber(itemStyle.marginRight);
41566
- sumWidth += itemWidth;
41567
- var moreWidth = 0;
41568
- var resetNum = items.length - 1 - i;
41569
- if (resetNum > 0) {
41570
- var reset = "+".concat(resetNum);
41571
- hideEl.childNodes[0].innerText = reset;
41572
- moreWidth = hideEl.offsetWidth + hideMargin;
41573
- }
41574
- if (sumWidth > contentWidth - moreWidth) {
41575
- num = i;
41576
- break;
41577
- }
41585
+ var itemWidthArr = items.map(function (item) {
41586
+ var itemStyle = getComputedStyle(item);
41587
+ var itemLen = item.offsetWidth + parsePxToNumber(itemStyle.marginLeft) + parsePxToNumber(itemStyle.marginRight);
41588
+ sumWidth += itemLen;
41589
+ return itemLen;
41590
+ });
41591
+ if (sumWidth <= contentWidth) {
41578
41592
  num = -1;
41593
+ } else {
41594
+ var len = 0;
41595
+ for (var i = 0; i < itemWidthArr.length; i++) {
41596
+ var itemLen = itemWidthArr[i];
41597
+ // number length
41598
+ var resetNum = items.length - 1 - i;
41599
+ var moreWidth = void 0;
41600
+ if (resetNum <= 0) {
41601
+ moreWidth = 0;
41602
+ } else {
41603
+ var reset = "+".concat(resetNum);
41604
+ hideEl.childNodes[0].innerText = reset;
41605
+ // (+num) width
41606
+ moreWidth = hideEl.offsetWidth + hideMargin;
41607
+ }
41608
+ len += itemLen;
41609
+ if (len > contentWidth - moreWidth) {
41610
+ break;
41611
+ }
41612
+ num += 1;
41613
+ if (i === items.length - 1) {
41614
+ // not show more
41615
+ num = -1;
41616
+ }
41617
+ }
41618
+ }
41619
+ // at least show one
41620
+ if (num === 0 && itemWidthArr[0]) {
41621
+ num = 1;
41579
41622
  }
41580
- ;
41581
41623
  return num;
41582
41624
  }
41583
41625
  var More = function More(props) {
@@ -51035,7 +51077,7 @@ var useForm = function useForm(props) {
51035
51077
  var _props$onChange;
51036
51078
  var newValue = typeof change === 'function' ? utils_immer_produce(context.value, change) : change;
51037
51079
  context.value = newValue;
51038
- (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, deepClone(context.value));
51080
+ (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, newValue);
51039
51081
  });
51040
51082
  var scrollToField = use_persist_fn(function (name) {
51041
51083
  var _document;
@@ -55578,7 +55620,8 @@ var VirtualNode = function VirtualNode(props) {
55578
55620
  className: rootClass,
55579
55621
  dir: config.direction,
55580
55622
  style: {
55581
- paddingLeft: level * indent
55623
+ paddingLeft: level * indent,
55624
+ height: props.lineHeight
55582
55625
  },
55583
55626
  children: [$indents, /*#__PURE__*/(0,jsx_runtime.jsx)(tree_content, {
55584
55627
  virtual: true,
@@ -55862,7 +55905,8 @@ var TreeVirtual = function TreeVirtual(props) {
55862
55905
  onNodeClick: onNodeClick,
55863
55906
  onToggle: onToggle,
55864
55907
  onChange: onChange,
55865
- size: datum.size
55908
+ size: datum.size,
55909
+ lineHeight: lineHeight
55866
55910
  }, id);
55867
55911
  };
55868
55912
  return /*#__PURE__*/(0,jsx_runtime.jsx)(virtual_scroll_list, {
@@ -56545,7 +56589,8 @@ var ColumnsList = function ColumnsList(props) {
56545
56589
  colNum: columns,
56546
56590
  lineHeight: lineHeight,
56547
56591
  rowsInView: itemsInView,
56548
- renderItem: renderItem
56592
+ renderItem: renderItem,
56593
+ paddingY: 4
56549
56594
  });
56550
56595
  };
56551
56596
  var renderSelectAll = function renderSelectAll() {
@@ -56953,7 +56998,8 @@ function Select(props0) {
56953
56998
  if (hideCreate) {
56954
56999
  // optionListRef.current?.hoverMove(filterData.length - 1, true);
56955
57000
  }
56956
- onFilter === null || onFilter === void 0 || onFilter(trim ? text.trim() : text, from);
57001
+ // onFilter?.(trim ? text.trim() : text, from);
57002
+ onFilter === null || onFilter === void 0 || onFilter(text.trim(), from);
56957
57003
  };
56958
57004
  var handleOptionClick = function handleOptionClick() {
56959
57005
  if (multiple) return;
@@ -72193,7 +72239,7 @@ var upload_interface = __webpack_require__(8821);
72193
72239
 
72194
72240
 
72195
72241
  /* harmony default export */ var src_0 = ({
72196
- version: '3.8.0-beta.18'
72242
+ version: '3.8.0-beta.19'
72197
72243
  });
72198
72244
  }();
72199
72245
  /******/ return __webpack_exports__;