@progress/kendo-react-grid
Version:
KendoReact Grid package
54 lines • 2.35 kB
JavaScript
;
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 __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var kendo_react_intl_1 = require("@progress/kendo-react-intl");
var messages_1 = require("./../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 = kendo_react_intl_1.provideLocalizationService(this);
return (React.createElement("span", { className: "k-pager-input k-label" },
localizationService.toLanguageString(messages_1.pagerPage, messages_1.messages[messages_1.pagerPage]),
" ",
React.createElement("input", { className: "k-textbox", value: this.value(), onBlur: function () { return _this.forceUpdate(); }, onChange: this.onChange }),
" ",
localizationService.toLanguageString(messages_1.pagerOf, messages_1.messages[messages_1.pagerOf]),
" ",
this.props.totalPages));
};
return PagerInput;
}(React.Component));
exports.PagerInput = PagerInput;
kendo_react_intl_1.registerForLocalization(PagerInput);
//# sourceMappingURL=PagerInput.js.map