-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathactions.js
46 lines (35 loc) · 1.36 KB
/
actions.js
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
import * as types from './constants'
export function compact(grid) {
return { type: types.COMPACT, grid}
}
export function add(grid, settings = { }) {
return { type: types.ADD, grid, settings }
}
export function remove(grid, id) {
return { type: types.REMOVE, grid, id }
}
export function update(grid, item) {
return { type: types.UPDATE, grid, item }
}
export function select(grid, id) {
return { type: types.SELECT, grid, id }
}
export function deselect(grid) {
return { type: types.DESELECT, grid }
}
export function breakpointChange(grid, breakpoint, cols) {
return { type: types.BREAKPOINT_CHANGE, grid, breakpoint, cols }
}
export function widthChange(grid, width, margin, cols) {
return { type: types.WIDTH_CHANGE, grid, width, margin, cols }
}
export function layoutChange(grid, layout, allLayouts) {
return { type: types.LAYOUT_CHANGE, grid, layout, allLayouts}
}
const commonEvent = (type) => (grid, layout, oldItem, newItem, placeholder, e, element) => { return { type: type, grid, layout, oldItem, newItem, placeholder, e, element } };
export const dragStart = commonEvent(types.DRAG_START);
export const dragStop = commonEvent(types.DRAG_STOP);
export const drag = commonEvent(types.DRAG);
export const resizeStart = commonEvent(types.RESIZE_START);
export const resizeStop = commonEvent(types.RESIZE_STOP);
export const resize = commonEvent(types.RESIZE);