@@ -3,10 +3,7 @@ import React from 'react';
33import isEqual from 'lodash/isEqual' ;
44import pick from 'lodash/pick' ;
55
6- import type {
7- OverlayControlItem ,
8- PreparedCopyItemOptions ,
9- } from '../components/OverlayControls/OverlayControls' ;
6+ import type { DashKitProps } from '../components/DashKit' ;
107import {
118 COMPACT_TYPE_HORIZONTAL_NOWRAP ,
129 DEFAULT_GROUP ,
@@ -15,67 +12,43 @@ import {
1512 TEMPORARY_ITEM_ID ,
1613} from '../constants/common' ;
1714import { DashKitContext , DashKitDnDContext , DashkitOvelayControlsContext } from '../context' ;
18- import type { DashKitCtxShape , OverlayControlsCtxShape , TemporaryLayout } from '../context' ;
19- import { useDeepEqualMemo } from '../hooks/useDeepEqualMemo' ;
2015import type {
21- Config ,
22- ConfigItem ,
23- ConfigLayout ,
24- GlobalParams ,
25- ItemDropProps ,
26- ItemsStateAndParams ,
27- } from '../shared' ;
16+ DashKitCtxShape ,
17+ DashkitPropsPassedToCtx ,
18+ OverlayControlsCtxShape ,
19+ TemporaryLayout ,
20+ } from '../context' ;
21+ import { useDeepEqualMemo } from '../hooks/useDeepEqualMemo' ;
22+ import type { ConfigLayout } from '../shared' ;
2823import { getAllConfigItems , getItemsParams , getItemsState } from '../shared' ;
29- import type {
30- ContextProps ,
31- DashKitGroup ,
32- ItemManipulationCallback ,
33- MenuItem ,
34- PluginRef ,
35- SettingsProps ,
36- } from '../typings' ;
24+ import type { PluginRef } from '../typings' ;
3725import type { RegisterManager , RegisterManagerPlugin } from '../utils' ;
3826import { UpdateManager , resolveLayoutGroup } from '../utils' ;
3927
4028const ITEM_PROPS = [ 'i' , 'h' , 'w' , 'x' , 'y' , 'parent' ] as const ;
4129
42- export type DashKitWithContextProps = {
43- config : Config ;
44- itemsStateAndParams : ItemsStateAndParams ;
45- groups ?: DashKitGroup [ ] ;
46- onChange : ( data : {
47- config : Config ;
48- itemsStateAndParams : ItemsStateAndParams ;
49- groups ?: DashKitGroup [ ] ;
50- } ) => void ;
51- layout : ConfigLayout [ ] ;
52- registerManager : RegisterManager ;
53- defaultGlobalParams : GlobalParams ;
54- globalParams : GlobalParams ;
55- onItemEdit : ( item : ConfigItem ) => void ;
56- context : ContextProps ;
57- noOverlay : boolean ;
58- focusable ?: boolean ;
59- settings : SettingsProps ;
60- onItemMountChange ?: ( item : ConfigItem , state : { isAsync : boolean ; isMounted : boolean } ) => void ;
61- onItemRender ?: ( item : ConfigItem ) => void ;
62- forwardedMetaRef : React . ForwardedRef < any > ;
63- draggableHandleClassName ?: string ;
64- onDrop ?: ( dropProps : ItemDropProps ) => void ;
65- overlayControls ?: Record < string , OverlayControlItem [ ] > | null ;
66- overlayMenuItems ?: MenuItem [ ] | null ;
67- getPreparedCopyItemOptions ?: ( options : PreparedCopyItemOptions ) => PreparedCopyItemOptions ;
68- onCopyFulfill ?: ( error : null | Error , data ?: PreparedCopyItemOptions ) => void ;
69- editMode : boolean ;
70- onItemFocus ?: ( item : ConfigItem ) => void ;
71- onItemBlur ?: ( item : ConfigItem ) => void ;
72- onDragStart ?: ItemManipulationCallback ;
73- onDrag ?: ItemManipulationCallback ;
74- onDragStop ?: ItemManipulationCallback ;
75- onResizeStart ?: ItemManipulationCallback ;
76- onResize ?: ItemManipulationCallback ;
77- onResizeStop ?: ItemManipulationCallback ;
78- } ;
30+ export type DashKitWithContextProps = DashkitPropsPassedToCtx &
31+ Pick <
32+ DashKitProps ,
33+ 'overlayControls' | 'overlayMenuItems' | 'getPreparedCopyItemOptions' | 'onCopyFulfill'
34+ > &
35+ Required <
36+ Pick <
37+ DashKitProps ,
38+ | 'itemsStateAndParams'
39+ | 'defaultGlobalParams'
40+ | 'globalParams'
41+ | 'context'
42+ | 'settings'
43+ | 'onItemEdit'
44+ | 'onChange'
45+ | 'onDrop'
46+ >
47+ > & {
48+ layout : ConfigLayout [ ] ;
49+ registerManager : RegisterManager ;
50+ forwardedMetaRef : React . ForwardedRef < any > ;
51+ } ;
7952
8053type OriginalLayouts = Record < string , ConfigLayout > ;
8154
0 commit comments