MCPcopy Create free account
hub / github.com/ElemeFE/element-react / reInitChecked

Function reInitChecked

src/tree/model/node.js:3–26  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

1import { markNodeData, NODE_KEY } from './util';
2
3const 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
28const getPropertyFromData = function(node, prop) {
29 const props = node.store.props;

Callers 1

setCheckedMethod · 0.85

Calls 1

setCheckedMethod · 0.45

Tested by

no test coverage detected