@gravity-ui/dashkit 5.6.0 → 5.6.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [5.6.1](https://github.com/gravity-ui/dashkit/compare/v5.6.0...v5.6.1) (2023-06-15)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **react-grid-layout:** fixed react-grid-layout issue ([#59](https://github.com/gravity-ui/dashkit/issues/59)) ([bdb3f87](https://github.com/gravity-ui/dashkit/commit/bdb3f87731cf82b8267c913bb0010c65f7014018))
9
+
3
10
  ## [5.6.0](https://github.com/gravity-ui/dashkit/compare/v5.5.0...v5.6.0) (2023-04-18)
4
11
 
5
12
 
@@ -10,7 +10,7 @@ const OverlayControls_1 = tslib_1.__importDefault(require("../OverlayControls/Ov
10
10
  const b = (0, bem_cn_lite_1.default)('dashkit-grid-item');
11
11
  class GridItem extends react_1.default.PureComponent {
12
12
  renderOverlay() {
13
- const { overlayControls } = this.props;
13
+ const { overlayControls, isDragging } = this.props;
14
14
  const { editMode } = this.context;
15
15
  if (!editMode || this.props.item.data._editActive) {
16
16
  return null;
@@ -19,7 +19,7 @@ class GridItem extends react_1.default.PureComponent {
19
19
  const controls = overlayControls && overlayControls[item.type];
20
20
  return (react_1.default.createElement(react_1.default.Fragment, null,
21
21
  react_1.default.createElement("div", { className: b('overlay') }),
22
- react_1.default.createElement(OverlayControls_1.default, { configItem: item, items: controls, overlayControls: overlayControls })));
22
+ react_1.default.createElement(OverlayControls_1.default, { configItem: item, items: controls, isDragging: isDragging, overlayControls: overlayControls })));
23
23
  }
24
24
  render() {
25
25
  // из-за бага, что Grid Items unmounts при изменении static, isDraggable, isResaizable
@@ -34,6 +34,7 @@ interface OverlayControlsDefaultProps {
34
34
  size: ButtonSize;
35
35
  }
36
36
  interface OverlayControlsProps extends OverlayControlsDefaultProps {
37
+ isDragging?: boolean;
37
38
  configItem: ConfigItem;
38
39
  items?: OverlayControlItem[];
39
40
  overlayControls?: Record<string, OverlayControlItem[]>;
@@ -76,6 +76,11 @@ class OverlayControls extends react_1.default.Component {
76
76
  this.context.editItem(this.props.configItem);
77
77
  };
78
78
  this.onRemoveItem = () => {
79
+ // Otherwise it will crush an app dute to the issue in react-grid-layout
80
+ // https://github.com/react-grid-layout/react-grid-layout/issues/1836
81
+ if (this.props.isDragging) {
82
+ return;
83
+ }
79
84
  const { id } = this.props.configItem;
80
85
  this.context.removeItem(id);
81
86
  };
@@ -8,7 +8,7 @@ import OverlayControls from '../OverlayControls/OverlayControls';
8
8
  const b = block('dashkit-grid-item');
9
9
  class GridItem extends React.PureComponent {
10
10
  renderOverlay() {
11
- const { overlayControls } = this.props;
11
+ const { overlayControls, isDragging } = this.props;
12
12
  const { editMode } = this.context;
13
13
  if (!editMode || this.props.item.data._editActive) {
14
14
  return null;
@@ -17,7 +17,7 @@ class GridItem extends React.PureComponent {
17
17
  const controls = overlayControls && overlayControls[item.type];
18
18
  return (React.createElement(React.Fragment, null,
19
19
  React.createElement("div", { className: b('overlay') }),
20
- React.createElement(OverlayControls, { configItem: item, items: controls, overlayControls: overlayControls })));
20
+ React.createElement(OverlayControls, { configItem: item, items: controls, isDragging: isDragging, overlayControls: overlayControls })));
21
21
  }
22
22
  render() {
23
23
  // из-за бага, что Grid Items unmounts при изменении static, isDraggable, isResaizable
@@ -35,6 +35,7 @@ interface OverlayControlsDefaultProps {
35
35
  size: ButtonSize;
36
36
  }
37
37
  interface OverlayControlsProps extends OverlayControlsDefaultProps {
38
+ isDragging?: boolean;
38
39
  configItem: ConfigItem;
39
40
  items?: OverlayControlItem[];
40
41
  overlayControls?: Record<string, OverlayControlItem[]>;
@@ -73,6 +73,11 @@ class OverlayControls extends React.Component {
73
73
  this.context.editItem(this.props.configItem);
74
74
  };
75
75
  this.onRemoveItem = () => {
76
+ // Otherwise it will crush an app dute to the issue in react-grid-layout
77
+ // https://github.com/react-grid-layout/react-grid-layout/issues/1836
78
+ if (this.props.isDragging) {
79
+ return;
80
+ }
76
81
  const { id } = this.props.configItem;
77
82
  this.context.removeItem(id);
78
83
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/dashkit",
3
- "version": "5.6.0",
3
+ "version": "5.6.1",
4
4
  "description": "Library for rendering dashboard grid layout",
5
5
  "license": "MIT",
6
6
  "repository": {