UNPKG

@progress/kendo-react-grid

Version:
52 lines 2.22 kB
var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); import * as React from 'react'; import { registerForLocalization, provideLocalizationService } from '@progress/kendo-react-intl'; import { messages, pagerOf, pagerPage } from './../messages'; /** * @hidden */ var PagerInput = /** @class */ (function (_super) { __extends(PagerInput, _super); function PagerInput() { var _this = _super !== null && _super.apply(this, arguments) || this; _this._text = undefined; _this.onChange = function (e) { var text = _this._text = e.target.value.replace(/\D/g, ''); _this.forceUpdate(); if (text) { _this.props.pageChange(parseInt(text, 10), e); } }; _this.value = function () { var value = _this._text === undefined ? _this.props.currentPage.toString() : _this._text; _this._text = undefined; return value; }; return _this; } PagerInput.prototype.render = function () { var _this = this; var localizationService = provideLocalizationService(this); return (React.createElement("span", { className: "k-pager-input k-label" }, localizationService.toLanguageString(pagerPage, messages[pagerPage]), " ", React.createElement("input", { className: "k-textbox", value: this.value(), onBlur: function () { return _this.forceUpdate(); }, onChange: this.onChange }), " ", localizationService.toLanguageString(pagerOf, messages[pagerOf]), " ", this.props.totalPages)); }; return PagerInput; }(React.Component)); export { PagerInput }; registerForLocalization(PagerInput); //# sourceMappingURL=PagerInput.js.map