@progress/kendo-react-grid
Version:
KendoReact Grid package
41 lines • 1.96 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 { getNestedValue } from './../utils';
import { guid } from '@progress/kendo-react-common';
/**
* @hidden
*/
var GridSelectionCell = /** @class */ (function (_super) {
__extends(GridSelectionCell, _super);
function GridSelectionCell() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._inputId = guid();
_this.handleOnChange = function (syntheticEvent) {
if (_this.props.selectionChange) {
_this.props.selectionChange({ syntheticEvent: syntheticEvent });
}
};
return _this;
}
GridSelectionCell.prototype.render = function () {
var data = getNestedValue(this.props.field, this.props.dataItem);
var defaultRendering = this.props.rowType !== 'groupHeader' ? (React.createElement("td", { style: this.props.style, className: this.props.className },
React.createElement("input", { checked: data, id: this._inputId, type: "checkbox", className: "k-checkbox", onChange: this.handleOnChange }),
React.createElement("label", { className: "k-checkbox-label", htmlFor: this._inputId }))) : null;
return this.props.render ?
this.props.render.call(undefined, defaultRendering, this.props) :
defaultRendering;
};
return GridSelectionCell;
}(React.Component));
export { GridSelectionCell };
//# sourceMappingURL=GridSelectionCell.js.map