kea-react
Version:
Componentes comunes de react
43 lines (42 loc) • 2.04 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 fields_1 = require("../../fields/fields");
var botones_1 = require("../../botones");
var search_1 = require("../../search");
function filter(item, data, string) {
return search_1.search(data.busqueda, string);
}
var FiltroBusquedaComponent = /** @class */ (function (_super) {
__extends(FiltroBusquedaComponent, _super);
function FiltroBusquedaComponent() {
return _super !== null && _super.apply(this, arguments) || this;
}
FiltroBusquedaComponent.prototype.render = function () {
var props = this.props;
var value = props.value || {};
var busqueda = value.busqueda || "";
var titulo = props.titulo;
var label = React.createElement("span", null,
React.createElement(botones_1.Link, { iconClass: "fa fa-times", onClick: props.onQuitar }),
" ",
React.createElement("label", null, titulo));
return (React.createElement("div", null,
React.createElement(fields_1.Text, { addon: React.createElement("i", { className: "fa fa-search" }), placeholder: "Búsqueda", label: label, value: busqueda, onChange: function (x) { return props.onChange({ busqueda: x }); } })));
};
return FiltroBusquedaComponent;
}(React.PureComponent));
exports.filtro = {
component: FiltroBusquedaComponent,
filter: function (item, data, string) { return filter(item, data, string); }
};