UNPKG

zent

Version:

一套前端设计语言和基于React的实现

25 lines (24 loc) 898 B
import { Direction } from './constants'; export var getOppositeDirection = function (direction) { return Direction.Left === direction ? Direction.Right : Direction.Left; }; export var getDisabledKeys = function (dataSource, keyName) { return dataSource .filter(function (_a) { var disabled = _a.disabled; return disabled; }) .map(function (_a) { var _b = keyName, key = _a[_b]; return key; }); }; export var getSingleDirectionSelectedKeysExcludeDisabled = function (_a) { var direction = _a.direction, selectedKeys = _a.selectedKeys, targetKeys = _a.targetKeys, disabledKeys = _a.disabledKeys; return selectedKeys.filter(function (key) { return !disabledKeys.includes(key) && (Direction.Left === direction ? !targetKeys.includes(key) : targetKeys.includes(key)); }); };