Comparing version 0.0.35 to 0.0.36
@@ -5,2 +5,7 @@ # Change Log | ||
<a name="0.0.36"></a> | ||
## [0.0.36](https://github.com/heyui/heyui/compare/v0.0.35...v0.0.36) (2017-05-10) | ||
<a name="0.0.35"></a> | ||
@@ -7,0 +12,0 @@ ## [0.0.35](https://github.com/heyui/heyui/compare/v0.0.34...v0.0.35) (2017-05-08) |
@@ -41,3 +41,3 @@ // import Affix from './components/affix'; | ||
// import Transfer from './components/transfer'; | ||
// import Tree from './components/tree'; | ||
import Tree from './components/tree'; | ||
// import Upload from './components/upload'; | ||
@@ -138,3 +138,3 @@ import AutoComplete from './components/autocomplete'; | ||
// Transfer, | ||
// Tree, | ||
Tree, | ||
// Upload | ||
@@ -141,0 +141,0 @@ }; |
{ | ||
"name": "heyui", | ||
"version": "0.0.35", | ||
"version": "0.0.36", | ||
"description": "A UI components Library.", | ||
@@ -23,3 +23,3 @@ "main": "./build/heyui.js", | ||
"manba": "0.0.19", | ||
"hey-validator": "0.0.4" | ||
"hey-validator": "0.0.5" | ||
}, | ||
@@ -26,0 +26,0 @@ "devDependencies": { |
@@ -9,2 +9,11 @@ import utils from './utils'; | ||
}, | ||
tree: { | ||
configs: {}, | ||
default: { | ||
titleName: 'title', | ||
keyName: 'key', | ||
parentName: 'parent', | ||
childrenName: 'children', | ||
} | ||
}, | ||
autocomplete: { | ||
@@ -11,0 +20,0 @@ configs: {}, |
@@ -179,15 +179,39 @@ import utils from 'hey-utils'; | ||
}, | ||
generateTree(data, isParent, parent = null) { | ||
if (!this.isFunction(isParent)) { | ||
log.error("generateTree:isParent必须为方法。"); | ||
toSimpleArray(data, key) { | ||
let r = []; | ||
if (this.isObject(data)) { | ||
for (let d of Object.keys(data)) { | ||
r.push(data[d][key]); | ||
} | ||
} | ||
if (this.isArray(data)) { | ||
for (let d of data) { | ||
r.push(d[key]); | ||
} | ||
} | ||
return r; | ||
}, | ||
generateTree(data, param) { | ||
if (!this.isArray(data)) { | ||
log.error("generateTree:data必须为Array。"); | ||
return null; | ||
} | ||
let top = []; | ||
let result = []; | ||
let dataObj = this.toObject(data, param.keyName); | ||
let parentObj = this.toObject(data, param.parentName); | ||
for (let d of data) { | ||
if (isParent(d, parent)) { | ||
d.children = this.generateTree(data, isParent, d); | ||
top.push(d); | ||
let parentCode = d[param.parentName]; | ||
if (!utils.isNull(d[param.parentName]) && dataObj[parentCode]) { | ||
let parent = dataObj[parentCode]; | ||
if (!utils.isArray(parent[param.childrenName])) { | ||
parent[param.childrenName] = []; | ||
} | ||
parent[param.childrenName].push(d); | ||
} | ||
if (utils.isNull(parentCode) || utils.isNull(parentObj[parentCode])) { | ||
result.push(d); | ||
} | ||
} | ||
return top; | ||
return result; | ||
}, | ||
@@ -194,0 +218,0 @@ getValue(item, param) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
1367996
283
20228
5
+ Addedhey-validator@0.0.5(transitive)
- Removedhey-validator@0.0.4(transitive)
Updatedhey-validator@0.0.5