office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
44 lines • 2.75 kB
JavaScript
define(["require", "exports", "tslib", "react", "office-ui-fabric-react/lib/components/GroupedList/index", "office-ui-fabric-react/lib/Utilities", "office-ui-fabric-react/lib/Link", "office-ui-fabric-react/lib/utilities/exampleData", "office-ui-fabric-react/lib/Styling", "./GroupedList.Custom.Example.scss"], function (require, exports, tslib_1, React, index_1, Utilities_1, Link_1, exampleData_1, Styling_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var _items;
var _groups;
var GroupedListCustomExample = /** @class */ (function (_super) {
tslib_1.__extends(GroupedListCustomExample, _super);
function GroupedListCustomExample(props) {
var _this = _super.call(this, props) || this;
_items = _items || exampleData_1.createListItems(20);
_groups = exampleData_1.createGroups(4, 0, 0, 5);
return _this;
}
GroupedListCustomExample.prototype.render = function () {
return (React.createElement(index_1.GroupedList, { items: _items, onRenderCell: this._onRenderCell, groupProps: {
onRenderHeader: this._onRenderHeader,
onRenderFooter: this._onRenderFooter
}, groups: _groups }));
};
GroupedListCustomExample.prototype._onRenderCell = function (nestingDepth, item, itemIndex) {
return (React.createElement("div", { "data-selection-index": itemIndex },
React.createElement("span", { className: "ms-GroupedListExample-name" }, item.name)));
};
GroupedListCustomExample.prototype._onRenderHeader = function (props) {
var toggleCollapse = function () {
props.onToggleCollapse(props.group);
};
return (React.createElement("div", { className: Utilities_1.css('ms-GroupedListExample-header', Styling_1.FontClassNames.xLarge) },
"This is a custom header for ",
props.group.name,
"\u00A0 (",
React.createElement(Link_1.Link, { onClick: toggleCollapse }, props.group.isCollapsed ? 'Expand' : 'Collapse'),
")"));
};
GroupedListCustomExample.prototype._onRenderFooter = function (props) {
return (React.createElement("div", { className: Utilities_1.css('ms-GroupedListExample-footer', Styling_1.FontClassNames.large) },
"This is a custom footer for ",
props.group.name));
};
return GroupedListCustomExample;
}(React.Component));
exports.GroupedListCustomExample = GroupedListCustomExample;
});
//# sourceMappingURL=GroupedList.Custom.Example.js.map