-
Notifications
You must be signed in to change notification settings - Fork 100
/
Copy pathdroppable-types.ts
93 lines (81 loc) · 2.77 KB
/
droppable-types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import type { ReactNode } from 'react';
import type {
DraggableId,
DroppableId,
TypeId,
Direction,
Placeholder,
State,
ContextId,
DraggableRubric,
DroppableMode,
} from '../../types';
import type { DraggableChildrenFn } from '../draggable/draggable-types';
import { updateViewportMaxScroll } from '../../state/action-creators';
export type { DraggableChildrenFn } from '../draggable/draggable-types';
export interface DroppableProvidedProps {
// used for shared global styles
'data-rfd-droppable-context-id': ContextId;
// Used to lookup. Currently not used for drag and drop lifecycle
'data-rfd-droppable-id': DroppableId;
}
export interface DroppableProvided {
innerRef: (a?: HTMLElement | null) => void;
placeholder: ReactNode | null;
droppableProps: DroppableProvidedProps;
}
export interface UseClone {
dragging: DraggableRubric;
render: DraggableChildrenFn;
}
export interface DroppableStateSnapshot {
// Is the Droppable being dragged over?
isDraggingOver: boolean;
// What is the id of the draggable that is dragging over the Droppable?
draggingOverWith: DraggableId | null;
// What is the id of the draggable that is dragging from this list?
// Useful for styling the home list when not being dragged over
draggingFromThisWith: DraggableId | null;
// Whether or not the placeholder is actively being used.
// This is useful information when working with virtual lists
isUsingPlaceholder: boolean;
}
export interface MapProps {
// placeholder:
// - used to keep space in the home list during the whole drag and drop
// - used to make space in foreign lists during a drag
placeholder: Placeholder | null;
shouldAnimatePlaceholder: boolean;
// snapshot based on redux state to be provided to consumers
snapshot: DroppableStateSnapshot;
useClone: UseClone | null;
}
export interface DefaultProps {
direction: Direction;
getContainerForClone: () => HTMLElement;
ignoreContainerClipping: boolean;
isCombineEnabled: boolean;
isDropDisabled: boolean;
mode: DroppableMode;
type: TypeId;
renderClone: DraggableChildrenFn | null;
}
export interface DispatchProps {
updateViewportMaxScroll: typeof updateViewportMaxScroll;
}
export interface DroppableProps extends Partial<DefaultProps> {
children: (
provided: DroppableProvided,
snapshot: DroppableStateSnapshot,
) => ReactNode;
droppableId: DroppableId;
renderClone?: DraggableChildrenFn | null;
}
export type InternalOwnProps = DroppableProps &
DefaultProps & {
renderClone: DraggableChildrenFn | null;
};
export type Props = MapProps & DispatchProps & InternalOwnProps;
// Having issues getting the correct type
// export type Selector = OutputSelector<State, OwnProps, MapProps>;
export type Selector = (state: State, ownProps: InternalOwnProps) => MapProps;