Latest updates from IceHrmPro
This commit is contained in:
37
web/node_modules/rc-tree-select/es/utils/strategyUtil.js
generated
vendored
Normal file
37
web/node_modules/rc-tree-select/es/utils/strategyUtil.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
import { isCheckDisabled } from './valueUtil';
|
||||
export var SHOW_ALL = 'SHOW_ALL';
|
||||
export var SHOW_PARENT = 'SHOW_PARENT';
|
||||
export var SHOW_CHILD = 'SHOW_CHILD';
|
||||
export function formatStrategyKeys(keys, strategy, keyEntities) {
|
||||
var keySet = new Set(keys);
|
||||
|
||||
if (strategy === SHOW_CHILD) {
|
||||
return keys.filter(function (key) {
|
||||
var entity = keyEntities[key];
|
||||
|
||||
if (entity && entity.children && entity.children.every(function (_ref) {
|
||||
var node = _ref.node;
|
||||
return isCheckDisabled(node) || keySet.has(node.key);
|
||||
})) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
if (strategy === SHOW_PARENT) {
|
||||
return keys.filter(function (key) {
|
||||
var entity = keyEntities[key];
|
||||
var parent = entity ? entity.parent : null;
|
||||
|
||||
if (parent && !isCheckDisabled(parent.node) && keySet.has(parent.node.key)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
return keys;
|
||||
}
|
||||
Reference in New Issue
Block a user