UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

21 lines 1.13 kB
import { SelectionDirection } from './interfaces'; var SelectionLayout = /** @class */ (function () { function SelectionLayout(direction) { this._direction = direction; } SelectionLayout.prototype.getItemIndexAbove = function (focusIndex, items) { return (this._direction === SelectionDirection.vertical) ? Math.max(0, focusIndex - 1) : focusIndex; }; SelectionLayout.prototype.getItemIndexBelow = function (focusIndex, items) { return (this._direction === SelectionDirection.vertical) ? Math.min(items.length - 1, focusIndex + 1) : focusIndex; }; SelectionLayout.prototype.getItemIndexLeft = function (focusIndex, items) { return (this._direction === SelectionDirection.vertical) ? focusIndex : Math.max(0, focusIndex - 1); }; SelectionLayout.prototype.getItemIndexRight = function (focusIndex, items) { return (this._direction === SelectionDirection.vertical) ? focusIndex : Math.min(items.length - 1, focusIndex + 1); }; return SelectionLayout; }()); export { SelectionLayout }; //# sourceMappingURL=SelectionLayout.js.map