office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
42 lines • 2.83 kB
JavaScript
define(["require", "exports", "tslib", "react", "../../Utilities", "../../Styling", "../../FocusZone", "./OverflowSet.scss"], function (require, exports, tslib_1, React, Utilities_1, Styling_1, FocusZone_1, stylesImport) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var styles = stylesImport;
var OverflowSet = /** @class */ (function (_super) {
tslib_1.__extends(OverflowSet, _super);
function OverflowSet() {
return _super !== null && _super.apply(this, arguments) || this;
}
OverflowSet.prototype.render = function () {
var _a = this.props, items = _a.items, overflowItems = _a.overflowItems, onRenderOverflowButton = _a.onRenderOverflowButton, className = _a.className, focusZoneProps = _a.focusZoneProps, _b = _a.vertical, vertical = _b === void 0 ? false : _b, _c = _a.role, role = _c === void 0 ? 'menubar' : _c;
return (React.createElement(FocusZone_1.FocusZone, tslib_1.__assign({}, focusZoneProps, { componentRef: this._resolveRef('_focusZone'), className: Styling_1.mergeStyles('ms-OverflowSet', styles.root, vertical && styles.rootVertical, className), direction: vertical ? FocusZone_1.FocusZoneDirection.vertical : FocusZone_1.FocusZoneDirection.horizontal, role: role }),
items && this._onRenderItems(items),
overflowItems && overflowItems.length > 0 && this._onRenderOverflowButtonWrapper(overflowItems)));
};
OverflowSet.prototype.focus = function () {
if (this._focusZone) {
this._focusZone.focus();
}
};
OverflowSet.prototype._onRenderItems = function (items) {
var _this = this;
return items.map(function (item, i) {
var wrapperDivProps = { className: Utilities_1.css('ms-OverflowSet-item', styles.item) };
return (React.createElement("div", tslib_1.__assign({ key: item.key }, wrapperDivProps), _this.props.onRenderItem(item)));
});
};
OverflowSet.prototype._onRenderOverflowButtonWrapper = function (items) {
var wrapperDivProps = { className: Utilities_1.css('ms-OverflowSet-overflowButton', styles.item) };
return (React.createElement("div", tslib_1.__assign({}, wrapperDivProps), this.props.onRenderOverflowButton(items)));
};
tslib_1.__decorate([
Utilities_1.autobind
], OverflowSet.prototype, "_onRenderItems", null);
tslib_1.__decorate([
Utilities_1.autobind
], OverflowSet.prototype, "_onRenderOverflowButtonWrapper", null);
return OverflowSet;
}(Utilities_1.BaseComponent));
exports.OverflowSet = OverflowSet;
});
//# sourceMappingURL=OverflowSet.js.map