@gravity-ui/dashkit 7.1.1 → 7.2.0-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.
Files changed (39) hide show
  1. package/build/cjs/components/ActionPanel/ActionPanel.d.ts +2 -15
  2. package/build/cjs/components/ActionPanel/types.d.ts +15 -0
  3. package/build/cjs/components/ActionPanel/types.js +2 -0
  4. package/build/cjs/components/DashKit/DashKit.d.ts +1 -1
  5. package/build/cjs/components/MobileLayout/helpers.d.ts +1 -1
  6. package/build/cjs/components/OverlayControls/OverlayControls.d.ts +4 -2
  7. package/build/cjs/components/index.d.ts +1 -0
  8. package/build/cjs/helpers.d.ts +3 -0
  9. package/build/cjs/helpers.js +6 -0
  10. package/build/cjs/hooks/useCalcLayout.d.ts +1 -1
  11. package/build/cjs/index.d.ts +2 -4
  12. package/build/cjs/index.js +2 -4
  13. package/build/cjs/shared/types/plugin.d.ts +1 -1
  14. package/build/cjs/typings/common.d.ts +1 -1
  15. package/build/cjs/typings/config.d.ts +1 -1
  16. package/build/cjs/typings/plugin.d.ts +2 -2
  17. package/build/cjs/utils/get-new-id.d.ts +1 -1
  18. package/build/cjs/utils/register-manager.d.ts +1 -1
  19. package/build/cjs/utils/update-manager.d.ts +2 -2
  20. package/build/esm/components/ActionPanel/ActionPanel.d.ts +2 -15
  21. package/build/esm/components/ActionPanel/types.d.ts +15 -0
  22. package/build/esm/components/ActionPanel/types.js +1 -0
  23. package/build/esm/components/DashKit/DashKit.d.ts +1 -1
  24. package/build/esm/components/MobileLayout/helpers.d.ts +1 -1
  25. package/build/esm/components/OverlayControls/OverlayControls.d.ts +4 -2
  26. package/build/esm/components/index.d.ts +1 -0
  27. package/build/esm/helpers.d.ts +3 -0
  28. package/build/esm/helpers.js +3 -0
  29. package/build/esm/hooks/useCalcLayout.d.ts +1 -1
  30. package/build/esm/index.d.ts +2 -4
  31. package/build/esm/index.js +2 -4
  32. package/build/esm/shared/types/plugin.d.ts +1 -1
  33. package/build/esm/typings/common.d.ts +1 -1
  34. package/build/esm/typings/config.d.ts +1 -1
  35. package/build/esm/typings/plugin.d.ts +2 -2
  36. package/build/esm/utils/get-new-id.d.ts +1 -1
  37. package/build/esm/utils/register-manager.d.ts +1 -1
  38. package/build/esm/utils/update-manager.d.ts +2 -2
  39. package/package.json +25 -3
@@ -1,16 +1,3 @@
1
- import React from 'react';
2
- export type ActionPanelItem = {
3
- id: string;
4
- icon: React.ReactNode;
5
- title: string;
6
- onClick?: () => void;
7
- className?: string;
8
- qa?: string;
9
- };
10
- export type ActionPanelProps = {
11
- items: ActionPanelItem[];
12
- className?: string;
13
- disable?: boolean;
14
- toggleAnimation?: boolean;
15
- };
1
+ /// <reference types="react" />
2
+ import { ActionPanelProps } from './types';
16
3
  export declare const ActionPanel: (props: ActionPanelProps) => JSX.Element | null;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ export type ActionPanelItem = {
3
+ id: string;
4
+ icon: React.ReactNode;
5
+ title: string;
6
+ onClick?: () => void;
7
+ className?: string;
8
+ qa?: string;
9
+ };
10
+ export type ActionPanelProps = {
11
+ items: ActionPanelItem[];
12
+ className?: string;
13
+ disable?: boolean;
14
+ toggleAnimation?: boolean;
15
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Config, ConfigItem, GlobalParams, ItemsStateAndParams } from '../../shared';
2
+ import type { Config, ConfigItem, GlobalParams, ItemsStateAndParams } from '../../shared';
3
3
  import { ContextProps, Plugin, SetConfigItem, SetItemOptions, Settings, SettingsProps } from '../../typings';
4
4
  import GridLayout from '../GridLayout/GridLayout';
5
5
  import { OverlayControlItem } from '../OverlayControls/OverlayControls';
@@ -1,3 +1,3 @@
1
- import { ConfigItem, ConfigLayout } from '../../shared';
1
+ import type { ConfigItem, ConfigLayout } from '../../shared';
2
2
  import { DashKitProps } from '../DashKit';
3
3
  export declare const getSortedConfigItems: (config: DashKitProps['config'], hasOrderId: boolean) => (ConfigItem & ConfigLayout)[];
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { ButtonSize, ButtonView, IconProps, MenuItemProps } from '@gravity-ui/uikit';
3
- import { Config, ConfigItem, ItemState, PluginBase, StringParams } from '../../shared';
3
+ import type { Config, ConfigItem, ItemState, PluginBase, StringParams } from '../../shared';
4
4
  import type { RegisterManager } from '../../utils/register-manager';
5
5
  export declare enum OverlayControlsPosition {
6
6
  TopRight = "top_right",
@@ -45,7 +45,9 @@ type PreparedCopyItemOptionsArg = Pick<ConfigItem, 'data' | 'type' | 'defaults'
45
45
  h: number;
46
46
  };
47
47
  };
48
- export type PreparedCopyItemOptions = PreparedCopyItemOptionsArg;
48
+ export type PreparedCopyItemOptions<C extends object = {}> = PreparedCopyItemOptionsArg & {
49
+ copyContext?: C;
50
+ };
49
51
  type DashKitCtx = React.Context<{
50
52
  context: Record<string, any>;
51
53
  registerManager: RegisterManager;
@@ -1,3 +1,4 @@
1
1
  export * from './DashKit';
2
2
  export type { OverlayControlItem, PreparedCopyItemOptions } from './OverlayControls/OverlayControls';
3
3
  export * from './ActionPanel/ActionPanel';
4
+ export type { ActionPanelItem, ActionPanelProps } from './ActionPanel/types';
@@ -0,0 +1,3 @@
1
+ export * from './utils';
2
+ export * from './constants';
3
+ export * from './shared';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./utils"), exports);
5
+ tslib_1.__exportStar(require("./constants"), exports);
6
+ tslib_1.__exportStar(require("./shared"), exports);
@@ -1,4 +1,4 @@
1
- import { Config } from '../shared';
1
+ import type { Config } from '../shared';
2
2
  import { RegisterManager } from '../utils';
3
3
  export declare const useCalcPropsLayout: (config: Config, registerManager: RegisterManager) => {
4
4
  i: string;
@@ -1,6 +1,4 @@
1
1
  export * from './components';
2
- export * from './utils';
3
- export * from './constants';
4
- export * from './typings';
5
- export * from './shared';
6
2
  export * from './plugins';
3
+ export * from './shared/types';
4
+ export * from './typings';
@@ -2,8 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./components"), exports);
5
- tslib_1.__exportStar(require("./utils"), exports);
6
- tslib_1.__exportStar(require("./constants"), exports);
7
- tslib_1.__exportStar(require("./typings"), exports);
8
- tslib_1.__exportStar(require("./shared"), exports);
9
5
  tslib_1.__exportStar(require("./plugins"), exports);
6
+ tslib_1.__exportStar(require("./shared/types"), exports);
7
+ tslib_1.__exportStar(require("./typings"), exports);
@@ -1,4 +1,4 @@
1
- import { ConfigItem } from './config';
1
+ import type { ConfigItem } from './config';
2
2
  interface PluginSpecialFields {
3
3
  prerenderMiddleware?: (item: ConfigItem) => ConfigItem;
4
4
  }
@@ -1,5 +1,5 @@
1
1
  import type ReactGridLayout from 'react-grid-layout';
2
- import { OverlayCustomControlItem } from '../components/OverlayControls/OverlayControls';
2
+ import type { OverlayCustomControlItem } from '../components/OverlayControls/OverlayControls';
3
3
  import { MenuItems } from '../constants';
4
4
  export interface Settings {
5
5
  gridLayout?: ReactGridLayout.ReactGridLayoutProps;
@@ -1,4 +1,4 @@
1
- import { ConfigItem, ConfigLayout } from '../shared';
1
+ import type { ConfigItem, ConfigLayout } from '../shared';
2
2
  export interface AddConfigItem extends Omit<ConfigItem, 'id' | 'namespace'> {
3
3
  id?: null;
4
4
  namespace?: string;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import ReactGridLayout from 'react-grid-layout';
3
- import { ConfigItem, ItemState, ItemStateAndParams, ItemStateAndParamsChangeOptions, PluginBase, StringParams } from '../shared';
4
- import { ContextProps, SettingsProps, WidgetLayout } from './common';
3
+ import type { ConfigItem, ItemState, ItemStateAndParams, ItemStateAndParamsChangeOptions, PluginBase, StringParams } from '../shared';
4
+ import type { ContextProps, SettingsProps, WidgetLayout } from './common';
5
5
  export interface PluginWidgetProps<T = StringParams> {
6
6
  id: string;
7
7
  editMode: boolean;
@@ -1,4 +1,4 @@
1
- import { Config } from '../shared';
1
+ import type { Config } from '../shared';
2
2
  type GetNewIdArgs = {
3
3
  config: Config;
4
4
  salt: Config['salt'];
@@ -1,5 +1,5 @@
1
1
  import ReactGridLayout from 'react-grid-layout';
2
- import { Plugin, PluginDefaultLayout, Settings } from '../typings';
2
+ import type { Plugin, PluginDefaultLayout, Settings } from '../typings';
3
3
  interface RegisterManagerDefaultLayout {
4
4
  x: number;
5
5
  y: number;
@@ -1,5 +1,5 @@
1
- import { Config, ConfigItem, ItemStateAndParams, ItemStateAndParamsChangeOptions, ItemsStateAndParams } from '../shared';
2
- import { AddConfigItem, SetItemOptions, WidgetLayout } from '../typings';
1
+ import type { Config, ConfigItem, ItemStateAndParams, ItemStateAndParamsChangeOptions, ItemsStateAndParams } from '../shared';
2
+ import type { AddConfigItem, SetItemOptions, WidgetLayout } from '../typings';
3
3
  import { RegisterManagerPluginLayout } from './register-manager';
4
4
  interface RemoveItemArg {
5
5
  id: string;
@@ -1,17 +1,4 @@
1
- import React from 'react';
1
+ /// <reference types="react" />
2
+ import { ActionPanelProps } from './types';
2
3
  import './ActionPanel.css';
3
- export type ActionPanelItem = {
4
- id: string;
5
- icon: React.ReactNode;
6
- title: string;
7
- onClick?: () => void;
8
- className?: string;
9
- qa?: string;
10
- };
11
- export type ActionPanelProps = {
12
- items: ActionPanelItem[];
13
- className?: string;
14
- disable?: boolean;
15
- toggleAnimation?: boolean;
16
- };
17
4
  export declare const ActionPanel: (props: ActionPanelProps) => JSX.Element | null;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ export type ActionPanelItem = {
3
+ id: string;
4
+ icon: React.ReactNode;
5
+ title: string;
6
+ onClick?: () => void;
7
+ className?: string;
8
+ qa?: string;
9
+ };
10
+ export type ActionPanelProps = {
11
+ items: ActionPanelItem[];
12
+ className?: string;
13
+ disable?: boolean;
14
+ toggleAnimation?: boolean;
15
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Config, ConfigItem, GlobalParams, ItemsStateAndParams } from '../../shared';
2
+ import type { Config, ConfigItem, GlobalParams, ItemsStateAndParams } from '../../shared';
3
3
  import { ContextProps, Plugin, SetConfigItem, SetItemOptions, Settings, SettingsProps } from '../../typings';
4
4
  import GridLayout from '../GridLayout/GridLayout';
5
5
  import { OverlayControlItem } from '../OverlayControls/OverlayControls';
@@ -1,3 +1,3 @@
1
- import { ConfigItem, ConfigLayout } from '../../shared';
1
+ import type { ConfigItem, ConfigLayout } from '../../shared';
2
2
  import { DashKitProps } from '../DashKit';
3
3
  export declare const getSortedConfigItems: (config: DashKitProps['config'], hasOrderId: boolean) => (ConfigItem & ConfigLayout)[];
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { ButtonSize, ButtonView, IconProps, MenuItemProps } from '@gravity-ui/uikit';
3
- import { Config, ConfigItem, ItemState, PluginBase, StringParams } from '../../shared';
3
+ import type { Config, ConfigItem, ItemState, PluginBase, StringParams } from '../../shared';
4
4
  import type { RegisterManager } from '../../utils/register-manager';
5
5
  import './OverlayControls.css';
6
6
  export declare enum OverlayControlsPosition {
@@ -46,7 +46,9 @@ type PreparedCopyItemOptionsArg = Pick<ConfigItem, 'data' | 'type' | 'defaults'
46
46
  h: number;
47
47
  };
48
48
  };
49
- export type PreparedCopyItemOptions = PreparedCopyItemOptionsArg;
49
+ export type PreparedCopyItemOptions<C extends object = {}> = PreparedCopyItemOptionsArg & {
50
+ copyContext?: C;
51
+ };
50
52
  type DashKitCtx = React.Context<{
51
53
  context: Record<string, any>;
52
54
  registerManager: RegisterManager;
@@ -1,3 +1,4 @@
1
1
  export * from './DashKit';
2
2
  export type { OverlayControlItem, PreparedCopyItemOptions } from './OverlayControls/OverlayControls';
3
3
  export * from './ActionPanel/ActionPanel';
4
+ export type { ActionPanelItem, ActionPanelProps } from './ActionPanel/types';
@@ -0,0 +1,3 @@
1
+ export * from './utils';
2
+ export * from './constants';
3
+ export * from './shared';
@@ -0,0 +1,3 @@
1
+ export * from './utils';
2
+ export * from './constants';
3
+ export * from './shared';
@@ -1,4 +1,4 @@
1
- import { Config } from '../shared';
1
+ import type { Config } from '../shared';
2
2
  import { RegisterManager } from '../utils';
3
3
  export declare const useCalcPropsLayout: (config: Config, registerManager: RegisterManager) => {
4
4
  i: string;
@@ -1,6 +1,4 @@
1
1
  export * from './components';
2
- export * from './utils';
3
- export * from './constants';
4
- export * from './typings';
5
- export * from './shared';
6
2
  export * from './plugins';
3
+ export * from './shared/types';
4
+ export * from './typings';
@@ -1,6 +1,4 @@
1
1
  export * from './components';
2
- export * from './utils';
3
- export * from './constants';
4
- export * from './typings';
5
- export * from './shared';
6
2
  export * from './plugins';
3
+ export * from './shared/types';
4
+ export * from './typings';
@@ -1,4 +1,4 @@
1
- import { ConfigItem } from './config';
1
+ import type { ConfigItem } from './config';
2
2
  interface PluginSpecialFields {
3
3
  prerenderMiddleware?: (item: ConfigItem) => ConfigItem;
4
4
  }
@@ -1,5 +1,5 @@
1
1
  import type ReactGridLayout from 'react-grid-layout';
2
- import { OverlayCustomControlItem } from '../components/OverlayControls/OverlayControls';
2
+ import type { OverlayCustomControlItem } from '../components/OverlayControls/OverlayControls';
3
3
  import { MenuItems } from '../constants';
4
4
  export interface Settings {
5
5
  gridLayout?: ReactGridLayout.ReactGridLayoutProps;
@@ -1,4 +1,4 @@
1
- import { ConfigItem, ConfigLayout } from '../shared';
1
+ import type { ConfigItem, ConfigLayout } from '../shared';
2
2
  export interface AddConfigItem extends Omit<ConfigItem, 'id' | 'namespace'> {
3
3
  id?: null;
4
4
  namespace?: string;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import ReactGridLayout from 'react-grid-layout';
3
- import { ConfigItem, ItemState, ItemStateAndParams, ItemStateAndParamsChangeOptions, PluginBase, StringParams } from '../shared';
4
- import { ContextProps, SettingsProps, WidgetLayout } from './common';
3
+ import type { ConfigItem, ItemState, ItemStateAndParams, ItemStateAndParamsChangeOptions, PluginBase, StringParams } from '../shared';
4
+ import type { ContextProps, SettingsProps, WidgetLayout } from './common';
5
5
  export interface PluginWidgetProps<T = StringParams> {
6
6
  id: string;
7
7
  editMode: boolean;
@@ -1,4 +1,4 @@
1
- import { Config } from '../shared';
1
+ import type { Config } from '../shared';
2
2
  type GetNewIdArgs = {
3
3
  config: Config;
4
4
  salt: Config['salt'];
@@ -1,5 +1,5 @@
1
1
  import ReactGridLayout from 'react-grid-layout';
2
- import { Plugin, PluginDefaultLayout, Settings } from '../typings';
2
+ import type { Plugin, PluginDefaultLayout, Settings } from '../typings';
3
3
  interface RegisterManagerDefaultLayout {
4
4
  x: number;
5
5
  y: number;
@@ -1,5 +1,5 @@
1
- import { Config, ConfigItem, ItemStateAndParams, ItemStateAndParamsChangeOptions, ItemsStateAndParams } from '../shared';
2
- import { AddConfigItem, SetItemOptions, WidgetLayout } from '../typings';
1
+ import type { Config, ConfigItem, ItemStateAndParams, ItemStateAndParamsChangeOptions, ItemsStateAndParams } from '../shared';
2
+ import type { AddConfigItem, SetItemOptions, WidgetLayout } from '../typings';
3
3
  import { RegisterManagerPluginLayout } from './register-manager';
4
4
  interface RemoveItemArg {
5
5
  id: string;
package/package.json CHANGED
@@ -1,12 +1,24 @@
1
1
  {
2
2
  "name": "@gravity-ui/dashkit",
3
- "version": "7.1.1",
3
+ "version": "7.2.0-beta.0",
4
4
  "description": "Library for rendering dashboard grid layout",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/gravity-ui/dashkit"
9
9
  },
10
+ "exports": {
11
+ ".": {
12
+ "types": "./build/esm/index.d.ts",
13
+ "require": "./build/cjs/index.js",
14
+ "import": "./build/esm/index.js"
15
+ },
16
+ "./helpers": {
17
+ "types": "./build/esm/helpers.d.ts",
18
+ "require": "./build/cjs/helpers.js",
19
+ "import": "./build/esm/helpers.js"
20
+ }
21
+ },
10
22
  "files": [
11
23
  "build"
12
24
  ],
@@ -17,9 +29,19 @@
17
29
  "publishConfig": {
18
30
  "access": "public"
19
31
  },
20
- "main": "build/cjs/index.js",
21
- "module": "build/esm/index.js",
32
+ "main": "./build/cjs/index.js",
33
+ "module": "./build/esm/index.js",
22
34
  "types": "build/esm/index.d.ts",
35
+ "typesVersions": {
36
+ "*": {
37
+ "index.d.ts": [
38
+ "./build/esm/index.d.ts"
39
+ ],
40
+ "helpers": [
41
+ "./build/esm/helpers.d.ts"
42
+ ]
43
+ }
44
+ },
23
45
  "scripts": {
24
46
  "lint:prettier": "prettier --check --log-level=error '**/*.{js,jsx,ts,tsx,scss}'",
25
47
  "lint:prettier:fix": "prettier --write '**/*.md'",