@progress/kendo-react-grid
Version:
KendoReact Grid package
63 lines • 3.51 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 __());
};
})();
import * as React from 'react';
import { DropDownList } from '@progress/kendo-react-dropdowns';
import { NumericTextBox } from '@progress/kendo-react-inputs';
import { DatePicker } from '@progress/kendo-react-dateinputs';
import { cellBoolDropdownChange, cellInputChange, cellOperatorChange } from '../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(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) {
cellInputChange(value, e, this.props);
};
GridColumnMenuFilterCell.prototype.operatorChange = function (event) {
cellOperatorChange(event, this.props.value, this.props.onChange);
};
GridColumnMenuFilterCell.prototype.boolDropdownChange = function (event) {
cellBoolDropdownChange(event, this.props.onChange);
};
GridColumnMenuFilterCell.prototype.filterComponent = function (filterType, value, operators) {
var _this = this;
switch (filterType) {
case 'numeric':
return (React.createElement(NumericTextBox, { value: value, onChange: function (e) { _this.inputChange(e.value, e.syntheticEvent); } }));
case 'date':
return (React.createElement(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(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));
export { GridColumnMenuFilterCell };
//# sourceMappingURL=GridColumnMenuFilterCell.js.map