@gravity-ui/dashkit 6.2.1 → 6.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.
@@ -5,6 +5,7 @@ export type ActionPanelItem = {
5
5
  title: string;
6
6
  onClick?: () => void;
7
7
  className?: string;
8
+ qa?: string;
8
9
  };
9
10
  export type ActionPanelProps = {
10
11
  items: ActionPanelItem[];
@@ -7,7 +7,7 @@ const cn_1 = require("../../utils/cn");
7
7
  const b = (0, cn_1.cn)('dashkit-action-panel');
8
8
  const ActionPanel = (props) => {
9
9
  return (react_1.default.createElement("div", { className: b(null, props.className) }, props.items.map((item) => {
10
- return (react_1.default.createElement("div", { role: "button", className: b('item', item.className), key: `dk-action-panel-${item.id}`, onClick: item.onClick },
10
+ return (react_1.default.createElement("div", { role: "button", className: b('item', item.className), key: `dk-action-panel-${item.id}`, onClick: item.onClick, "data-qa": item.qa },
11
11
  react_1.default.createElement("div", { className: b('icon') }, item.icon),
12
12
  react_1.default.createElement("div", { className: b('title'), title: item.title }, item.title)));
13
13
  })));
@@ -6,6 +6,8 @@ import { OverlayControlItem } from '../OverlayControls/OverlayControls';
6
6
  interface DashKitGeneralProps {
7
7
  config: Config;
8
8
  editMode: boolean;
9
+ draggableHandleClassName?: string;
10
+ overlayControls?: Record<string, OverlayControlItem[]>;
9
11
  }
10
12
  interface DashKitDefaultProps {
11
13
  onItemEdit: (item: ConfigItem) => void;
@@ -18,9 +20,8 @@ interface DashKitDefaultProps {
18
20
  itemsStateAndParams: ItemsStateAndParams;
19
21
  settings: SettingsProps;
20
22
  context: ContextProps;
21
- overlayControls?: Record<string, OverlayControlItem[]>;
22
- noOverlay?: boolean;
23
- draggableHandleClassName?: string;
23
+ noOverlay: boolean;
24
+ _experimentDisableItemAnimation: boolean;
24
25
  }
25
26
  export interface DashKitProps extends DashKitGeneralProps, Partial<DashKitDefaultProps> {
26
27
  }
@@ -68,4 +68,5 @@ DashKit.defaultProps = {
68
68
  },
69
69
  context: {},
70
70
  noOverlay: false,
71
+ _experimentDisableItemAnimation: false,
71
72
  };
@@ -34,6 +34,9 @@
34
34
  transition: all 200ms ease;
35
35
  transition-property: left, top;
36
36
  }
37
+ .react-grid-item.dashkit-grid-item_disable-animation {
38
+ transition: none;
39
+ }
37
40
 
38
41
  .react-grid-item.cssTransforms {
39
42
  transition-property: transform;
@@ -25,7 +25,7 @@ class GridItem extends react_1.default.PureComponent {
25
25
  // из-за бага, что Grid Items unmounts при изменении static, isDraggable, isResaizable
26
26
  // https://github.com/STRML/react-grid-layout/issues/721
27
27
  const { style, onMouseDown, onMouseUp, onTouchEnd, onTouchStart, children, className, isDragging, noOverlay, withCustomHandle, } = this.props;
28
- const { editMode } = this.context;
28
+ const { editMode, _experimentDisableItemAnimation } = this.context;
29
29
  const width = Number.parseInt(style.width, 10);
30
30
  const height = Number.parseInt(style.height, 10);
31
31
  const transform = style.transform;
@@ -40,6 +40,7 @@ class GridItem extends react_1.default.PureComponent {
40
40
  return (react_1.default.createElement("div", Object.assign({ className: b({
41
41
  'is-dragging': isDragging,
42
42
  'with-custom-handle': withCustomHandle,
43
+ 'disable-animation': _experimentDisableItemAnimation,
43
44
  }, preparedClassName), "data-qa": "dashkit-grid-item", style: style, ref: this.props.forwardedRef }, reactGridLayoutProps),
44
45
  react_1.default.createElement("div", { className: b('item', { editMode: editMode && !_editActive && !noOverlay }) },
45
46
  react_1.default.createElement(Item_1.default, { id: this.props.id, item: this.props.item, shouldItemUpdate: !isDragging, width: width, height: height, transform: transform, adjustWidgetLayout: this.props.adjustWidgetLayout, layout: this.props.layout, forwardedPluginRef: this.props.forwardedPluginRef })),
@@ -145,6 +145,7 @@ function useMemoStateContext(props) {
145
145
  revertToOriginalLayout,
146
146
  forwardedMetaRef: props.forwardedMetaRef,
147
147
  draggableHandleClassName: props.draggableHandleClassName,
148
+ _experimentDisableItemAnimation: props._experimentDisableItemAnimation,
148
149
  }), [
149
150
  resultLayout,
150
151
  props.config,
@@ -166,6 +167,7 @@ function useMemoStateContext(props) {
166
167
  revertToOriginalLayout,
167
168
  props.forwardedMetaRef,
168
169
  props.draggableHandleClassName,
170
+ props._experimentDisableItemAnimation,
169
171
  ]);
170
172
  }
171
173
  function withContext(Component) {
@@ -6,6 +6,7 @@ export type ActionPanelItem = {
6
6
  title: string;
7
7
  onClick?: () => void;
8
8
  className?: string;
9
+ qa?: string;
9
10
  };
10
11
  export type ActionPanelProps = {
11
12
  items: ActionPanelItem[];
@@ -4,7 +4,7 @@ import './ActionPanel.css';
4
4
  const b = cn('dashkit-action-panel');
5
5
  export const ActionPanel = (props) => {
6
6
  return (React.createElement("div", { className: b(null, props.className) }, props.items.map((item) => {
7
- return (React.createElement("div", { role: "button", className: b('item', item.className), key: `dk-action-panel-${item.id}`, onClick: item.onClick },
7
+ return (React.createElement("div", { role: "button", className: b('item', item.className), key: `dk-action-panel-${item.id}`, onClick: item.onClick, "data-qa": item.qa },
8
8
  React.createElement("div", { className: b('icon') }, item.icon),
9
9
  React.createElement("div", { className: b('title'), title: item.title }, item.title)));
10
10
  })));
@@ -6,6 +6,8 @@ import { OverlayControlItem } from '../OverlayControls/OverlayControls';
6
6
  interface DashKitGeneralProps {
7
7
  config: Config;
8
8
  editMode: boolean;
9
+ draggableHandleClassName?: string;
10
+ overlayControls?: Record<string, OverlayControlItem[]>;
9
11
  }
10
12
  interface DashKitDefaultProps {
11
13
  onItemEdit: (item: ConfigItem) => void;
@@ -18,9 +20,8 @@ interface DashKitDefaultProps {
18
20
  itemsStateAndParams: ItemsStateAndParams;
19
21
  settings: SettingsProps;
20
22
  context: ContextProps;
21
- overlayControls?: Record<string, OverlayControlItem[]>;
22
- noOverlay?: boolean;
23
- draggableHandleClassName?: string;
23
+ noOverlay: boolean;
24
+ _experimentDisableItemAnimation: boolean;
24
25
  }
25
26
  export interface DashKitProps extends DashKitGeneralProps, Partial<DashKitDefaultProps> {
26
27
  }
@@ -63,4 +63,5 @@ DashKit.defaultProps = {
63
63
  },
64
64
  context: {},
65
65
  noOverlay: false,
66
+ _experimentDisableItemAnimation: false,
66
67
  };
@@ -34,6 +34,9 @@
34
34
  transition: all 200ms ease;
35
35
  transition-property: left, top;
36
36
  }
37
+ .react-grid-item.dashkit-grid-item_disable-animation {
38
+ transition: none;
39
+ }
37
40
 
38
41
  .react-grid-item.cssTransforms {
39
42
  transition-property: transform;
@@ -23,7 +23,7 @@ class GridItem extends React.PureComponent {
23
23
  // из-за бага, что Grid Items unmounts при изменении static, isDraggable, isResaizable
24
24
  // https://github.com/STRML/react-grid-layout/issues/721
25
25
  const { style, onMouseDown, onMouseUp, onTouchEnd, onTouchStart, children, className, isDragging, noOverlay, withCustomHandle, } = this.props;
26
- const { editMode } = this.context;
26
+ const { editMode, _experimentDisableItemAnimation } = this.context;
27
27
  const width = Number.parseInt(style.width, 10);
28
28
  const height = Number.parseInt(style.height, 10);
29
29
  const transform = style.transform;
@@ -38,6 +38,7 @@ class GridItem extends React.PureComponent {
38
38
  return (React.createElement("div", Object.assign({ className: b({
39
39
  'is-dragging': isDragging,
40
40
  'with-custom-handle': withCustomHandle,
41
+ 'disable-animation': _experimentDisableItemAnimation,
41
42
  }, preparedClassName), "data-qa": "dashkit-grid-item", style: style, ref: this.props.forwardedRef }, reactGridLayoutProps),
42
43
  React.createElement("div", { className: b('item', { editMode: editMode && !_editActive && !noOverlay }) },
43
44
  React.createElement(Item, { id: this.props.id, item: this.props.item, shouldItemUpdate: !isDragging, width: width, height: height, transform: transform, adjustWidgetLayout: this.props.adjustWidgetLayout, layout: this.props.layout, forwardedPluginRef: this.props.forwardedPluginRef })),
@@ -141,6 +141,7 @@ function useMemoStateContext(props) {
141
141
  revertToOriginalLayout,
142
142
  forwardedMetaRef: props.forwardedMetaRef,
143
143
  draggableHandleClassName: props.draggableHandleClassName,
144
+ _experimentDisableItemAnimation: props._experimentDisableItemAnimation,
144
145
  }), [
145
146
  resultLayout,
146
147
  props.config,
@@ -162,6 +163,7 @@ function useMemoStateContext(props) {
162
163
  revertToOriginalLayout,
163
164
  props.forwardedMetaRef,
164
165
  props.draggableHandleClassName,
166
+ props._experimentDisableItemAnimation,
165
167
  ]);
166
168
  }
167
169
  export function withContext(Component) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/dashkit",
3
- "version": "6.2.1",
3
+ "version": "6.4.0",
4
4
  "description": "Library for rendering dashboard grid layout",
5
5
  "license": "MIT",
6
6
  "repository": {