@gravity-ui/dashkit 8.3.0-beta.1 → 8.4.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.
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { Config, ConfigItem, GlobalParams, ItemDropProps, ItemsStateAndParams } from '../../shared';
3
- import { ContextProps, DashKiGroup, Plugin, SetConfigItem, SetNewItemOptions, Settings, SettingsProps } from '../../typings';
3
+ import { ContextProps, DashKitGroup, Plugin, SetConfigItem, SetNewItemOptions, Settings, SettingsProps } from '../../typings';
4
4
  import GridLayout from '../GridLayout/GridLayout';
5
5
  import { OverlayControlItem } from '../OverlayControls/OverlayControls';
6
6
  interface DashKitGeneralProps {
@@ -14,7 +14,7 @@ interface DashKitDefaultProps {
14
14
  onChange: (data: {
15
15
  config: Config;
16
16
  itemsStateAndParams: ItemsStateAndParams;
17
- groups?: DashKiGroup[];
17
+ groups?: DashKitGroup[];
18
18
  }) => void;
19
19
  onDrop: (dropProps: ItemDropProps) => void;
20
20
  defaultGlobalParams: GlobalParams;
@@ -24,7 +24,7 @@ interface DashKitDefaultProps {
24
24
  context: ContextProps;
25
25
  noOverlay: boolean;
26
26
  focusable?: boolean;
27
- groups?: DashKiGroup[];
27
+ groups?: DashKitGroup[];
28
28
  }
29
29
  export interface DashKitProps extends DashKitGeneralProps, Partial<DashKitDefaultProps> {
30
30
  }
@@ -24,9 +24,9 @@ class DragOverLayout extends react_grid_layout_1.default {
24
24
  this.dragReset();
25
25
  }
26
26
  };
27
- const oldonDrag = this.onDrag;
27
+ this.parentOnDrag = this.onDrag;
28
28
  this.onDrag = (i, x, y, sintE) => {
29
- oldonDrag(i, x, y, sintE);
29
+ this.parentOnDrag(i, x, y, sintE);
30
30
  this.mouseLeaveHandler(sintE.e);
31
31
  };
32
32
  }
@@ -38,6 +38,12 @@ class DragOverLayout extends react_grid_layout_1.default {
38
38
  componentWillUnmount() {
39
39
  window.removeEventListener('dragend', this.dragReset);
40
40
  }
41
+ containerHeight() {
42
+ if (this.props.autoSize && this.state.layout.length === 0) {
43
+ return 'unset';
44
+ }
45
+ return super.containerHeight();
46
+ }
41
47
  processGridItem(child, isDroppingItem) {
42
48
  var _a;
43
49
  const gridItem = (_a = super.processGridItem) === null || _a === void 0 ? void 0 : _a.call(this, child, isDroppingItem);
@@ -18,7 +18,7 @@ export interface DashkitGroupRenderProps {
18
18
  items: ConfigItem[];
19
19
  layout: ConfigLayout[];
20
20
  }
21
- export interface DashKiGroup {
21
+ export interface DashKitGroup {
22
22
  id?: string;
23
23
  render?: (id: string, children: React.ReactNode, props: DashkitGroupRenderProps) => React.ReactNode;
24
24
  }
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { Config, ConfigItem, GlobalParams, ItemDropProps, ItemsStateAndParams } from '../../shared';
3
- import { ContextProps, DashKiGroup, Plugin, SetConfigItem, SetNewItemOptions, Settings, SettingsProps } from '../../typings';
3
+ import { ContextProps, DashKitGroup, Plugin, SetConfigItem, SetNewItemOptions, Settings, SettingsProps } from '../../typings';
4
4
  import GridLayout from '../GridLayout/GridLayout';
5
5
  import { OverlayControlItem } from '../OverlayControls/OverlayControls';
6
6
  interface DashKitGeneralProps {
@@ -14,7 +14,7 @@ interface DashKitDefaultProps {
14
14
  onChange: (data: {
15
15
  config: Config;
16
16
  itemsStateAndParams: ItemsStateAndParams;
17
- groups?: DashKiGroup[];
17
+ groups?: DashKitGroup[];
18
18
  }) => void;
19
19
  onDrop: (dropProps: ItemDropProps) => void;
20
20
  defaultGlobalParams: GlobalParams;
@@ -24,7 +24,7 @@ interface DashKitDefaultProps {
24
24
  context: ContextProps;
25
25
  noOverlay: boolean;
26
26
  focusable?: boolean;
27
- groups?: DashKiGroup[];
27
+ groups?: DashKitGroup[];
28
28
  }
29
29
  export interface DashKitProps extends DashKitGeneralProps, Partial<DashKitDefaultProps> {
30
30
  }
@@ -20,9 +20,9 @@ class DragOverLayout extends ReactGridLayout {
20
20
  this.dragReset();
21
21
  }
22
22
  };
23
- const oldonDrag = this.onDrag;
23
+ this.parentOnDrag = this.onDrag;
24
24
  this.onDrag = (i, x, y, sintE) => {
25
- oldonDrag(i, x, y, sintE);
25
+ this.parentOnDrag(i, x, y, sintE);
26
26
  this.mouseLeaveHandler(sintE.e);
27
27
  };
28
28
  }
@@ -34,6 +34,12 @@ class DragOverLayout extends ReactGridLayout {
34
34
  componentWillUnmount() {
35
35
  window.removeEventListener('dragend', this.dragReset);
36
36
  }
37
+ containerHeight() {
38
+ if (this.props.autoSize && this.state.layout.length === 0) {
39
+ return 'unset';
40
+ }
41
+ return super.containerHeight();
42
+ }
37
43
  processGridItem(child, isDroppingItem) {
38
44
  var _a;
39
45
  const gridItem = (_a = super.processGridItem) === null || _a === void 0 ? void 0 : _a.call(this, child, isDroppingItem);
@@ -18,7 +18,7 @@ export interface DashkitGroupRenderProps {
18
18
  items: ConfigItem[];
19
19
  layout: ConfigLayout[];
20
20
  }
21
- export interface DashKiGroup {
21
+ export interface DashKitGroup {
22
22
  id?: string;
23
23
  render?: (id: string, children: React.ReactNode, props: DashkitGroupRenderProps) => React.ReactNode;
24
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/dashkit",
3
- "version": "8.3.0-beta.1",
3
+ "version": "8.4.0",
4
4
  "description": "Library for rendering dashboard grid layout",
5
5
  "license": "MIT",
6
6
  "repository": {