@gravity-ui/dashkit 5.1.0 → 5.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [5.2.0](https://github.com/gravity-ui/dashkit/compare/v5.1.0...v5.2.0) (2023-03-27)
4
+
5
+
6
+ ### Features
7
+
8
+ * add custom qa attribute for overlay controls ([#45](https://github.com/gravity-ui/dashkit/issues/45)) ([738ce14](https://github.com/gravity-ui/dashkit/commit/738ce14a7883a88d3096ed4c9bd21bcc16f3fd20))
9
+ * export OverlayControlItem type ([#50](https://github.com/gravity-ui/dashkit/issues/50)) ([a68cc5c](https://github.com/gravity-ui/dashkit/commit/a68cc5cb4e4470278220e18f79f9b82dc6a7cfba))
10
+
3
11
  ## [5.1.0](https://github.com/gravity-ui/dashkit/compare/v5.0.0...v5.1.0) (2023-02-09)
4
12
 
5
13
 
@@ -16,6 +16,7 @@ export interface OverlayControlItem {
16
16
  allWidgetsControls?: boolean;
17
17
  excludeWidgetsTypes?: Array<PluginBase['type']>;
18
18
  id?: string;
19
+ qa?: string;
19
20
  }
20
21
  export interface OverlayCustomControlItem {
21
22
  id: string;
@@ -25,6 +26,7 @@ export interface OverlayCustomControlItem {
25
26
  handler?: (item: ConfigItem, params: StringParams) => void;
26
27
  visible?: (item: ConfigItem) => boolean;
27
28
  className?: string;
29
+ qa?: string;
28
30
  }
29
31
  interface OverlayControlsDefaultProps {
30
32
  position: OverlayControlsPosition;
@@ -26,9 +26,9 @@ class OverlayControls extends react_1.default.Component {
26
26
  super(...arguments);
27
27
  this.renderControlsItem = (item, index, length) => {
28
28
  const { view, size } = this.props;
29
- const { title, handler, icon, iconSize } = item;
29
+ const { title, handler, icon, iconSize, qa } = item;
30
30
  const onItemClickHandler = typeof handler === 'function' ? handler : noop_1.default;
31
- return (react_1.default.createElement(uikit_1.Button, { key: index, view: view, size: size, title: title, pin: this.getControlItemPinStyle(index, length), onClick: () => onItemClickHandler(this.props.configItem) },
31
+ return (react_1.default.createElement(uikit_1.Button, { key: index, view: view, size: size, title: title, pin: this.getControlItemPinStyle(index, length), onClick: () => onItemClickHandler(this.props.configItem), qa: qa },
32
32
  react_1.default.createElement(uikit_1.Icon, { data: icon || CogIcon_1.CogIcon, size: icon ? iconSize : 24 })));
33
33
  };
34
34
  this.getCustomLeftOverlayControls = () => {
@@ -171,10 +171,11 @@ class OverlayControls extends react_1.default.Component {
171
171
  icon: item.icon,
172
172
  action: itemAction,
173
173
  className: item.className,
174
+ qa: item.qa,
174
175
  };
175
176
  });
176
177
  items = items.filter(Boolean);
177
- return (react_1.default.createElement(uikit_1.DropdownMenu, { items: items, switcher: react_1.default.createElement(uikit_1.Button, { view: view, size: size, pin: "brick-round" },
178
+ return (react_1.default.createElement(uikit_1.DropdownMenu, { items: items, switcher: react_1.default.createElement(uikit_1.Button, { view: view, size: size, pin: "brick-round", qa: "dashkit-overlay-control-menu" },
178
179
  react_1.default.createElement(uikit_1.Icon, { data: DotsIcon_1.DotsIcon, size: "16" })) }));
179
180
  }
180
181
  getControlItemPinStyle(index, itemsLength) {
@@ -1 +1,2 @@
1
1
  export * from './DashKit';
2
+ export { OverlayControlItem } from './OverlayControls/OverlayControls';
@@ -17,6 +17,7 @@ export interface OverlayControlItem {
17
17
  allWidgetsControls?: boolean;
18
18
  excludeWidgetsTypes?: Array<PluginBase['type']>;
19
19
  id?: string;
20
+ qa?: string;
20
21
  }
21
22
  export interface OverlayCustomControlItem {
22
23
  id: string;
@@ -26,6 +27,7 @@ export interface OverlayCustomControlItem {
26
27
  handler?: (item: ConfigItem, params: StringParams) => void;
27
28
  visible?: (item: ConfigItem) => boolean;
28
29
  className?: string;
30
+ qa?: string;
29
31
  }
30
32
  interface OverlayControlsDefaultProps {
31
33
  position: OverlayControlsPosition;
@@ -23,9 +23,9 @@ class OverlayControls extends React.Component {
23
23
  super(...arguments);
24
24
  this.renderControlsItem = (item, index, length) => {
25
25
  const { view, size } = this.props;
26
- const { title, handler, icon, iconSize } = item;
26
+ const { title, handler, icon, iconSize, qa } = item;
27
27
  const onItemClickHandler = typeof handler === 'function' ? handler : noop;
28
- return (React.createElement(Button, { key: index, view: view, size: size, title: title, pin: this.getControlItemPinStyle(index, length), onClick: () => onItemClickHandler(this.props.configItem) },
28
+ return (React.createElement(Button, { key: index, view: view, size: size, title: title, pin: this.getControlItemPinStyle(index, length), onClick: () => onItemClickHandler(this.props.configItem), qa: qa },
29
29
  React.createElement(Icon, { data: icon || CogIcon, size: icon ? iconSize : 24 })));
30
30
  };
31
31
  this.getCustomLeftOverlayControls = () => {
@@ -168,10 +168,11 @@ class OverlayControls extends React.Component {
168
168
  icon: item.icon,
169
169
  action: itemAction,
170
170
  className: item.className,
171
+ qa: item.qa,
171
172
  };
172
173
  });
173
174
  items = items.filter(Boolean);
174
- return (React.createElement(DropdownMenu, { items: items, switcher: React.createElement(Button, { view: view, size: size, pin: "brick-round" },
175
+ return (React.createElement(DropdownMenu, { items: items, switcher: React.createElement(Button, { view: view, size: size, pin: "brick-round", qa: "dashkit-overlay-control-menu" },
175
176
  React.createElement(Icon, { data: DotsIcon, size: "16" })) }));
176
177
  }
177
178
  getControlItemPinStyle(index, itemsLength) {
@@ -1 +1,2 @@
1
1
  export * from './DashKit';
2
+ export { OverlayControlItem } from './OverlayControls/OverlayControls';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/dashkit",
3
- "version": "5.1.0",
3
+ "version": "5.2.0",
4
4
  "description": "Library for rendering dashboard grid layout",
5
5
  "license": "MIT",
6
6
  "repository": {