| 1 | import { markNodeData, NODE_KEY } from './util'; |
| 2 | |
| 3 | const reInitChecked = function(node) { |
| 4 | const siblings = node.childNodes; |
| 5 | |
| 6 | let all = true; |
| 7 | let none = true; |
| 8 | |
| 9 | for (let i = 0, j = siblings.length; i < j; i++) { |
| 10 | const sibling = siblings[i]; |
| 11 | if (sibling.checked !== true || sibling.indeterminate) { |
| 12 | all = false; |
| 13 | } |
| 14 | if (sibling.checked !== false || sibling.indeterminate) { |
| 15 | none = false; |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | if (all) { |
| 20 | node.setChecked(true); |
| 21 | } else if (!all && !none) { |
| 22 | node.setChecked('half'); |
| 23 | } else if (none) { |
| 24 | node.setChecked(false); |
| 25 | } |
| 26 | }; |
| 27 | |
| 28 | const getPropertyFromData = function(node, prop) { |
| 29 | const props = node.store.props; |