UNPKG

@progress/kendo-react-grid

Version:
65 lines 3.73 kB
"use strict"; 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_dropdowns_1 = require("@progress/kendo-react-dropdowns"); var kendo_react_inputs_1 = require("@progress/kendo-react-inputs"); var kendo_react_dateinputs_1 = require("@progress/kendo-react-dateinputs"); var filterCommon_1 = require("../filterCommon"); /** * @hidden */ var GridColumnMenuFilterCell = /** @class */ (function (_super) { __extends(GridColumnMenuFilterCell, _super); function GridColumnMenuFilterCell(props) { var _this = _super.call(this, props) || this; _this.inputChange = _this.inputChange.bind(_this); _this.operatorChange = _this.operatorChange.bind(_this); _this.boolDropdownChange = _this.boolDropdownChange.bind(_this); return _this; } /** * @hidden */ GridColumnMenuFilterCell.prototype.render = function () { var _this = this; var value = this.props.operators.find(function (item) { return item.operator === _this.props.operator; }) || null; return (React.createElement("div", null, this.props.filterType !== 'boolean' && (React.createElement(kendo_react_dropdowns_1.DropDownList, { value: value, onChange: this.operatorChange, data: this.props.operators, textField: "text" })), this.filterComponent(this.props.filterType, this.props.value, this.props.operators))); }; GridColumnMenuFilterCell.prototype.inputChange = function (value, e) { filterCommon_1.cellInputChange(value, e, this.props); }; GridColumnMenuFilterCell.prototype.operatorChange = function (event) { filterCommon_1.cellOperatorChange(event, this.props.value, this.props.onChange); }; GridColumnMenuFilterCell.prototype.boolDropdownChange = function (event) { filterCommon_1.cellBoolDropdownChange(event, this.props.onChange); }; GridColumnMenuFilterCell.prototype.filterComponent = function (filterType, value, operators) { var _this = this; switch (filterType) { case 'numeric': return (React.createElement(kendo_react_inputs_1.NumericTextBox, { value: value, onChange: function (e) { _this.inputChange(e.value, e.syntheticEvent); } })); case 'date': return (React.createElement(kendo_react_dateinputs_1.DatePicker, { value: value, onChange: function (e) { _this.inputChange(e.value, e.syntheticEvent); } })); case 'boolean': var noFilterSet_1 = function (filter) { return filter === null || filter === undefined; }; return (React.createElement(kendo_react_dropdowns_1.DropDownList, { onChange: this.boolDropdownChange, value: operators.find(function (item) { return item.operator === (noFilterSet_1(value) ? '' : value); }), data: operators, textField: "text" })); default: return (React.createElement("input", { className: "k-textbox", value: value || '', onChange: function (e) { _this.inputChange(e.target.value, e); } })); } }; return GridColumnMenuFilterCell; }(React.Component)); exports.GridColumnMenuFilterCell = GridColumnMenuFilterCell; //# sourceMappingURL=GridColumnMenuFilterCell.js.map