+ {groups.map((group) => {
+ const groupId = group.id || DEFAULT_GROUP;
+ const items = sortedItems[groupId] || [];
+
+ const children = items.map((item, index) => {
+ const isItemWithActiveAutoheight =
+ item.id in this.state.itemsWithActiveAutoheight;
+
+ return (
+
+
+
+ );
+ });
+
+ indexOffset += items.length;
+
+ if (group.render) {
+ return group.render(groupId, children, {
+ isMobile: true,
+ config,
+ context,
+ editMode,
+ items,
+ layout,
+ });
+ }
+
+ return children;
+ })}
+
+ );
+ }
+
+ getSortedLayoutItems() {
+ if (this.sortedLayoutItems && this.context.layout === this._memoLayout) {
+ return this.sortedLayoutItems;
+ }
+
+ this._memoLayout = this.context.layout;
+
+ const hasOrderId = Boolean(this.context.config.items.find((item) => item.orderId));
+
+ this.sortedLayoutItems = groupBy(
+ getSortedConfigItems(this.context.config, hasOrderId),
+ (item) => item.parent || DEFAULT_GROUP,
+ );
+
+ return this.sortedLayoutItems;
+ }
+
+ getMemoForwardRefCallback(refIndex: number) {
+ if (!this._memoForwardedPluginRef[refIndex]) {
+ this._memoForwardedPluginRef[refIndex] = (pluginRef: PlugibRefObject) => {
+ this.pluginsRefs[refIndex] = pluginRef;
+ };
+ }
+
+ return this._memoForwardedPluginRef[refIndex];
+ }
+
+ adjustWidgetLayout(id: string, {needSetDefault}: {needSetDefault: boolean}) {
+ if (needSetDefault) {
+ const indexesOfItemsWithActiveAutoheight = {
+ ...this.state.itemsWithActiveAutoheight,
+ };
+
+ delete indexesOfItemsWithActiveAutoheight[id];
+
+ this.setState({itemsWithActiveAutoheight: indexesOfItemsWithActiveAutoheight});
+ } else {
+ this.setState({
+ itemsWithActiveAutoheight: Object.assign({}, this.state.itemsWithActiveAutoheight, {
+ [id]: true,
+ }),
+ });
+ }
+ }
+
+ getMemoAdjustWidgetLayout(id: string) {
+ if (!this._memoAdjustWidgetLayout[id]) {
+ this._memoAdjustWidgetLayout[id] = this.adjustWidgetLayout.bind(this, id);
+ }
+
+ return this._memoAdjustWidgetLayout[id];
+ }
+}
diff --git a/src/components/OverlayControls/OverlayControls.tsx b/src/components/OverlayControls/OverlayControls.tsx
index 86c26b6..a82955a 100644
--- a/src/components/OverlayControls/OverlayControls.tsx
+++ b/src/components/OverlayControls/OverlayControls.tsx
@@ -20,15 +20,13 @@ import {
OVERLAY_CONTROLS_CLASS_NAME,
OVERLAY_ICON_SIZE,
} from '../../constants';
-import {DashkitOvelayControlsContext} from '../../context/DashKitContext';
+import {DashkitOvelayControlsContext, OverlayControlsCtxShape} from '../../context';
import {i18n} from '../../i18n';
import {
type ConfigItem,
- type ConfigLayout,
+ type ItemParams,
type ItemState,
- type ItemsStateAndParamsBase,
type PluginBase,
- type StringParams,
isItemWithTabs,
resolveItemInnerId,
} from '../../shared';
@@ -63,7 +61,7 @@ export interface OverlayCustomControlItem {
title?: string;
icon?: MenuItemProps['icon'];
iconSize?: number | string;
- handler?: (item: ConfigItem, params: StringParams, state: ItemState) => void;
+ handler?: (item: ConfigItem, params: ItemParams, state: ItemState) => void;
visible?: (item: ConfigItem) => boolean;
className?: string;
qa?: string;
@@ -94,19 +92,6 @@ export type PreparedCopyItemOptions