@gravity-ui/dashkit 8.7.0 → 8.7.1

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.
@@ -143,20 +143,20 @@ class OverlayControls extends react_1.default.Component {
143
143
  const controls = hasCustomOverlayLeftControls
144
144
  ? customLeftControls.map((item, index, items) => this.renderControlsItem(item, index, items.length + 1))
145
145
  : defaultControl;
146
- const menu = this.renderMenu();
146
+ const menu = this.renderMenu(controls === null);
147
147
  return (react_1.default.createElement("div", { className: b('default-controls', {
148
148
  'with-custom-left': hasCustomOverlayLeftControls,
149
149
  }) },
150
150
  controls,
151
151
  menu));
152
152
  }
153
- renderMenu() {
153
+ renderMenu(isOnlyOneItem) {
154
154
  const { view, size } = this.props;
155
155
  const dropdown = this.renderDropdownMenu();
156
156
  if (dropdown) {
157
157
  return dropdown;
158
158
  }
159
- return (react_1.default.createElement(uikit_1.Button, { key: 'delete-control', view: view, size: size, title: (0, i18n_1.i18n)('label_delete'), pin: "brick-round", onClick: this.onRemoveItem, qa: "dashkit-overlay-control-menu" },
159
+ return (react_1.default.createElement(uikit_1.Button, { key: 'delete-control', view: view, size: size, title: (0, i18n_1.i18n)('label_delete'), pin: isOnlyOneItem ? 'round-round' : 'brick-round', onClick: this.onRemoveItem, qa: "dashkit-overlay-control-menu" },
160
160
  react_1.default.createElement(uikit_1.Icon, { data: CloseIcon_1.CloseIcon, size: "12" })));
161
161
  }
162
162
  isDefaultMenu(menu) {
@@ -225,8 +225,9 @@ class OverlayControls extends react_1.default.Component {
225
225
  getCustomControlsWithWidgets() {
226
226
  const items = this.getItems();
227
227
  const result = items.map((item, index, controlItems) => this.renderControlsItem(item, index, controlItems.length));
228
+ const isOnlyOneItem = items.length === 0;
228
229
  // Добавляем контрол удаления или меню виджета по умолчанию
229
- result.push(this.renderMenu());
230
+ result.push(this.renderMenu(isOnlyOneItem));
230
231
  return result;
231
232
  }
232
233
  }
@@ -140,20 +140,20 @@ class OverlayControls extends React.Component {
140
140
  const controls = hasCustomOverlayLeftControls
141
141
  ? customLeftControls.map((item, index, items) => this.renderControlsItem(item, index, items.length + 1))
142
142
  : defaultControl;
143
- const menu = this.renderMenu();
143
+ const menu = this.renderMenu(controls === null);
144
144
  return (React.createElement("div", { className: b('default-controls', {
145
145
  'with-custom-left': hasCustomOverlayLeftControls,
146
146
  }) },
147
147
  controls,
148
148
  menu));
149
149
  }
150
- renderMenu() {
150
+ renderMenu(isOnlyOneItem) {
151
151
  const { view, size } = this.props;
152
152
  const dropdown = this.renderDropdownMenu();
153
153
  if (dropdown) {
154
154
  return dropdown;
155
155
  }
156
- return (React.createElement(Button, { key: 'delete-control', view: view, size: size, title: i18n('label_delete'), pin: "brick-round", onClick: this.onRemoveItem, qa: "dashkit-overlay-control-menu" },
156
+ return (React.createElement(Button, { key: 'delete-control', view: view, size: size, title: i18n('label_delete'), pin: isOnlyOneItem ? 'round-round' : 'brick-round', onClick: this.onRemoveItem, qa: "dashkit-overlay-control-menu" },
157
157
  React.createElement(Icon, { data: CloseIcon, size: "12" })));
158
158
  }
159
159
  isDefaultMenu(menu) {
@@ -222,8 +222,9 @@ class OverlayControls extends React.Component {
222
222
  getCustomControlsWithWidgets() {
223
223
  const items = this.getItems();
224
224
  const result = items.map((item, index, controlItems) => this.renderControlsItem(item, index, controlItems.length));
225
+ const isOnlyOneItem = items.length === 0;
225
226
  // Добавляем контрол удаления или меню виджета по умолчанию
226
- result.push(this.renderMenu());
227
+ result.push(this.renderMenu(isOnlyOneItem));
227
228
  return result;
228
229
  }
229
230
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/dashkit",
3
- "version": "8.7.0",
3
+ "version": "8.7.1",
4
4
  "description": "Library for rendering dashboard grid layout",
5
5
  "license": "MIT",
6
6
  "repository": {