| @@ 210-240 (lines=31) @@ | ||
| 207 | >>>>>>> cc5039bab2db43dffc3dec6fd8fe7b5bc8c236a4 |
|
| 208 | data: data.insert(rowIndex, newRow), |
|
| 209 | proxy: data, |
|
| 210 | isEditing: true, |
|
| 211 | total: updatedTotal + 1, |
|
| 212 | lastUpdate: generateLastUpdate() |
|
| 213 | <<<<<<< HEAD |
|
| 214 | }, 'mergeIn'); |
|
| 215 | ======= |
|
| 216 | }, DataSource, 'mergeIn'); |
|
| 217 | >>>>>>> cc5039bab2db43dffc3dec6fd8fe7b5bc8c236a4 |
|
| 218 | }; |
|
| 219 | ||
| 220 | export const moveNode = (state, { |
|
| 221 | current, next, showTreeRootNode, stateKey |
|
| 222 | }) => { |
|
| 223 | const nextPath = List(next.path); |
|
| 224 | const tree = state.getIn([stateKey, 'treeData']); |
|
| 225 | const currentPath = List(current.path); |
|
| 226 | ||
| 227 | const newTreeMove = moveTreeNode( |
|
| 228 | tree, |
|
| 229 | current.index, |
|
| 230 | currentPath, |
|
| 231 | next.index, |
|
| 232 | nextPath |
|
| 233 | ); |
|
| 234 | ||
| 235 | let flatMove = treeToFlatList(newTreeMove); |
|
| 236 | ||
| 237 | // remove root-node |
|
| 238 | if (!showTreeRootNode) { |
|
| 239 | flatMove = flatMove.shift(); |
|
| 240 | } |
|
| 241 | ||
| 242 | <<<<<<< HEAD |
|
| 243 | return getUpdatedDataRecord(state, stateKey, { |
|
| @@ 37-64 (lines=28) @@ | ||
| 34 | } |
|
| 35 | ||
| 36 | return getUpdatedRecord(state, stateKey, { |
|
| 37 | ||
| 38 | data: keyedData, |
|
| 39 | proxy: keyedData, |
|
| 40 | total: total || keyedData.count(), |
|
| 41 | treeData: fromJS(treeData), |
|
| 42 | gridType: gridType || 'grid', |
|
| 43 | currentRecords: keyedCurr |
|
| 44 | ? keyedCurr |
|
| 45 | : keyedData, |
|
| 46 | lastUpdate: generateLastUpdate() |
|
| 47 | }, DataSource); |
|
| 48 | ||
| 49 | }; |
|
| 50 | ||
| 51 | export const setPartialTreeData = (state, { |
|
| 52 | data, parentId, showTreeRootNode, stateKey |
|
| 53 | }) => { |
|
| 54 | ||
| 55 | const tree = state.getIn([stateKey, 'treeData']); |
|
| 56 | const flat = state.getIn([stateKey, 'data']); |
|
| 57 | const pathToNode = [ |
|
| 58 | -1, ...getTreePathFromId(flat, parentId) |
|
| 59 | ]; |
|
| 60 | const updatedTree = setTreeValue( |
|
| 61 | tree, pathToNode, { children: data } |
|
| 62 | ); |
|
| 63 | ||
| 64 | let updatedFlat = treeToFlatList(updatedTree); |
|
| 65 | ||
| 66 | if (!showTreeRootNode) { |
|
| 67 | updatedFlat = updatedFlat.shift(); |
|