shineout 3.7.8-beta.1 → 3.7.8-beta.11

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/README-zh_CN.md CHANGED
@@ -11,7 +11,7 @@
11
11
  <p align="center">
12
12
  <a href="https://www.npmjs.com/package/shineout"><img src="https://img.shields.io/npm/v/shineout.svg?style=flat-square"></a>
13
13
  <a href="https://www.npmjs.com/package/shineout"><img src="https://img.shields.io/npm/dm/shineout.svg?style=flat-square"></a>
14
- <img src="https://img.shields.io/badge/React-%3E%3D16.8.0-green.svg?style=flat-square">
14
+ <img src="https://img.shields.io/badge/React-%3E%3D16.14.0-green.svg?style=flat-square">
15
15
  </p>
16
16
 
17
17
  ## ✨ 特性
package/README.md CHANGED
@@ -11,7 +11,7 @@ English | [简体中文](./README-zh_CN.md)
11
11
  <p align="center">
12
12
  <a href="https://www.npmjs.com/package/shineout"><img src="https://img.shields.io/npm/v/shineout.svg?style=flat-square"></a>
13
13
  <a href="https://www.npmjs.com/package/shineout"><img src="https://img.shields.io/npm/dm/shineout.svg?style=flat-square"></a>
14
- <img src="https://img.shields.io/badge/React-%3E%3D16.8.0-green.svg?style=flat-square">
14
+ <img src="https://img.shields.io/badge/React-%3E%3D16.14.0-green.svg?style=flat-square">
15
15
  </p>
16
16
 
17
17
  ## ✨ Features
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.1'
525
+ version: '3.7.8-beta.11'
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.1');
12237
+ /* harmony default export */ var version = ('3.7.8-beta.11');
12238
12238
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12239
12239
 
12240
12240
 
@@ -30411,20 +30411,20 @@ var usePopup = function usePopup(props) {
30411
30411
  }
30412
30412
  };
30413
30413
  var handleMouseEnter = use_persist_fn(function (e) {
30414
- var _targetEvents$onMouse, _targetRef$current;
30414
+ var _targetEvents$onMouse, _targetRef$current, _popupRef$current2;
30415
30415
  targetEvents === null || targetEvents === void 0 || (_targetEvents$onMouse = targetEvents.onMouseEnter) === null || _targetEvents$onMouse === void 0 || _targetEvents$onMouse.call(targetEvents, e);
30416
30416
  if (trigger !== 'hover') return;
30417
30417
  var isParentContainsCurrent = (_targetRef$current = targetRef.current) === null || _targetRef$current === void 0 ? void 0 : _targetRef$current.contains(e.target);
30418
- if (isParentContainsCurrent) {
30418
+ if (isParentContainsCurrent || popupRef !== null && popupRef !== void 0 && (_popupRef$current2 = popupRef.current) !== null && _popupRef$current2 !== void 0 && _popupRef$current2.contains(e.target)) {
30419
30419
  handleHoverToggle(true);
30420
30420
  }
30421
30421
  });
30422
30422
  var handleMouseLeave = use_persist_fn(function (e) {
30423
- var _targetEvents$onMouse2, _popupRef$current2;
30423
+ var _targetEvents$onMouse2, _popupRef$current3;
30424
30424
  targetEvents === null || targetEvents === void 0 || (_targetEvents$onMouse2 = targetEvents.onMouseLeave) === null || _targetEvents$onMouse2 === void 0 || _targetEvents$onMouse2.call(targetEvents, e);
30425
30425
  if (trigger !== 'hover') return;
30426
30426
  // @ts-ignore
30427
- if (e.relatedTarget instanceof HTMLElement && (_popupRef$current2 = popupRef.current) !== null && _popupRef$current2 !== void 0 && _popupRef$current2.contains(e.relatedTarget)) {
30427
+ if (e.relatedTarget instanceof HTMLElement && (_popupRef$current3 = popupRef.current) !== null && _popupRef$current3 !== void 0 && _popupRef$current3.contains(e.relatedTarget)) {
30428
30428
  return;
30429
30429
  }
30430
30430
  handleHoverToggle(false);
@@ -31081,6 +31081,23 @@ var getCurrentCSSZoom = function getCurrentCSSZoom() {
31081
31081
  // height: rect.height * zoomRatio,
31082
31082
  // }
31083
31083
  // }
31084
+
31085
+ var getScrollPosition = function getScrollPosition(element) {
31086
+ if (!element) return {
31087
+ scrollTop: 0,
31088
+ scrollLeft: 0
31089
+ };
31090
+ if (element === document.documentElement || element === document.body) {
31091
+ return {
31092
+ scrollTop: document.documentElement.scrollTop || document.body.scrollTop,
31093
+ scrollLeft: document.documentElement.scrollLeft || document.body.scrollLeft
31094
+ };
31095
+ }
31096
+ return {
31097
+ scrollTop: element.scrollTop,
31098
+ scrollLeft: element.scrollLeft
31099
+ };
31100
+ };
31084
31101
  ;// CONCATENATED MODULE: ../hooks/src/common/use-position-style/index.ts
31085
31102
 
31086
31103
 
@@ -31324,17 +31341,18 @@ var usePositionStyle = function usePositionStyle(config) {
31324
31341
  };
31325
31342
  };
31326
31343
  var getAbsoluteStyle = function getAbsoluteStyle(position) {
31327
- var _scrollElRef$current, _scrollElRef$current2, _scrollElRef$current3;
31344
+ var _scrollElRef$current;
31328
31345
  if (!parentElRef.current) return {
31329
31346
  style: hideStyle
31330
31347
  };
31331
31348
  var rect = context.parentRect;
31332
31349
  var needCheck = !show || !shallow_equal(context.prevParentPosition, parentElNewPosition);
31333
- var scrollTop = (scrollElRef === null || scrollElRef === void 0 || (_scrollElRef$current = scrollElRef.current) === null || _scrollElRef$current === void 0 ? void 0 : _scrollElRef$current.scrollTop) || 0;
31334
- var scrollLeft = (scrollElRef === null || scrollElRef === void 0 || (_scrollElRef$current2 = scrollElRef.current) === null || _scrollElRef$current2 === void 0 ? void 0 : _scrollElRef$current2.scrollLeft) || 0;
31335
- if (needCheck && scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current && (_scrollElRef$current3 = scrollElRef.current) !== null && _scrollElRef$current3 !== void 0 && _scrollElRef$current3.contains(parentElRef.current)) {
31336
- var _scrollElRef$current4;
31337
- var visibleRect = ((_scrollElRef$current4 = scrollElRef.current) === null || _scrollElRef$current4 === void 0 ? void 0 : _scrollElRef$current4.getBoundingClientRect()) || {};
31350
+ var _getScrollPosition = getScrollPosition(scrollElRef === null || scrollElRef === void 0 ? void 0 : scrollElRef.current),
31351
+ scrollTop = _getScrollPosition.scrollTop,
31352
+ scrollLeft = _getScrollPosition.scrollLeft;
31353
+ if (needCheck && scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current && (_scrollElRef$current = scrollElRef.current) !== null && _scrollElRef$current !== void 0 && _scrollElRef$current.contains(parentElRef.current)) {
31354
+ var _scrollElRef$current2;
31355
+ var visibleRect = ((_scrollElRef$current2 = scrollElRef.current) === null || _scrollElRef$current2 === void 0 ? void 0 : _scrollElRef$current2.getBoundingClientRect()) || {};
31338
31356
  if (rect.bottom < visibleRect.top || rect.top > visibleRect.bottom + scrollTop || rect.right < visibleRect.left || rect.left > visibleRect.right + scrollLeft) {
31339
31357
  return {
31340
31358
  style: hideStyle
@@ -31408,7 +31426,9 @@ var usePositionStyle = function usePositionStyle(config) {
31408
31426
  }
31409
31427
 
31410
31428
  // 当父元素的滚动容器滚动时,判断是否需要更新弹出层位置,包括是否隐藏弹出层(通过hideStyle隐藏,不是show状态)
31411
- context.prevParentPosition = parentElNewPosition;
31429
+ if (show) {
31430
+ context.prevParentPosition = parentElNewPosition;
31431
+ }
31412
31432
  });
31413
31433
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(updateStyle, [show, position, absolute, updateKey, fixedWidth, parentElNewPosition, popupElSize]);
31414
31434
  return {
@@ -39572,9 +39592,9 @@ var useTree = function useTree(props) {
39572
39592
  var _context$value;
39573
39593
  if (mode !== MODE.MODE_0) return;
39574
39594
  (_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;
39577
- if (children.length) {
39595
+ var node = context.pathMap.get(id);
39596
+ var children = node === null || node === void 0 ? void 0 : node.children;
39597
+ if (children && children.length) {
39578
39598
  var noCheckedChildren = children.filter(function (cid) {
39579
39599
  var _context$value2;
39580
39600
  return !((_context$value2 = context.value) !== null && _context$value2 !== void 0 && _context$value2.includes(cid));
@@ -40058,7 +40078,8 @@ var VirtualList = function VirtualList(props) {
40058
40078
  preIndex: null,
40059
40079
  topTimer: null,
40060
40080
  rateTimer: null,
40061
- shouldUpdateHeight: true
40081
+ shouldUpdateHeight: true,
40082
+ prevWrapperRefHeight: 0
40062
40083
  }),
40063
40084
  context = _useRef.current;
40064
40085
  var getContentHeight = function getContentHeight(index) {
@@ -40218,11 +40239,14 @@ var VirtualList = function VirtualList(props) {
40218
40239
  context.preIndex = startIndex;
40219
40240
  }, [startIndex]);
40220
40241
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function () {
40221
- if (keepScrollHeight) return;
40242
+ var _wrapperRef$current2;
40243
+ var currentWrapperRefHeight = ((_wrapperRef$current2 = wrapperRef.current) === null || _wrapperRef$current2 === void 0 ? void 0 : _wrapperRef$current2.clientHeight) || 0;
40244
+ if (keepScrollHeight && currentWrapperRefHeight === context.prevWrapperRefHeight) return;
40222
40245
  if (keepScrollTop) return;
40223
40246
  // 数据变化的时候清空掉 preIndex, 如果之前有缓存的index, setRowHeight 会有问题
40224
40247
  setTop(0);
40225
40248
  setStartIndex(0);
40249
+ context.prevWrapperRefHeight = currentWrapperRefHeight;
40226
40250
  return function () {
40227
40251
  context.preIndex = null;
40228
40252
  };
@@ -41392,25 +41416,44 @@ function getResetMore(onFilter, container, doms) {
41392
41416
  var hideMargin = parsePxToNumber(hideElStyle.marginLeft) + parsePxToNumber(hideElStyle.marginRight);
41393
41417
  var num = 0;
41394
41418
  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
- }
41419
+ var itemWidthArr = items.map(function (item) {
41420
+ var itemStyle = getComputedStyle(item);
41421
+ var itemLen = item.offsetWidth + parsePxToNumber(itemStyle.marginLeft) + parsePxToNumber(itemStyle.marginRight);
41422
+ sumWidth += itemLen;
41423
+ return itemLen;
41424
+ });
41425
+ if (sumWidth <= contentWidth) {
41411
41426
  num = -1;
41427
+ } else {
41428
+ var len = 0;
41429
+ for (var i = 0; i < itemWidthArr.length; i++) {
41430
+ var itemLen = itemWidthArr[i];
41431
+ // number length
41432
+ var resetNum = items.length - 1 - i;
41433
+ var moreWidth = void 0;
41434
+ if (resetNum <= 0) {
41435
+ moreWidth = 0;
41436
+ } else {
41437
+ var reset = "+".concat(resetNum);
41438
+ hideEl.childNodes[0].innerText = reset;
41439
+ // (+num) width
41440
+ moreWidth = hideEl.offsetWidth + hideMargin;
41441
+ }
41442
+ len += itemLen;
41443
+ if (len > contentWidth - moreWidth) {
41444
+ break;
41445
+ }
41446
+ num += 1;
41447
+ if (i === items.length - 1) {
41448
+ // not show more
41449
+ num = -1;
41450
+ }
41451
+ }
41452
+ }
41453
+ // at least show one
41454
+ if (num === 0 && itemWidthArr[0]) {
41455
+ num = 1;
41412
41456
  }
41413
- ;
41414
41457
  return num;
41415
41458
  }
41416
41459
  var More = function More(props) {
@@ -42522,8 +42565,8 @@ var Cascader = function Cascader(props0) {
42522
42565
  }
42523
42566
  }, [data]);
42524
42567
 
42525
- // 修复外部受控打开的场景下,从外部修改value导致的面板勾选情况没有及时同步
42526
- if (openProp && !shallowEqual(value, datum.getValue())) {
42568
+ // 修复外部受控打开或renderOptionList做全选的场景下,从外部修改value导致的面板勾选情况没有及时同步
42569
+ if ((openProp || props.renderOptionList) && !shallowEqual(value, datum.getValue())) {
42527
42570
  datum.setValue(value);
42528
42571
  }
42529
42572
  ;
@@ -42532,9 +42575,6 @@ var Cascader = function Cascader(props0) {
42532
42575
  datum.setValue(value);
42533
42576
  if (!open) return;
42534
42577
  updatePathByValue();
42535
- if (props.renderOptionList) {
42536
- updatePath();
42537
- }
42538
42578
  }, [value, open]);
42539
42579
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
42540
42580
  if (filterText !== undefined) {
@@ -45939,7 +45979,9 @@ var useTime = function useTime(props) {
45939
45979
  _props$secondStep = props.secondStep,
45940
45980
  secondStep = _props$secondStep === void 0 ? 1 : _props$secondStep,
45941
45981
  staticMin = props.staticMin,
45942
- staticMax = props.staticMax;
45982
+ staticMax = props.staticMax,
45983
+ position = props.position,
45984
+ rangeDate = props.rangeDate;
45943
45985
  var min = util.resetTimeByFormat(mi, format, options);
45944
45986
  var max = util.resetTimeByFormat(ma, format, options);
45945
45987
  var current = props.value || util.newDate(undefined, options);
@@ -45965,7 +46007,7 @@ var useTime = function useTime(props) {
45965
46007
  disabledTime = props.disabledTime;
45966
46008
  if (disabledTime) {
45967
46009
  var _time = util.format(date, util.TIME_FORMAT, options);
45968
- if (typeof disabledTime === 'function') return disabledTime(_time);
46010
+ if (typeof disabledTime === 'function') return disabledTime(_time, position, rangeDate === null || rangeDate === void 0 ? void 0 : rangeDate[0], rangeDate === null || rangeDate === void 0 ? void 0 : rangeDate[1]);
45969
46011
  return disabledTime === _time;
45970
46012
  }
45971
46013
  var isDis = disabled && typeof disabled === 'function' ? disabled(date) : false;
@@ -46316,7 +46358,9 @@ var Time = function Time(props) {
46316
46358
  disabledTime: props.disabledTime,
46317
46359
  hourStep: props.hourStep,
46318
46360
  minuteStep: props.minuteStep,
46319
- secondStep: props.secondStep
46361
+ secondStep: props.secondStep,
46362
+ position: props.position,
46363
+ rangeDate: props.rangeDate
46320
46364
  }),
46321
46365
  func = _useTimePick.func,
46322
46366
  times = _useTimePick.times;
@@ -50831,7 +50875,7 @@ var useForm = function useForm(props) {
50831
50875
  var _props$onChange;
50832
50876
  var newValue = typeof change === 'function' ? utils_immer_produce(context.value, change) : change;
50833
50877
  context.value = newValue;
50834
- (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, deepClone(context.value));
50878
+ (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, newValue);
50835
50879
  });
50836
50880
  var scrollToField = use_persist_fn(function (name) {
50837
50881
  var _document;
@@ -55369,7 +55413,8 @@ var VirtualNode = function VirtualNode(props) {
55369
55413
  className: rootClass,
55370
55414
  dir: config.direction,
55371
55415
  style: {
55372
- paddingLeft: level * indent
55416
+ paddingLeft: level * indent,
55417
+ height: props.lineHeight
55373
55418
  },
55374
55419
  children: [$indents, /*#__PURE__*/(0,jsx_runtime.jsx)(tree_content, {
55375
55420
  virtual: true,
@@ -55653,7 +55698,8 @@ var TreeVirtual = function TreeVirtual(props) {
55653
55698
  onNodeClick: onNodeClick,
55654
55699
  onToggle: onToggle,
55655
55700
  onChange: onChange,
55656
- size: datum.size
55701
+ size: datum.size,
55702
+ lineHeight: lineHeight
55657
55703
  }, id);
55658
55704
  };
55659
55705
  return /*#__PURE__*/(0,jsx_runtime.jsx)(virtual_scroll_list, {
@@ -56737,7 +56783,8 @@ function Select(props0) {
56737
56783
  if (hideCreate) {
56738
56784
  // optionListRef.current?.hoverMove(filterData.length - 1, true);
56739
56785
  }
56740
- onFilter === null || onFilter === void 0 || onFilter(trim ? text.trim() : text, from);
56786
+ // onFilter?.(trim ? text.trim() : text, from);
56787
+ onFilter === null || onFilter === void 0 || onFilter(text.trim(), from);
56741
56788
  };
56742
56789
  var handleOptionClick = function handleOptionClick() {
56743
56790
  if (multiple) return;
@@ -71834,7 +71881,7 @@ var upload_interface = __webpack_require__(8821);
71834
71881
 
71835
71882
 
71836
71883
  /* harmony default export */ var src_0 = ({
71837
- version: '3.7.8-beta.1'
71884
+ version: '3.7.8-beta.11'
71838
71885
  });
71839
71886
  }();
71840
71887
  /******/ return __webpack_exports__;