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

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.
@@ -420,9 +420,11 @@ class TagInput extends BaseComponent {
420
420
  }));
421
421
 
422
422
  if (active && draggable && sortableListItems.length > 0) {
423
+ // helperClass:add styles to the helper(item being dragged) https://github.com/clauderic/react-sortable-hoc/issues/87
423
424
  // @ts-ignore skip SortableItem type check
424
425
  return /*#__PURE__*/React.createElement(SortableList, {
425
426
  useDragHandle: true,
427
+ helperClass: "".concat(prefixCls, "-drag-item-move"),
426
428
  items: sortableListItems,
427
429
  onSortEnd: this.onSortEnd,
428
430
  axis: "xy"
@@ -185,5 +185,6 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
185
185
  renderPortal: () => JSX.Element;
186
186
  wrapSpan: (elem: React.ReactNode | React.ReactElement) => JSX.Element;
187
187
  mergeEvents: (rawEvents: Record<string, any>, events: Record<string, any>) => {};
188
+ getPopupId: () => string;
188
189
  render(): JSX.Element;
189
190
  }
@@ -1,3 +1,4 @@
1
+ import _isEqual from "lodash/isEqual";
1
2
  import _isFunction from "lodash/isFunction";
2
3
  import _isEmpty from "lodash/isEmpty";
3
4
  import _each from "lodash/each";
@@ -273,6 +274,10 @@ export default class Tooltip extends BaseComponent {
273
274
  return mergedEvents;
274
275
  };
275
276
 
277
+ this.getPopupId = () => {
278
+ return this.state.id;
279
+ };
280
+
276
281
  this.state = {
277
282
  visible: false,
278
283
 
@@ -585,7 +590,7 @@ export default class Tooltip extends BaseComponent {
585
590
  this.props.visible ? this.foundation.delayShow() : this.foundation.delayHide();
586
591
  }
587
592
 
588
- if (prevProps.rePosKey !== this.props.rePosKey) {
593
+ if (!_isEqual(prevProps.rePosKey, this.props.rePosKey)) {
589
594
  this.rePosition();
590
595
  }
591
596
  }
@@ -19,7 +19,30 @@ import Spin from '../spin';
19
19
  import Button from '../button';
20
20
  import Tree from '../tree';
21
21
  import { IconClose, IconSearch, IconHandle } from '@douyinfe/semi-icons';
22
- const prefixcls = cssClasses.PREFIX;
22
+ const prefixcls = cssClasses.PREFIX; // SortableItem & SortableList should not be assigned inside of the render function
23
+
24
+ const SortableItem = SortableElement(props => props.item.node);
25
+ const SortableList = SortableContainer(_ref => {
26
+ let {
27
+ items
28
+ } = _ref;
29
+ return /*#__PURE__*/React.createElement("div", {
30
+ className: "".concat(prefixcls, "-right-list"),
31
+ role: "list",
32
+ "aria-label": "Selected list"
33
+ }, items.map((item, index) =>
34
+ /*#__PURE__*/
35
+ // @ts-ignore skip SortableItem type check
36
+ React.createElement(SortableItem, {
37
+ key: item.label,
38
+ index: index,
39
+ item: item
40
+ }))) // eslint-disable-next-line @typescript-eslint/ban-ts-comment
41
+ // @ts-ignore see reasons: https://github.com/clauderic/react-sortable-hoc/issues/206
42
+ ;
43
+ }, {
44
+ distance: 10
45
+ });
23
46
 
24
47
  class Transfer extends BaseComponent {
25
48
  constructor(props) {
@@ -462,34 +485,16 @@ class Transfer extends BaseComponent {
462
485
  }
463
486
 
464
487
  renderRightSortableList(selectedData) {
465
- // when choose some items && draggable is true
466
- const SortableItem = SortableElement(props => this.renderRightItem(props.item));
467
- const SortableList = SortableContainer(_ref => {
468
- let {
469
- items
470
- } = _ref;
471
- return /*#__PURE__*/React.createElement("div", {
472
- className: "".concat(prefixcls, "-right-list"),
473
- role: "list",
474
- "aria-label": "Selected list"
475
- }, items.map((item, index) =>
476
- /*#__PURE__*/
477
- // @ts-ignore skip SortableItem type check
478
- React.createElement(SortableItem, {
479
- key: item.label,
480
- index: index,
481
- item: item
482
- }))) // eslint-disable-next-line @typescript-eslint/ban-ts-comment
483
- // @ts-ignore see reasons: https://github.com/clauderic/react-sortable-hoc/issues/206
484
- ;
485
- }, {
486
- distance: 10
487
- }); // @ts-ignore skip SortableItem type check
488
+ const sortableListItems = selectedData.map(item => Object.assign(Object.assign({}, item), {
489
+ node: this.renderRightItem(item)
490
+ })); // helperClass:add styles to the helper(item being dragged) https://github.com/clauderic/react-sortable-hoc/issues/87
491
+ // @ts-ignore skip SortableItem type check
488
492
 
489
493
  const sortList = /*#__PURE__*/React.createElement(SortableList, {
490
494
  useDragHandle: true,
495
+ helperClass: "".concat(prefixcls, "-right-item-drag-item-move"),
491
496
  onSortEnd: this.onSortEnd,
492
- items: selectedData
497
+ items: sortableListItems
493
498
  });
494
499
  return sortList;
495
500
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.23.0-beta.1",
3
+ "version": "2.23.1",
4
4
  "description": "",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -18,11 +18,11 @@
18
18
  ],
19
19
  "dependencies": {
20
20
  "@douyinfe/semi-animation": "2.12.0",
21
- "@douyinfe/semi-animation-react": "2.23.0-beta.1",
22
- "@douyinfe/semi-foundation": "2.23.0-beta.1",
23
- "@douyinfe/semi-icons": "2.23.0-beta.1",
21
+ "@douyinfe/semi-animation-react": "2.23.1",
22
+ "@douyinfe/semi-foundation": "2.23.1",
23
+ "@douyinfe/semi-icons": "2.23.1",
24
24
  "@douyinfe/semi-illustrations": "2.15.0",
25
- "@douyinfe/semi-theme-default": "2.23.0-beta.1",
25
+ "@douyinfe/semi-theme-default": "2.23.1",
26
26
  "async-validator": "^3.5.0",
27
27
  "classnames": "^2.2.6",
28
28
  "copy-text-to-clipboard": "^2.1.1",
@@ -69,13 +69,13 @@
69
69
  ],
70
70
  "author": "",
71
71
  "license": "MIT",
72
- "gitHead": "afe3b23c86641a627ade78ceb414d05223fc7354",
72
+ "gitHead": "3960e35ea5c7244e5adbc9cb938330e9a6ee43e2",
73
73
  "devDependencies": {
74
74
  "@babel/plugin-proposal-decorators": "^7.15.8",
75
75
  "@babel/plugin-transform-runtime": "^7.15.8",
76
76
  "@babel/preset-env": "^7.15.8",
77
77
  "@babel/preset-react": "^7.14.5",
78
- "@douyinfe/semi-scss-compile": "2.23.0-beta.1",
78
+ "@douyinfe/semi-scss-compile": "2.23.1",
79
79
  "@storybook/addon-knobs": "^6.3.1",
80
80
  "@types/lodash": "^4.14.176",
81
81
  "@types/react": ">=16.0.0",