Conditions | 8 |
Paths | 7 |
Total Lines | 49 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | import { fromJS } from 'immutable'; |
||
20 | export default function gridState(state = initialState, action) { |
||
21 | |||
22 | switch (action.type) { |
||
23 | |||
24 | case HIDE_HEADER: |
||
25 | return state.mergeIn([action.stateKey], fromJS({ |
||
26 | headerHidden: action.headerHidden, |
||
27 | lastUpdate: generateLastUpdate() |
||
28 | })); |
||
29 | |||
30 | case SET_COLUMNS: |
||
31 | |||
32 | if (action.stateful) { |
||
33 | setColumnsInStorage({ |
||
34 | stateKey: action.stateKey, |
||
35 | columns: action.columns |
||
36 | }); |
||
37 | } |
||
38 | |||
39 | return state.mergeIn([action.stateKey], fromJS({ |
||
40 | columns: action.columns, |
||
41 | lastUpdate: generateLastUpdate() |
||
42 | })); |
||
43 | |||
44 | case SET_SORT_DIRECTION: |
||
45 | return state.mergeIn([action.stateKey], fromJS({ |
||
46 | columns: action.columns, |
||
47 | lastUpdate: generateLastUpdate() |
||
48 | })); |
||
49 | |||
50 | case RESIZE_COLUMNS: |
||
51 | |||
52 | if (action.stateful) { |
||
53 | setColumnsInStorage({ |
||
54 | stateKey: action.stateKey, |
||
55 | columns: action.columns |
||
56 | }); |
||
57 | } |
||
58 | |||
59 | return state.mergeIn([action.stateKey], fromJS({ |
||
60 | columns: action.columns, |
||
61 | lastUpdate: generateLastUpdate() |
||
62 | })); |
||
63 | |||
64 | default: |
||
65 | |||
66 | return state; |
||
67 | } |
||
68 | } |
||
69 | |||
77 |