office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
25 lines (23 loc) • 1.23 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
var interfaces_1 = require("./interfaces");
var SelectionLayout = (function () {
function SelectionLayout(direction) {
this._direction = direction;
}
SelectionLayout.prototype.getItemIndexAbove = function (focusIndex, items) {
return (this._direction === interfaces_1.SelectionDirection.vertical) ? Math.max(0, focusIndex - 1) : focusIndex;
};
SelectionLayout.prototype.getItemIndexBelow = function (focusIndex, items) {
return (this._direction === interfaces_1.SelectionDirection.vertical) ? Math.min(items.length - 1, focusIndex + 1) : focusIndex;
};
SelectionLayout.prototype.getItemIndexLeft = function (focusIndex, items) {
return (this._direction === interfaces_1.SelectionDirection.vertical) ? focusIndex : Math.max(0, focusIndex - 1);
};
SelectionLayout.prototype.getItemIndexRight = function (focusIndex, items) {
return (this._direction === interfaces_1.SelectionDirection.vertical) ? focusIndex : Math.min(items.length - 1, focusIndex + 1);
};
return SelectionLayout;
}());
exports.SelectionLayout = SelectionLayout;
//# sourceMappingURL=SelectionLayout.js.map
;