@gravity-ui/dashkit 6.1.0-beta.2 → 6.1.0-beta.4
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/build/cjs/components/ActionPanel/ActionPanel.d.ts +1 -0
- package/build/cjs/components/ActionPanel/ActionPanel.js +1 -1
- package/build/cjs/components/DashKit/DashKit.d.ts +0 -2
- package/build/cjs/components/DashKitView/DashKitView.d.ts +6 -2
- package/build/cjs/components/DashKitView/DashKitView.js +2 -6
- package/build/cjs/components/index.d.ts +1 -1
- package/build/cjs/hocs/withContext.js +1 -1
- package/build/cjs/typings/common.d.ts +0 -2
- package/build/esm/components/ActionPanel/ActionPanel.d.ts +1 -0
- package/build/esm/components/ActionPanel/ActionPanel.js +1 -1
- package/build/esm/components/DashKit/DashKit.d.ts +0 -2
- package/build/esm/components/DashKitView/DashKitView.d.ts +7 -2
- package/build/esm/components/DashKitView/DashKitView.js +2 -6
- package/build/esm/components/index.d.ts +1 -1
- package/build/esm/hocs/withContext.js +1 -1
- package/build/esm/typings/common.d.ts +0 -2
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ const react_1 = tslib_1.__importDefault(require("react"));
|
|
|
6
6
|
const cn_1 = require("../../utils/cn");
|
|
7
7
|
const b = (0, cn_1.cn)('dashkit-action-panel');
|
|
8
8
|
const ActionPanel = (props) => {
|
|
9
|
-
return (react_1.default.createElement("div", { className: b() }, props.items.map((item) => {
|
|
9
|
+
return (react_1.default.createElement("div", { className: b(null, props.className) }, props.items.map((item) => {
|
|
10
10
|
return (react_1.default.createElement("div", { role: "button", className: b('item', item.className), key: `dk-action-panel-${item.id}`, onClick: item.onClick },
|
|
11
11
|
react_1.default.createElement("div", { className: b('icon') }, item.icon),
|
|
12
12
|
react_1.default.createElement("div", { className: b('title'), title: item.title }, item.title)));
|
|
@@ -3,7 +3,6 @@ import GridLayout from '../GridLayout/GridLayout';
|
|
|
3
3
|
import { SetConfigItem, Settings, SettingsProps, ContextProps, Plugin, SetItemOptions } from '../../typings';
|
|
4
4
|
import { GlobalParams, Config, ConfigItem, ItemsStateAndParams } from '../../shared';
|
|
5
5
|
import { OverlayControlItem } from '../OverlayControls/OverlayControls';
|
|
6
|
-
import { ActionPanelItem } from '../ActionPanel/ActionPanel';
|
|
7
6
|
interface DashKitGeneralProps {
|
|
8
7
|
config: Config;
|
|
9
8
|
editMode: boolean;
|
|
@@ -22,7 +21,6 @@ interface DashKitDefaultProps {
|
|
|
22
21
|
overlayControls?: Record<string, OverlayControlItem[]>;
|
|
23
22
|
noOverlay?: boolean;
|
|
24
23
|
draggableHandleClassName?: string;
|
|
25
|
-
actionPanel?: ActionPanelItem[];
|
|
26
24
|
}
|
|
27
25
|
export interface DashKitProps extends DashKitGeneralProps, Partial<DashKitDefaultProps> {
|
|
28
26
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { RegisterManager } from '../../utils';
|
|
3
|
+
import type { DashKitProps } from '../DashKit';
|
|
4
|
+
declare const DashKitViewForwardedMeta: React.ForwardRefExoticComponent<DashKitProps & {
|
|
5
|
+
registerManager: RegisterManager;
|
|
6
|
+
} & React.RefAttributes<unknown>>;
|
|
1
7
|
export default DashKitViewForwardedMeta;
|
|
2
|
-
declare const DashKitViewForwardedMeta: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
|
3
|
-
import React from "react";
|
|
@@ -8,15 +8,11 @@ const MobileLayout_1 = tslib_1.__importDefault(require("../MobileLayout/MobileLa
|
|
|
8
8
|
const withContext_1 = require("../../hocs/withContext");
|
|
9
9
|
const useCalcLayout_1 = require("../../hooks/useCalcLayout");
|
|
10
10
|
const cn_1 = require("../../utils/cn");
|
|
11
|
-
const ActionPanel_1 = require("../ActionPanel/ActionPanel");
|
|
12
11
|
const b = (0, cn_1.cn)('dashkit');
|
|
13
12
|
function DashKitView(props) {
|
|
14
|
-
var _a;
|
|
15
13
|
const context = react_1.default.useContext(DashKitContext_1.DashKitContext);
|
|
16
|
-
const { registerManager, forwardedMetaRef
|
|
17
|
-
return (react_1.default.createElement("div", { className: b({ theme: registerManager.settings.theme }) },
|
|
18
|
-
registerManager.settings.isMobile ? (react_1.default.createElement(MobileLayout_1.default, null)) : (react_1.default.createElement(GridLayout_1.default, { ref: forwardedMetaRef, overlayControls: props.overlayControls })),
|
|
19
|
-
Boolean(((_a = props.actionPanel) === null || _a === void 0 ? void 0 : _a.length) && editMode) && (react_1.default.createElement(ActionPanel_1.ActionPanel, { items: props.actionPanel }))));
|
|
14
|
+
const { registerManager, forwardedMetaRef } = context;
|
|
15
|
+
return (react_1.default.createElement("div", { className: b({ theme: registerManager.settings.theme }) }, registerManager.settings.isMobile ? (react_1.default.createElement(MobileLayout_1.default, null)) : (react_1.default.createElement(GridLayout_1.default, { ref: forwardedMetaRef, overlayControls: props.overlayControls }))));
|
|
20
16
|
}
|
|
21
17
|
const DashKitViewWithContext = (0, withContext_1.withContext)(DashKitView);
|
|
22
18
|
const DashKitViewForwardedMeta = react_1.default.forwardRef((props, ref) => {
|
|
@@ -172,7 +172,7 @@ function withContext(Component) {
|
|
|
172
172
|
const WithContext = (props) => {
|
|
173
173
|
const contextValue = useMemoStateContext(props);
|
|
174
174
|
return (react_1.default.createElement(DashKitContext_1.DashKitContext.Provider, { value: contextValue },
|
|
175
|
-
react_1.default.createElement(Component, { overlayControls: props.overlayControls
|
|
175
|
+
react_1.default.createElement(Component, { overlayControls: props.overlayControls })));
|
|
176
176
|
};
|
|
177
177
|
WithContext.displayName = `withContext(${Component.displayName || Component.name || 'Component'}`;
|
|
178
178
|
return WithContext;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { OverlayCustomControlItem } from '../components/OverlayControls/OverlayControls';
|
|
2
2
|
import { MenuItems } from '../constants';
|
|
3
3
|
import type { ReactGridLayoutProps } from 'react-grid-layout';
|
|
4
|
-
import { ActionPanelItem } from '../components/ActionPanel/ActionPanel';
|
|
5
4
|
export interface Settings {
|
|
6
5
|
gridLayout?: ReactGridLayoutProps;
|
|
7
6
|
theme?: string;
|
|
8
7
|
isMobile?: boolean;
|
|
9
8
|
menu?: Array<MenuItem>;
|
|
10
|
-
actionPanel?: ActionPanelItem[];
|
|
11
9
|
}
|
|
12
10
|
export type MenuItem = (typeof MenuItems)[keyof typeof MenuItems] | OverlayCustomControlItem;
|
|
13
11
|
export interface SettingsProps {
|
|
@@ -3,7 +3,7 @@ import { cn } from '../../utils/cn';
|
|
|
3
3
|
import './ActionPanel.css';
|
|
4
4
|
const b = cn('dashkit-action-panel');
|
|
5
5
|
export const ActionPanel = (props) => {
|
|
6
|
-
return (React.createElement("div", { className: b() }, props.items.map((item) => {
|
|
6
|
+
return (React.createElement("div", { className: b(null, props.className) }, props.items.map((item) => {
|
|
7
7
|
return (React.createElement("div", { role: "button", className: b('item', item.className), key: `dk-action-panel-${item.id}`, onClick: item.onClick },
|
|
8
8
|
React.createElement("div", { className: b('icon') }, item.icon),
|
|
9
9
|
React.createElement("div", { className: b('title'), title: item.title }, item.title)));
|
|
@@ -3,7 +3,6 @@ import GridLayout from '../GridLayout/GridLayout';
|
|
|
3
3
|
import { SetConfigItem, Settings, SettingsProps, ContextProps, Plugin, SetItemOptions } from '../../typings';
|
|
4
4
|
import { GlobalParams, Config, ConfigItem, ItemsStateAndParams } from '../../shared';
|
|
5
5
|
import { OverlayControlItem } from '../OverlayControls/OverlayControls';
|
|
6
|
-
import { ActionPanelItem } from '../ActionPanel/ActionPanel';
|
|
7
6
|
interface DashKitGeneralProps {
|
|
8
7
|
config: Config;
|
|
9
8
|
editMode: boolean;
|
|
@@ -22,7 +21,6 @@ interface DashKitDefaultProps {
|
|
|
22
21
|
overlayControls?: Record<string, OverlayControlItem[]>;
|
|
23
22
|
noOverlay?: boolean;
|
|
24
23
|
draggableHandleClassName?: string;
|
|
25
|
-
actionPanel?: ActionPanelItem[];
|
|
26
24
|
}
|
|
27
25
|
export interface DashKitProps extends DashKitGeneralProps, Partial<DashKitDefaultProps> {
|
|
28
26
|
}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { RegisterManager } from '../../utils';
|
|
3
|
+
import type { DashKitProps } from '../DashKit';
|
|
4
|
+
import './DashKitView.css';
|
|
5
|
+
declare const DashKitViewForwardedMeta: React.ForwardRefExoticComponent<DashKitProps & {
|
|
6
|
+
registerManager: RegisterManager;
|
|
7
|
+
} & React.RefAttributes<unknown>>;
|
|
1
8
|
export default DashKitViewForwardedMeta;
|
|
2
|
-
declare const DashKitViewForwardedMeta: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
|
3
|
-
import React from "react";
|
|
@@ -5,16 +5,12 @@ import MobileLayout from '../MobileLayout/MobileLayout';
|
|
|
5
5
|
import { withContext } from '../../hocs/withContext';
|
|
6
6
|
import { useCalcPropsLayout } from '../../hooks/useCalcLayout';
|
|
7
7
|
import { cn } from '../../utils/cn';
|
|
8
|
-
import { ActionPanel } from '../ActionPanel/ActionPanel';
|
|
9
8
|
import './DashKitView.css';
|
|
10
9
|
const b = cn('dashkit');
|
|
11
10
|
function DashKitView(props) {
|
|
12
|
-
var _a;
|
|
13
11
|
const context = React.useContext(DashKitContext);
|
|
14
|
-
const { registerManager, forwardedMetaRef
|
|
15
|
-
return (React.createElement("div", { className: b({ theme: registerManager.settings.theme }) },
|
|
16
|
-
registerManager.settings.isMobile ? (React.createElement(MobileLayout, null)) : (React.createElement(GridLayout, { ref: forwardedMetaRef, overlayControls: props.overlayControls })),
|
|
17
|
-
Boolean(((_a = props.actionPanel) === null || _a === void 0 ? void 0 : _a.length) && editMode) && (React.createElement(ActionPanel, { items: props.actionPanel }))));
|
|
12
|
+
const { registerManager, forwardedMetaRef } = context;
|
|
13
|
+
return (React.createElement("div", { className: b({ theme: registerManager.settings.theme }) }, registerManager.settings.isMobile ? (React.createElement(MobileLayout, null)) : (React.createElement(GridLayout, { ref: forwardedMetaRef, overlayControls: props.overlayControls }))));
|
|
18
14
|
}
|
|
19
15
|
const DashKitViewWithContext = withContext(DashKitView);
|
|
20
16
|
const DashKitViewForwardedMeta = React.forwardRef((props, ref) => {
|
|
@@ -168,7 +168,7 @@ export function withContext(Component) {
|
|
|
168
168
|
const WithContext = (props) => {
|
|
169
169
|
const contextValue = useMemoStateContext(props);
|
|
170
170
|
return (React.createElement(DashKitContext.Provider, { value: contextValue },
|
|
171
|
-
React.createElement(Component, { overlayControls: props.overlayControls
|
|
171
|
+
React.createElement(Component, { overlayControls: props.overlayControls })));
|
|
172
172
|
};
|
|
173
173
|
WithContext.displayName = `withContext(${Component.displayName || Component.name || 'Component'}`;
|
|
174
174
|
return WithContext;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { OverlayCustomControlItem } from '../components/OverlayControls/OverlayControls';
|
|
2
2
|
import { MenuItems } from '../constants';
|
|
3
3
|
import type { ReactGridLayoutProps } from 'react-grid-layout';
|
|
4
|
-
import { ActionPanelItem } from '../components/ActionPanel/ActionPanel';
|
|
5
4
|
export interface Settings {
|
|
6
5
|
gridLayout?: ReactGridLayoutProps;
|
|
7
6
|
theme?: string;
|
|
8
7
|
isMobile?: boolean;
|
|
9
8
|
menu?: Array<MenuItem>;
|
|
10
|
-
actionPanel?: ActionPanelItem[];
|
|
11
9
|
}
|
|
12
10
|
export type MenuItem = (typeof MenuItems)[keyof typeof MenuItems] | OverlayCustomControlItem;
|
|
13
11
|
export interface SettingsProps {
|