rc-tree-select
Advanced tools
Comparing version 1.2.2 to 1.2.3
@@ -188,13 +188,24 @@ 'use strict'; | ||
// console.log(filterParentPosition(['0-2', '0-10', '0-0-1', '0-1-1', '0-0','0-1', '0-10-0'])); | ||
function containsPath(path1, path2) { | ||
if (path2.length > path1.length) { | ||
return false; | ||
} | ||
for (var i = 0; i < path2.length; i++) { | ||
if (path1[i] !== path2[i]) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
var stripTail = function stripTail(str) { | ||
var arr = str.match(/(.+)(-[^-]+)$/); | ||
var st = ''; | ||
if (arr && arr.length === 3) { | ||
st = arr[1]; | ||
} | ||
return st; | ||
}; | ||
function handleCheckState(obj, checkedPosArr, checkIt) { | ||
var stripTail = function stripTail(str) { | ||
var arr = str.match(/(.+)(-[^-]+)$/); | ||
var st = ''; | ||
if (arr && arr.length === 3) { | ||
st = arr[1]; | ||
} | ||
return st; | ||
}; | ||
// stripTail('x-xx-sss-xx') | ||
@@ -205,5 +216,7 @@ var splitPos = function splitPos(pos) { | ||
checkedPosArr.forEach(function (_pos) { | ||
var posPath = splitPos(_pos); | ||
// 设置子节点,全选或全不选 | ||
Object.keys(obj).forEach(function (i) { | ||
if (splitPos(i).length > splitPos(_pos).length && i.indexOf(_pos) === 0) { | ||
var iPath = splitPos(i); | ||
if (iPath.length > posPath.length && containsPath(iPath, posPath)) { | ||
obj[i].checkPart = false; | ||
@@ -223,4 +236,6 @@ obj[i].checked = checkIt; | ||
var parentPos = stripTail(__pos); | ||
var parentPosPath = splitPos(parentPos); | ||
Object.keys(obj).forEach(function (i) { | ||
if (splitPos(i).length === _posLen && i.indexOf(parentPos) === 0) { | ||
var iPath = splitPos(i); | ||
if (iPath.length === _posLen && containsPath(iPath, parentPosPath)) { | ||
sibling++; | ||
@@ -227,0 +242,0 @@ if (obj[i].checked) { |
{ | ||
"name": "rc-tree-select", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"description": "tree-select ui component for react", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
87236
2542