shineout 3.6.6 → 3.6.7-beta.2

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
@@ -514,5 +514,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
514
514
  // 此文件由脚本自动生成,请勿直接修改。
515
515
  // This file was generated automatically by a script. Please do not modify it directly.
516
516
  var _default = exports.default = {
517
- version: '3.6.6'
517
+ version: '3.6.7-beta.2'
518
518
  };
@@ -2,7 +2,7 @@ import { TagProps as UnStyledTagProps, TagInputProps as UnStyledTagInputProps }
2
2
  /**
3
3
  * @title Tag
4
4
  */
5
- export type TagProps = Omit<UnStyledTagProps, 'jssStyle' | 'inlineStyle'>;
5
+ export type TagProps = Omit<UnStyledTagProps, 'jssStyle' | 'inlineStyle' | 'onMouseDown'>;
6
6
  /**
7
7
  * @title Tag.Input
8
8
  */
package/dist/shineout.js CHANGED
@@ -12217,7 +12217,7 @@ var handleStyle = function handleStyle(style) {
12217
12217
  };
12218
12218
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12219
12219
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12220
- /* harmony default export */ var version = ('3.6.6');
12220
+ /* harmony default export */ var version = ('3.6.7-beta.2');
12221
12221
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12222
12222
 
12223
12223
 
@@ -29783,6 +29783,8 @@ var getPosition = function getPosition(target) {
29783
29783
 
29784
29784
 
29785
29785
  var defaultContext = {
29786
+ addParent: function addParent(_ref) {},
29787
+ removeParent: function removeParent(_ref) {},
29786
29788
  bindChild: function bindChild(_ref) {},
29787
29789
  removeChild: function removeChild(_ref) {}
29788
29790
  };
@@ -29813,21 +29815,32 @@ var usePopup = function usePopup(props) {
29813
29815
  setOpenState = _useState2[1];
29814
29816
  var _useContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(popup_context),
29815
29817
  bindChild = _useContext.bindChild,
29816
- removeChild = _useContext.removeChild;
29818
+ removeChild = _useContext.removeChild,
29819
+ addParent = _useContext.addParent,
29820
+ removeParent = _useContext.removeParent;
29817
29821
  var targetRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
29818
29822
  var popupRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
29819
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
29820
- bindChild(popupRef);
29821
- return function () {
29822
- removeChild(popupRef);
29823
- };
29824
- }, []);
29825
29823
  var _useRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
29826
29824
  triggerTimer: null,
29827
29825
  // 记录所有的子popup 点击子 popup 不关闭弹窗
29828
29826
  chain: [targetRef, popupRef]
29829
29827
  }),
29830
29828
  context = _useRef.current;
29829
+ var handleAddParent = function handleAddParent(elRef) {
29830
+ context.chain.push(elRef);
29831
+
29832
+ // 继续向上添加当前的 popupRef 到父级
29833
+ addParent(elRef);
29834
+ };
29835
+ var handleRemoveParent = function handleRemoveParent(elRef) {
29836
+ var index = context.chain.findIndex(function (item) {
29837
+ return item === elRef;
29838
+ });
29839
+ if (index > -1) {
29840
+ context.chain.splice(index, 1);
29841
+ removeParent(elRef);
29842
+ }
29843
+ };
29831
29844
  var open = openState;
29832
29845
  var changeOpen = function changeOpen(openIn, delay) {
29833
29846
  if (context.triggerTimer) clearTimeout(context.triggerTimer);
@@ -29961,8 +29974,13 @@ var usePopup = function usePopup(props) {
29961
29974
  });
29962
29975
  var providerValue = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
29963
29976
  return {
29977
+ addParent: handleAddParent,
29978
+ removeParent: handleRemoveParent,
29964
29979
  bindChild: function bindChild(elRef) {
29965
- context.chain.push(elRef);
29980
+ if (elRef.current) {
29981
+ addParent(elRef);
29982
+ context.chain.push(elRef);
29983
+ }
29966
29984
  },
29967
29985
  removeChild: function removeChild(elRef) {
29968
29986
  var index = context.chain.findIndex(function (item) {
@@ -29970,10 +29988,19 @@ var usePopup = function usePopup(props) {
29970
29988
  });
29971
29989
  if (index > -1) {
29972
29990
  context.chain.splice(index, 1);
29991
+ removeParent(elRef);
29973
29992
  }
29974
29993
  }
29975
29994
  };
29976
29995
  }, []);
29996
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function () {
29997
+ if (open) {
29998
+ bindChild(popupRef);
29999
+ }
30000
+ return function () {
30001
+ removeChild(popupRef);
30002
+ };
30003
+ }, [open]);
29977
30004
  return {
29978
30005
  open: open,
29979
30006
  position: position,
@@ -40191,7 +40218,7 @@ var TagInput = function TagInput(props) {
40191
40218
 
40192
40219
 
40193
40220
 
40194
- var tag_excluded = ["jssStyle", "className", "type", "color", "size", "disabled", "mode", "shape", "children", "onClick", "onClose", "style", "backgroundColor", "inlineStyle", "onKeyUp", "onCompleted", "onEnterPress", "closable"];
40221
+ var tag_excluded = ["jssStyle", "className", "type", "color", "size", "disabled", "mode", "shape", "children", "onClick", "onClose", "style", "backgroundColor", "inlineStyle", "onKeyUp", "onCompleted", "onEnterPress", "closable", "onMouseDown"];
40195
40222
 
40196
40223
 
40197
40224
 
@@ -40222,6 +40249,7 @@ var Tag = function Tag(props) {
40222
40249
  onCompleted = props.onCompleted,
40223
40250
  onEnterPress = props.onEnterPress,
40224
40251
  closable = props.closable,
40252
+ onMouseDown = props.onMouseDown,
40225
40253
  rest = objectWithoutProperties_default()(props, tag_excluded);
40226
40254
  if (props.type) {
40227
40255
  tag_devUseWarning.deprecated('type', 'color', 'Tag');
@@ -40295,6 +40323,7 @@ var Tag = function Tag(props) {
40295
40323
  return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
40296
40324
  className: tagStyle.closeIcon,
40297
40325
  onClick: handleClose,
40326
+ onMouseDown: onMouseDown,
40298
40327
  children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
40299
40328
  className: tagStyle.closeIconWrapper,
40300
40329
  children: icons_config.tag.Close
@@ -40449,10 +40478,6 @@ var More = function More(props) {
40449
40478
  className: compressedClassName,
40450
40479
  visible: visible,
40451
40480
  onVisibleChange: setVisible,
40452
- getPopupContainer: function getPopupContainer() {
40453
- var _props$morePopoverCon;
40454
- return (_props$morePopoverCon = props.morePopoverContainer) === null || _props$morePopoverCon === void 0 ? void 0 : _props$morePopoverCon.current;
40455
- },
40456
40481
  children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
40457
40482
  className: styles.moreWrapper,
40458
40483
  onClick: function onClick(e) {
@@ -40546,6 +40571,7 @@ var result_Result = function Result(props) {
40546
40571
  var render = useRender();
40547
40572
  var resultRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
40548
40573
  var prevMore = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(more);
40574
+ var removeLock = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(false);
40549
40575
  var showInput = allowOnFilter;
40550
40576
  var mounted = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(false);
40551
40577
  var styles = props.classes;
@@ -40621,6 +40647,12 @@ var result_Result = function Result(props) {
40621
40647
  })
40622
40648
  }, 'input');
40623
40649
  };
40650
+ var handleCloseMouseDown = function handleCloseMouseDown() {
40651
+ removeLock.current = true;
40652
+ setTimeout(function () {
40653
+ removeLock.current = false;
40654
+ }, 0);
40655
+ };
40624
40656
  var renderResultItem = function renderResultItem(item, index, nodes, v) {
40625
40657
  var handleClose = function handleClose() {
40626
40658
  onRemove === null || onRemove === void 0 || onRemove(item, v);
@@ -40661,6 +40693,7 @@ var result_Result = function Result(props) {
40661
40693
  className: classnames_default()(styles.tag, more === 1 && styles.tagOnly, resultClassName),
40662
40694
  closable: closeable && 'only',
40663
40695
  onClose: closeable && handleClose,
40696
+ onMouseDown: closeable ? handleCloseMouseDown : undefined,
40664
40697
  onClick: handleClick,
40665
40698
  jssStyle: jssStyle,
40666
40699
  inlineStyle: true
@@ -40747,8 +40780,7 @@ var result_Result = function Result(props) {
40747
40780
  compressed: compressed,
40748
40781
  renderCompressed: renderCompressed,
40749
40782
  compressedClassName: compressedClassName,
40750
- showNum: moreNumber,
40751
- morePopoverContainer: props.morePopoverContainer
40783
+ showNum: moreNumber
40752
40784
  }, 'more');
40753
40785
  var renderResult = function renderResult() {
40754
40786
  if (empty) {
@@ -40777,6 +40809,7 @@ var result_Result = function Result(props) {
40777
40809
  var handleResetMore = function handleResetMore() {
40778
40810
  if (!compressed) return;
40779
40811
  if (isCompressedBound()) return;
40812
+ if (removeLock.current) return;
40780
40813
  setMore(-1);
40781
40814
  setShouldResetMore(true);
40782
40815
  };
@@ -41302,8 +41335,7 @@ var Cascader = function Cascader(props0) {
41302
41335
  onResultItemClick: handleResultItemClick,
41303
41336
  checkUnMatched: checkUnMatched,
41304
41337
  getDataByValues: getDataByValues,
41305
- setInputText: setInputText,
41306
- morePopoverContainer: targetRef
41338
+ setInputText: setInputText
41307
41339
  })
41308
41340
  });
41309
41341
  return /*#__PURE__*/(0,jsx_runtime.jsx)(PopupProvider, {
@@ -49613,7 +49645,7 @@ var useForm = function useForm(props) {
49613
49645
  if (errors.length > 0) {
49614
49646
  var errorFields = [];
49615
49647
  for (var _key in context.errors) {
49616
- if (context.errors[_key]) {
49648
+ if (context.errors[_key] && context.names.has(_key)) {
49617
49649
  var _context$errors$_key;
49618
49650
  errorFields.push({
49619
49651
  name: _key,
@@ -49929,7 +49961,6 @@ var useForm = function useForm(props) {
49929
49961
  }
49930
49962
  if (validateFieldSet.size === 0 && updateFieldSet.size === 0) {
49931
49963
  context.names.delete(n);
49932
- delete context.errors[n];
49933
49964
  delete context.defaultValues[n];
49934
49965
  }
49935
49966
  var finalReserveAble = (_props$reserveAble = props.reserveAble) !== null && _props$reserveAble !== void 0 ? _props$reserveAble : reserveAble;
@@ -55740,8 +55771,7 @@ function Select(props0) {
55740
55771
  checkUnMatched: checkUnMatched,
55741
55772
  onRemove: handleRemove,
55742
55773
  classes: styles,
55743
- setInputText: setInputText,
55744
- morePopoverContainer: targetRef
55774
+ setInputText: setInputText
55745
55775
  })
55746
55776
  });
55747
55777
  return /*#__PURE__*/(0,jsx_runtime.jsx)(PopupProvider, {
@@ -66244,8 +66274,7 @@ var TreeSelect = function TreeSelect(props0) {
66244
66274
  getDataByValues: getResultByValue,
66245
66275
  onRemove: handleRemove,
66246
66276
  classes: styles,
66247
- setInputText: setInputText,
66248
- morePopoverContainer: targetRef
66277
+ setInputText: setInputText
66249
66278
  })
66250
66279
  });
66251
66280
  return /*#__PURE__*/(0,jsx_runtime.jsx)(PopupProvider, {
@@ -70082,7 +70111,7 @@ var upload_interface = __webpack_require__(8821);
70082
70111
 
70083
70112
 
70084
70113
  /* harmony default export */ var src_0 = ({
70085
- version: '3.6.6'
70114
+ version: '3.6.7-beta.2'
70086
70115
  });
70087
70116
  }();
70088
70117
  /******/ return __webpack_exports__;