aboutsummaryrefslogtreecommitdiffstats
path: root/ui/imports/ui/actions/tree-node.actions.js
blob: 0fad8c9f15e08ba4e962e62653d02aecb8a93af8 (plain)
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others /
//                                                                                      /
// All rights reserved. This program and the accompanying materials                     /
// are made available under the terms of the Apache License, Version 2.0                /
// which accompanies this distribution, and is available at                             /
// http://www.apache.org/licenses/LICENSE-2.0                                           /
/////////////////////////////////////////////////////////////////////////////////////////
//import * as R from 'ramda';

export const UPDATE_TREE_NODE_INFO = 'UPDATE_TREE_NODE_INFO';
export const ADD_UPDATE_CHILDREN_TREE_NODE = 'ADD_UPDATE_CHILDREN_TREE_NODE';
export const RESET_TREE_NODE_CHILDREN = 'RESET_TREE_NODE_CHILDREN';
export const START_OPEN_TREE_NODE = 'START_OPEN_TREE_NODE';
export const END_OPEN_TREE_NODE = 'END_OPEN_TREE_NODE';
export const START_CLOSE_TREE_NODE = 'START_CLOSE_TREE_NODE';
export const END_CLOSE_TREE_NODE = 'END_CLOSE_TREE_NODE';
export const SET_CHILD_DETECTED_TREE_NODE = 'SET_CHILD_DETECTED_TREE_NODE';
export const SET_POSITION_REPORT_IS_NEEDED_AS_ON = 'SET_POSITION_REPORT_IS_NEEDED_AS_ON';
export const REPORT_NODE_POSITION_RETRIEVED = 'REPORT_NODE_POSITION_RETRIEVED';
export const SET_SCROLL_TO_NODE_IS_NEEDED_AS_ON = 'SET_SCROLL_TO_NODE_IS_NEEDED_AS_ON';
export const REPORT_SCROLL_TO_NODE_PERFORMED = 'REPORT_SCROLL_TO_NODE_PERFORMED';
export const RESET_NEED_CHILD_DETECTION = 'RESET_NEED_CHILD_DETECTION';

export function updateTreeNodeInfo(nodeInfo, level) {
  return {
    type: UPDATE_TREE_NODE_INFO,
    payload: {
      nodeInfo: nodeInfo,
      level: level
    }
  };
}

export function addUpdateChildrenTreeNode(nodePath, childrenInfo, level) {
  return {
    type: ADD_UPDATE_CHILDREN_TREE_NODE,
    payload: {
      nodePath: nodePath,
      childrenInfo: childrenInfo,
      level: level
    },
  };
}

export function resetTreeNodeChildren(nodePath) {
  return {
    type: RESET_TREE_NODE_CHILDREN,
    payload: {
      nodePath: nodePath,
    }
  };
}

export function startOpenTreeNode(nodePath) {
  return {
    type: START_OPEN_TREE_NODE,
    payload: {
      nodePath: nodePath,
    }
  };
}

export function endOpenTreeNode(nodePath) {
  return {
    type: END_OPEN_TREE_NODE,
    payload: {
      nodePath: nodePath,
    }
  };
}

export function startCloseTreeNode(nodePath) {
  return {
    type: START_CLOSE_TREE_NODE,
    payload: {
      nodePath: nodePath,
    }
  };
}

export function endCloseTreeNode(nodePath) {
  return {
    type: END_CLOSE_TREE_NODE,
    payload: {
      nodePath: nodePath,
    }
  };
}

export function setChildDetectedTreeNode(nodePath) {
  return {
    type: SET_CHILD_DETECTED_TREE_NODE,
    payload: {
      nodePath: nodePath
    }
  };
}

export function setPositionReportIsNeededAsOn(nodePath) {
  return {
    type: SET_POSITION_REPORT_IS_NEEDED_AS_ON,
    payload: {
      nodePath: nodePath
    }
  };
}

export function reportNodePositionRetrieved(nodePath, rect) {
  return {
    type: REPORT_NODE_POSITION_RETRIEVED,
    payload: {
      nodePath: nodePath, 
      rect: rect
    }
  };
}

export function setScrollToNodeIsNeededAsOn(nodePath) {
  return {
    type: SET_SCROLL_TO_NODE_IS_NEEDED_AS_ON,
    payload: {
      nodePath: nodePath 
    }
  };
}

export function reportScrollToNodePerformed(nodePath) {
  return {
    type: REPORT_SCROLL_TO_NODE_PERFORMED,
    payload: {
      nodePath: nodePath
    }
  };
}

export function resetNeedChildDetection(nodePath) {
  return {
    type: RESET_NEED_CHILD_DETECTION,
    payload: {
      nodePath: nodePath
    }
  };
}