@douyinfe/semi-ui 2.23.0-beta.1 → 2.23.0

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.
@@ -17967,6 +17967,10 @@ var isUndefined_default = /*#__PURE__*/__webpack_require__.n(isUndefined);
17967
17967
  var external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_ = __webpack_require__("faye");
17968
17968
  var external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_default = /*#__PURE__*/__webpack_require__.n(external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_);
17969
17969
 
17970
+ // EXTERNAL MODULE: /home/runner/work/semi-design/semi-design/node_modules/lodash/isEqual.js
17971
+ var isEqual = __webpack_require__("nnRT");
17972
+ var isEqual_default = /*#__PURE__*/__webpack_require__.n(isEqual);
17973
+
17970
17974
  // EXTERNAL MODULE: /home/runner/work/semi-design/semi-design/node_modules/lodash/isFunction.js
17971
17975
  var isFunction = __webpack_require__("2q8g");
17972
17976
  var isFunction_default = /*#__PURE__*/__webpack_require__.n(isFunction);
@@ -18219,6 +18223,14 @@ class foundation_Tooltip extends foundation {
18219
18223
  const content = this.getProp('content');
18220
18224
  const trigger = this.getProp('trigger');
18221
18225
  const clickTriggerToHide = this.getProp('clickTriggerToHide');
18226
+ const {
18227
+ visible
18228
+ } = this.getStates();
18229
+
18230
+ if (visible) {
18231
+ return;
18232
+ }
18233
+
18222
18234
  this.clearDelayTimer();
18223
18235
  /**
18224
18236
  * If you emit an event in setState callback, you need to place the event listener function before setState to execute.
@@ -18235,7 +18247,7 @@ class foundation_Tooltip extends foundation {
18235
18247
  });
18236
18248
 
18237
18249
  this._adapter.insertPortal(content, {
18238
- left: -9990,
18250
+ left: -9999,
18239
18251
  top: -9999
18240
18252
  }); // offscreen rendering
18241
18253
 
@@ -19764,10 +19776,6 @@ const TriangleArrowVertical = props => {
19764
19776
  width: prop_types_default.a.number,
19765
19777
  height: prop_types_default.a.number
19766
19778
  }));
19767
- // EXTERNAL MODULE: /home/runner/work/semi-design/semi-design/node_modules/lodash/isEqual.js
19768
- var isEqual = __webpack_require__("nnRT");
19769
- var isEqual_default = /*#__PURE__*/__webpack_require__.n(isEqual);
19770
-
19771
19779
  // CONCATENATED MODULE: ./_cssAnimation/index.tsx
19772
19780
 
19773
19781
 
@@ -19906,6 +19914,7 @@ _cssAnimation_CSSAnimation.defaultProps = {
19906
19914
 
19907
19915
 
19908
19916
 
19917
+
19909
19918
  var tooltip_rest = undefined && undefined.__rest || function (s, e) {
19910
19919
  var t = {};
19911
19920
 
@@ -20173,6 +20182,10 @@ class tooltip_Tooltip extends baseComponent_BaseComponent {
20173
20182
  return mergedEvents;
20174
20183
  };
20175
20184
 
20185
+ this.getPopupId = () => {
20186
+ return this.state.id;
20187
+ };
20188
+
20176
20189
  this.state = {
20177
20190
  visible: false,
20178
20191
 
@@ -20485,7 +20498,7 @@ class tooltip_Tooltip extends baseComponent_BaseComponent {
20485
20498
  this.props.visible ? this.foundation.delayShow() : this.foundation.delayHide();
20486
20499
  }
20487
20500
 
20488
- if (prevProps.rePosKey !== this.props.rePosKey) {
20501
+ if (!isEqual_default()(prevProps.rePosKey, this.props.rePosKey)) {
20489
20502
  this.rePosition();
20490
20503
  }
20491
20504
  }
@@ -56836,7 +56849,6 @@ class yearAndMonth_YearAndMonth extends baseComponent_BaseComponent {
56836
56849
  disabledDate,
56837
56850
  yearAndMonthOpts
56838
56851
  } = this.props;
56839
- console.log('yearAndMonthOpts', yearAndMonthOpts);
56840
56852
 
56841
56853
  let transform = val => val;
56842
56854
 
@@ -60412,26 +60424,39 @@ class foundation_DropdownFoundation extends foundation {
60412
60424
  this._adapter.setPopVisible(visible);
60413
60425
 
60414
60426
  this._adapter.notifyVisibleChange(visible);
60427
+
60428
+ const {
60429
+ trigger
60430
+ } = this.getProps();
60431
+
60432
+ if (visible && trigger === "click") {
60433
+ const popupId = this._adapter.getPopupId();
60434
+
60435
+ this.setFocusToFirstMenuItem(popupId);
60436
+ }
60415
60437
  }
60416
60438
 
60417
- getMenuItemNodes(target) {
60418
- const id = target.attributes['data-popupid'].value;
60439
+ getMenuItemNodes(id) {
60419
60440
  const menuWrapper = document.getElementById(id); // if has dropdown item, the item must wrapped by li
60420
60441
 
60421
60442
  return menuWrapper ? Array.from(menuWrapper.getElementsByTagName('li')).filter(item => item.ariaDisabled === "false") : null;
60422
60443
  }
60423
60444
 
60424
- setFocusToFirstMenuItem(target) {
60425
- const menuItemNodes = this.getMenuItemNodes(target);
60445
+ setFocusToFirstMenuItem(id) {
60446
+ const menuItemNodes = this.getMenuItemNodes(id);
60426
60447
  menuItemNodes && setFocusToFirstItem(menuItemNodes);
60427
60448
  }
60428
60449
 
60429
- setFocusToLastMenuItem(target) {
60430
- const menuItemNodes = this.getMenuItemNodes(target);
60450
+ setFocusToLastMenuItem(id) {
60451
+ const menuItemNodes = this.getMenuItemNodes(id);
60431
60452
  menuItemNodes && setFocusToLastItem(menuItemNodes);
60432
60453
  }
60433
60454
 
60434
60455
  handleKeyDown(event) {
60456
+ var _a, _b;
60457
+
60458
+ const id = (_b = (_a = event.target) === null || _a === void 0 ? void 0 : _a.attributes['data-popupid']) === null || _b === void 0 ? void 0 : _b.value;
60459
+
60435
60460
  switch (event.key) {
60436
60461
  case ' ':
60437
60462
  case 'Enter':
@@ -60441,12 +60466,12 @@ class foundation_DropdownFoundation extends foundation {
60441
60466
  break;
60442
60467
 
60443
60468
  case 'ArrowDown':
60444
- this.setFocusToFirstMenuItem(event.target);
60469
+ this.setFocusToFirstMenuItem(id);
60445
60470
  handlePrevent(event);
60446
60471
  break;
60447
60472
 
60448
60473
  case 'ArrowUp':
60449
- this.setFocusToLastMenuItem(event.target);
60474
+ this.setFocusToLastMenuItem(id);
60450
60475
  handlePrevent(event);
60451
60476
  break;
60452
60477
 
@@ -60464,17 +60489,6 @@ class menuFoundation_DropdownMenuFoundation extends foundation {
60464
60489
  super(...arguments);
60465
60490
  this.menuItemNodes = null;
60466
60491
  this.firstChars = [];
60467
- } // if trigger is click, auto focus to the first menu item
60468
-
60469
-
60470
- autoFocus(ulElement) {
60471
- const trigger = this._adapter.getContext('trigger');
60472
-
60473
- if (trigger === 'click') {
60474
- // find all non-disabled li under this menu and set focus to the first menu
60475
- this.menuItemNodes = [...ulElement.getElementsByTagName('li')].filter(item => item.ariaDisabled !== "true");
60476
- setFocusToFirstItem(this.menuItemNodes);
60477
- }
60478
60492
  }
60479
60493
 
60480
60494
  handleEscape(menu) {
@@ -60576,7 +60590,6 @@ const dropdownMenu_prefixCls = dropdown_constants_cssClasses.PREFIX;
60576
60590
  class dropdownMenu_DropdownMenu extends baseComponent_BaseComponent {
60577
60591
  constructor(props) {
60578
60592
  super(props);
60579
- this.menuRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createRef();
60580
60593
  this.foundation = new menuFoundation_DropdownMenuFoundation(this.adapter);
60581
60594
  }
60582
60595
 
@@ -60584,10 +60597,6 @@ class dropdownMenu_DropdownMenu extends baseComponent_BaseComponent {
60584
60597
  return Object.assign({}, super.adapter);
60585
60598
  }
60586
60599
 
60587
- componentDidMount() {
60588
- this.foundation.autoFocus(this.menuRef.current);
60589
- }
60590
-
60591
60600
  render() {
60592
60601
  const _a = this.props,
60593
60602
  {
@@ -60599,8 +60608,7 @@ class dropdownMenu_DropdownMenu extends baseComponent_BaseComponent {
60599
60608
 
60600
60609
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("ul", Object.assign({
60601
60610
  role: "menu",
60602
- "aria-orientation": "vertical",
60603
- ref: this.menuRef
60611
+ "aria-orientation": "vertical"
60604
60612
  }, rest, {
60605
60613
  className: classnames_default()("".concat(dropdownMenu_prefixCls, "-menu"), className),
60606
60614
  style: style,
@@ -60833,6 +60841,7 @@ class dropdown_Dropdown extends baseComponent_BaseComponent {
60833
60841
  popVisible: props.visible
60834
60842
  };
60835
60843
  this.foundation = new foundation_DropdownFoundation(this.adapter);
60844
+ this.tooltipRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createRef();
60836
60845
  }
60837
60846
 
60838
60847
  get adapter() {
@@ -60840,7 +60849,8 @@ class dropdown_Dropdown extends baseComponent_BaseComponent {
60840
60849
  setPopVisible: popVisible => this.setState({
60841
60850
  popVisible
60842
60851
  }),
60843
- notifyVisibleChange: visible => this.props.onVisibleChange(visible)
60852
+ notifyVisibleChange: visible => this.props.onVisibleChange(visible),
60853
+ getPopupId: () => this.tooltipRef.current.getPopupId()
60844
60854
  });
60845
60855
  }
60846
60856
 
@@ -60997,7 +61007,8 @@ class dropdown_Dropdown extends baseComponent_BaseComponent {
60997
61007
  trigger: trigger,
60998
61008
  onVisibleChange: this.handleVisibleChange,
60999
61009
  showArrow: false,
61000
- returnFocusOnClose: true
61010
+ returnFocusOnClose: true,
61011
+ ref: this.tooltipRef
61001
61012
  }, attr), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.isValidElement(children) ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.cloneElement(children, {
61002
61013
  //@ts-ignore
61003
61014
  className: classnames_default()(get_default()(children, 'props.className'), {
@@ -72120,7 +72131,7 @@ class select_Select extends baseComponent_BaseComponent {
72120
72131
  } // Add isOptionChanged: There may be cases where the value is unchanged, but the optionList is updated. At this time, the label corresponding to the value may change, and the selected item needs to be updated
72121
72132
 
72122
72133
 
72123
- if (prevProps.value !== this.props.value || isOptionsChanged) {
72134
+ if (!isEqual_default()(this.props.value, prevProps.value) || isOptionsChanged) {
72124
72135
  if ('value' in this.props) {
72125
72136
  this.foundation.handleValueChange(this.props.value);
72126
72137
  } else {