new Tree()
专用树选择类核心方法
Ox中配置专用的树相关信息,如果是在 Ox 配置和数据驱动的应用程序中,可直接使用,内部使用代码如下:
const onTree = (keys = [], data = [], config = {}) => {
const source = Ux.toTreeArray(data, config.tree);
let treeArray = [];
if (config.mode) {
// 执行选择方法 Tree[xxx]
const fun = Ux.Tree[config.mode];
if (U.isFunction(fun)) {
const result = fun(keys, source);
const $result = Ux.immutable(result);
treeArray = data.filter(each => $result.contains(each.key));
}
}
return treeArray;
};
如果是开发模式则直接使用 Ux.treeXX
系列的Api相关信息。
Methods
(static) CHILDREN(keys, data, parentField) → {Array}
标准函数
选择当前节点的直接子节点。
Parameters:
Name | Type | Default | Description |
---|---|---|---|
keys |
Array | 被选择的节点的id集合 |
|
data |
Array | 将选择的数据源。 |
|
parentField |
String |
parent
|
父字段专用字段名。 |
Returns:
返回选择的数组。
- Type
- Array
(static) CHILDREN_ALL(keys, data, parentField) → {Array}
标准函数
选择当前节点的所有子节点(不包含当前节点)。
Parameters:
Name | Type | Default | Description |
---|---|---|---|
keys |
Array | 被选择的节点的id集合 |
|
data |
Array | 将选择的数据源。 |
|
parentField |
String |
parent
|
父字段专用字段名。 |
Returns:
返回选择的数组。
- Type
- Array
(static) CHILDREN_ALL_INCLUDE(keys, data, parentField) → {Array}
标准函数
选择当前节点(多个)和这个节点所有子节点。
Parameters:
Name | Type | Default | Description |
---|---|---|---|
keys |
Array | 被选择的节点的id集合 |
|
data |
Array | 将选择的数据源。 |
|
parentField |
String |
parent
|
父字段专用字段名。 |
Returns:
返回选择的数组。
- Type
- Array
(static) PARENT(keys, data, parentField) → {Array}
标准函数
选择当前节点的直接父节点。
Parameters:
Name | Type | Default | Description |
---|---|---|---|
keys |
Array | 被选择的节点的id集合 |
|
data |
Array | 将选择的数据源。 |
|
parentField |
String |
parent
|
父字段专用字段名。 |
Returns:
返回选择的数组。
- Type
- Array
(static) PARENT_ALL(keys, data, parentField) → {Array}
标准函数
选择当前节点的所有父节点(不包含当前节点)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
keys |
Array | 被选择的节点的id集合 |
|
data |
Array | 将选择的数据源。 |
|
parentField |
String |
parent
|
父字段专用字段名。 |
Returns:
返回选择的数组。
- Type
- Array
(static) PARENT_ALL_INCLUDE(keys, data, parentField) → {Array}
标准函数
选择当前节点(多个)和这个节点所有父节点。
Parameters:
Name | Type | Default | Description |
---|---|---|---|
keys |
Array | 被选择的节点的id集合 |
|
data |
Array | 将选择的数据源。 |
|
parentField |
String |
parent
|
父字段专用字段名。 |
Returns:
返回选择的数组。
- Type
- Array