UNPKG

@skbkontur/db-viewer-ui

Version:

Database Viewer with custom configuration

30 lines 1.84 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CountOfRecordsSelector = void 0; const tslib_1 = require("tslib"); const jsx_runtime_1 = require("react/jsx-runtime"); const ArrowShapeTriangleADownIcon16Regular_1 = require("@skbkontur/icons/ArrowShapeTriangleADownIcon16Regular"); const CounterIcon16Regular_1 = require("@skbkontur/icons/CounterIcon16Regular"); const react_ui_1 = require("@skbkontur/react-ui"); const react_1 = tslib_1.__importDefault(require("react")); class CountOfRecordsSelector extends react_1.default.Component { constructor() { super(...arguments); Object.defineProperty(this, "renderLinkDropdownItem", { enumerable: true, configurable: true, writable: true, value: (count) => { if (count === this.props.count) { return null; } return ((0, jsx_runtime_1.jsx)(react_ui_1.MenuItem, { onClick: () => this.props.onChange(count), "data-tid": `${count}Items`, children: count }, `${count}Items`)); } }); } render() { return ((0, jsx_runtime_1.jsx)(react_ui_1.DropdownMenu, { "data-tid": "CountDropdown", menuWidth: 200, caption: (0, jsx_runtime_1.jsxs)(react_ui_1.Link, { "data-tid": "CurrentCount", icon: (0, jsx_runtime_1.jsx)(CounterIcon16Regular_1.CounterIcon16Regular, {}), children: [this.props.count, " \u0437\u0430\u043F\u0438\u0441\u0435\u0439 \u043D\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0435", "\u00A0", (0, jsx_runtime_1.jsx)(ArrowShapeTriangleADownIcon16Regular_1.ArrowShapeTriangleADownIcon16Regular, {})] }), children: [20, 50, 100].map(this.renderLinkDropdownItem) })); } } exports.CountOfRecordsSelector = CountOfRecordsSelector; //# sourceMappingURL=CountOfRecordsSelector.js.map