@progress/kendo-react-grid
Version:
KendoReact Grid package
45 lines • 2 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 { registerForIntl, provideIntlService } from '@progress/kendo-react-intl';
var GridCell = /** @class */ (function (_super) {
__extends(GridCell, _super);
function GridCell() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @hidden
*/
GridCell.prototype.render = function () {
var defaultRendering = null;
if (this.props.rowType === 'groupFooter') {
defaultRendering = React.createElement("td", { className: this.props.className });
}
else if (this.props.field !== undefined && this.props.rowType !== 'groupHeader') {
var data = getNestedValue(this.props.field, this.props.dataItem);
var dataAsString = '';
if (data !== undefined && data !== null) {
dataAsString = this.props.format ?
provideIntlService(this).format(this.props.format, data) :
data.toString();
}
defaultRendering = (React.createElement("td", { colSpan: this.props.colSpan, style: this.props.style, className: this.props.className }, dataAsString));
}
return this.props.render ?
this.props.render.call(undefined, defaultRendering, this.props) :
defaultRendering;
};
return GridCell;
}(React.Component));
export { GridCell };
registerForIntl(GridCell);
//# sourceMappingURL=GridCell.js.map