@gravity-ui/dashkit 8.14.1 → 8.15.0-beta.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.
@@ -19,7 +19,12 @@ const ActionPanel = (props) => {
19
19
  const isDisabled = (_a = props.disable) !== null && _a !== void 0 ? _a : false;
20
20
  const isAnimated = (_b = props.toggleAnimation) !== null && _b !== void 0 ? _b : false;
21
21
  const nodeRef = react_1.default.useRef(null);
22
- const content = (react_1.default.createElement("div", { ref: nodeRef, className: b(null, props.className) }, props.items.map((item) => (react_1.default.createElement(exports.ActionPanelItemContainer, { key: `dk-action-panel-${item.id}`, item: item })))));
22
+ const content = (react_1.default.createElement("div", { ref: nodeRef, className: b(null, props.className) }, props.items.map((_a) => {
23
+ var { wrapTo } = _a, item = tslib_1.__rest(_a, ["wrapTo"]);
24
+ const key = `dk-action-panel-${item.id}`;
25
+ const children = react_1.default.createElement(exports.ActionPanelItemContainer, { key: key, item: item });
26
+ return wrapTo ? wrapTo(Object.assign(Object.assign({}, item), { key, children })) : children;
27
+ })));
23
28
  if (isAnimated) {
24
29
  return (react_1.default.createElement(react_transition_group_1.CSSTransition, { in: !isDisabled, nodeRef: nodeRef, classNames: b(null), timeout: 300, unmountOnExit: true }, content));
25
30
  }
@@ -8,6 +8,10 @@ export type ActionPanelItem = {
8
8
  qa?: string;
9
9
  onClick?: () => void;
10
10
  dragProps?: ItemDragProps;
11
+ wrapTo?: (props: Omit<ActionPanelItem, 'wrapTo'> & {
12
+ key: React.Key;
13
+ children: React.ReactNode;
14
+ }) => React.ReactNode;
11
15
  };
12
16
  export type ActionPanelProps = {
13
17
  items: ActionPanelItem[];
@@ -320,6 +320,7 @@ class GridLayout extends react_1.default.PureComponent {
320
320
  }
321
321
  _onResizeStop(group, layout, oldItem, newItem, placeholder, e, element) {
322
322
  var _a;
323
+ this._onStop(group, layout);
323
324
  (_a = this.context.onResizeStop) === null || _a === void 0 ? void 0 : _a.call(this, this.prepareDefaultArguments(group, layout, oldItem, newItem, placeholder, e, element));
324
325
  }
325
326
  _onTargetRestore() {
@@ -1,3 +1,4 @@
1
+ import { __rest } from "tslib";
1
2
  import React from 'react';
2
3
  import { CSSTransition } from 'react-transition-group';
3
4
  import { useDnDItemProps } from '../../hooks/useDnDItemProps';
@@ -15,7 +16,12 @@ export const ActionPanel = (props) => {
15
16
  const isDisabled = (_a = props.disable) !== null && _a !== void 0 ? _a : false;
16
17
  const isAnimated = (_b = props.toggleAnimation) !== null && _b !== void 0 ? _b : false;
17
18
  const nodeRef = React.useRef(null);
18
- const content = (React.createElement("div", { ref: nodeRef, className: b(null, props.className) }, props.items.map((item) => (React.createElement(ActionPanelItemContainer, { key: `dk-action-panel-${item.id}`, item: item })))));
19
+ const content = (React.createElement("div", { ref: nodeRef, className: b(null, props.className) }, props.items.map((_a) => {
20
+ var { wrapTo } = _a, item = __rest(_a, ["wrapTo"]);
21
+ const key = `dk-action-panel-${item.id}`;
22
+ const children = React.createElement(ActionPanelItemContainer, { key: key, item: item });
23
+ return wrapTo ? wrapTo(Object.assign(Object.assign({}, item), { key, children })) : children;
24
+ })));
19
25
  if (isAnimated) {
20
26
  return (React.createElement(CSSTransition, { in: !isDisabled, nodeRef: nodeRef, classNames: b(null), timeout: 300, unmountOnExit: true }, content));
21
27
  }
@@ -8,6 +8,10 @@ export type ActionPanelItem = {
8
8
  qa?: string;
9
9
  onClick?: () => void;
10
10
  dragProps?: ItemDragProps;
11
+ wrapTo?: (props: Omit<ActionPanelItem, 'wrapTo'> & {
12
+ key: React.Key;
13
+ children: React.ReactNode;
14
+ }) => React.ReactNode;
11
15
  };
12
16
  export type ActionPanelProps = {
13
17
  items: ActionPanelItem[];
@@ -317,6 +317,7 @@ class GridLayout extends React.PureComponent {
317
317
  }
318
318
  _onResizeStop(group, layout, oldItem, newItem, placeholder, e, element) {
319
319
  var _a;
320
+ this._onStop(group, layout);
320
321
  (_a = this.context.onResizeStop) === null || _a === void 0 ? void 0 : _a.call(this, this.prepareDefaultArguments(group, layout, oldItem, newItem, placeholder, e, element));
321
322
  }
322
323
  _onTargetRestore() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/dashkit",
3
- "version": "8.14.1",
3
+ "version": "8.15.0-beta.0",
4
4
  "description": "Library for rendering dashboard grid layout",
5
5
  "license": "MIT",
6
6
  "repository": {