@gravity-ui/dashkit 8.14.0 → 8.14.1-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 { renderItem } = _a, item = tslib_1.__rest(_a, ["renderItem"]);
24
+ const key = `dk-action-panel-${item.id}`;
25
+ const children = react_1.default.createElement(exports.ActionPanelItemContainer, { key: key, item: item });
26
+ return renderItem ? renderItem(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
+ renderItem?: (props: Omit<ActionPanelItem, 'renderItem'> & {
12
+ key: React.Key;
13
+ children: React.ReactNode;
14
+ }) => JSX.Element;
11
15
  };
12
16
  export type ActionPanelProps = {
13
17
  items: ActionPanelItem[];
@@ -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 { renderItem } = _a, item = __rest(_a, ["renderItem"]);
21
+ const key = `dk-action-panel-${item.id}`;
22
+ const children = React.createElement(ActionPanelItemContainer, { key: key, item: item });
23
+ return renderItem ? renderItem(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
+ renderItem?: (props: Omit<ActionPanelItem, 'renderItem'> & {
12
+ key: React.Key;
13
+ children: React.ReactNode;
14
+ }) => JSX.Element;
11
15
  };
12
16
  export type ActionPanelProps = {
13
17
  items: ActionPanelItem[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/dashkit",
3
- "version": "8.14.0",
3
+ "version": "8.14.1-beta.0",
4
4
  "description": "Library for rendering dashboard grid layout",
5
5
  "license": "MIT",
6
6
  "repository": {