UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

48 lines 2.47 kB
import * as tslib_1 from "tslib"; import * as React from 'react'; import { GroupedList } from 'office-ui-fabric-react/lib/components/GroupedList/index'; import { css } from 'office-ui-fabric-react/lib/Utilities'; import { Link } from 'office-ui-fabric-react/lib/Link'; import { createListItems, createGroups } from 'office-ui-fabric-react/lib/utilities/exampleData'; import { FontClassNames } from 'office-ui-fabric-react/lib/Styling'; import './GroupedList.Custom.Example.scss'; 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 || createListItems(20); _groups = createGroups(4, 0, 0, 5); return _this; } GroupedListCustomExample.prototype.render = function () { return (React.createElement(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: css('ms-GroupedListExample-header', FontClassNames.xLarge) }, "This is a custom header for ", props.group.name, "\u00A0 (", React.createElement(Link, { onClick: toggleCollapse }, props.group.isCollapsed ? 'Expand' : 'Collapse'), ")")); }; GroupedListCustomExample.prototype._onRenderFooter = function (props) { return (React.createElement("div", { className: css('ms-GroupedListExample-footer', FontClassNames.large) }, "This is a custom footer for ", props.group.name)); }; return GroupedListCustomExample; }(React.Component)); export { GroupedListCustomExample }; //# sourceMappingURL=GroupedList.Custom.Example.js.map